Possibly fixed test
[p5sagit/Oyster.git] / .build / 0ey2IQdAX1 / lib / Oyster / Provision.pm
CommitLineData
6b832bd6 1package Oyster::Provision;
2
3use Moose;
4
5has 'name' => ( is => 'ro', isa => 'Str', required => 1 );
6has 'size' => ( is => 'ro', isa => 'Str', required => 1 );
7has 'image' => ( is => 'ro', isa => 'Str', required => 1 );
8has 'pub_ssh' => ( is => 'ro', isa => 'Str', required => 1 );
9
10has 'config' => (is => 'rw', isa => 'HashRef', required => 1 );
11
12sub BUILD {
13
14 my $self = shift;
15
16 if(!exists($self->config()->{provision_backend})) {
17 $self->config()->{provision_backend} = 'Oyster::Provision::Rackspace';
18 }
19
20 my $role = $self->config()->{provision_backend};
21
22 eval "use $role";
23 "$role"->meta->apply($self);
24}
25
261;
27
28__END__
29
30=head1 NAME
31
32Oyster::Provision - Provision an Oyster
33
34=head1 SYNOPSIS
35
36 my $server = Oyster::Provision->new(
37 name => 'Ostrica',
38 size => '256',
39 image => 'Meerkat',
40 pub_ssh => "$ENV{HOME}/.ssh/id_rsa.pub",
41 );
42 $server->create;
43
44=head1 BACKENDS
45
46By default, the L<Oyster::Provision::Rackspace> backend
47will be used.
48
49Each backend needs to accept at least the C<name>,
50C<size>, C<image> and C<pub_ssh> parameters. The meaning
51of these parameters may differ from one backend to another.
52
53=head1 METHOS
54
55Each backend usually implements the following C<required>
56methods:
57
58=over
59
60=item create
61
62Creates a new server by given name, if such server does
63not exist.
64
65Installs the required packages for the distribution
66
67=item delete
68
69Gets rid of the server instance
70
71=item resize
72
73Hopefully scales the server
74
75=back
76
77=cut