OpenStack::Client::Auth - OpenStack Keystone authentication and authorization
use OpenStack::Client::Auth (); my $auth = OpenStack::Client::Auth->new('http://openstack.foo.bar:5000/v2.0', 'tenant' => $ENV{'OS_TENANT_NAME'}, 'username' => $ENV{'OS_USERNAME'}, 'password' => $ENV{'OS_PASSWORD'} ); my $glance = $auth->service('image', 'region' => $ENV{'OS_REGION_NAME'} );
OpenStack::Client::Auth provides an interface for obtaining authorization to access other OpenStack cloud services.
OpenStack::Client::Auth
OpenStack::Client::Auth->new($endpoint, %args)
Contact the OpenStack Keystone API at the address provided in $endpoint, and obtain an authorization token and set of endpoints for which the client is allowed to access. Credentials are specified in %args; the following named values are required:
tenant
The OpenStack tenant (project) name
username
The OpenStack user name
password
The OpenStack password
When successful, this method will return an object containing the following:
response
The full decoded JSON authorization response from Keystone
services
A hash containing services the client has authorization to
clients
An initially empty hash that would contain OpenStack::Client objects obtained for any requested OpenStack services
$auth->response()
Return the full decoded response from the Keystone API.
$auth->access()
Return the service access data stored in the current object.
$auth->token()
Return the authorization token data stored in the current object.
$auth->services()
Return a list of service types the OpenStack user is authorized to access.
$auth->service($type, %opts)
Obtain a client to the OpenStack service $type, where $type is usually one of:
compute
ec2
identity
image
network
volumev2
The following values may be specified in %opts to help locate the most appropriate endpoint for a given service:
uri
When specified, use a specific URI to gain access to a named service endpoint. This might be useful for non-production development or testing scenarios.
id
When specified, attempt to obtain a client for the very endpoint indicated by that identifier.
region
When specified, attempt to obtain a client for the endpoint for that region. When not specified, the a client for the first endpoint found for service $type is returned instead.
endpoint
When specified and set to one of 'public', 'internal' or 'admin', return a client for the corresponding public, internal or admin endpoint. The default endpoint is the public endpoint.
Written by Alexandra Hrefna Hilmisdóttir <xan@cpanel.net>
Copyright (c) 2015 cPanel, Inc. Released under the terms of the MIT license. See LICENSE for further details.
To install OpenStack::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenStack::Client
CPAN shell
perl -MCPAN -e shell install OpenStack::Client
For more information on module installation, please visit the detailed CPAN module installation guide.