File Coverage

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