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, proxy_url=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': 'pending', 'ON': 'running', 'OFF': 'pending', 'UNKNOWN': 'unknown', 'NOT_ALLOCATED': 'terminated', 'LOCKED': 'pending', 'ALLOCATED': 'pending', 'CONFIGURED': 'pending'}¶
-
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 asynchronous 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.aliyun module¶
-
class
libcloud.common.aliyun.
AliyunXmlResponse
(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.aliyun.
AliyunRequestSigner
(access_key, access_secret, version)[source]¶ Bases:
object
Class handles signing the outgoing Aliyun requests.
Parameters: - access_key (
str
) – Access key. - access_secret (
str
) – Access secret. - version (
str
) – API version.
- access_key (
-
class
libcloud.common.aliyun.
AliyunRequestSignerAlgorithmV1_0
(access_key, access_secret, version)[source]¶ Bases:
libcloud.common.aliyun.AliyunRequestSigner
Aliyun request signer using signature version 1.0.
Parameters: - access_key (
str
) – Access key. - access_secret (
str
) – Access secret. - version (
str
) – API version.
- access_key (
-
class
libcloud.common.aliyun.
SignedAliyunConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, retry_delay=None, backoff=None, api_version=None, signature_version='1.0')[source]¶ Bases:
libcloud.common.aliyun.AliyunConnection
-
api_version
= None¶
-
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.
-
exceptions
= {}¶
-
xpath
= None¶
- response (
-
class
libcloud.common.aws.
AWSTokenConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=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, proxy_url=None, token=None, retry_delay=None, backoff=None, signature_version='2')[source]¶ Bases:
libcloud.common.aws.AWSTokenConnection
-
version
= None¶
-
-
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
-
skip_accept_encoding
= False¶
-
skip_host
= False¶
-
-
class
libcloud.common.azure.
AzureRawResponse
(connection, response=None)[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.azure_arm module¶
-
class
libcloud.common.azure_arm.
AzureAuthJsonResponse
(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.azure_arm.
AzureBaseDriver
[source]¶ Bases:
object
-
name
= 'Microsoft Azure Resource Management API'¶
-
-
class
libcloud.common.azure_arm.
AzureJsonResponse
(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.azure_arm.
AzureResourceManagementConnection
(key, secret, secure=True, tenant_id=None, subscription_id=None, cloud_environment=None, **kwargs)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
Represents a single connection to Azure
-
conn_class
¶ alias of
LibcloudConnection
-
driver
¶ alias of
AzureBaseDriver
-
name
= 'Azure AD Auth'¶
-
rawResponseCls
¶ alias of
RawResponse
-
responseCls
¶ alias of
AzureJsonResponse
-
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
) – Whether 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_class
¶ alias of
LibcloudConnection
-
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, stream=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. - stream (
bool
) – True to return an iterator in Response.iter_content and allow streaming of the response data (for downloading large files)
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, proxy_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.
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, response=None)[source]¶ Bases:
libcloud.common.base.Response
Parameters: connection ( Connection
) – Parent connection object.-
reason
¶
-
response
¶
-
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.buddyns module¶
-
exception
libcloud.common.buddyns.
BuddyNSException
(code, message)[source]¶ Bases:
exceptions.Exception
-
class
libcloud.common.buddyns.
BuddyNSResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
-
errors
= []¶
-
objects
= []¶
-
-
class
libcloud.common.buddyns.
BuddyNSConnection
(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.-
host
= 'www.buddyns.com'¶
-
responseCls
¶ alias of
BuddyNSResponse
-
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_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
) – Whether 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.dimensiondata module¶
Dimension Data Common Components
-
class
libcloud.common.dimensiondata.
DimensionDataAccountDetails
(user_name, full_name, first_name, last_name, email)[source]¶ Bases:
object
Dimension Data account class details
-
class
libcloud.common.dimensiondata.
DimensionDataAntiAffinityRule
(id, node_list)[source]¶ Bases:
object
Anti-Affinity rule for DimensionData
An Anti-Affinity rule ensures that servers in the rule will not reside on the same VMware ESX host.
Instantiate a new
DimensionDataAntiAffinityRule
Parameters: - id (
str
) – The ID of the Anti-Affinity rule - node_list (
list
ofstr
) – List of node ids that belong in this rule
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataBackupClient
(id, type, status, schedule_policy, storage_policy, download_url, alert=None, running_job=None)[source]¶ Bases:
object
An object that represents a backup client
Initialize an instance of
DimensionDataBackupClient
Parameters: - id (
str
) – Unique ID for the client - type (
DimensionDataBackupClientType
) – The type of client that this client is - status (
str
) – The states of this particular backup client. i.e. (Unregistered) - schedule_policy (
str
) – The schedule policy for this client NOTE: Dimension Data only sends back the name of the schedule policy, no further details - storage_policy (
str
) – The storage policy for this client NOTE: Dimension Data only sends back the name of the storage policy, no further details - download_url (
str
) – The download url for this client - alert (
DimensionDataBackupClientRunningJob
) – The alert configured for this backup client (optional) - alert – The running job for the client (optional)
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataBackupClientAlert
(trigger, notify_list=[])[source]¶ Bases:
object
An alert for a backup client
Initialize an instance of
DimensionDataBackupClientAlert
Parameters: - trigger (
str
) – Trigger type for the client i.e. ON_FAILURE - notify_list (
list
ofstr
) – List of email addresses that are notified when the alert is fired
- trigger (
-
class
libcloud.common.dimensiondata.
DimensionDataBackupClientRunningJob
(id, status, percentage=0)[source]¶ Bases:
object
A running job for a given backup client
Initialize an instance of
DimensionDataBackupClientRunningJob
Parameters: - id (
str
) – The unqiue ID of the job - status (
str
) – The status of the job i.e. Waiting - percentage (
int
) – The percentage completion of the job
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataBackupClientType
(type, is_file_system, description)[source]¶ Bases:
object
A client type object for backups
Initialize an instance of
DimensionDataBackupClientType
Parameters: - type (
str
) – The type of client i.e. (FA.Linux, MySQL, ect.) - is_file_system (
bool
) – The name of the iRule - description (
str
) – Description of the client
- type (
-
class
libcloud.common.dimensiondata.
DimensionDataBackupDetails
(asset_id, service_plan, status, clients=None)[source]¶ Bases:
object
Dimension Data Backup Details represents information about a targets backups configuration
Initialize an instance of
DimensionDataBackupDetails
Parameters: - asset_id (
str
) – Asset identification for backups - service_plan (
str
) – The service plan for backups. i.e (Essentials) - status (
str
) – The overall status this backup target. i.e. (unregistered) - clients (
list
ofDimensionDataBackupClient
) – Backup clients attached to this target
- asset_id (
-
class
libcloud.common.dimensiondata.
DimensionDataBackupSchedulePolicy
(name, description)[source]¶ Bases:
object
A representation of a schedule policy
Initialize an instance of
DimensionDataBackupSchedulePolicy
Parameters: - name (
str
) – The name of the policy i.e 12AM - 6AM - description (
str
) – Short summary of the details of the policy
- name (
-
class
libcloud.common.dimensiondata.
DimensionDataBackupStoragePolicy
(name, retention_period, secondary_location)[source]¶ Bases:
object
A representation of a storage policy
Initialize an instance of
DimensionDataBackupStoragePolicy
Parameters: - name (
str
) – The name of the storage policy i.e. 14 Day Storage Policy - retention_period (
int
) – How long to keep the backup in days - secondary_location (
str
) – The secondary location i.e. Primary
- name (
-
class
libcloud.common.dimensiondata.
DimensionDataChildIpAddressList
(id, name)[source]¶ Bases:
object
DimensionData Child IP Address list
” Initialize an instance of
DimensionDataChildIpAddressList
Parameters: - id (
str
) – GUID of the IP Address List key - name (
str
) – Name of the IP Address List
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataChildPortList
(id, name)[source]¶ Bases:
object
DimensionData Child Port list
” Initialize an instance of
DimensionDataChildIpAddressList
Parameters: - id (
str
) – GUID of the child port list key - name (
str
) – Name of the child port List
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataConnection
(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, api_version=None, **conn_kwargs)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
Connection class for the DimensionData driver
-
active_api_version
= '2.4'¶
-
allow_insecure
= False¶
-
api_path_version_1
= '/oec'¶
-
api_path_version_2
= '/caas'¶
-
api_version_1
= 0.9¶
-
get_account_details
()[source]¶ Get the details of this account
Return type: DimensionDataAccountDetails
-
get_resource_path_api_1
()[source]¶ This method returns a resource path which is necessary for referencing resources that require a full path instead of just an ID, such as networks, and customer snapshots.
-
get_resource_path_api_2
()[source]¶ This method returns a resource path which is necessary for referencing resources that require a full path instead of just an ID, such as networks, and customer snapshots.
-
latest_api_version
= '2.4'¶
-
oldest_api_version
= '2.2'¶
-
paginated_request_with_orgId_api_2
(action, params=None, data='', headers=None, method='GET', page_size=250)[source]¶ A paginated request to the MCP2.0 API This essentially calls out to request_with_orgId_api_2 for each page and yields the response to make a generator This generator can be looped through to grab all the pages.
Parameters: - action (
str
) – The resource to access (i.e. ‘network/vlan’) - params (
dict
orNone
) – Parameters to give to the action - data (
str
) – The data payload to be added to the request - headers (
str
ordict
orNone
) – Additional header to be added to the request - method (
str
) – HTTP Method for the request (i.e. ‘GET’, ‘POST’) - page_size (
int
) – The size of each page to be returned Note: Max page size in MCP2.0 is currently 250
- action (
-
rawResponseCls
¶ alias of
DimensionDataRawResponse
-
responseCls
¶ alias of
DimensionDataResponse
-
wait_for_state
(state, func, poll_interval=2, timeout=60, *args, **kwargs)[source]¶ Wait for the function which returns a instance with field status/state to match.
Keep polling func until one of the desired states is matched
Parameters: - state (
str
orlist
) – Either the desired state (str) or a list of states - func (
function
) – The function to call, e.g. ex_get_vlan. Note: This function needs to return an object which hasstatus
attribute. - poll_interval (int) – The number of seconds to wait between checks
- timeout (int) – The total number of seconds to wait to reach a state
- args (Positional arguments) – The arguments for func
- kwargs (Keyword arguments) – The arguments for func
Returns: Result from the calling function.
- state (
-
-
class
libcloud.common.dimensiondata.
DimensionDataDefaultHealthMonitor
(id, name, node_compatible, pool_compatible)[source]¶ Bases:
object
A default health monitor for a VIP (node, pool or listener)
Initialize an instance of
DimensionDataDefaultHealthMonitor
Parameters: - id (
str
) – The ID of the monitor - name (
str
) – The name of the monitor - node_compatible (
bool
) – Is a monitor capable of monitoring nodes - pool_compatible (
bool
) – Is a monitor capable of monitoring pools
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataDefaultiRule
(id, name, compatible_listeners)[source]¶ Bases:
object
A default iRule for a network domain, can be applied to a listener
Initialize an instance of
DimensionDataDefaultiRule
Parameters: - id (
str
) – The ID of the iRule - name (
str
) – The name of the iRule - compatible_listeners (
list
ofDimensionDataVirtualListenerCompatibility
) – List of compatible Virtual Listener types
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataFirewallAddress
(any_ip, ip_address, ip_prefix_size, port_begin, port_end, address_list_id, port_list_id)[source]¶ Bases:
object
The source or destination model in a firewall rule
-
class
libcloud.common.dimensiondata.
DimensionDataFirewallRule
(id, name, action, location, network_domain, status, ip_version, protocol, source, destination, enabled)[source]¶ Bases:
object
DimensionData Firewall Rule for a network domain
-
class
libcloud.common.dimensiondata.
DimensionDataIpAddress
(begin, end=None, prefix_size=None)[source]¶ Bases:
object
A representation of IP Address in Dimension Data
Initialize an instance of
DimensionDataIpAddress
Parameters: - begin (
str
) – IP Address Begin - end (
str
) – IP Address end - prefixSize (
int
) – IP Address prefix size
- begin (
-
class
libcloud.common.dimensiondata.
DimensionDataIpAddressList
(id, name, description, ip_version, ip_address_collection, state, create_time, child_ip_address_lists=None)[source]¶ Bases:
object
DimensionData IP Address list
” Initialize an instance of
DimensionDataIpAddressList
Parameters: - id (
str
) – GUID of the IP Address List key - name (
str
) – Name of the IP Address List - description (
str
) – Description of the IP Address List - ip_version (
str
) – IP version. E.g. IPV4, IPV6 - ip_address_collection (
List
) – Collection of DimensionDataIpAddress - state (
str
) – IP Address list state - create_time (
date time
) – IP Address List created time - child_ip_address_lists (List) – List of IP address list to be included
of :class:’DimensionDataIpAddressList’
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataNatRule
(id, network_domain, internal_ip, external_ip, status)[source]¶ Bases:
object
An IP NAT rule in a network domain
-
class
libcloud.common.dimensiondata.
DimensionDataNetwork
(id, name, description, location, private_net, multicast, status)[source]¶ Bases:
object
DimensionData network with location.
-
class
libcloud.common.dimensiondata.
DimensionDataNetworkDomain
(id, name, description, location, status, plan)[source]¶ Bases:
object
DimensionData network domain with location.
-
class
libcloud.common.dimensiondata.
DimensionDataNic
(private_ip_v4=None, vlan=None, network_adapter_name=None)[source]¶ Bases:
object
A representation of Network Adapter in Dimension Data
Initialize an instance of
DimensionDataNic
Parameters: - private_ip_v4 (
str
) – IPv4 - vlan (class: DimensionDataVlan or
str
) – Network VLAN - network_adapter_name (
str
) – Network Adapter Name
- private_ip_v4 (
-
class
libcloud.common.dimensiondata.
DimensionDataPersistenceProfile
(id, name, compatible_listeners, fallback_compatible)[source]¶ Bases:
object
Each Persistence Profile declares the combination of Virtual Listener type and protocol with which it is compatible and whether or not it is compatible as a Fallback Persistence Profile.
Initialize an instance of
DimensionDataPersistenceProfile
Parameters: - id (
str
) – The ID of the profile - name (
str
) – The name of the profile - compatible_listeners (
list
ofDimensionDataVirtualListenerCompatibility
) – List of compatible Virtual Listener types - fallback_compatible (
bool
) – Is capable as a fallback profile
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataPool
(id, name, description, status, load_balance_method, health_monitor_id, service_down_action, slow_ramp_time)[source]¶ Bases:
object
DimensionData VIP Pool.
Initialize an instance of
DimensionDataPool
Parameters: - id (
str
) – The ID of the pool - name (
str
) – The name of the pool - description (
str
) – Plan text description of the pool - status (
DimensionDataStatus
) – The status of the pool - load_balance_method (
str
) – The load balancer method - health_monitor_id (
str
) – The ID of the health monitor - service_down_action (
str
) – Action to take when pool is down - slow_ramp_time (
int
) – The ramp-up time for service recovery
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataPoolMember
(id, name, status, ip, port, node_id)[source]¶ Bases:
object
DimensionData VIP Pool Member.
Initialize an instance of
DimensionDataPoolMember
Parameters: - id (
str
) – The ID of the pool member - name (
str
) – The name of the pool member - status (
DimensionDataStatus
) – The status of the pool - ip (
str
) – The IP of the pool member - port (
int
) – The port of the pool member - node_id (
str
) – The ID of the associated node
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataPort
(begin, end=None)[source]¶ Bases:
object
A representation of Port in Dimension Data
Initialize an instance of
DimensionDataPort
Parameters: - begin (
str
) – Port Number Begin - end (
str
) – Port Number end
- begin (
-
class
libcloud.common.dimensiondata.
DimensionDataPortList
(id, name, description, port_collection, child_portlist_list, state, create_time)[source]¶ Bases:
object
DimensionData Port list
” Initialize an instance of
DimensionDataPortList
Parameters: - id (
str
) – GUID of the Port List key - name (
str
) – Name of the Port List - description (
str
) – Description of the Port List - port_collection (
List
) – Collection of DimensionDataPort - child_portlist_list (
List
) – Collection of DimensionDataChildPort - state (
str
) – Port list state - create_time (
date time
) – Port List created time
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataPublicIpBlock
(id, base_ip, size, location, network_domain, status)[source]¶ Bases:
object
DimensionData Public IP Block with location.
-
class
libcloud.common.dimensiondata.
DimensionDataRawResponse
(connection, response=None)[source]¶ Bases:
libcloud.common.base.RawResponse
Parameters: connection ( Connection
) – Parent connection object.
-
class
libcloud.common.dimensiondata.
DimensionDataResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.XmlResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
-
class
libcloud.common.dimensiondata.
DimensionDataServerCpuSpecification
(cpu_count, cores_per_socket, performance)[source]¶ Bases:
object
A class that represents the specification of the CPU(s) for a node
Instantiate a new
DimensionDataServerCpuSpecification
Parameters: - cpu_count (
int
) – The number of CPUs - cores_per_socket (
int
) – The number of cores per socket, the recommendation is 1 - performance (
str
) – The performance type, e.g. HIGHPERFORMANCE
- cpu_count (
-
class
libcloud.common.dimensiondata.
DimensionDataServerDisk
(id=None, scsi_id=None, size_gb=None, speed=None, state=None)[source]¶ Bases:
object
A class that represents the disk on a server
Instantiate a new
DimensionDataServerDisk
Parameters: - id (
str
) – The id of the disk - scsi_id (
int
) – Representation for scsi - size_gb (
int
) – Size of the disk - speed (
str
) – Speed of the disk (i.e. STANDARD) - state (
str
) – State of the disk (i.e. PENDING)
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataServerVMWareTools
(status, version_status, api_version)[source]¶ Bases:
object
A class that represents the VMWareTools for a node
Instantiate a new
DimensionDataServerVMWareTools
objectParameters: - status (
str
) – The status of VMWare Tools - version_status (
str
) – The status for the version of VMWare Tools (i.e NEEDS_UPGRADE) - api_version (
str
) – The API version of VMWare Tools
- status (
-
class
libcloud.common.dimensiondata.
DimensionDataStatus
(action=None, request_time=None, user_name=None, number_of_steps=None, update_time=None, step_name=None, step_number=None, step_percent_complete=None, failure_reason=None)[source]¶ Bases:
object
- DimensionData API pending operation status class
- action, request_time, user_name, number_of_steps, update_time, step.name, step.number, step.percent_complete, failure_reason,
-
class
libcloud.common.dimensiondata.
DimensionDataTag
(asset_type, asset_id, asset_name, datacenter, key, value)[source]¶ Bases:
object
A representation of a Tag in Dimension Data A Tag first must have a Tag Key, then an asset is tag with a key and an option value. Tags can be queried later to filter assets and also show up on usage report if so desired.
Initialize an instance of
DimensionDataTag
Parameters: - asset_type (
str
) – The type of asset. Current asset types: SERVER, VLAN, NETWORK_DOMAIN, CUSTOMER_IMAGE, PUBLIC_IP_BLOCK, ACCOUNT - asset_id (
str
) – The GUID of the asset that is tagged - asset_name (
str
) – The name of the asset that is tagged - datacenter (
str
) – The short datacenter name of the tagged asset - key (
DimensionDataTagKey
) – The tagged key - value (
None
orstr
) – The tagged value
- asset_type (
-
class
libcloud.common.dimensiondata.
DimensionDataTagKey
(id, name, description, value_required, display_on_report)[source]¶ Bases:
object
A representation of a Tag Key in Dimension Data A tag key is required to tag an asset
Initialize an instance of
DimensionDataTagKey
Parameters: - id (
str
) – GUID of the tag key - name (
str
) – Name of the tag key - description (
str
) – Description of the tag key - value_required (
bool
) – If a value is required for this tag key - display_on_report (
bool
) – If this tag key should be displayed on usage reports
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataVIPNode
(id, name, status, ip, connection_limit='10000', connection_rate_limit='10000')[source]¶ Bases:
object
Initialize an instance of
DimensionDataVIPNode
Parameters: - id (
str
) – The ID of the node - name (
str
) – The name of the node - status (
DimensionDataStatus
) – The status of the node - ip (
str
) – The IP of the node - connection_limit (
int
) – The total connection limit for the node - connection_rate_limit (
int
) – The rate limit for the node
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataVirtualListener
(id, name, status, ip)[source]¶ Bases:
object
DimensionData Virtual Listener.
Initialize an instance of
DimensionDataVirtualListener
Parameters: - id (
str
) – The ID of the listener - name (
str
) – The name of the listener - status (
DimensionDataStatus
) – The status of the listener - ip (
str
) – The IP of the listener
- id (
-
class
libcloud.common.dimensiondata.
DimensionDataVirtualListenerCompatibility
(type, protocol)[source]¶ Bases:
object
A compatibility preference for a persistence profile or iRule specifies which virtual listener types this profile or iRule can be applied to.
-
class
libcloud.common.dimensiondata.
DimensionDataVlan
(id, name, description, location, network_domain, status, private_ipv4_range_address, private_ipv4_range_size, ipv6_range_address, ipv6_range_size, ipv4_gateway, ipv6_gateway)[source]¶ Bases:
object
DimensionData VLAN.
Initialize an instance of
DimensionDataVlan
Parameters: - id (
str
) – The ID of the VLAN - name (
str
) – The name of the VLAN - description (
str
) – Plan text description of the VLAN - location (
NodeLocation
) – The location (data center) of the VLAN - network_domain (
DimensionDataNetworkDomain
) – The Network Domain that owns this VLAN - status (
DimensionDataStatus
) – The status of the VLAN - private_ipv4_range_address (
str
) – The host address of the VLAN IP space - private_ipv4_range_size (
int
) – The size (e.g. ‘24’) of the VLAN as a CIDR range size - ipv6_range_address (
str
) – The host address of the VLAN IP space - ipv6_range_size (
int
) – The size (e.g. ‘32’) of the VLAN as a CIDR range size - ipv4_gateway (
str
) – The IPv4 default gateway address - ipv6_gateway (
str
) – The IPv6 default gateway address
- id (
-
class
libcloud.common.dimensiondata.
NetworkDomainServicePlan
[source]¶ Bases:
object
-
ADVANCED
= 'ADVANCED'¶
-
ESSENTIALS
= 'ESSENTIALS'¶
-
-
libcloud.common.dimensiondata.
dd_object_to_id
(obj, obj_type, id_value='id')[source]¶ Takes in a DD object or string and prints out it’s id This is a helper method, as many of our functions can take either an object or a string, and we need an easy way of converting them
Parameters: - obj (
object
) – The object to get the id for - func (
function
) – The function to call, e.g. ex_get_vlan. Note: This function needs to return an object which hasstatus
attribute.
Return type: str
- obj (
libcloud.common.dnsimple module¶
-
class
libcloud.common.dnsimple.
DNSimpleDNSConnection
(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
-
add_default_headers
(headers)[source]¶ Add headers that are necessary for every request
This method adds
token
to the request.
-
host
= 'api.dnsimple.com'¶
-
responseCls
¶ alias of
DNSimpleDNSResponse
-
-
class
libcloud.common.dnsimple.
DNSimpleDNSResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
libcloud.common.dnspod module¶
-
exception
libcloud.common.dnspod.
DNSPodException
(code, message)[source]¶ Bases:
exceptions.Exception
-
class
libcloud.common.dnspod.
DNSPodResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
-
errors
= []¶
-
objects
= []¶
-
-
class
libcloud.common.dnspod.
DNSPodConnection
(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.-
host
= 'api.dnspod.com'¶
-
responseCls
¶ alias of
DNSPodResponse
-
libcloud.common.durabledns module¶
-
class
libcloud.common.durabledns.
DurableConnection
(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
-
host
= 'durabledns.com'¶
-
responseCls
¶ alias of
DurableResponse
-
-
exception
libcloud.common.durabledns.
DurableDNSException
(code, message)[source]¶ Bases:
exceptions.Exception
-
class
libcloud.common.durabledns.
DurableResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.XmlResponse
-
errors
= []¶
-
objects
= []¶
-
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 exceptions.
-
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, proxy_url=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’). - 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.
GoogleAuthType
[source]¶ Bases:
object
SA (Service Account), IA (Installed Application), GCE (Auth from a GCE instance with service account enabled) GCS_S3 (Cloud Storage S3 interoperability authentication)
-
ALL_TYPES
= ['SA', 'IA', 'GCE', 'GCS_S3']¶
-
GCE
= 'GCE'¶
-
GCS_S3
= 'GCS_S3'¶
-
IA
= 'IA'¶
-
OAUTH2_TYPES
= ['SA', 'IA', 'GCE']¶
-
SA
= 'SA'¶
-
-
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
) – See GoogleAuthType class for list and description of accepted values. 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 instance 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.
Mocked in libcloud.test.common.google.GoogleTestCase.
Returns: Code supplied by the user after authenticating Return type: str
- user_id (
-
class
libcloud.common.google.
GoogleOAuth2Credential
(user_id, key, auth_type=None, credential_file=None, scopes=None, **kwargs)[source]¶ Bases:
object
-
access_token
¶
-
default_credential_file
= '~/.google_libcloud_auth'¶
-
token_expire_utc_datetime
¶
-
-
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.liquidweb module¶
-
exception
libcloud.common.liquidweb.
LiquidWebException
(value, http_code, extra=None)[source]¶ Bases:
libcloud.common.types.ProviderError
The base class for other Liquidweb exceptions
Parameters: - value (
str
) – message contained in error - http_code (
int
) – error code - extra (
list
) – extra fields specific to error type
- value (
-
class
libcloud.common.liquidweb.
LiquidWebResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
-
error_dict
= {}¶
-
errors
= None¶
-
objects
= None¶
-
-
class
libcloud.common.liquidweb.
LiquidWebConnection
(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
-
host
= 'api.stormondemand.com'¶
-
responseCls
¶ alias of
LiquidWebResponse
-
libcloud.common.luadns module¶
-
exception
libcloud.common.luadns.
LuadnsException
(code, message)[source]¶ Bases:
exceptions.Exception
-
class
libcloud.common.luadns.
LuadnsResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
-
errors
= []¶
-
objects
= []¶
-
-
class
libcloud.common.luadns.
LuadnsConnection
(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
-
host
= 'api.luadns.com'¶
-
responseCls
¶ alias of
LuadnsResponse
-
libcloud.common.nfsn module¶
-
class
libcloud.common.nfsn.
NFSNConnection
(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
-
allow_insecure
= False¶
-
encode_data
(data)[source]¶ NFSN expects the body to be regular key-value pairs that are not JSON-encoded.
-
host
= 'api.nearlyfreespeech.net'¶
-
request
(action, params=None, data='', headers=None, method='GET')[source]¶ Add the X-NFSN-Authentication header to an HTTP request.
-
responseCls
¶ alias of
NFSNResponse
-
-
class
libcloud.common.nfsn.
NFSNResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
libcloud.common.nsone module¶
-
exception
libcloud.common.nsone.
NsOneException
(code, message)[source]¶ Bases:
exceptions.Exception
-
class
libcloud.common.nsone.
NsOneResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
-
errors
= []¶
-
objects
= []¶
-
-
class
libcloud.common.nsone.
NsOneConnection
(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.-
host
= 'api.nsone.net'¶
-
responseCls
¶ alias of
NsOneResponse
-
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
Parameters: headers ( dict
) – Default input headersReturn type: dict
Returns: 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, proxy_url=None, ex_force_base_url=None, ex_force_auth_url=None, ex_force_auth_version=None, ex_force_auth_token=None, ex_token_scope='project', ex_domain_name='Default', 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 (
str
) – Base URL for connection requests. If not specified, this will be determined by authenticating. - ex_force_auth_url (
str
) – Base URL for authentication requests. - ex_force_auth_version (
str
) – Authentication version to use. If not specified, defaults to AUTH_API_VERSION. - ex_force_auth_token (
str
) – 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. - token_scope (
str
) – Whether to scope a token to a “project”, a “domain” or “unscoped”. - ex_domain_name (
str
) – When authenticating, provide this domain name to the identity service. A scoped token will be returned. Some cloud providers require the domain name to be provided at authentication time. Others will use a default domain if none is provided. - ex_tenant_name (
str
) – 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. - ex_force_service_type (
str
) – Service type to use when selecting an service. If not specified, a provider specific default will be used. - ex_force_service_name (
str
) – Service name to use when selecting an service. If not specified, a provider specific default will be used. - ex_force_service_region (
str
) – Region to use when selecting an service. If not specified, a provider specific default will be used.
-
accept_format
= None¶
-
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
-
get_service_name
()[source]¶ Gets the service name used to look up the endpoint in the service catalog.
Returns: name of the service in the catalog
-
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 (
-
class
libcloud.common.openstack.
OpenStackDriverMixin
(ex_force_base_url=None, ex_force_auth_url=None, ex_force_auth_version=None, ex_force_auth_token=None, ex_token_scope='project', ex_domain_name='Default', ex_tenant_name=None, ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None, *args, **kwargs)[source]¶ Bases:
object
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 instantiated 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, domain_name='Default', token_scope='project', 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.
-
auth_version
= None¶
-
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, domain_name='Default', token_scope='project', 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, domain_name='Default', token_scope='project', 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, domain_name='Default', token_scope='project', 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_2_0_Connection_VOMS
(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
,libcloud.common.base.CertificateConnection
Connection class for Keystone API v2.0. with VOMS proxy support In this case the key parameter will be the path of the VOMS proxy file.
-
auth_version
= '2.0'¶
-
name
= 'OpenStack Identity API v2.0 VOMS support'¶
-
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”, a “domain” or “unscoped”
-
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.Return type: OpenStackIdentityDomain
-
grant_domain_role_to_user
(domain, role, user)[source]¶ Grant domain role to a user.
Note: This function appears to be idempotent.
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 appears to be idempotent.
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 (
-
class
libcloud.common.openstack_identity.
OpenStackIdentity_3_0_Connection_OIDC_access_token
(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.OpenStackIdentity_3_0_Connection
Connection class for Keystone API v3.x. using OpenID Connect tokens
The OIDC token must be set in the self.key attribute.
The identity provider name required to get the full path must be set in the self.user_id attribute.
The protocol name required to get the full path must be set in the self.tenant_name attribute.
The user must be scoped to the first project accessible with the specified access token (usually there are only one)
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”, a “domain” or “unscoped”
-
auth_version
= '3.0'¶
-
name
= 'OpenStack Identity API v3.x with OIDC support'¶
-
responseCls
¶ alias of
OpenStackAuthResponse
- tenant_name (
libcloud.common.ovh module¶
-
class
libcloud.common.ovh.
OvhResponse
(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.ovh.
OvhConnection
(user_id, *args, **kwargs)[source]¶ Bases:
libcloud.common.base.ConnectionUserAndKey
A connection to the Ovh API
Wraps SSL connections to the Ovh API, automagically injecting the parameters that the API needs for each request.
-
LOCATIONS
= {'GRA1': {'country': 'FR', 'id': 'GRA1', 'name': 'Gravelines 1'}, 'BHS1': {'country': 'CA', 'id': 'BHS1', 'name': 'Montreal 1'}, 'SBG1': {'country': 'FR', 'id': 'SBG1', 'name': 'Strasbourg 1'}}¶
-
allow_insecure
= True¶
-
host
= 'api.ovh.com'¶
-
request_path
= '/1.0'¶
-
responseCls
¶ alias of
OvhResponse
-
timestamp
= None¶
-
ua
= []¶
-
libcloud.common.pointdns module¶
-
class
libcloud.common.pointdns.
PointDNSConnection
(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
-
add_default_headers
(headers)[source]¶ Add headers that are necessary for every request
This method adds
token
to the request.
-
host
= 'pointhq.com'¶
-
responseCls
¶ alias of
PointDNSDNSResponse
-
-
class
libcloud.common.pointdns.
PointDNSDNSResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
libcloud.common.providers module¶
Common methods for obtaining a reference to the provider driver class.
-
libcloud.common.providers.
get_driver
(drivers, provider, deprecated_providers=None, deprecated_constants=None)[source]¶ Get a driver.
Parameters: - drivers (
dict
) – Dictionary containing valid providers. - provider (
libcloud.types.Provider
) – Id (constant) of provider to get the driver for.
Param: deprecated_providers: Dictionary with information about the deprecated drivers.
Param: deprecated_constants: Dictionary with information about the deprecated provider constants.
- drivers (
libcloud.common.rackspace module¶
Common settings for Rackspace Cloud Servers and Cloud Files
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.vultr module¶
-
class
libcloud.common.vultr.
VultrConnection
(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 Vultr API
Initialize user_id and key; set secure to an
int
based on passed value.-
add_default_headers
(headers)[source]¶ Returns default headers such as content-type. Returns a dictionary.
-
add_default_params
(params)[source]¶ Returns default params such as api_key which is needed to perform an action.Returns a dictionary. Example:/v1/server/upgrade_plan?api_key=self.key
-
host
= 'api.vultr.com'¶
-
responseCls
¶ alias of
VultrResponse
-
-
exception
libcloud.common.vultr.
VultrException
(code, message)[source]¶ Bases:
exceptions.Exception
Error originating from the Vultr API
-
class
libcloud.common.vultr.
VultrResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.JsonResponse
-
ERROR_CODE_MAP
= {400: 'Invalid API location. Check the URL that you are using.', 403: 'Invalid or missing API key. Check that your API key is present and matches your assigned key.', 500: 'Internal server error. Try again at a later time.', 405: 'Invalid HTTP method. Check that the method (POST|GET) matches what the documentation indicates.', 503: 'Rate limit hit. API requests are limited to an average of 1/s. Try your request again later.', 412: 'Request failed. Check the response body for a more detailed description.'}¶
-
error_dict
= {}¶
-
errors
= None¶
-
objects
= None¶
-
libcloud.common.worldwidedns module¶
-
exception
libcloud.common.worldwidedns.
ErrorOnReloadInNameServer
(server, http_code, driver=None)[source]¶
-
class
libcloud.common.worldwidedns.
WorldWideDNSConnection
(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
-
add_default_params
(params)[source]¶ Add parameters that are necessary for every request
This method adds
NAME
andPASSWORD
to the request.
-
host
= 'www.worldwidedns.net'¶
-
responseCls
¶ alias of
WorldWideDNSResponse
-
-
exception
libcloud.common.worldwidedns.
WorldWideDNSException
(value, http_code, code, driver=None)[source]¶
-
class
libcloud.common.worldwidedns.
WorldWideDNSResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.Response
Parameters: - response (
httplib.HTTPResponse
) – HTTP response object. (optional) - connection (
Connection
) – Parent connection object.
- response (
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.
-
endpoint
= None¶
-
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 (
libcloud.common.zonomi module¶
-
exception
libcloud.common.zonomi.
ZonomiException
(code, message)[source]¶ Bases:
exceptions.Exception
-
class
libcloud.common.zonomi.
ZonomiResponse
(response, connection)[source]¶ Bases:
libcloud.common.base.XmlResponse
-
errors
= None¶
-
objects
= None¶
-
-
class
libcloud.common.zonomi.
ZonomiConnection
(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.-
add_default_headers
(headers)[source]¶ Adds default headers needed to perform a successful request such as Content-Type, User-Agent.
-
host
= 'zonomi.com'¶
-
responseCls
¶ alias of
ZonomiResponse
-