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