The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::RackSpace::CloudServers - Interface to RackSpace CloudServers via API

VERSION

version 0.15

SYNOPSIS

  use Net::RackSpace::CloudServers;
  my $cs = Net::RackSpace::CloudServers->new(
    user => 'myusername', key => 'mysecretkey',
    # location => 'UK',
  );
  # list my servers;
  my @servers = $cs->get_server;
  foreach my $server ( @servers ) {
    print 'Have server ', $server->name, ' id ', $server->id, "\n";
  }

METHODS

new / BUILD

The constructor logs you into CloudServers:

  my $cs = Net::RackSpace::CloudServers->new(
    user => 'myusername', key => 'mysecretkey',
    # location => 'US',
  );

The location parameter can be either US or UK, as the APIs have the same interface and just different endpoints. This is all handled transparently. The default is to use the US API endpoint.

get_server

Lists all the servers linked to the account. If no ID is passed as parameter, returns an array of Net::RackSpace::CloudServers::Server object containing only id and name set. If an ID is passed as parameter, it will return a Net::RackSpace::CloudServers::Server object containing id, name, imageid, etc. See Net::RackSpace::CloudServers::Server for details.

  my @servers     = $cs->get_server;    # all servers, id/name
  my $test_server = $cs->get_server(1); # ID 1, detailed

get_server_detail

Lists more details about all the servers and returns them as a Net::RackSpace::CloudServers::Server object:

  my @servers     = $cs->get_server_detail;    # all servers, id/name
  my $test_server = $cs->get_server_detail(1); # ID 1, detailed

limits

Lists all the limits currently set for the account, and returns them as a Net::RackSpace::CloudServers::Limits object:

  my $limits = $cs->limits;

get_flavor

Lists all the flavors able to be used. If no ID is passed as parameter, returns an array of Net::RackSpace::CloudServers::Flavor object containing only id and name set. If an ID is passed as parameter, it will return a Net::RackSpace::CloudServers::Flavor object containing id, name, ram and disk.

  my @flavors = $cs->get_flavor;
  foreach (@flavors) { print $_->id, ' ', $_->name, "\n" }

  my $f1 = $cs->get_flavor(1);
  print join(' ', $f1->id, $f1->name, $f1->ram, $f1->disk), "\n";

get_flavor_detail

Lists details of all the flavors able to be used. If no ID is passed as parameter, returns an array of Net::RackSpace::CloudServers::Flavor. All details are returned back: id, name, ram and disk. If an ID is passed as parameter, it will return a Net::RackSpace::CloudServers::Flavor object with all details filled in.

get_image

Lists all the server/backup images able to be used. If no ID is passed as parameter, returns an array of Net::RackSpace::CloudServers::Image object containing only id and name set. If an ID is passed as parameter, it will return a Net::RackSpace::CloudServers::Image object with all the available attributes set.

  my @images = $cs->get_image;
  foreach (@images) { print $_->id, ' ', $_->name, "\n" }

  my $f1 = $cs->get_image(1);
  print join(' ', $f1->id, $f1->name, $f1->updated, $f1->status), "\n";

get_image_detail

Lists details of all the server/backup images able to be used. If no ID is passed as parameter, returns an array of Net::RackSpace::CloudServers::Image. All details are returned back: id, name, serverid, updated, created, status and progress. If an ID is passed as parameter, it will return a Net::RackSpace::CloudServers::Image object with all details filled in.

delete_image

Deletes a previously created backup image. Needs the image ID passed as parameter, returns undef in case of success or confess()es in case of error.

AUTHOR

Marco Fontani, <mfontani at cpan.org>

BUGS

Please report any bugs or feature requests to bug-net-rackspace-cloudservers at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-RackSpace-CloudServers. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Net::RackSpace::CloudServers

You can also look for information at:

ACKNOWLEDGEMENTS

Léon Brocard for Net::Mosso::CloudFiles

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.