NAME
Net::OpenStack::Compute - Bindings for the OpenStack Compute API.
VERSION
version 1.1100
SYNOPSIS
use Net::OpenStack::Compute;
my $compute = Net::OpenStack::Compute->new(
auth_url => 'https://identity.api.rackspacecloud.com/v2.0',
user => 'alejandro',
password => 'password',
region => 'ORD',
);
$compute->create_server({
name => 'server1',
flavorRef => $flav_id,
imageRef => $img_id,
});
DESCRIPTION
This class is an interface to the OpenStack Compute API. Also see the oscompute command line tool.
METHODS
Methods that take a hashref data param generally expect the corresponding data format as defined by the OpenStack API JSON request objects. See the OpenStack Docs for more information. Methods that return a single resource will return false if the resource is not found. Methods that return an arrayref of resources will return an empty arrayref if the list is empty. Methods that create, modify, or delete resources will throw an exception on failure.
new
Creates a client.
params:
- auth_url
-
Required. The url of the authentication endpoint. For example:
'https://identity.api.rackspacecloud.com/v2.0'
- user
-
Required.
- password
-
Required.
- region
-
Optional.
- project_id
-
Optional.
- service_name
-
Optional.
- verify_ssl
-
Optional. Defaults to 1.
- is_rax_auth
-
Optional. Defaults to 0.
get_server
get_server($id)
Returns the server with the given id or false if it doesn't exist.
get_servers
get_servers(%params)
params:
- detail
-
Optional. Defaults to 0.
- query
-
Optional query string to be appended to requests.
Returns an arrayref of all the servers.
get_servers_by_name
get_servers_by_name($name)
Returns an arrayref of servers with the given name. Returns an empty arrayref if there are no such servers.
create_server
create_server({ name => $name, flavorRef => $flavor, imageRef => $img_id })
Returns a server hashref.
delete_server
delete_server($id)
Returns true on success.
rebuild_server
rebuild_server($server_id, { imageRef => $img_id })
Returns a server hashref.
set_password
set_password($server_id, $new_password)
Returns true on success.
get_networks
get_networks($id)
Returns a network list . =head2 get_image
get_image($id)
Returns an image hashref.
get_images
get_images(%params)
params:
- detail
-
Optional. Defaults to 0.
- query
-
Optional query string to be appended to requests.
Returns an arrayref of all the images.
create_image
create_image($server_id, { name => 'bob' })
Returns an image hashref.
delete_image
delete_image($id)
Returns true on success.
get_flavor
get_flavor($id)
Returns a flavor hashref.
get_flavors
get_flavors(%params)
params:
- detail
-
Optional. Defaults to 0.
- query
-
Optional query string to be appended to requests.
Returns an arrayref of all the flavors.
token
token()
Returns the OpenStack Compute API auth token.
base_url
base_url()
Returns the base url for the OpenStack Compute API, which is returned by the server after authenticating.
SEE ALSO
AUTHOR
Naveed Massjouni <naveedm9@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Naveed Massjouni.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.