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