File Coverage

blib/lib/Net/RackSpace/CloudServers/Flavor.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 22 100.0


line stmt bran cond sub pod time code
1             package Net::RackSpace::CloudServers::Flavor;
2              
3             BEGIN {
4 2     2   39 $Net::RackSpace::CloudServers::Flavor::VERSION = '0.14';
5             }
6 2     2   12 use warnings;
  2         3  
  2         47  
7 2     2   10 use strict;
  2         4  
  2         51  
8 2     2   10 use Any::Moose;
  2         5  
  2         10  
9 2     2   799 use Carp;
  2         4  
  2         295  
10              
11             has 'cloudservers' =>
12             ( is => 'rw', isa => 'Net::RackSpace::CloudServers', required => 1 );
13             has 'id' => ( is => 'ro', isa => 'Int', required => 1 );
14             has 'name' => ( is => 'ro', isa => 'Str', required => 1 );
15             has 'ram' => ( is => 'ro', isa => 'Maybe[Int]', required => 1 );
16             has 'disk' => ( is => 'ro', isa => 'Maybe[Int]', required => 1 );
17              
18 2     2   19 no Any::Moose;
  2         4  
  2         9  
19             __PACKAGE__->meta->make_immutable();
20              
21             =head1 NAME
22              
23             Net::RackSpace::CloudServers::Flavor - a RackSpace CloudServers Flavor
24              
25             =head1 VERSION
26              
27             version 0.14
28              
29             =head1 SYNOPSIS
30              
31             use Net::RackSpace::CloudServers;
32             use Net::RackSpace::CloudServers::Flavor;
33             my $cs = Net::RackSpace::CloudServers->new( user => 'myusername', key => 'mysecretkey' );
34             my $flavor = Net::RackSpace::CloudServers::Flavor->new(
35             cloudservers => $cs,
36             id => '1', name => 'test', ram => 5, disk => 10,
37             );
38             # get list:
39             my @flavors = $cs->flavors;
40             foreach my $flavor ( @flavors ) {
41             print 'Have flavor ', $flavor->name, ' id ', $flavor->id, "\n";
42             }
43             # get detailed list
44             my @flavors = $cs->flavors(1);
45             foreach my $flavor ( @flavors ) {
46             print 'Have flavor ', $flavor->name, ' id ', $flavor->id,
47             ' ram ', $flavor->ram, ' disk ', $flavor->disk,
48             "\n";
49             }
50              
51             =head1 METHODS
52              
53             =head2 new / BUILD
54              
55             The constructor creates a Flavor:
56              
57             my $flavor = Net::RackSpace::CloudServers::Flavor->new(
58             cloudserver => $cs
59             id => 'id', name => 'name',
60             );
61              
62             This normally gets created for you by L<Net::RackSpace::Cloudserver>'s L<flavors> or L<flavorsdetails> methods.
63             Needs a Net::RackSpace::CloudServers::Flavor object.
64              
65             =head2 id
66              
67             The id is used for the creation of new cloudservers
68              
69             =head2 name
70              
71             The name which identifies the flavor
72              
73             =head2 ram
74              
75             How much RAM does this flavor have
76              
77             =head2 disk
78              
79             How much disk space does this flavor have
80              
81             =head1 AUTHOR
82              
83             Marco Fontani, C<< <mfontani at cpan.org> >>
84              
85             =head1 BUGS
86              
87             Please report any bugs or feature requests to C<bug-net-rackspace-cloudservers at rt.cpan.org>, or through
88             the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-RackSpace-CloudServers>. I will be notified, and then you'll
89             automatically be notified of progress on your bug as I make changes.
90              
91             =head1 SUPPORT
92              
93             You can find documentation for this module with the perldoc command.
94              
95             perldoc Net::RackSpace::CloudServers::Flavor
96              
97             You can also look for information at:
98              
99             =over 4
100              
101             =item * RT: CPAN's request tracker
102              
103             L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-RackSpace-CloudServers>
104              
105             =item * AnnoCPAN: Annotated CPAN documentation
106              
107             L<http://annocpan.org/dist/Net-RackSpace-CloudServers>
108              
109             =item * CPAN Ratings
110              
111             L<http://cpanratings.perl.org/d/Net-RackSpace-CloudServers>
112              
113             =item * Search CPAN
114              
115             L<http://search.cpan.org/dist/Net-RackSpace-CloudServers/>
116              
117             =back
118              
119             =head1 COPYRIGHT & LICENSE
120              
121             Copyright 2009 Marco Fontani, all rights reserved.
122              
123             This program is free software; you can redistribute it and/or modify it
124             under the same terms as Perl itself.
125              
126             =cut
127              
128             1; # End of Net::RackSpace::CloudServers::Flavor