libcloud.common package¶
Submodules¶
libcloud.common.abiquo module¶
Abiquo Utilities Module for the Abiquo Driver.
Common utilities needed by the AbiquoNodeDriver
.
-
class
libcloud.common.abiquo.
AbiquoConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, retry_delay=None, backoff=None)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
,libcloud.common.base.PollingConnection
A Connection to Abiquo API.
Basic
ConnectionUserAndKey
connection withPollingConnection
features for asynchronous tasks.-
add_default_headers
(headers)[source]¶ Add Basic Authentication header to all the requests.
It injects the ‘Authorization: Basic Base64String===’ header in each request
Parameters: headers ( dict
) – Default input headersReturn type: dict
Returns: Default input headers with the ‘Authorization’ header
-
get_poll_request_kwargs
(response, context, request_kwargs)[source]¶ Manage polling request arguments.
Return keyword arguments which are passed to the
NodeDriver.request
method when polling for the job status. The Abiquo Asynchronous Response returns and ‘acceptedrequest’ XmlElement as the following:<acceptedrequest> <link href="http://uri/to/task" rel="status"/> <message>You can follow the progress in the link</message> </acceptedrequest>
We need to extract the href URI to poll.
Parameters: - response (
xml.etree.ElementTree
) – Object returned by poll request. - request_kwargs (
dict
) – Default request arguments and headers
Return type: dict
Returns: Modified keyword arguments
- response (
-
has_completed
(response)[source]¶ Decide if the asynchronous job has ended.
Parameters: response ( xml.etree.ElementTree
) – Response object returned by poll requestReturn type: bool
Returns: Whether the job has completed
-
responseCls
¶ alias of
AbiquoResponse
-
-
class
libcloud.common.abiquo.
AbiquoResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.XmlResponse
Abiquo XML Response.
Wraps the response in XML bodies or extract the error data in case of error.
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
NODE_STATE_MAP
= {'PAUSED': 3, 'ON': 0, 'OFF': 3, 'UNKNOWN': 4, 'NOT_ALLOCATED': 2, 'LOCKED': 3, 'ALLOCATED': 3, 'CONFIGURED': 3}¶
-
async_success
()[source]¶ Determinate if async request was successful.
An async_request retrieves for a task object that can be successfully retrieved (self.status == OK), but the asyncronous task (the body of the HTTP response) which we are asking for has finished with an error. So this method checks if the status code is ‘OK’ and if the task has finished successfully.
Return type: bool
Returns: successful asynchronous request or not
- response (
-
exception
libcloud.common.abiquo.
ForbiddenError
(driver)[source]¶ Bases:
libcloud.common.types.LibcloudError
Exception used when credentials are ok but user has not permissions.
-
libcloud.common.abiquo.
get_href
(element, rel)[source]¶ Search a RESTLink element in the
AbiquoResponse
.Abiquo, as a REST API, it offers self-discovering functionality. That means that you could walk through the whole API only navigating from the links offered by the entities.
This is a basic method to find the ‘relations’ of an entity searching into its links.
For instance, a Rack entity serialized as XML as the following:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <rack> <link href="http://host/api/admin/datacenters/1" type="application/vnd.abiquo.datacenter+xml" rel="datacenter"/> <link href="http://host/api/admin/datacenters/1/racks/1" type="application/vnd.abiquo.rack+xml" rel="edit"/> <link href="http://host/api/admin/datacenters/1/racks/1/machines" type="application/vnd.abiquo.machines+xml" rel="machines"/> <haEnabled>false</haEnabled> <id>1</id> <longDescription></longDescription> <name>racacaca</name> <nrsq>10</nrsq> <shortDescription></shortDescription> <vlanIdMax>4094</vlanIdMax> <vlanIdMin>2</vlanIdMin> <vlanPerVdcReserved>1</vlanPerVdcReserved> <vlansIdAvoided></vlansIdAvoided> </rack>
offers link to datacenters (rel=’datacenter’), to itself (rel=’edit’) and to the machines defined in it (rel=’machines’)
A call to this method with the ‘rack’ element using ‘datacenter’ as ‘rel’ will return:
‘http://10.60.12.7:80/api/admin/datacenters/1‘
Parameters: - element (
xml.etree.ElementTree
) – Xml Entity returned by Abiquo API (required) - rel (
str
) – relation link name
Return type: str
Returns: the ‘href’ value according to the ‘rel’ input parameter
- element (
libcloud.common.aws module¶
-
class
libcloud.common.aws.
AWSBaseResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.XmlResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
namespace
= None¶
- response (
-
class
libcloud.common.aws.
AWSGenericResponse
(response, connection)[source]¶ Bases:
libcloud.common.aws.AWSBaseResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
expections
= {}¶
-
xpath
= None¶
- response (
-
class
libcloud.common.aws.
AWSTokenConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, token=None, retry_delay=None, backoff=None)[source]¶
-
class
libcloud.common.aws.
SignedAWSConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, token=None, retry_delay=None, backoff=None, signature_version='2')[source]¶
-
class
libcloud.common.aws.
AWSRequestSignerAlgorithmV2
(access_key, access_secret, version, connection)[source]¶ Bases:
libcloud.common.aws.AWSRequestSigner
Parameters: - access_key (
str
) – Access key. - access_secret (
str
) – Access secret. - version (
str
) – API version. - connection (
Connection
) – Connection instance.
- access_key (
-
class
libcloud.common.aws.
AWSRequestSignerAlgorithmV4
(access_key, access_secret, version, connection)[source]¶ Bases:
libcloud.common.aws.AWSRequestSigner
Parameters: - access_key (
str
) – Access key. - access_secret (
str
) – Access secret. - version (
str
) – API version. - connection (
Connection
) – Connection instance.
- access_key (
libcloud.common.azure module¶
-
class
libcloud.common.azure.
AzureBaseDriver
[source]¶ Bases:
object
-
name
= 'Microsoft Azure Service Management API'¶
-
-
class
libcloud.common.azure.
AzureConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
Represents a single connection to Azure
-
rawResponseCls
¶ alias of
AzureRawResponse
-
responseCls
¶ alias of
AzureResponse
-
-
class
libcloud.common.azure.
AzureRawResponse
(connection)[source]¶ Bases:
libcloud.common.base.RawResponse
Parameters: connection ( Connection
) – Parent connection object.
-
exception
libcloud.common.azure.
AzureRedirectException
(response)[source]¶ Bases:
exceptions.Exception
-
class
libcloud.common.azure.
AzureResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.XmlResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
valid_response_codes
= [404, 409, 400, 307]¶
- response (
-
class
libcloud.common.azure.
AzureServiceManagementConnection
(subscription_id, key_file, *args, **kwargs)[source]¶ Bases:
libcloud.common.base.CertificateConnection
Authentication class for “Service Account” authentication.
Check to see if PyCrypto is available, and convert key file path into a key string if the key is in a file.
Parameters: - subscription_id (
str
) – Azure subscription ID. - key_file (
str
) – The PEM file used to authenticate with the service.
-
add_default_headers
(headers)[source]¶ @inherits:
Connection.add_default_headers
TODO: move to constant..
-
driver
¶ alias of
AzureBaseDriver
-
host
= 'management.core.windows.net'¶
-
keyfile
= ''¶
-
name
= 'Azure Service Management API Connection'¶
-
rawResponseCls
¶ alias of
AzureRawResponse
-
responseCls
¶ alias of
AzureResponse
- subscription_id (
libcloud.common.base module¶
-
class
libcloud.common.base.
BaseDriver
(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]¶ Bases:
object
Base driver class from which other classes can inherit from.
Parameters: - key (
str
) – API key or username to be used (required) - secret (
str
) – Secret password to be used (required) - secure (
bool
) – Weither to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default. - host (
str
) – Override hostname used for connections. - port (
int
) – Override port used for connections. - api_version (
str
) – Optional API version. Only used by drivers which support multiple API versions. - region (
str
) – Optional driver region. Only used by drivers which support multiple regions.
Return type: None
-
connectionCls
¶ alias of
ConnectionKey
- key (
-
class
libcloud.common.base.
Connection
(secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, retry_delay=None, backoff=None)[source]¶ Bases:
object
A Base Connection class to derive from.
-
action
= None¶
-
add_default_headers
(headers)[source]¶ Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
-
add_default_params
(params)[source]¶ Adds default parameters (such as API key, version, etc.) to the passed params
Should return a dictionary.
-
allow_insecure
= True¶
-
backoff
= None¶
-
cache_busting
= False¶
-
conn_classes
= (<class 'libcloud.httplib_ssl.LibcloudHTTPConnection'>, <class 'libcloud.httplib_ssl.LibcloudHTTPSConnection'>)¶
-
connect
(host=None, port=None, base_url=None, **kwargs)[source]¶ Establish a connection with the API server.
Parameters: - host (
str
) – Optional host to override our default - port (
int
) – Optional port to override our default
Returns: A connection
- host (
-
connection
= None¶
-
driver
= None¶
-
host
= '127.0.0.1'¶
-
port
= 443¶
-
pre_connect_hook
(params, headers)[source]¶ A hook which is called before connecting to the remote server. This hook can perform a final manipulation on the params, headers and url parameters.
Parameters: - params (
dict
) – Request parameters. - headers (
dict
) – Request headers.
- params (
-
rawResponseCls
¶ alias of
RawResponse
-
request
(action, params=None, data=None, headers=None, method='GET', raw=False)[source]¶ Request a given action.
Basically a wrapper around the connection object’s request that does some helpful pre-processing.
Parameters: - action (
str
) – A path. This can include arguments. If included, any extra parameters are appended to the existing ones. - params (
dict
) – Optional mapping of additional parameters to send. If None, leave as an emptydict
. - data (
unicode
) – A body of data to send with the request. - headers (
dict
) – Extra headers to add to the request None, leave as an emptydict
. - method (
str
) – An HTTP method such as “GET” or “POST”. - raw (
bool
) – True to perform a “raw” request aka only send the headers and use the rawResponseCls class. This is used with storage API when uploading a file.
Returns: An
Response
instance.Return type: Response
instance- action (
-
retry_delay
= None¶
-
secure
= 1¶
-
set_http_proxy
(proxy_url)[source]¶ Set a HTTP proxy which will be used with this connection.
Parameters: proxy_url ( str
) – Proxy URL (e.g. http://<hostname>:<port> without authentication and http://<username>:<password>@<hostname>:<port> for basic auth authentication information.
-
timeout
= None¶
-
-
class
libcloud.common.base.
PollingConnection
(secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, retry_delay=None, backoff=None)[source]¶ Bases:
libcloud.common.base.Connection
Connection class which can also work with the async APIs.
After initial requests, this class periodically polls for jobs status and waits until the job has finished. If job doesn’t finish in timeout seconds, an Exception thrown.
-
async_request
(action, params=None, data=None, headers=None, method='GET', context=None)[source]¶ Perform an ‘async’ request to the specified path. Keep in mind that this function is blocking and ‘async’ in this case means that the hit URL only returns a job ID which is the periodically polled until the job has completed.
This function works like this:
- Perform a request to the specified path. Response should contain a ‘job_id’.
- Returned ‘job_id’ is then used to construct a URL which is used for retrieving job status. Constructed URL is then periodically polled until the response indicates that the job has completed or the timeout of ‘self.timeout’ seconds has been reached.
Parameters: - action (
str
) – A path - params (
dict
) – Optional mapping of additional parameters to send. If None, leave as an emptydict
. - data (
unicode
) – A body of data to send with the request. - headers (
dict
) – Extra headers to add to the request None, leave as an emptydict
. - method (
str
) – An HTTP method such as “GET” or “POST”. - context (
dict
) – Context dictionary which is passed to the functions which construct initial and poll URL.
Returns: An
Response
instance.Return type: Response
instance
-
get_poll_request_kwargs
(response, context, request_kwargs)[source]¶ Return keyword arguments which are passed to the request() method when polling for the job status.
Parameters: - response (
dict
) – Response object returned by poll request. - request_kwargs – Kwargs previously used to initiate the poll request.
:return
dict
Keyword arguments- response (
-
get_request_kwargs
(action, params=None, data=None, headers=None, method='GET', context=None)[source]¶ Arguments which are passed to the initial request() call inside async_request.
-
has_completed
(response)[source]¶ Return job completion status.
Parameters: response ( HTTPResponse
) – Response object returned by poll request.:return
bool
True if the job has completed, False otherwise.
-
poll_interval
= 0.5¶
-
request_method
= 'request'¶
-
timeout
= 200¶
-
-
class
libcloud.common.base.
ConnectionKey
(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.Connection
Base connection class which accepts a single
key
argument.Initialize user_id and key; set secure to an
int
based on passed value.
-
class
libcloud.common.base.
ConnectionUserAndKey
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionKey
Base connection class which accepts a
user_id
andkey
argument.-
user_id
= None¶
-
-
class
libcloud.common.base.
CertificateConnection
(cert_file, secure=True, host=None, port=None, url=None, timeout=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.Connection
Base connection class which accepts a single
cert_file
argument.Initialize cert_file; set secure to an
int
based on passed value.
-
class
libcloud.common.base.
LoggingHTTPConnection
(*args, **kwargs)[source]¶ Bases:
libcloud.common.base.LoggingConnection
,libcloud.httplib_ssl.LibcloudHTTPConnection
Utility Class for logging HTTP connections
-
protocol
= 'http'¶
-
-
class
libcloud.common.base.
LoggingHTTPSConnection
(*args, **kwargs)[source]¶ Bases:
libcloud.common.base.LoggingConnection
,libcloud.httplib_ssl.LibcloudHTTPSConnection
Utility Class for logging HTTPS connections
Constructor
-
protocol
= 'https'¶
-
-
class
libcloud.common.base.
Response
(response, connection)[source]¶ Bases:
object
A base Response class to derive from.
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
body
= None¶
-
connection
= None¶
-
error
= None¶
-
headers
= {}¶
-
object
= None¶
-
parse_body
()[source]¶ Parse response body.
Override in a provider’s subclass.
Returns: Parsed body. Return type: str
-
parse_error
()[source]¶ Parse the error messages.
Override in a provider’s subclass.
Returns: Parsed error. Return type: str
-
parse_zero_length_body
= False¶
-
status
= 200¶
- response (
-
class
libcloud.common.base.
HTTPResponse
(sock, debuglevel=0, strict=0, method=None, buffering=False)[source]¶ Bases:
httplib.HTTPResponse
-
class
libcloud.common.base.
JsonResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.Response
A Base JSON Response class to derive from.
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
parse_error
()¶
- response (
-
class
libcloud.common.base.
XmlResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.Response
A Base XML Response class to derive from.
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
parse_error
()¶
- response (
-
class
libcloud.common.base.
RawResponse
(connection)[source]¶ Bases:
libcloud.common.base.Response
Parameters: connection ( Connection
) – Parent connection object.-
headers
¶
-
reason
¶
-
response
¶
-
status
¶
-
libcloud.common.brightbox module¶
-
class
libcloud.common.brightbox.
BrightboxConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
Connection class for the Brightbox driver
-
host
= 'api.gb1.brightbox.com'¶
-
responseCls
¶ alias of
BrightboxResponse
-
-
class
libcloud.common.brightbox.
BrightboxResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
libcloud.common.cloudsigma module¶
libcloud.common.cloudstack module¶
-
class
libcloud.common.cloudstack.
CloudStackConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
,libcloud.common.base.PollingConnection
-
ASYNC_FAILURE
= 2¶
-
ASYNC_PENDING
= 0¶
-
ASYNC_SUCCESS
= 1¶
-
encode_data
(data)[source]¶ Must of the data is sent as part of query params (eeww), but in newer versions, userdata argument can be sent as a urlencoded data in the request body.
-
poll_interval
= 1¶
-
request_method
= '_sync_request'¶
-
responseCls
¶ alias of
CloudStackResponse
-
timeout
= 600¶
-
-
class
libcloud.common.cloudstack.
CloudStackDriverMixIn
(key, secret=None, secure=True, host=None, port=None)[source]¶ Bases:
object
-
connectionCls
¶ alias of
CloudStackConnection
-
host
= None¶
-
path
= None¶
-
-
class
libcloud.common.cloudstack.
CloudStackResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
libcloud.common.digitalocean module¶
Common settings and connection objects for DigitalOcean Cloud
-
class
libcloud.common.digitalocean.
DigitalOcean_v1_Response
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
-
class
libcloud.common.digitalocean.
DigitalOcean_v1_Connection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
Connection class for the DigitalOcean (v1) driver.
-
add_default_params
(params)[source]¶ Add parameters that are necessary for every request
This method adds
client_id
andapi_key
to the request.
-
host
= 'api.digitalocean.com'¶
-
responseCls
¶ alias of
DigitalOcean_v1_Response
-
-
class
libcloud.common.digitalocean.
DigitalOcean_v2_Response
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
valid_response_codes
= [200, 202, 201, 204]¶
- response (
-
class
libcloud.common.digitalocean.
DigitalOcean_v2_Connection
(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionKey
Connection class for the DigitalOcean (v2) driver.
Initialize user_id and key; set secure to an
int
based on passed value.-
add_default_headers
(headers)[source]¶ Add headers that are necessary for every request
This method adds
token
to the request.
-
add_default_params
(params)[source]¶ Add parameters that are necessary for every request
This method adds
per_page
to the request to reduce the total number of paginated requests to the API.
-
host
= 'api.digitalocean.com'¶
-
responseCls
¶ alias of
DigitalOcean_v2_Response
-
-
class
libcloud.common.digitalocean.
DigitalOceanBaseDriver
(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]¶ Bases:
libcloud.common.base.BaseDriver
DigitalOcean BaseDriver
Parameters: - key (
str
) – API key or username to be used (required) - secret (
str
) – Secret password to be used (required) - secure (
bool
) – Weither to use HTTPS or HTTP. Note: Some providers only support HTTPS, and it is on by default. - host (
str
) – Override hostname used for connections. - port (
int
) – Override port used for connections. - api_version (
str
) – Optional API version. Only used by drivers which support multiple API versions. - region (
str
) – Optional driver region. Only used by drivers which support multiple regions.
Return type: None
-
name
= 'DigitalOcean'¶
-
website
= 'https://www.digitalocean.com'¶
- key (
libcloud.common.exceptions module¶
-
exception
libcloud.common.exceptions.
BaseHTTPError
(code, message, headers=None)[source]¶ Bases:
exceptions.Exception
The base exception class for all HTTP related eceptions.
-
exception
libcloud.common.exceptions.
RateLimitReachedError
(*args, **kwargs)[source]¶ Bases:
libcloud.common.exceptions.BaseHTTPError
HTTP 429 - Rate limit: you’ve sent too many requests for this time period.
-
code
= 429¶
-
message
= '429 Rate limit exceeded'¶
-
libcloud.common.gandi module¶
Gandi driver base classes
-
class
libcloud.common.gandi.
BaseGandiDriver
[source]¶ Bases:
object
Gandi base driver
-
connectionCls
¶ alias of
GandiConnection
-
name
= 'Gandi'¶
-
-
class
libcloud.common.gandi.
BaseObject
(id, state, driver)[source]¶ Bases:
object
Base class for objects not conventional
-
get_uuid
()[source]¶ Unique hash for this object
Returns: str
The hash is a function of an SHA1 hash of prefix, the object’s ID and its driver which means that it should be unique between all interfaces. TODO : to review >>> from libcloud.compute.drivers.dummy import DummyNodeDriver >>> driver = DummyNodeDriver(0) >>> vif = driver.create_interface() >>> vif.get_uuid() ‘d3748461511d8b9b0e0bfa0d4d3383a619a2bb9f’
Note, for example, that this example will always produce the same UUID!
-
uuid_prefix
= ''¶
-
-
class
libcloud.common.gandi.
Disk
(id, state, name, driver, size, extra=None)[source]¶ Bases:
libcloud.common.gandi.BaseObject
Gandi disk component
-
class
libcloud.common.gandi.
GandiConnection
(key, secure=True, timeout=None, retry_delay=None, backoff=None)[source]¶ Bases:
libcloud.common.xmlrpc.XMLRPCConnection
,libcloud.common.base.ConnectionKey
Connection class for the Gandi driver
-
endpoint
= '/xmlrpc/'¶
-
host
= 'rpc.gandi.net'¶
-
responseCls
¶ alias of
GandiResponse
-
-
exception
libcloud.common.gandi.
GandiException
[source]¶ Bases:
exceptions.Exception
Exception class for Gandi driver
-
class
libcloud.common.gandi.
GandiResponse
(response, connection)[source]¶ Bases:
libcloud.common.xmlrpc.XMLRPCResponse
A Base Gandi Response class to derive from.
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
-
class
libcloud.common.gandi.
IPAddress
(id, state, inet, driver, version=4, extra=None)[source]¶ Bases:
libcloud.common.gandi.BaseObject
Provide a common interface for ip addresses
-
uuid_prefix
= 'inet:'¶
-
-
class
libcloud.common.gandi.
NetworkInterface
(id, state, mac_address, driver, ips=None, node_id=None, extra=None)[source]¶ Bases:
libcloud.common.gandi.BaseObject
Provide a common interface for network interfaces
-
uuid_prefix
= 'if:'¶
-
libcloud.common.gogrid module¶
-
class
libcloud.common.gogrid.
GoGridConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
Connection class for the GoGrid driver
-
host
= 'api.gogrid.com'¶
-
responseCls
¶ alias of
GoGridResponse
-
-
class
libcloud.common.gogrid.
GoGridIpAddress
(id, ip, public, state, subnet)[source]¶ Bases:
object
IP Address
-
class
libcloud.common.gogrid.
BaseGoGridDriver
[source]¶ Bases:
object
GoGrid has common object model for services they provide, like locations and IP, so keep handling of these things in a single place.
-
ex_list_ips
(**kwargs)[source]¶ Return list of IP addresses assigned to the account.
Parameters: - public (
bool
) – set to True to list only public IPs or False to list only private IPs. Set to None or not specify at all not to filter by type - assigned (
bool
) – set to True to list only addresses assigned to servers, False to list unassigned addresses and set to None or don’t set at all not no filter by state - location (
NodeLocation
) – filter IP addresses by location
Return type: list
ofGoGridIpAddress
- public (
-
name
= 'GoGrid'¶
-
libcloud.common.google module¶
Module for Google Connection and Authentication classes.
Information about setting up your Google OAUTH2 credentials:
For libcloud, there are two basic methods for authenticating to Google using OAUTH2: Service Accounts and Client IDs for Installed Applications.
Both are initially set up from the Cloud Console_ _Console: https://cloud.google.com/console
Setting up Service Account authentication (note that you need the PyCrypto package installed to use this):
Go to the Console
Go to your project and then to “APIs & auth” on the left
Click on “Credentials”
Click on “Create New Client ID...”
Select “Service account” and click on “Create Client ID”
Download the Private Key (should happen automatically). The key you download is in JSON format.
Move the .json file to a safe location.
Optionally, you may choose to Generate a PKCS12 key from the Console. It needs to be converted to the PEM format. Please note, the PKCS12 format is deprecated and may be removed in a future release. - Convert the key using OpenSSL (the default password is ‘notasecret’):
openssl pkcs12 -in YOURPRIVKEY.p12 -nodes -nocerts -passin pass:notasecret | openssl rsa -out PRIV.pem
- Move the .pem file to a safe location.
To Authenticate, you will need to pass the Service Account’s “Email address” in as the user_id and the path to the .pem file as the key.
Setting up Installed Application authentication:
- Go to the Console
- Go to your project and then to “APIs & auth” on the left
- Click on “Credentials”
- Select “Installed application” and “Other” then click on “Create Client ID”
- To Authenticate, pass in the “Client ID” as the user_id and the “Client secret” as the key
- The first time that you do this, the libcloud will give you a URL to visit. Copy and paste the URL into a browser.
- When you go to the URL it will ask you to log in (if you aren’t already) and ask you if you want to allow the project access to your account.
- Click on Accept and you will be given a code.
- Paste that code at the prompt given to you by the Google libcloud connection.
- At that point, a token & refresh token will be stored in your home directory and will be used for authentication.
Please remember to secure your keys and access tokens.
-
exception
libcloud.common.google.
GoogleAuthError
(value)[source]¶ Bases:
libcloud.common.types.LibcloudError
Generic Error class for various authentication errors.
-
class
libcloud.common.google.
GoogleBaseAuthConnection
(user_id, key=None, scopes=None, redirect_uri='urn:ietf:wg:oauth:2.0:oob', login_hint=None, **kwargs)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
Base class for Google Authentication. Should be subclassed for specific types of authentication.
Parameters: - user_id (
str
) – The email address (for service accounts) or Client ID (for installed apps) to be used for authentication. - key (
str
) – The RSA Key (for service accounts) or file path containing key or Client Secret (for installed apps) to be used for authentication. - scopes (
list
) – A list of urls defining the scope of authentication to grant. - redirect_uri (
str
) – The Redirect URI for the authentication request. See Google OAUTH2 documentation for more info. - login_hint (
str
) – Login hint for authentication request. Useful for Installed Application authentication.
-
auth_path
= '/o/oauth2/auth'¶
-
driver
¶ alias of
GoogleBaseDriver
-
host
= 'accounts.google.com'¶
-
name
= 'Google Auth'¶
-
refresh_token
(token_info)[source]¶ Refresh the current token.
Fetch an updated refresh token from internal metadata service.
Parameters: token_info ( dict
) – Dictionary containing token information. (Not used, but here for compatibility)Returns: A dictionary containing updated token information. Return type: dict
-
responseCls
¶ alias of
GoogleResponse
- user_id (
-
class
libcloud.common.google.
GoogleBaseConnection
(user_id, key=None, auth_type=None, credential_file=None, scopes=None, **kwargs)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
,libcloud.common.base.PollingConnection
Base connection class for interacting with Google APIs.
Determine authentication type, set up appropriate authentication connection and get initial authentication information.
Parameters: - user_id (
str
) – The email address (for service accounts) or Client ID (for installed apps) to be used for authentication. - key (
str
) – The RSA Key (for service accounts) or file path containing key or Client Secret (for installed apps) to be used for authentication. - auth_type (
str
) – Accepted values are “SA” or “IA” or “GCE” (“Service Account” or “Installed Application” or “GCE” if libcloud is being used on a GCE instance with service account enabled). If not supplied, auth_type will be guessed based on value of user_id or if the code is being executed in a GCE instance.). If not supplied, auth_type will be guessed based on value of user_id or if the code is running on a GCE instance. - credential_file (
str
) – Path to file for caching authentication information. - scopes (
list
) – List of OAuth2 scope URLs. The empty default sets read/write access to Compute, Storage, and DNS.
-
driver
¶ alias of
GoogleBaseDriver
-
get_poll_request_kwargs
(response, context, request_kwargs)[source]¶ @inherits:
PollingConnection.get_poll_request_kwargs
-
has_completed
(response)[source]¶ Determine if operation has completed based on response.
Parameters: response (I{responseCls}) – JSON response Returns: True if complete, False otherwise Return type: bool
-
host
= 'www.googleapis.com'¶
-
morph_action_hook
(action)[source]¶ Update action to correct request path.
In many places, the Google API returns a full URL to a resource. This will strip the scheme and host off of the path and just return the request. Otherwise, it will prepend the base request_path to the action.
Parameters: action ( str
) – The action to be called in the http requestReturns: The modified request based on the action Return type: str
-
poll_interval
= 2.0¶
-
pre_connect_hook
(params, headers)[source]¶ Check to make sure that token hasn’t expired. If it has, get an updated token. Also, add the token to the headers.
@inherits:
Connection.pre_connect_hook
-
responseCls
¶ alias of
GoogleResponse
-
timeout
= 180¶
- user_id (
-
class
libcloud.common.google.
GoogleGCEServiceAcctAuthConnection
(user_id, key=None, scopes=None, redirect_uri='urn:ietf:wg:oauth:2.0:oob', login_hint=None, **kwargs)[source]¶ Bases:
libcloud.common.google.GoogleBaseAuthConnection
Authentication class for self-authentication when used with a GCE istance that supports serviceAccounts.
Parameters: - user_id (
str
) – The email address (for service accounts) or Client ID (for installed apps) to be used for authentication. - key (
str
) – The RSA Key (for service accounts) or file path containing key or Client Secret (for installed apps) to be used for authentication. - scopes (
list
) – A list of urls defining the scope of authentication to grant. - redirect_uri (
str
) – The Redirect URI for the authentication request. See Google OAUTH2 documentation for more info. - login_hint (
str
) – Login hint for authentication request. Useful for Installed Application authentication.
- user_id (
-
class
libcloud.common.google.
GoogleInstalledAppAuthConnection
(user_id, key=None, scopes=None, redirect_uri='urn:ietf:wg:oauth:2.0:oob', login_hint=None, **kwargs)[source]¶ Bases:
libcloud.common.google.GoogleBaseAuthConnection
Authentication connection for “Installed Application” authentication.
Parameters: - user_id (
str
) – The email address (for service accounts) or Client ID (for installed apps) to be used for authentication. - key (
str
) – The RSA Key (for service accounts) or file path containing key or Client Secret (for installed apps) to be used for authentication. - scopes (
list
) – A list of urls defining the scope of authentication to grant. - redirect_uri (
str
) – The Redirect URI for the authentication request. See Google OAUTH2 documentation for more info. - login_hint (
str
) – Login hint for authentication request. Useful for Installed Application authentication.
-
get_code
()[source]¶ Give the user a URL that they can visit to authenticate and obtain a code. This method will ask for that code that the user can paste in.
Returns: Code supplied by the user after authenticating Return type: str
- user_id (
-
class
libcloud.common.google.
GoogleResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Google Base Response class.
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
-
class
libcloud.common.google.
GoogleServiceAcctAuthConnection
(user_id, key, *args, **kwargs)[source]¶ Bases:
libcloud.common.google.GoogleBaseAuthConnection
Authentication class for “Service Account” authentication.
Check to see if PyCrypto is available, and convert key file path into a key string if the key is in a file.
Parameters: - user_id (
str
) – Email address to be used for Service Account authentication. - key (
str
) – The RSA Key or path to file containing the key.
- user_id (
libcloud.common.hostvirtual module¶
-
class
libcloud.common.hostvirtual.
HostVirtualConnection
(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionKey
Initialize user_id and key; set secure to an
int
based on passed value.-
allow_insecure
= False¶
-
host
= 'vapi.vr.org'¶
-
-
class
libcloud.common.hostvirtual.
HostVirtualResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
valid_response_codes
= [200, 202, 201, 204]¶
- response (
libcloud.common.linode module¶
-
exception
libcloud.common.linode.
LinodeException
(code, message)[source]¶ Bases:
exceptions.Exception
Error originating from the Linode API
This class wraps a Linode API error, a list of which is available in the API documentation. All Linode API errors are a numeric code and a human-readable description.
-
class
libcloud.common.linode.
LinodeResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Linode API response
Wraps the HTTP response returned by the Linode API.
libcloud does not take advantage of batching, so a response will always reflect the above format. A few weird quirks are caught here as well.
Instantiate a LinodeResponse from the HTTP response
Parameters: response – The raw response returned by urllib Returns: parsed LinodeResponse
-
objects
= None¶
-
-
class
libcloud.common.linode.
LinodeConnection
(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionKey
A connection to the Linode API
Wraps SSL connections to the Linode API, automagically injecting the parameters that the API needs for each request.
Initialize user_id and key; set secure to an
int
based on passed value.-
add_default_params
(params)[source]¶ Add parameters that are necessary for every request
This method adds
api_key
andapi_responseFormat
to the request.
-
host
= 'api.linode.com'¶
-
responseCls
¶ alias of
LinodeResponse
-
libcloud.common.onapp module¶
-
class
libcloud.common.onapp.
OnAppConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
OnApp connection class
-
add_default_headers
(headers)[source]¶ Add Basic Authentication header to all the requests. It injects the “Authorization: Basic Base64String===” header in each request :type headers:
dict
:param headers: Default input headers :rtype:dict
:return: Default input headers with the “Authorization”header
-
responseCls
¶ alias of
OnAppResponse
-
-
class
libcloud.common.onapp.
OnAppResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
OnApp response class
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
libcloud.common.openstack module¶
Common utilities for OpenStack
-
class
libcloud.common.openstack.
OpenStackBaseConnection
(user_id, key, secure=True, host=None, port=None, timeout=None, ex_force_base_url=None, ex_force_auth_url=None, ex_force_auth_version=None, ex_force_auth_token=None, ex_tenant_name=None, ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None, retry_delay=None, backoff=None)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
Base class for OpenStack connections.
Parameters: - user_id (
str
) – User name to use when authenticating - key (
str
) – Secret to use when authenticating. - secure (
bool
) – Use HTTPS? (True by default.) - ex_force_base_url – Base URL for connection requests. If
not specified, this will be determined by authenticating. :type ex_force_base_url:
str
Parameters: - ex_force_auth_url (
str
) – Base URL for authentication requests. - ex_force_auth_version – Authentication version to use. If
not specified, defaults to AUTH_API_VERSION. :type ex_force_auth_version:
str
Parameters: ex_force_auth_token – Authentication token to use for connection requests. If specified, the connection will not attempt to authenticate, and the value of ex_force_base_url will be used to determine the base request URL. If ex_force_auth_token is passed in, ex_force_base_url must also be provided. :type ex_force_auth_token:
str
Parameters: ex_tenant_name – When authenticating, provide this tenant name to the identity service. A scoped token will be returned. Some cloud providers require the tenant name to be provided at authentication time. Others will use a default tenant if none is provided. :type ex_tenant_name:
str
Parameters: ex_force_service_type – Service type to use when selecting an service. If not specified, a provider specific default will be used. :type ex_force_service_type:
str
Parameters: ex_force_service_name – Service name to use when selecting an service. If not specified, a provider specific default will be used. :type ex_force_service_name:
str
Parameters: ex_force_service_region – Region to use when selecting an service. If not specified, a provider specific default will be used. :type ex_force_service_region:
str
-
auth_token
= None¶
-
auth_token_expires
= None¶
-
auth_url
= None¶
-
auth_user_info
= None¶
-
get_auth_class
()[source]¶ Retrieve identity / authentication class instance.
Return type: OpenStackIdentityConnection
-
get_endpoint
()[source]¶ Selects the endpoint to use based on provider specific values, or overrides passed in by the user when setting up the driver.
Returns: url of the relevant endpoint for the driver
-
service_catalog
= None¶
-
service_name
= None¶
-
service_region
= None¶
-
service_type
= None¶
- user_id (
-
class
libcloud.common.openstack.
OpenStackResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.Response
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
node_driver
= None¶
- response (
libcloud.common.openstack_identity module¶
Common / shared code for handling authentication against OpenStack identity service (Keystone).
-
class
libcloud.common.openstack_identity.
OpenStackIdentityVersion
(version, status, updated, url)[source]¶ Bases:
object
-
class
libcloud.common.openstack_identity.
OpenStackIdentityDomain
(id, name, enabled)[source]¶ Bases:
object
-
class
libcloud.common.openstack_identity.
OpenStackIdentityProject
(id, name, description, enabled, domain_id=None)[source]¶ Bases:
object
-
class
libcloud.common.openstack_identity.
OpenStackIdentityUser
(id, domain_id, name, email, description, enabled)[source]¶ Bases:
object
-
class
libcloud.common.openstack_identity.
OpenStackIdentityRole
(id, name, description, enabled)[source]¶ Bases:
object
-
class
libcloud.common.openstack_identity.
OpenStackServiceCatalog
(service_catalog, auth_version='1.1')[source]¶ Bases:
object
http://docs.openstack.org/api/openstack-identity-service/2.0/content/
This class should be instanciated with the contents of the ‘serviceCatalog’ in the auth response. This will do the work of figuring out which services actually exist in the catalog as well as split them up by type, name, and region if available
-
get_endpoint
(service_type=None, name=None, region=None, endpoint_type='external')[source]¶ Retrieve a single endpoint using the provided criteria.
Note: If no or more than one matching endpoint is found, an exception is thrown.
-
get_endpoints
(service_type=None, name=None)[source]¶ Retrieve all the endpoints for the provided service type and name.
Return type: list
ofOpenStackServiceCatalogEntryEndpoint
-
get_entries
()[source]¶ Return all the entries for this service catalog.
Return type: list
ofOpenStackServiceCatalogEntry
-
get_public_urls
(service_type=None, name=None)[source]¶ Retrieve all the available public (external) URLs for the provided service type and name.
-
get_regions
(service_type=None)[source]¶ Retrieve a list of all the available regions.
Parameters: service_type ( str
) – If specified, only return regions for this service type.Return type: list
ofstr
-
-
class
libcloud.common.openstack_identity.
OpenStackServiceCatalogEntry
(service_type, endpoints=None, service_name=None)[source]¶ Bases:
object
Parameters: - service_type (
str
) – Service type. - endpoints (
list
) – Endpoints belonging to this entry. - service_name (
str
) – Optional service name.
- service_type (
-
class
libcloud.common.openstack_identity.
OpenStackServiceCatalogEntryEndpoint
(region, url, endpoint_type='external')[source]¶ Bases:
object
Parameters: - region (
str
) – Endpoint region. - url (
str
) – Endpoint URL. - endpoint_type (
str
) – Endpoint type (external / internal / admin).
-
VALID_ENDPOINT_TYPES
= ['internal', 'external', 'admin']¶
- region (
-
class
libcloud.common.openstack_identity.
OpenStackIdentityEndpointType
[source]¶ Bases:
object
Enum class for openstack identity endpoint type.
-
ADMIN
= 'admin'¶
-
EXTERNAL
= 'external'¶
-
INTERNAL
= 'internal'¶
-
-
class
libcloud.common.openstack_identity.
OpenStackIdentityConnection
(auth_url, user_id, key, tenant_name=None, timeout=None, parent_conn=None)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
Base identity connection class which contains common / shared logic.
Note: This class shouldn’t be instantiated directly.
-
authenticate
(force=False)[source]¶ Authenticate against the identity API.
Parameters: force ( bool
) – Forcefully update the token even if it’s already cached and still valid.
-
authenticated_request
(action, params=None, data=None, headers=None, method='GET', raw=False)[source]¶ Perform an authenticated request against the identity API.
-
is_token_valid
()[source]¶ Return True if the current auth token is already cached and hasn’t expired yet.
Returns: True
if the token is still valid,False
otherwise.Return type: bool
-
list_supported_versions
()[source]¶ Retrieve a list of all the identity versions which are supported by this installation.
Return type: list
ofOpenStackIdentityVersion
-
responseCls
¶ alias of
OpenStackAuthResponse
-
timeout
= None¶
-
-
class
libcloud.common.openstack_identity.
OpenStackIdentity_1_0_Connection
(auth_url, user_id, key, tenant_name=None, timeout=None, parent_conn=None)[source]¶ Bases:
libcloud.common.openstack_identity.OpenStackIdentityConnection
Connection class for Keystone API v1.0.
-
auth_version
= '1.0'¶
-
name
= 'OpenStack Identity API v1.0'¶
-
responseCls
¶ alias of
OpenStackAuthResponse
-
-
class
libcloud.common.openstack_identity.
OpenStackIdentity_1_1_Connection
(auth_url, user_id, key, tenant_name=None, timeout=None, parent_conn=None)[source]¶ Bases:
libcloud.common.openstack_identity.OpenStackIdentityConnection
Connection class for Keystone API v1.1.
-
auth_version
= '1.1'¶
-
name
= 'OpenStack Identity API v1.1'¶
-
responseCls
¶ alias of
OpenStackAuthResponse
-
-
class
libcloud.common.openstack_identity.
OpenStackIdentity_2_0_Connection
(auth_url, user_id, key, tenant_name=None, timeout=None, parent_conn=None)[source]¶ Bases:
libcloud.common.openstack_identity.OpenStackIdentityConnection
Connection class for Keystone API v2.0.
-
auth_version
= '2.0'¶
-
name
= 'OpenStack Identity API v1.0'¶
-
responseCls
¶ alias of
OpenStackAuthResponse
-
-
class
libcloud.common.openstack_identity.
OpenStackIdentity_3_0_Connection
(auth_url, user_id, key, tenant_name=None, domain_name='Default', token_scope='project', timeout=None, parent_conn=None)[source]¶ Bases:
libcloud.common.openstack_identity.OpenStackIdentityConnection
Connection class for Keystone API v3.x.
Parameters: - tenant_name (
str
) – Name of the project this user belongs to. Note: When token_scope is set to project, this argument control to which project to scope the token to. - domain_name (
str
) – Domain the user belongs to. Note: Then token_scope is set to token, this argument controls to which domain to scope the token to. - token_scope (
str
) – Whether to scope a token to a “project” or a “domain”
-
VALID_TOKEN_SCOPES
= ['project', 'domain', 'unscoped']¶
-
auth_version
= '3.0'¶
-
create_user
(email, password, name, description=None, domain_id=None, default_project_id=None, enabled=True)[source]¶ Create a new user account.
Parameters: - email (
str
) – User’s mail address. - password (
str
) – User’s password. - name (
str
) – User’s name. - description (
str
) – Optional description. - domain_id (
str
) – ID of the domain to add the user to (optional). - default_project_id (
str
) – ID of the default user project (optional). - enabled (
bool
) – True to enable user after creation.
Returns: Created user.
Return type: - email (
-
disable_user
(user)[source]¶ Disable user account.
Note: This operation appears to be idempotent.
Parameters: user ( OpenStackIdentityUser
) – User to disable.Returns: User account which has been disabled. Return type: OpenStackIdentityUser
-
enable_user
(user)[source]¶ Enable user account.
Note: This operation appears to be idempotent.
Parameters: user ( OpenStackIdentityUser
) – User to enable.Returns: User account which has been enabled. Return type: OpenStackIdentityUser
-
get_domain
(domain_id)[source]¶ Retrieve information about a single domain.
Parameters: domain_id ( str
) – ID of domain to retrieve information for.Rtyle: OpenStackIdentityDomain
-
grant_domain_role_to_user
(domain, role, user)[source]¶ Grant domain role to a user.
Note: This function appears to be idempodent.
Parameters: - domain (
OpenStackIdentityDomain
) – Domain to grant the role to. - role (
OpenStackIdentityRole
) – Role to grant. - user (
OpenStackIdentityUser
) – User to grant the role to.
Returns: True
on success.Return type: bool
- domain (
-
grant_project_role_to_user
(project, role, user)[source]¶ Grant project role to a user.
Note: This function appeats to be idempodent.
Parameters: - project (
OpenStackIdentityDomain
) – Project to grant the role to. - role (
OpenStackIdentityRole
) – Role to grant. - user (
OpenStackIdentityUser
) – User to grant the role to.
Returns: True
on success.Return type: bool
- project (
-
list_domains
()[source]¶ List the available domains.
Return type: list
ofOpenStackIdentityDomain
-
list_projects
()[source]¶ List the available projects.
Note: To perform this action, user you are currently authenticated with needs to be an admin.
Return type: list
ofOpenStackIdentityProject
-
list_roles
()[source]¶ List the available roles.
Return type: list
ofOpenStackIdentityRole
-
list_user_domain_roles
(domain, user)[source]¶ Retrieve all the roles for a particular user on a domain.
Return type: list
ofOpenStackIdentityRole
-
list_user_projects
(user)[source]¶ Retrieve all the projects user belongs to.
Return type: list
ofOpenStackIdentityProject
-
list_users
()[source]¶ List the available users.
Return type: list
ofOpenStackIdentityUser
-
name
= 'OpenStack Identity API v3.x'¶
-
responseCls
¶ alias of
OpenStackAuthResponse
-
revoke_domain_role_from_user
(domain, user, role)[source]¶ Revoke domain role from a user.
Parameters: - domain (
OpenStackIdentityDomain
) – Domain to revoke the role from. - role (
OpenStackIdentityRole
) – Role to revoke. - user (
OpenStackIdentityUser
) – User to revoke the role from.
Returns: True
on success.Return type: bool
- domain (
-
revoke_project_role_from_user
(project, role, user)[source]¶ Revoke project role from a user.
Parameters: - project (
OpenStackIdentityDomain
) – Project to revoke the role from. - role (
OpenStackIdentityRole
) – Role to revoke. - user (
OpenStackIdentityUser
) – User to revoke the role from.
Returns: True
on success.Return type: bool
- project (
- tenant_name (
libcloud.common.rackspace module¶
Common settings for Rackspace Cloud Servers and Cloud Files
libcloud.common.runabove module¶
-
class
libcloud.common.runabove.
RunAboveResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
-
class
libcloud.common.runabove.
RunAboveConnection
(user_id, *args, **kwargs)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
A connection to the RunAbove API
Wraps SSL connections to the RunAbove API, automagically injecting the parameters that the API needs for each request.
-
LOCATIONS
= {'SBG-1': {'country': 'FR', 'id': 'SBG-1', 'name': 'Strasbourg 1'}, 'BHS-1': {'country': 'CA', 'id': 'BHS-1', 'name': 'Montreal 1'}}¶
-
allow_insecure
= True¶
-
host
= 'api.runabove.com'¶
-
request_path
= '/1.0'¶
-
responseCls
¶ alias of
RunAboveResponse
-
timestamp
= None¶
-
ua
= []¶
-
libcloud.common.softlayer module¶
Softlayer connection
-
class
libcloud.common.softlayer.
SoftLayerConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶ Bases:
libcloud.common.xmlrpc.XMLRPCConnection
,libcloud.common.base.ConnectionUserAndKey
-
endpoint
= '/xmlrpc/v3'¶
-
host
= 'api.softlayer.com'¶
-
responseCls
¶ alias of
SoftLayerResponse
-
-
exception
libcloud.common.softlayer.
SoftLayerException
(value, driver=None)[source]¶ Bases:
libcloud.common.types.LibcloudError
Exception class for SoftLayer driver
-
exception
libcloud.common.softlayer.
SoftLayerObjectDoesntExist
(value, driver=None)[source]¶ Bases:
libcloud.common.types.LibcloudError
Exception class for SoftLayer driver object doesnt exist
-
class
libcloud.common.softlayer.
SoftLayerResponse
(response, connection)[source]¶ Bases:
libcloud.common.xmlrpc.XMLRPCResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
defaultExceptionCls
¶ alias of
SoftLayerException
-
exceptions
= {'SoftLayer_Account': <class 'libcloud.common.types.InvalidCredsError'>, 'SoftLayer_Exception_ObjectNotFound': <class 'libcloud.common.softlayer.SoftLayerObjectDoesntExist'>}¶
- response (
libcloud.common.types module¶
-
exception
libcloud.common.types.
LibcloudError
(value, driver=None)[source]¶ Bases:
exceptions.Exception
The base class for other libcloud exceptions
-
exception
libcloud.common.types.
MalformedResponseError
(value, body=None, driver=None)[source]¶ Bases:
libcloud.common.types.LibcloudError
Exception for the cases when a provider returns a malformed response, e.g. you request JSON and provider returns ‘<h3>something</h3>’ due to some error on their side.
-
exception
libcloud.common.types.
ProviderError
(value, http_code, driver=None)[source]¶ Bases:
libcloud.common.types.LibcloudError
Exception used when provider gives back error response (HTTP 4xx, 5xx) for a request.
Specific sub types can be derieved for errors like HTTP 401 : InvalidCredsError HTTP 404 : NodeNotFoundError, ContainerDoesNotExistError
-
exception
libcloud.common.types.
InvalidCredsError
(value='Invalid credentials with the provider', driver=None)[source]¶ Bases:
libcloud.common.types.ProviderError
Exception used when invalid credentials are used on a provider.
-
libcloud.common.types.
InvalidCredsException
¶ alias of
InvalidCredsError
libcloud.common.xmlrpc module¶
Base classes for working with xmlrpc APIs
-
class
libcloud.common.xmlrpc.
ErrorCodeMixin
[source]¶ Bases:
object
This is a helper for API’s that have a well defined collection of error codes that are easily parsed out of error messages. It acts as a factory: it finds the right exception for the error code, fetches any parameters it needs from the context and raises it.
-
exceptions
= {}¶
-
-
exception
libcloud.common.xmlrpc.
ProtocolError
[source]¶ Bases:
exceptions.Exception
-
class
libcloud.common.xmlrpc.
XMLRPCConnection
(secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, retry_delay=None, backoff=None)[source]¶ Bases:
libcloud.common.base.Connection
Connection class which can call XMLRPC based API’s.
This class uses the xmlrpclib marshalling and demarshalling code but uses the http transports provided by libcloud giving it better certificate validation and debugging helpers than the core client library.
-
request
(method_name, *args, **kwargs)[source]¶ Call a given method_name.
Parameters: - method_name (
str
) – A method exposed by the xmlrpc endpoint that you are connecting to. - args (
tuple
) – Arguments to invoke with method with.
- method_name (
-
responseCls
¶ alias of
XMLRPCResponse
-
-
class
libcloud.common.xmlrpc.
XMLRPCResponse
(response, connection)[source]¶ Bases:
libcloud.common.xmlrpc.ErrorCodeMixin
,libcloud.common.base.Response
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
-
defaultExceptionCls
¶ alias of
Exception
- response (