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

version 0.14

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',
flavor => 2, image => 8,
# others
);
my $srv = $tmp->create_server;
print "root pass: ", $srv->adminpass, " IP: @{$srv->public_address}\n";

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.
This creates a real server based on a Server template object (TODO: will accept all the other build parameters).
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.
Changes the server's name to the new value given. Dies on error, or returns the response
$srv->change_name('newname');
Changes the server's root password to the new value given. Dies on error, or returns the response
$srv->change_root_password('toor');
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");

The id is used for the creation of new cloudservers
The name which identifies the server
When newly built ONLY, the automatically generated password for root
The ID of the Net::RackSpace::CloudServer::Image from which the server has been created
The ID of the Net::RackSpace::CloudServer::Flavor the server is currently running as
An ID which univocally identifies a server on your account. May not be unique across accounts.
The status of the server: building, etc
The progress of the current status operation: 60%, etc.
Arrayref containing the list of public addresses the server is configured to use
Arrayref containing the list of private addresses the server is configured to use
Hashref containing any metadata that has been set for the server

Marco Fontani, <mfontani at cpan.org>

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.

You can find documentation for this module with the perldoc command.
perldoc Net::RackSpace::CloudServers::Server
You can also look for information at:
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-RackSpace-CloudServers

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.