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