NAME

OpenStack::Client - A cute little client to OpenStack services

SYNOPSIS

#
# First, connect to an API endpoint via the Keystone
# authorization service
#
use OpenStack::Client::Auth ();

my $endpoint = 'http://openstack.foo.bar:5000/v2.0';

my $auth = OpenStack::Client::Auth->new($endpoint,
    'tenant'   => $ENV{'OS_TENANT_NAME'},
    'username' => $ENV{'OS_USERNAME'},
    'password' => $ENV{'OS_PASSWORD'}
);

my $glance = $auth->service('image',
    'region' => $ENV{'OS_REGION_NAME'}
);

my @images = $glance->all('/v2/images', 'images');

#
# Or, connect directly to an API endpoint by URI
#
use OpenStack::Client ();

my $endpoint = 'http://glance.foo.bar:9292';

my $glance = OpenStack::Client->new($endpoint,
    'token' => {
        'id' => 'foo'
    }
);

my @images = $glance->all('/v2/images', 'images');

DESCRIPTION

OpenStack::Client is a no-frills OpenStack API client which provides generic access to OpenStack APIs with minimal remote service discovery facilities; with a minimal client, the key understanding of the remote services are primarily predicated on an understanding of the authoritative OpenStack API documentation:

http://developer.openstack.org/api-ref.html

Authorization, authentication, and access to OpenStack services such as the OpenStack Compute and Networking APIs is made convenient by OpenStack::Client::Auth. Further, some small handling of response body data such as obtaining the full resultset of a paginated response is handled for convenience.

Ordinarily, a client can be obtained conveniently by using the services() method on a OpenStack::Client::Auth object.

INSTANTIATION

INSTANCE METHODS

These methods are useful for identifying key attributes of an OpenStack service endpoint client.

PERFORMING REMOTE CALLS

EXAMPLES

The following shows how one may update image metadata using the PATCH method supported by version 2 of the Image API. @image_updates is an array of hash references of the structure defined by the PATCH RFC (6902) governing "JavaScript Object Notation (JSON) Patch"; i.e., operations consisting of add, replace, or delete.

my $headers = {
    'Content-Type' => 'application/openstack-images-v2.1-json-patch'
};

my $response = $glance->call({
    'method'  => 'PATCH',
    'headers' => $headers,
    'path'    => qq[/v2/images/$image->{id}],
    'body'    => \@image_updates
);

FETCHING REMOTE RESOURCES

CREATING AND UPDATING REMOTE RESOURCES

DELETING REMOTE RESOURCES

SEE ALSO

AUTHOR

Written by Alexandra Hrefna Maheu xan@cpanel.net

CONTRIBUTORS

COPYRIGHT

Copyright (c) 2019 cPanel, L.L.C. Released under the terms of the MIT license. See LICENSE for further details.