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

NAME

Net::RackSpace::CloudServers::Server - a RackSpace CloudServers Server instance

VERSION

version 0.15

SYNOPSIS

  use Net::RackSpace::CloudServers;
  use Net::RackSpace::CloudServers::Server;
  my $cs = Net::RackSpace::CloudServers->new( user => 'myusername', key => 'mysecretkey' );
  my $server = Net::RackSpace::CloudServers::Server->new(
    cloudservers => $cs,
    id => '1', name => 'test',
  );
  # get list:
  my @servers = $cs->get_server;
  foreach my $server ( @servers ) {
    print 'Have server ', $server->name, ' id ', $server->id, "\n";
  }
  # get detailed list
  my @servers = $cs->get_server_detail();
  foreach my $server ( @servers) {
    print 'Have server ', $server->name, ' id ', $server->id,
      # ...
      "\n";
  }

  ## Create server from template
  my $tmp = Net::RackSpace::CloudServer::Server->new(
    cloudservers => $cs, name => 'myserver',
    flavorid => 2, imageid => 8,
    # others
  );
  my $srv = $tmp->create_server;
  print "root pass: ", $srv->adminpass, " IP: @{$srv->public_address}\n";

METHODS

new / BUILD

The constructor creates a Server object, see create_server to create a server instance from a template:

  my $server = Net::RackSpace::CloudServers::Server->new(
    cloudserver => $cs
    id => 'id', name => 'name',
  );

This normally gets created for you by Net::RackSpace::Cloudserver's get_server or get_server_detail methods. Needs a Net::RackSpace::CloudServers object as cloudservers parameter.

create_server

This creates a real server based on a Server template object (TODO: will accept all the other build parameters).

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 confess()es on failure.

change_name

Changes the server's name to the new value given. Dies on error, or returns the response

  $srv->change_name('newname');

change_root_password

Changes the server's root password to the new value given. Dies on error, or returns the response

  $srv->change_root_password('toor');

create_image

Creates a named backup image of the current server. Returns the newly created Net::RackSpace::CloudServers::Image object, which includes the new image's id.

  $srv->create_image("test backup 001");

ATTRIBUTES

id

The id is used for the creation of new cloudservers

name

The name which identifies the server

adminpass

When newly built ONLY, the automatically generated password for root

imageid

The ID of the Net::RackSpace::CloudServer::Image from which the server has been created

flavorid

The ID of the Net::RackSpace::CloudServer::Flavor the server is currently running as

hostid

An ID which univocally identifies a server on your account. May not be unique across accounts.

status

The status of the server: building, etc

progress

The progress of the current status operation: 60%, etc.

public_address

Arrayref containing the list of public addresses the server is configured to use

private_address

Arrayref containing the list of private addresses the server is configured to use

metadata

Hashref containing any metadata that has been set for the server

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::Server

You can also look for information at:

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.