From 9ff623a96d109d4274b6c07ee8092bbabe7a26a9 Mon Sep 17 00:00:00 2001 From: Marco Fontani Date: Sun, 22 Nov 2009 17:43:54 +0000 Subject: [PATCH] Added POD; bumped version --- dist.ini | 3 +- lib/Net/RackSpace/CloudServers/Limits.pm | 110 ++++++++++++++++++++++- lib/Net/RackSpace/CloudServers/Server.pm | 6 ++ 3 files changed, 117 insertions(+), 2 deletions(-) diff --git a/dist.ini b/dist.ini index 15924e5..7b05c30 100644 --- a/dist.ini +++ b/dist.ini @@ -1,5 +1,5 @@ name = Net-RackSpace-CloudServers -version = 0.09_00 +version = 0.09_10 author = Marco Fontani license = Perl_5 copyright_holder = Marco Fontani @@ -11,6 +11,7 @@ Moose = 0.87 MooseX::StrictConstructor = 0 LWP::ConnCache::MaxKeepAliveRequests = 0 LWP::UserAgent::Determined = 0 +HTTP::Request = 0 JSON = 0 YAML = 0 diff --git a/lib/Net/RackSpace/CloudServers/Limits.pm b/lib/Net/RackSpace/CloudServers/Limits.pm index a74ad3b..ee762e5 100644 --- a/lib/Net/RackSpace/CloudServers/Limits.pm +++ b/lib/Net/RackSpace/CloudServers/Limits.pm @@ -61,4 +61,112 @@ sub refresh { return $self; } -1; +=head1 NAME + +Net::RackSpace::CloudServers::Limits- a RackSpace CloudServers Limits instance + +=head1 SYNOPSIS + + use Net::RackSpace::CloudServers; + use Net::RackSpace::CloudServers::Limits; + my $cs = Net::RackSpace::CloudServers->new( + user => $ENV{CLOUDSERVERS_USER}, + key => $ENV{CLOUDSERVERS_KEY}, + ); + my $limits = Net::RackSpace::CloudServers::Limits->new( + cloudservers => $cs, + ); + $limits->refresh(); + print "Can still allocate ", $limits->totalramsize, " MB RAM\n"; + print "Can still use ", $limits->maxipgroups, " IP Groups\n"; + print "Can have ", $limits->maxipgroupmembers, " more IP groups members\n"; + # next bit isn't OO-ed yet. + foreach my $k ( @{ $limits->rate } ) { + print $k->{verb}, ' to URI ', $k->{URI}, ' remaining: ', + $k->{remaining}, ' per ', $k->{unit}, + ' (will be reset at: ', scalar localtime $k->{resetTime}, ')', + "\n"; + } + +=head1 METHODS + +=head2 new / BUILD + +The constructor creates a Limits half-object. See L to refresh the limits once gathered. + +This normally gets created for you by L's L method. +Needs a Net::RackSpace::CloudServers object as B parameter. + +=head2 refresh + +This method refreshes the information contained in the object + +=head1 ATTRIBUTES + +=head2 totalramsize + +Indicates the maximum amount of RAM (in megabytes) linked to your account. + +=head2 maxipgroups + +Indicates the maximum number of shared IP groups your account can create + +=head2 maxipgroupmembers + +Indicates the maximum amount of servers that can be associated with any one shared IP group + +=head2 rate + +TODO: not yet OO-ified. + +Is an arrayref of the rate-limits that currently apply to your account via the API. +You'll receive 413 errors in case you exceed the limits described. + +=head1 AUTHOR + +Marco Fontani, C<< >> + +=head1 BUGS + +Please report any bugs or feature requests to C, or through +the web interface at L. +I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. + +=head1 SUPPORT + +You can find documentation for this module with the perldoc command. + + perldoc Net::RackSpace::CloudServers::Limits + +You can also look for information at: + +=over 4 + +=item * RT: CPAN's request tracker + +L + +=item * AnnoCPAN: Annotated CPAN documentation + +L + +=item * CPAN Ratings + +L + +=item * Search CPAN + +L + +=back + +=head1 COPYRIGHT & LICENSE + +Copyright 2009 Marco Fontani, all rights reserved. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +=cut + +1; # End of Net::RackSpace::CloudServers::Limits diff --git a/lib/Net/RackSpace/CloudServers/Server.pm b/lib/Net/RackSpace/CloudServers/Server.pm index d7e80df..e5e359c 100644 --- a/lib/Net/RackSpace/CloudServers/Server.pm +++ b/lib/Net/RackSpace/CloudServers/Server.pm @@ -172,6 +172,12 @@ Needs a Net::RackSpace::CloudServers object as B parameter. This creates a real server based on a Server template object (TODO: will accept all the other build parameters). +=head2 delete_server + +This will ask RackSpace to delete the cloud server instance specified in this object's ID from the system. +This operation is irreversible. Please notice that all images created from this server (if any) will also +be removed. This method doesn't return anything on success, and Ces on failure. + =head2 change_name Changes the server's name to the new value given. Dies on error, or returns the response