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:
ConnectionUserAndKey
,PollingConnection
A Connection to Abiquo API.
Basic
ConnectionUserAndKey
connection withPollingConnection
features for asynchronous tasks.Initialize user_id and key; set secure to an
int
based on passed value.- 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 headers- Return 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
- has_completed(response)[source]¶
Decide if the asynchronous job has ended.
- Parameters:
response (
xml.etree.ElementTree
) – Response object returned by poll request- Return type:
bool
- Returns:
Whether the job has completed
- responseCls¶
alias of
AbiquoResponse
- class libcloud.common.abiquo.AbiquoResponse(response, connection)[source]¶
Bases:
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 = {'ALLOCATED': NodeState.PENDING, 'CONFIGURED': NodeState.PENDING, 'LOCKED': NodeState.PENDING, 'NOT_ALLOCATED': NodeState.TERMINATED, 'OFF': NodeState.PENDING, 'ON': NodeState.RUNNING, 'PAUSED': NodeState.PENDING, 'UNKNOWN': NodeState.UNKNOWN}¶
- 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
- exception libcloud.common.abiquo.ForbiddenError(driver)[source]¶
Bases:
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
libcloud.common.aliyun module¶
- class libcloud.common.aliyun.AliyunConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶
Bases:
ConnectionUserAndKey
Initialize user_id and key; set secure to an
int
based on passed value.
- 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.
- class libcloud.common.aliyun.AliyunRequestSignerAlgorithmV1_0(access_key, access_secret, version)[source]¶
Bases:
AliyunRequestSigner
Aliyun request signer using signature version 1.0.
- Parameters:
access_key (
str
) – Access key.access_secret (
str
) – Access secret.version (
str
) – API version.
- class libcloud.common.aliyun.AliyunXmlResponse(response, connection)[source]¶
Bases:
XmlResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- namespace = None¶
- 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:
AliyunConnection
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_params(params)[source]¶
Adds default parameters (such as API key, version, etc.) to the passed params
Should return a dictionary.
- api_version = None¶
libcloud.common.aws module¶
- class libcloud.common.aws.AWSBaseResponse(response, connection)[source]¶
Bases:
XmlResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- namespace = None¶
- class libcloud.common.aws.AWSDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, token=None, **kwargs)[source]¶
Bases:
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
- class libcloud.common.aws.AWSGenericResponse(response, connection)[source]¶
Bases:
AWSBaseResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- parse_error()[source]¶
Parse the error messages.
Override in a provider’s subclass.
- Returns:
Parsed error.
- Return type:
str
- success()[source]¶
Determine if our request was successful.
The meaning of this can be arbitrary; did we receive OK status? Did the node get created? Were we authenticated?
- Return type:
bool
- Returns:
True
orFalse
- xpath = None¶
- class libcloud.common.aws.AWSRequestSignerAlgorithmV2(access_key, access_secret, version, connection)[source]¶
Bases:
AWSRequestSigner
- Parameters:
access_key (
str
) – Access key.access_secret (
str
) – Access secret.version (
str
) – API version.connection (
Connection
) – Connection instance.
- class libcloud.common.aws.AWSRequestSignerAlgorithmV4(access_key, access_secret, version, connection)[source]¶
Bases:
AWSRequestSigner
- Parameters:
access_key (
str
) – Access key.access_secret (
str
) – Access secret.version (
str
) – API version.connection (
Connection
) – Connection instance.
- 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]¶
Bases:
ConnectionUserAndKey
Initialize user_id and key; set secure to an
int
based on passed value.
- 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:
AWSTokenConnection
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_params(params)[source]¶
Adds default parameters (such as API key, version, etc.) to the passed params
Should return a dictionary.
libcloud.common.azure module¶
- class libcloud.common.azure.AzureActiveDirectoryConnection(key, secret, secure=True, host=None, port=None, tenant_id=None, identity=None, cloud_environment='default', **kwargs)[source]¶
Bases:
ConnectionUserAndKey
Represents a single connection to Azure using Azure AD for Blob
Initialize user_id and key; set secure to an
int
based on passed value.- API_VERSION = '2017-11-09'¶
- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- conn_class¶
alias of
LibcloudConnection
- connect(**kwargs)[source]¶
Establish a connection with the API server.
- Parameters:
host (
str
) – Optional host to override our defaultport (
int
) – Optional port to override our default
- Returns:
A connection
- driver¶
alias of
AzureBaseDriver
- name = 'Azure AD Auth'¶
- rawResponseCls¶
alias of
AzureRawResponse
- request(action, params=None, data=None, headers=None, method='GET', raw=False, stream=False, json=None, retry_failed=None, *kwargs)[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)retry_failed – True if failed requests should be retried. This argument can override module level constant and environment variable value on per-request basis.
- Returns:
An
Response
instance.- Return type:
Response
instance
- responseCls¶
alias of
AzureResponse
- class libcloud.common.azure.AzureBaseDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]¶
Bases:
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 = '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:
ConnectionUserAndKey
Represents a single connection to Azure
Initialize user_id and key; set secure to an
int
based on passed value.- API_VERSION = '2012-02-12'¶
- add_default_params(params)[source]¶
Adds default parameters (such as API key, version, etc.) to the passed params
Should return a dictionary.
- 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.
- rawResponseCls¶
alias of
AzureRawResponse
- responseCls¶
alias of
AzureResponse
- class libcloud.common.azure.AzureRawResponse(connection, response=None)[source]¶
Bases:
RawResponse
- Parameters:
connection (
Connection
) – Parent connection object.
- class libcloud.common.azure.AzureResponse(response, connection)[source]¶
Bases:
XmlResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- parse_body()[source]¶
Parse response body.
Override in a provider’s subclass.
- Returns:
Parsed body.
- Return type:
str
- parse_error(msg=None)[source]¶
Parse the error messages.
Override in a provider’s subclass.
- Returns:
Parsed error.
- Return type:
str
- success()[source]¶
Determine if our request was successful.
The meaning of this can be arbitrary; did we receive OK status? Did the node get created? Were we authenticated?
- Return type:
bool
- Returns:
True
orFalse
- valid_response_codes = [<HTTPStatus.NOT_FOUND: 404>, <HTTPStatus.CONFLICT: 409>, <HTTPStatus.BAD_REQUEST: 400>, <HTTPStatus.TEMPORARY_REDIRECT: 307>, <HTTPStatus.PARTIAL_CONTENT: 206>]¶
- class libcloud.common.azure.AzureServiceManagementConnection(subscription_id, key_file, *args, **kwargs)[source]¶
Bases:
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
- keyfile = ''¶
- name = 'Azure Service Management API Connection'¶
- rawResponseCls¶
alias of
AzureRawResponse
- responseCls¶
alias of
AzureResponse
libcloud.common.azure_arm module¶
- class libcloud.common.azure_arm.AzureAuthJsonResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- class libcloud.common.azure_arm.AzureBaseDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]¶
Bases:
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 = 'Microsoft Azure Resource Management API'¶
- class libcloud.common.azure_arm.AzureJsonResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- class libcloud.common.azure_arm.AzureResourceManagementConnection(key, secret, secure=True, tenant_id=None, subscription_id=None, cloud_environment=None, **kwargs)[source]¶
Bases:
ConnectionUserAndKey
Represents a single connection to Azure
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- conn_class¶
alias of
LibcloudConnection
- connect(**kwargs)[source]¶
Establish a connection with the API server.
- Parameters:
host (
str
) – Optional host to override our defaultport (
int
) – Optional port to override our default
- Returns:
A connection
- driver¶
alias of
AzureBaseDriver
- name = 'Azure AD Auth'¶
- 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.stream (
bool
) – True to return an iterator in Response.iter_content and allow streaming of the response data (for downloading large files)retry_failed – True if failed requests should be retried. This argument can override module level constant and environment variable value on per-request basis.
- Returns:
An
Response
instance.- Return type:
Response
instance
- 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
- 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:
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.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 defaultport (
int
) – Optional port to override our default
- Returns:
A connection
- connection = None¶
- driver: Type[BaseDriver] = None¶
- morph_action_hook(action)[source]¶
Here we strip any duplicated leading or traling slashes to prevent typos and other issues where some APIs don’t correctly handle double slashes.
Keep in mind that in some situations, “/” is a vallid path name so we have a module flag which disables this behavior (https://github.com/apache/libcloud/issues/1529).
- 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.
- rawResponseCls¶
alias of
RawResponse
- request(action, params=None, data=None, headers=None, method='GET', raw=False, stream=False, json=None, retry_failed=None)[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)retry_failed – True if failed requests should be retried. This argument can override module level constant and environment variable value on per-request basis.
- Returns:
An
Response
instance.- Return type:
Response
instance
- retry_delay = None¶
- secure = 1¶
- 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:
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:
ConnectionKey
Base connection class which accepts a
user_id
andkey
argument.Initialize user_id and key; set secure to an
int
based on passed value.
- class libcloud.common.base.HTTPResponse(sock, debuglevel=0, method=None, url=None)[source]¶
Bases:
HTTPResponse
- read(amt=None)[source]¶
Read and return up to n bytes.
If the argument is omitted, None, or negative, reads and returns all data until EOF.
If the argument is positive, and the underlying raw stream is not ‘interactive’, multiple raw reads may be issued to satisfy the byte count (unless EOF is reached first). But for interactive raw streams (as well as sockets and pipes), at most one raw read will be issued, and a short result does not imply that EOF is imminent.
Returns an empty bytes object on EOF.
Returns None if the underlying raw stream was open in non-blocking mode and no data is available at the moment.
- class libcloud.common.base.JsonResponse(response, connection)[source]¶
Bases:
Response
A Base JSON Response class to derive from.
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- parse_body()[source]¶
Parse response body.
Override in a provider’s subclass.
- Returns:
Parsed body.
- Return type:
str
- parse_error()¶
Parse the error messages.
Override in a provider’s subclass.
- Returns:
Parsed error.
- Return type:
str
- 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:
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 pathparams (
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
- 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'¶
- class libcloud.common.base.RawResponse(connection, response=None)[source]¶
Bases:
Response
- Parameters:
connection (
Connection
) – Parent connection object.
- property body¶
- property reason¶
- property response¶
- 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¶
- 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¶
- class libcloud.common.base.XmlResponse(response, connection)[source]¶
Bases:
Response
A Base XML Response class to derive from.
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- parse_body()[source]¶
Parse response body.
Override in a provider’s subclass.
- Returns:
Parsed body.
- Return type:
str
- parse_error()¶
Parse the error messages.
Override in a provider’s subclass.
- Returns:
Parsed error.
- Return type:
str
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:
ConnectionUserAndKey
Connection class for the Brightbox driver
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- responseCls¶
alias of
BrightboxResponse
- class libcloud.common.brightbox.BrightboxResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- parse_body()[source]¶
Parse response body.
Override in a provider’s subclass.
- Returns:
Parsed body.
- Return type:
str
libcloud.common.buddyns module¶
- 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:
ConnectionKey
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- responseCls¶
alias of
BuddyNSResponse
- class libcloud.common.buddyns.BuddyNSResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
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:
ConnectionUserAndKey
,PollingConnection
Initialize user_id and key; set secure to an
int
based on passed value.- ASYNC_FAILURE = 2¶
- ASYNC_PENDING = 0¶
- ASYNC_SUCCESS = 1¶
- add_default_params(params)[source]¶
Adds default parameters (such as API key, version, etc.) to the passed params
Should return a dictionary.
- 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.
- 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
- get_request_kwargs(action, params=None, data='', 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 = 1¶
- 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.
- request_method = '_sync_request'¶
- responseCls¶
alias of
CloudStackResponse
- 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:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
libcloud.common.digitalocean module¶
Common settings and connection objects for DigitalOcean Cloud
- class libcloud.common.digitalocean.DigitalOceanBaseDriver(key, secret=None, api_version='v2', **kwargs)[source]¶
Bases:
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'¶
- 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:
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.
- responseCls¶
alias of
DigitalOcean_v2_Response
- class libcloud.common.digitalocean.DigitalOcean_v2_Response(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- parse_error()[source]¶
Parse the error messages.
Override in a provider’s subclass.
- Returns:
Parsed error.
- Return type:
str
- success()[source]¶
Determine if our request was successful.
The meaning of this can be arbitrary; did we receive OK status? Did the node get created? Were we authenticated?
- Return type:
bool
- Returns:
True
orFalse
- valid_response_codes = [<HTTPStatus.OK: 200>, <HTTPStatus.ACCEPTED: 202>, <HTTPStatus.CREATED: 201>, <HTTPStatus.NO_CONTENT: 204>]¶
libcloud.common.dimensiondata module¶
Dimension Data Common Components
- exception libcloud.common.dimensiondata.DimensionDataAPIException(code, msg, driver)[source]¶
Bases:
LibcloudError
- 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 rulenode_list (
list
ofstr
) – List of node ids that belong in this rule
- 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 clienttype (
DimensionDataBackupClientType
) – The type of client that this client isstatus (
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 detailsstorage_policy (
str
) – The storage policy for this client NOTE: Dimension Data only sends back the name of the storage policy, no further detailsdownload_url (
str
) – The download url for this clientalert (
DimensionDataBackupClientRunningJob
) – The alert configured for this backup client (optional)alert – The running job for the client (optional)
- 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_FAILUREnotify_list (
list
ofstr
) – List of email addresses that are notified when the alert is fired
- 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 jobstatus (
str
) – The status of the job i.e. Waitingpercentage (
int
) – The percentage completion of the job
- 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 iRuledescription (
str
) – Description of the client
- 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 backupsservice_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
- 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 - 6AMdescription (
str
) – Short summary of the details of the policy
- 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 Policyretention_period (
int
) – How long to keep the backup in dayssecondary_location (
str
) – The secondary location i.e. Primary
- 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 keyname (
str
) – Name of the IP Address List
- 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 keyname (
str
) – Name of the child port List
- 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:
ConnectionUserAndKey
Connection class for the DimensionData driver
Initialize user_id and key; set secure to an
int
based on passed value.- active_api_version = '2.4'¶
- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- allow_insecure = False¶
- api_path_version_1 = '/oec'¶
- api_path_version_2 = '/caas'¶
- api_version_1 = 0.9¶
- 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 actiondata (
str
) – The data payload to be added to the requestheaders (
str
ordict
orNone
) – Additional header to be added to the requestmethod (
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
- 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 statesfunc (
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.
- 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 monitorname (
str
) – The name of the monitornode_compatible (
bool
) – Is a monitor capable of monitoring nodespool_compatible (
bool
) – Is a monitor capable of monitoring pools
- 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 iRulename (
str
) – The name of the iRulecompatible_listeners (
list
ofDimensionDataVirtualListenerCompatibility
) – List of compatible Virtual Listener types
- 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 Beginend (
str
) – IP Address endprefixSize (
int
) – IP Address prefix size
- 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 keyname (
str
) – Name of the IP Address Listdescription (
str
) – Description of the IP Address Listip_version (
str
) – IP version. E.g. IPV4, IPV6ip_address_collection (
List
) – Collection of DimensionDataIpAddressstate (
str
) – IP Address list statecreate_time (
date time
) – IP Address List created timechild_ip_address_lists (List of :class:'DimensionDataIpAddressList') – List of IP address list to be included
- 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
) – IPv4vlan (class: DimensionDataVlan or
str
) – Network VLANnetwork_adapter_name (
str
) – Network Adapter Name
- 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 profilename (
str
) – The name of the profilecompatible_listeners (
list
ofDimensionDataVirtualListenerCompatibility
) – List of compatible Virtual Listener typesfallback_compatible (
bool
) – Is capable as a fallback profile
- 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 poolname (
str
) – The name of the pooldescription (
str
) – Plan text description of the poolstatus (
DimensionDataStatus
) – The status of the poolload_balance_method (
str
) – The load balancer methodhealth_monitor_id (
str
) – The ID of the health monitorservice_down_action (
str
) – Action to take when pool is downslow_ramp_time (
int
) – The ramp-up time for service recovery
- 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 membername (
str
) – The name of the pool memberstatus (
DimensionDataStatus
) – The status of the poolip (
str
) – The IP of the pool memberport (
int
) – The port of the pool membernode_id (
str
) – The ID of the associated node
- 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 Beginend (
str
) – Port Number end
- 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 keyname (
str
) – Name of the Port Listdescription (
str
) – Description of the Port Listport_collection (
List
) – Collection of DimensionDataPortchild_portlist_list (
List
) – Collection of DimensionDataChildPortstate (
str
) – Port list statecreate_time (
date time
) – Port List created time
- 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:
RawResponse
- Parameters:
connection (
Connection
) – Parent connection object.
- class libcloud.common.dimensiondata.DimensionDataResponse(response, connection)[source]¶
Bases:
XmlResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- 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 CPUscores_per_socket (
int
) – The number of cores per socket, the recommendation is 1performance (
str
) – The performance type, e.g. HIGHPERFORMANCE
- 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 diskscsi_id (
int
) – Representation for scsisize_gb (
int
) – Size of the diskspeed (
str
) – Speed of the disk (i.e. STANDARD)state (
str
) – State of the disk (i.e. PENDING)
- 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
object- Parameters:
status (
str
) – The status of VMWare Toolsversion_status (
str
) – The status for the version of VMWare Tools (i.e NEEDS_UPGRADE)api_version (
str
) – The API version of VMWare Tools
- 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, ACCOUNTasset_id (
str
) – The GUID of the asset that is taggedasset_name (
str
) – The name of the asset that is taggeddatacenter (
str
) – The short datacenter name of the tagged assetkey (
DimensionDataTagKey
) – The tagged keyvalue (
None
orstr
) – The tagged value
- 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 keyname (
str
) – Name of the tag keydescription (
str
) – Description of the tag keyvalue_required (
bool
) – If a value is required for this tag keydisplay_on_report (
bool
) – If this tag key should be displayed on usage reports
- 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 nodename (
str
) – The name of the nodestatus (
DimensionDataStatus
) – The status of the nodeip (
str
) – The IP of the nodeconnection_limit (
int
) – The total connection limit for the nodeconnection_rate_limit (
int
) – The rate limit for the node
- 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 listenername (
str
) – The name of the listenerstatus (
DimensionDataStatus
) – The status of the listenerip (
str
) – The IP of the listener
- 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 VLANname (
str
) – The name of the VLANdescription (
str
) – Plan text description of the VLANlocation (
NodeLocation
) – The location (data center) of the VLANnetwork_domain (
DimensionDataNetworkDomain
) – The Network Domain that owns this VLANstatus (
DimensionDataStatus
) – The status of the VLANprivate_ipv4_range_address (
str
) – The host address of the VLAN IP spaceprivate_ipv4_range_size (
int
) – The size (e.g. ‘24’) of the VLAN as a CIDR range sizeipv6_range_address (
str
) – The host address of the VLAN IP spaceipv6_range_size (
int
) – The size (e.g. ‘32’) of the VLAN as a CIDR range sizeipv4_gateway (
str
) – The IPv4 default gateway addressipv6_gateway (
str
) – The IPv6 default gateway address
- 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 forfunc (
function
) – The function to call, e.g. ex_get_vlan. Note: This function needs to return an object which hasstatus
attribute.
- Return type:
str
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:
ConnectionUserAndKey
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.
- responseCls¶
alias of
DNSimpleDNSResponse
- class libcloud.common.dnsimple.DNSimpleDNSResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
libcloud.common.dnspod module¶
- 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:
ConnectionKey
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- responseCls¶
alias of
DNSPodResponse
- class libcloud.common.dnspod.DNSPodResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
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:
ConnectionUserAndKey
Initialize user_id and key; set secure to an
int
based on passed value.- 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.
- responseCls¶
alias of
DurableResponse
- class libcloud.common.durabledns.DurableResponse(response, connection)[source]¶
Bases:
XmlResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
libcloud.common.exceptions module¶
- exception libcloud.common.exceptions.BaseHTTPError(code, message, headers=None)[source]¶
Bases:
Exception
The base exception class for all HTTP related exceptions.
- exception libcloud.common.exceptions.RateLimitReachedError(*args, **kwargs)[source]¶
Bases:
BaseHTTPError
HTTP 429 - Rate limit: you’ve sent too many requests for this time period.
- code = 429¶
- message = '429 Rate limit exceeded'¶
- libcloud.common.exceptions.exception_from_message(code, message, headers=None)[source]¶
Return an instance of BaseHTTPException or subclass based on response code.
If headers include Retry-After, RFC 2616 says that its value may be one of two formats: HTTP-date or delta-seconds, for example:
Retry-After: Fri, 31 Dec 1999 23:59:59 GMT Retry-After: 120
If Retry-After comes in HTTP-date, it’ll be translated to a positive delta-seconds value when passing it to the exception constructor.
Also, RFC 2616 says that Retry-After isn’t just only applicable to 429 HTTP status, but also to other responses, like 503 and 3xx.
- Usage::
- raise exception_from_message(code=self.status,
message=self.parse_error(), headers=self.headers)
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:
BaseObject
Gandi disk component
- class libcloud.common.gandi.GandiConnection(key, secure=True, timeout=None, retry_delay=None, backoff=None, proxy_url=None)[source]¶
Bases:
XMLRPCConnection
,ConnectionKey
Connection class for the Gandi driver
Initialize user_id and key; set secure to an
int
based on passed value.- request(method, *args)[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.
- responseCls¶
alias of
GandiResponse
- exception libcloud.common.gandi.GandiException[source]¶
Bases:
Exception
Exception class for Gandi driver
- class libcloud.common.gandi.GandiResponse(response, connection)[source]¶
Bases:
XMLRPCResponse
A Base Gandi Response class to derive from.
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- class libcloud.common.gandi.IPAddress(id, state, inet, driver, version=4, extra=None)[source]¶
Bases:
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:
BaseObject
Provide a common interface for network interfaces
- uuid_prefix = 'if:'¶
libcloud.common.gandi_live module¶
Gandi Live driver base classes
- class libcloud.common.gandi_live.BaseGandiLiveDriver[source]¶
Bases:
object
Gandi Live base driver
- connectionCls¶
alias of
GandiLiveConnection
- name = 'GandiLive'¶
- exception libcloud.common.gandi_live.GandiLiveBaseError(value: str, http_code: int, driver: BaseDriver | None = None)[source]¶
Bases:
ProviderError
Exception class for Gandi Live driver
- class libcloud.common.gandi_live.GandiLiveConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶
Bases:
ConnectionKey
Connection class for the Gandi Live driver
Initialize user_id and key; set secure to an
int
based on passed value.- responseCls¶
alias of
GandiLiveResponse
- class libcloud.common.gandi_live.GandiLiveResponse(response, connection)[source]¶
Bases:
JsonResponse
A Base Gandi Live Response class to derive from.
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- exception libcloud.common.gandi_live.InvalidRequestError(value: str, http_code: int, driver: BaseDriver | None = None)[source]¶
Bases:
GandiLiveBaseError
- exception libcloud.common.gandi_live.JsonParseError(value: str, http_code: int, driver: BaseDriver | None = None)[source]¶
Bases:
GandiLiveBaseError
- exception libcloud.common.gandi_live.ResourceConflictError(value: str, http_code: int, driver: BaseDriver | None = None)[source]¶
Bases:
GandiLiveBaseError
- exception libcloud.common.gandi_live.ResourceNotFoundError(value: str, http_code: int, driver: BaseDriver | None = None)[source]¶
Bases:
GandiLiveBaseError
libcloud.common.gig_g8 module¶
- class libcloud.common.gig_g8.G8Connection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶
Bases:
ConnectionKey
Connection class for G8
Initialize user_id and key; set secure to an
int
based on passed value.- responseCls¶
alias of
JsonResponse
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 cryptography 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:
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='http://127.0.0.1', login_hint=None, **kwargs)[source]¶
Bases:
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
- name = 'Google Auth'¶
- redirect_uri_port = 8087¶
- 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
- class libcloud.common.google.GoogleBaseConnection(user_id, key=None, auth_type=None, credential_file=None, scopes=None, **kwargs)[source]¶
Bases:
ConnectionUserAndKey
,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
- 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 request- Returns:
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
- class libcloud.common.google.GoogleBaseDriver(key, secret=None, secure=True, host=None, port=None, api_version=None, region=None, **kwargs)[source]¶
Bases:
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 = 'Google API'¶
- exception libcloud.common.google.GoogleBaseError(value, http_code, code, driver=None)[source]¶
Bases:
ProviderError
- class libcloud.common.google.GoogleGCEServiceAcctAuthConnection(user_id, key=None, scopes=None, redirect_uri='http://127.0.0.1', login_hint=None, **kwargs)[source]¶
Bases:
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.
- class libcloud.common.google.GoogleInstalledAppAuthConnection(user_id, key=None, scopes=None, redirect_uri='http://127.0.0.1', login_hint=None, **kwargs)[source]¶
Bases:
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.
Mocked in libcloud.test.common.google.GoogleTestCase.
- Returns:
Code supplied by the user after authenticating
- Return type:
str
- class libcloud.common.google.GoogleOAuth2Credential(user_id, key, auth_type=None, credential_file=None, scopes=None, **kwargs)[source]¶
Bases:
object
- property access_token¶
- default_credential_file = '~/.google_libcloud_auth'¶
- property token_expire_utc_datetime¶
- class libcloud.common.google.GoogleResponse(response, connection)[source]¶
Bases:
JsonResponse
Google Base Response class.
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- class libcloud.common.google.GoogleServiceAcctAuthConnection(user_id, key, *args, **kwargs)[source]¶
Bases:
GoogleBaseAuthConnection
Authentication class for “Service Account” authentication.
Check to see if cryptography is available, and convert PEM key file into a key string, or extract the key from JSON object, string or file.
- Parameters:
user_id (
str
) – Email address to be used for Service Account authentication.key – The path to a PEM/JSON file containing the private RSA
key, or a str/dict containing the PEM/JSON. :type key:
str
ordict
- exception libcloud.common.google.InvalidRequestError(value, http_code, code, driver=None)[source]¶
Bases:
GoogleBaseError
- exception libcloud.common.google.JsonParseError(value, http_code, code, driver=None)[source]¶
Bases:
GoogleBaseError
- exception libcloud.common.google.QuotaExceededError(value, http_code, code, driver=None)[source]¶
Bases:
GoogleBaseError
- exception libcloud.common.google.ResourceExistsError(value, http_code, code, driver=None)[source]¶
Bases:
GoogleBaseError
- exception libcloud.common.google.ResourceInUseError(value, http_code, code, driver=None)[source]¶
Bases:
GoogleBaseError
- exception libcloud.common.google.ResourceNotFoundError(value, http_code, code, driver=None)[source]¶
Bases:
GoogleBaseError
libcloud.common.gridscale module¶
Common settings and connection objects for gridscale
- class libcloud.common.gridscale.GridscaleBaseDriver(user_id, key, **kwargs)[source]¶
Bases:
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
- connectionCls¶
alias of
GridscaleConnection
- name = 'gridscale'¶
- website = 'https://gridscale.io'¶
- class libcloud.common.gridscale.GridscaleConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶
Bases:
ConnectionUserAndKey
,PollingConnection
gridscale connection class Authentication using uuid and api token
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
add parameters that are necessary for each request to be successful
- Parameters:
headers (
str
) – Authentification token- Returns:
None
- async_request(*poargs, **kwargs)[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 pathparams (
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
- 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.
- responseCls¶
alias of
GridscaleResponse
- class libcloud.common.gridscale.GridscaleResponse(response, connection)[source]¶
Bases:
JsonResponse
Gridscale API Response
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- parse_error()[source]¶
Parse the error messages.
Override in a provider’s subclass.
- Returns:
Parsed error.
- Return type:
str
- success()[source]¶
Determine if our request was successful.
The meaning of this can be arbitrary; did we receive OK status? Did the node get created? Were we authenticated?
- Return type:
bool
- Returns:
True
orFalse
- valid_response_codes = [<HTTPStatus.OK: 200>, <HTTPStatus.ACCEPTED: 202>, <HTTPStatus.NO_CONTENT: 204>]¶
libcloud.common.kubernetes module¶
Module which contains common Kubernetes related code.
- class libcloud.common.kubernetes.KubernetesBasicAuthConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶
Bases:
ConnectionUserAndKey
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Add parameters that are necessary for every request If user and password are specified, include a base http auth header
- responseCls¶
alias of
KubernetesResponse
- class libcloud.common.kubernetes.KubernetesDriverMixin(key=None, secret=None, secure=False, host='localhost', port=4243, key_file=None, cert_file=None, ca_cert=None, ex_token_bearer_auth=False)[source]¶
Bases:
object
Base driver class to be used with various Kubernetes drivers.
NOTE: This base class can be used in different APIs such as container and compute one.
- 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.key_file (
str
) – Path to the key file used to authenticate (when using key file auth).cert_file (
str
) – Path to the cert file used to authenticate (when using key file auth).ex_token_bearer_auth (
bool
) – True to use token bearer auth.
- Returns:
None
- class libcloud.common.kubernetes.KubernetesTLSAuthConnection(key, secure=True, host='localhost', port='6443', key_file=None, cert_file=None, **kwargs)[source]¶
Bases:
KeyCertificateConnection
Initialize cert_file; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- responseCls¶
alias of
KubernetesResponse
- class libcloud.common.kubernetes.KubernetesTokenAuthConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶
Bases:
ConnectionKey
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- responseCls¶
alias of
KubernetesResponse
libcloud.common.linode module¶
- 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:
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.
- responseCls¶
alias of
LinodeResponse
- class libcloud.common.linode.LinodeConnectionV4(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶
Bases:
ConnectionKey
A connection to the Linode API
Wraps SSL connections to the Linode API
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
page_size
to the request to reduce the total number of paginated requests to the API.
- responseCls¶
alias of
LinodeResponseV4
- class libcloud.common.linode.LinodeDisk(id, state, name, filesystem, driver, size, extra=None)[source]¶
Bases:
BaseObject
- exception libcloud.common.linode.LinodeException(code, message)[source]¶
Bases:
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.LinodeIPAddress(inet, public, version, driver, extra=None)[source]¶
Bases:
object
- class libcloud.common.linode.LinodeResponse(response, connection)[source]¶
Bases:
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.LinodeResponseV4(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- valid_response_codes = [<HTTPStatus.OK: 200>, <HTTPStatus.NO_CONTENT: 204>]¶
libcloud.common.liquidweb module¶
- 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:
ConnectionUserAndKey
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- responseCls¶
alias of
LiquidWebResponse
- exception libcloud.common.liquidweb.LiquidWebException(value, http_code, extra=None)[source]¶
Bases:
ProviderError
The base class for other Liquidweb exceptions
- Parameters:
value (
str
) – message contained in errorhttp_code (
int
) – error codeextra (
list
) – extra fields specific to error type
- class libcloud.common.liquidweb.LiquidWebResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- errors = None¶
- objects = None¶
libcloud.common.luadns module¶
- 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:
ConnectionUserAndKey
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- responseCls¶
alias of
LuadnsResponse
- class libcloud.common.luadns.LuadnsResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
libcloud.common.maxihost module¶
- class libcloud.common.maxihost.MaxihostConnection(key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, backoff=None, retry_delay=None)[source]¶
Bases:
ConnectionKey
Connection class for the Maxihost 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 apikey to the request.
- responseCls¶
alias of
MaxihostResponse
- class libcloud.common.maxihost.MaxihostResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- parse_error()[source]¶
Parse the error messages.
Override in a provider’s subclass.
- Returns:
Parsed error.
- Return type:
str
- success()[source]¶
Determine if our request was successful.
The meaning of this can be arbitrary; did we receive OK status? Did the node get created? Were we authenticated?
- Return type:
bool
- Returns:
True
orFalse
- valid_response_codes = [<HTTPStatus.OK: 200>, <HTTPStatus.ACCEPTED: 202>, <HTTPStatus.CREATED: 201>, <HTTPStatus.NO_CONTENT: 204>]¶
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:
ConnectionUserAndKey
Initialize user_id and key; set secure to an
int
based on passed value.- allow_insecure = False¶
- encode_data(data)[source]¶
NFSN expects the body to be regular key-value pairs that are not JSON-encoded.
- request(action, params=None, data='', headers=None, method='GET')[source]¶
Add the X-NFSN-Authentication header to an HTTP request.
- responseCls¶
alias of
NFSNResponse
- exception libcloud.common.nfsn.NFSNException(value, http_code, code, driver=None)[source]¶
Bases:
ProviderError
- class libcloud.common.nfsn.NFSNResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
libcloud.common.nsone module¶
- 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:
ConnectionKey
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- responseCls¶
alias of
NsOneResponse
- class libcloud.common.nsone.NsOneResponse(response, connection)[source]¶
Bases:
JsonResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
libcloud.common.nttcis module¶
NTTCIS Common Components
- class libcloud.common.nttcis.NetworkDomainServicePlan[source]¶
Bases:
object
- ADVANCED = 'ADVANCED'¶
- ESSENTIALS = 'ESSENTIALS'¶
- exception libcloud.common.nttcis.NttCisAPIException(code, msg, driver)[source]¶
Bases:
LibcloudError
- class libcloud.common.nttcis.NttCisAccountDetails(user_name, full_name, first_name, last_name, email)[source]¶
Bases:
object
NTTCIS account class details
- class libcloud.common.nttcis.NttCisAntiAffinityRule(id, node_list)[source]¶
Bases:
object
Anti-Affinity rule for NTTCIS
An Anti-Affinity rule ensures that servers in the rule will not reside on the same VMware ESX host.
Instantiate a new
NttCisDataAntiAffinityRule
- Parameters:
id (
str
) – The ID of the Anti-Affinity rulenode_list (
list
ofstr
) – List of node ids that belong in this rule
- class libcloud.common.nttcis.NttCisBackupClient(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 this class.
- Parameters:
id (
str
) – Unique ID for the clienttype (
NttCisBackupClientType
) – The type of client that this client isstatus (
str
) – The states of this particular backup client. i.e. (Unregistered)schedule_policy (
str
) – The schedule policy for this client NOTE: NTTCIS only sends back the name of the schedule policy, no further detailsstorage_policy (
str
) – The storage policy for this client NOTE: NTTCIS only sends back the name of the storage policy, no further detailsdownload_url (
str
) – The download url for this clientalert (
NttCisBackupClientRunningJob
) – The alert configured for this backup client (optional)alert – The running job for the client (optional)
- class libcloud.common.nttcis.NttCisBackupClientAlert(trigger, notify_list=[])[source]¶
Bases:
object
An alert for a backup client
Initialize an instance of
NttCisBackupClientAlert
- Parameters:
trigger (
str
) – Trigger type for the client i.e. ON_FAILUREnotify_list (
list
ofstr
) – List of email addresses that are notified when the alert is fired
- class libcloud.common.nttcis.NttCisBackupClientRunningJob(id, status, percentage=0)[source]¶
Bases:
object
A running job for a given backup client
Initialize an instance of
NttCisBackupClientRunningJob
- Parameters:
id (
str
) – The unqiue ID of the jobstatus (
str
) – The status of the job i.e. Waitingpercentage (
int
) – The percentage completion of the job
- class libcloud.common.nttcis.NttCisBackupClientType(type, is_file_system, description)[source]¶
Bases:
object
A client type object for backups
Initialize an instance of
NttCisBackupClientType
- Parameters:
type (
str
) – The type of client i.e. (FA.Linux, MySQL, ect.)is_file_system (
bool
) – The name of the iRuledescription (
str
) – Description of the client
- class libcloud.common.nttcis.NttCisBackupDetails(asset_id, service_plan, status, clients=None)[source]¶
Bases:
object
NTTCIS Backup Details represents information about a targets backups configuration
Initialize an instance of
NttCisBackupDetails
- Parameters:
asset_id (
str
) – Asset identification for backupsservice_plan (
str
) – The service plan for backups. i.e (Essentials)status (
str
) – The overall status this backup target. i.e. (unregistered)clients (
list
ofNttCisBackupClient
) – Backup clients attached to this target
- class libcloud.common.nttcis.NttCisBackupSchedulePolicy(name, description)[source]¶
Bases:
object
A representation of a schedule policy
Initialize an instance of
NttCisBackupSchedulePolicy
- Parameters:
name (
str
) – The name of the policy i.e 12AM - 6AMdescription (
str
) – Short summary of the details of the policy
- class libcloud.common.nttcis.NttCisBackupStoragePolicy(name, retention_period, secondary_location)[source]¶
Bases:
object
A representation of a storage policy
Initialize an instance of
NttCisBackupStoragePolicy
- Parameters:
name (
str
) – The name of the storage policy i.e. 14 Day Storage Policyretention_period (
int
) – How long to keep the backup in dayssecondary_location (
str
) – The secondary location i.e. Primary
- class libcloud.common.nttcis.NttCisChildIpAddressList(id, name)[source]¶
Bases:
object
NttCis Child IP Address list
” Initialize an instance of
NttCisDataChildIpAddressList
- Parameters:
id (
str
) – GUID of the IP Address List keyname (
str
) – Name of the IP Address List
- class libcloud.common.nttcis.NttCisChildPortList(id, name)[source]¶
Bases:
object
NttCis Child Port list
” Initialize an instance of
NttCisChildIpAddressList
- Parameters:
id (
str
) – GUID of the child port list keyname (
str
) – Name of the child port List
- class libcloud.common.nttcis.NttCisConnection(user_id, key, secure=True, host=None, port=None, url=None, timeout=None, proxy_url=None, api_version=None, **conn_kwargs)[source]¶
Bases:
ConnectionUserAndKey
Connection class for the NttCis driver
Initialize user_id and key; set secure to an
int
based on passed value.- active_api_version = '2.7'¶
- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- 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.7'¶
- 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 actiondata (
str
) – The data payload to be added to the requestheaders (
str
ordict
orNone
) – Additional header to be added to the requestmethod (
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
- rawResponseCls¶
alias of
NttCisRawResponse
- responseCls¶
alias of
NttCisResponse
- 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 statesfunc (
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.
- class libcloud.common.nttcis.NttCisDefaultHealthMonitor(id, name, node_compatible, pool_compatible)[source]¶
Bases:
object
A default health monitor for a VIP (node, pool or listener)
Initialize an instance of
NttCisDefaultHealthMonitor
- Parameters:
id (
str
) – The ID of the monitorname (
str
) – The name of the monitornode_compatible (
bool
) – Is a monitor capable of monitoring nodespool_compatible (
bool
) – Is a monitor capable of monitoring pools
- class libcloud.common.nttcis.NttCisDefaultiRule(id, name, compatible_listeners)[source]¶
Bases:
object
A default iRule for a network domain, can be applied to a listener
Initialize an instance of
NttCisefaultiRule
- Parameters:
id (
str
) – The ID of the iRulename (
str
) – The name of the iRulecompatible_listeners (
list
ofNttCisVirtualListenerCompatibility
) – List of compatible Virtual Listener types
- class libcloud.common.nttcis.NttCisFirewallAddress(any_ip=None, ip_address=None, ip_prefix_size=None, port_begin=None, port_end=None, address_list_id=None, port_list_id=None)[source]¶
Bases:
object
The source or destination model in a firewall rule 9/4/18: Editing Class to use with ex_create_firewall_rtule method. Will haved to circle back and test for any other uses.
- Parameters:
any_ip – used to set ip address to “ANY”
ip_address – Optional, an ip address of either IPv4 decimal notation or an IPv6 address
:type
str
- Parameters:
ip_prefix_size – An integer denoting prefix size.
:type
int
- Parameters:
port_begin – integer for an individual port or start of a list of ports if not using a port list
:type
int
- Parameters:
port_end – integer required if using a list of ports (NOT a port list but a list starting with port begin)
:type
int
- Parameters:
address_list_id – An id identifying an address list
:type
str
- Parameters:
port_list_id – An id identifying a port list
:type
str
- class libcloud.common.nttcis.NttCisFirewallRule(id, name, action, location, network_domain, status, ip_version, protocol, source, destination, enabled)[source]¶
Bases:
object
NTTCIS Firewall Rule for a network domain
- class libcloud.common.nttcis.NttCisIpAddress(begin, end=None, prefix_size=None)[source]¶
Bases:
object
A representation of IP Address in NttCis
Initialize an instance of
NttCisIpAddress
- Parameters:
begin (
str
) – IP Address Beginend (
str
) – IP Address endprefixSize (
int
) – IP Address prefix size
- class libcloud.common.nttcis.NttCisIpAddressList(id, name, description, ip_version, ip_address_collection, state, create_time, child_ip_address_lists=None)[source]¶
Bases:
object
NttCis IP Address list
” Initialize an instance of
NttCisIpAddressList
- Parameters:
id (
str
) – GUID of the IP Address List keyname (
str
) – Name of the IP Address Listdescription (
str
) – Description of the IP Address Listip_version (
str
) – IP version. E.g. IPV4, IPV6ip_address_collection (
List
) – Collection of NttCisIpAddressstate (
str
) – IP Address list statecreate_time (
date time
) – IP Address List created timechild_ip_address_lists (List) – List of IP address list to be included
of :class:’NttCisIpAddressList’
- class libcloud.common.nttcis.NttCisNatRule(id, network_domain, internal_ip, external_ip, status)[source]¶
Bases:
object
An IP NAT rule in a network domain
- class libcloud.common.nttcis.NttCisNetwork(id, name, description, location, private_net, multicast, status)[source]¶
Bases:
object
NTTCIS network with location.
- class libcloud.common.nttcis.NttCisNetworkDomain(id, name, description, location, status, plan)[source]¶
Bases:
object
NttCis network domain with location.
- class libcloud.common.nttcis.NttCisNic(private_ip_v4=None, vlan=None, network_adapter_name=None)[source]¶
Bases:
object
A representation of Network Adapter in NTTCIS
Initialize an instance of
NttCisNic
- Parameters:
private_ip_v4 (
str
) – IPv4vlan (class: NttCisVlan or
str
) – Network VLANnetwork_adapter_name (
str
) – Network Adapter Name
- class libcloud.common.nttcis.NttCisPersistenceProfile(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
NttCisPersistenceProfile
- Parameters:
id (
str
) – The ID of the profilename (
str
) – The name of the profilecompatible_listeners (
list
ofNttCisVirtualListenerCompatibility
) – List of compatible Virtual Listener typesfallback_compatible (
bool
) – Is capable as a fallback profile
- class libcloud.common.nttcis.NttCisPool(id, name, description, status, load_balance_method, health_monitor_id, service_down_action, slow_ramp_time)[source]¶
Bases:
object
NttCis VIP Pool.
Initialize an instance of
NttCisPool
- Parameters:
id (
str
) – The ID of the poolname (
str
) – The name of the pooldescription (
str
) – Plan text description of the poolstatus (:class:NttCisStatus`) – The status of the pool
load_balance_method (
str
) – The load balancer methodhealth_monitor_id (
str
) – The ID of the health monitorservice_down_action (
str
) – Action to take when pool is downslow_ramp_time (
int
) – The ramp-up time for service recovery
- class libcloud.common.nttcis.NttCisPoolMember(id, name, status, ip, port, node_id)[source]¶
Bases:
object
NTTCIS VIP Pool Member.
Initialize an instance of
NttCisPoolMember
- Parameters:
id (
str
) – The ID of the pool membername (
str
) – The name of the pool memberstatus (
NttCisStatus
) – The status of the poolip (
str
) – The IP of the pool memberport (
int
) – The port of the pool membernode_id (
str
) – The ID of the associated node
- class libcloud.common.nttcis.NttCisPort(begin, end=None)[source]¶
Bases:
object
A representation of Port in NTTCIS
Initialize an instance of
NttCisPort
- Parameters:
begin (
str
) – Port Number Beginend (
str
) – Port Number end
- class libcloud.common.nttcis.NttCisPortList(id, name, description, port_collection, child_portlist_list, state, create_time)[source]¶
Bases:
object
NttCis Port list
” Initialize an instance of
DNttCisPortList
- Parameters:
id (
str
) – GUID of the Port List keyname (
str
) – Name of the Port Listdescription (
str
) – Description of the Port Listport_collection (
List
) – Collection of NttCisPortchild_portlist_list (
List
) – Collection of NttCisChildPortstate (
str
) – Port list statecreate_time (
date time
) – Port List created time
- class libcloud.common.nttcis.NttCisPublicIpBlock(id, base_ip, size, location, network_domain, status)[source]¶
Bases:
object
NTTCIS Public IP Block with location.
- class libcloud.common.nttcis.NttCisRawResponse(connection, response=None)[source]¶
Bases:
RawResponse
- Parameters:
connection (
Connection
) – Parent connection object.
- class libcloud.common.nttcis.NttCisReservedIpAddress(datacenter_id, exclusive, vlan_id, ip, description=None)[source]¶
Bases:
object
NTTCIS Rerverse IPv4 address
- class libcloud.common.nttcis.NttCisResponse(response, connection)[source]¶
Bases:
XmlResponse
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- class libcloud.common.nttcis.NttCisScsiController(id, adapter_type, bus_number, state)[source]¶
Bases:
object
A class that represents the disk on a server
Instantiate a new
DimensionDataServerDisk
- Parameters:
id (
str
) – The id of the controlleradapter_type (
str
) – The ‘brand’ of adapterbus_number – The bus number occupied on the virtual hardware
state (
str
) – Curent state (i.e. NORMAL)state – State of the disk (i.e. PENDING)
- class libcloud.common.nttcis.NttCisServerCpuSpecification(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
NttCisServerCpuSpecification
- Parameters:
cpu_count (
int
) – The number of CPUscores_per_socket (
int
) – The number of cores per socket, the recommendation is 1performance (
str
) – The performance type, e.g. HIGHPERFORMANCE
- class libcloud.common.nttcis.NttCisServerDisk(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 diskscsi_id (
int
) – Representation for scsisize_gb (
int
) – Size of the diskspeed (
str
) – Speed of the disk (i.e. STANDARD)state (
str
) – State of the disk (i.e. PENDING)
- class libcloud.common.nttcis.NttCisServerVMWareTools(status, version_status, api_version)[source]¶
Bases:
object
A class that represents the VMWareTools for a node
Instantiate a new
NttCisServerVMWareTools
object- Parameters:
status (
str
) – The status of VMWare Toolsversion_status (
str
) – The status for the version of VMWare Tools (i.e NEEDS_UPGRADE)api_version (
str
) – The API version of VMWare Tools
- class libcloud.common.nttcis.NttCisSnapshot(server_id, service_plan, id=None, window_id=None, start_time=None, state=None, end_time=None, type=None, expiry_time=None, action=None)[source]¶
Bases:
object
NTTCIS Class representing server snapshots
- class libcloud.common.nttcis.NttCisStatus(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
- NTTCIS 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.nttcis.NttCisTag(asset_type, asset_id, asset_name, datacenter, key, value)[source]¶
Bases:
object
A representation of a Tag in NTTCIS 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
NttCisTag
- Parameters:
asset_type (
str
) – The type of asset. Current asset types: SERVER, VLAN, NETWORK_DOMAIN, CUSTOMER_IMAGE, PUBLIC_IP_BLOCK, ACCOUNTasset_id (
str
) – The GUID of the asset that is taggedasset_name (
str
) – The name of the asset that is taggeddatacenter (
str
) – The short datacenter name of the tagged assetkey (
NttCisTagKey
) – The tagged keyvalue (
None
orstr
) – The tagged value
- class libcloud.common.nttcis.NttCisTagKey(id, name, description, value_required, display_on_report)[source]¶
Bases:
object
A representation of a Tag Key in NTTCIS A tag key is required to tag an asset
Initialize an instance of
NttCisTagKey
- Parameters:
id (
str
) – GUID of the tag keyname (
str
) – Name of the tag keydescription (
str
) – Description of the tag keyvalue_required (
bool
) – If a value is required for this tag keydisplay_on_report (
bool
) – If this tag key should be displayed on usage reports
- class libcloud.common.nttcis.NttCisVIPNode(id, name, status, ip, connection_limit='10000', connection_rate_limit='10000', health_monitor=None)[source]¶
Bases:
object
Initialize an instance of
NttCisVIPNode
- Parameters:
id (
str
) – The ID of the nodename (
str
) – The name of the nodestatus (
NttCisStatus
) – The status of the nodeip (
str
) – The IP of the nodeconnection_limit (
int
) – The total connection limit for the nodeconnection_rate_limit (
int
) – The rate limit for the node
- class libcloud.common.nttcis.NttCisVirtualListener(id, name, status, ip)[source]¶
Bases:
object
NTTCIS Virtual Listener.
Initialize an instance of
NttCisVirtualListener
- Parameters:
id (
str
) – The ID of the listenername (
str
) – The name of the listenerstatus (
NttCisStatus
) – The status of the listenerip (
str
) – The IP of the listener
- class libcloud.common.nttcis.NttCisVirtualListenerCompatibility(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.nttcis.NttCisVlan(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
NTTCIS VLAN.
Initialize an instance of
DimensionDataVlan
- Parameters:
id (
str
) – The ID of the VLANname (
str
) – The name of the VLANdescription (
str
) – Plan text description of the VLANlocation (
NodeLocation
) – The location (data center) of the VLANnetwork_domain (
DimensionDataNetworkDomain
) – The Network Domain that owns this VLANstatus (
DimensionDataStatus
) – The status of the VLANprivate_ipv4_range_address (
str
) – The host address of the VLAN IP spaceprivate_ipv4_range_size (
int
) – The size (e.g. ‘24’) of the VLAN as a CIDR range sizeipv6_range_address (
str
) – The host address of the VLAN IP spaceipv6_range_size (
int
) – The size (e.g. ‘32’) of the VLAN as a CIDR range sizeipv4_gateway (
str
) – The IPv4 default gateway addressipv6_gateway (
str
) – The IPv6 default gateway address
- class libcloud.common.nttcis.XmlDictConfig(parent_element)[source]¶
Bases:
dict
Inherits from dict. Looks for XML elements, such as attrib, that can be converted to a dictionary. Any XML element that contains other XML elements, will be passed to XmlListConfig
- class libcloud.common.nttcis.XmlListConfig(elem_list)[source]¶
Bases:
list
Creates a class from XML elements that make a list. If a list of XML elements with attributes, the attributes are passed to XmlDictConfig.
- libcloud.common.nttcis.class_factory(cls_name, attrs)[source]¶
This class takes a name and a dictionary to create a class. The clkass has an init method, an iter for retrieving properties, and, finally, a repr for returning the instance :param cls_name: The name to be tacked onto the suffix NttCis :type cls_name:
str
:param attrs: The attributes and values for an instance :type attrs:dict
:return: a class that inherits from ClassFactory :rtype:ClassFactory
- libcloud.common.nttcis.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 forfunc (
function
) – The function to call, e.g. ex_get_vlan. Note: This function needs to return an object which hasstatus
attribute.
- Return type:
str
- libcloud.common.nttcis.process_xml(xml)[source]¶
Take the xml and put it into a dictionary. The process the dictionary recursively. This returns a class based on the XML API. Thus, properties will have the camel case found in the Java XML. This a trade-off to reduce the number of “static” classes that all have to be synchronized with any changes in the API. :param xml: The serialized version of the XML returned from Cloud Control :return: a dynamic class that inherits from ClassFactory :rtype: ClassFactory
- libcloud.common.nttcis.processor(mapping, name=None)[source]¶
Closure that keeps the deepcopy of the original dict converted to XML current. :param mapping: The converted XML to dict/lists :type mapping:
dict
:param name: (Optional) what becomes the class name if provided :type:str
:return: Nothing
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:
ConnectionUserAndKey
OnApp connection class
Initialize user_id and key; set secure to an
int
based on passed value.- 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 headers- Return type:
dict
- Returns:
Default input headers with the “Authorization” header.
- responseCls¶
alias of
OnAppResponse
- class libcloud.common.onapp.OnAppResponse(response, connection)[source]¶
Bases:
JsonResponse
OnApp response class
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
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_tenant_domain_id='default', ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None, ex_force_microversion=None, ex_auth_cache=None, retry_delay=None, backoff=None)[source]¶
Bases:
ConnectionUserAndKey
Base class for OpenStack connections.
- Parameters:
user_id (
str
) – User name to use when authenticatingkey (
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_tenant_domain_id (
str
) – When authenticating, provide this tenant domain id to the identity service. A scoped token will be returned. Some cloud providers require the tenant domain id to be provided at authentication time. Others will use a default tenant domain id 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.ex_auth_cache (
OpenStackAuthenticationCache
) – External cache where authentication tokens are stored for reuse by other processes. Tokens are always cached in memory on the driver instance. To share tokens among multiple drivers, processes, or systems, pass a cache here.
Initialize user_id and key; set secure to an
int
based on passed value.- accept_format = None¶
- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- auth_token_expires = 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
- morph_action_hook(action)[source]¶
Here we strip any duplicated leading or traling slashes to prevent typos and other issues where some APIs don’t correctly handle double slashes.
Keep in mind that in some situations, “/” is a vallid path name so we have a module flag which disables this behavior (https://github.com/apache/libcloud/issues/1529).
- request(action, params=None, data='', 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.stream (
bool
) – True to return an iterator in Response.iter_content and allow streaming of the response data (for downloading large files)retry_failed – True if failed requests should be retried. This argument can override module level constant and environment variable value on per-request basis.
- Returns:
An
Response
instance.- Return type:
Response
instance
- service_catalog = None¶
- service_name = None¶
- service_region = None¶
- service_type = None¶
- 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_tenant_domain_id='default', ex_force_service_type=None, ex_force_service_name=None, ex_force_service_region=None, ex_auth_cache=None, ex_force_microversion=None, *args, **kwargs)[source]¶
Bases:
object
- exception libcloud.common.openstack.OpenStackException(value: str, http_code: int, driver: BaseDriver | None = None)[source]¶
Bases:
ProviderError
- class libcloud.common.openstack.OpenStackResponse(response, connection)[source]¶
Bases:
Response
- Parameters:
response (
httplib.HTTPResponse
) – HTTP response object. (optional)connection (
Connection
) – Parent connection object.
- node_driver = None¶
- parse_body()[source]¶
Parse response body.
Override in a provider’s subclass.
- Returns:
Parsed body.
- Return type:
str
libcloud.common.openstack_identity module¶
Common / shared code for handling authentication against OpenStack identity service (Keystone).
- class libcloud.common.openstack_identity.OpenStackAuthenticationCache[source]¶
Bases:
object
Base class for external OpenStack authentication caches.
Authentication tokens are always cached in memory in
OpenStackIdentityConnection
.auth_token and related fields. These tokens are lost when the driver is garbage collected. To share tokens among multiple drivers, processes, or systems, use anOpenStackAuthenticationCache
in OpenStackIdentityConnection.auth_cache.Cache implementors should inherit this class and define the methods below.
- clear(key)[source]¶
Clear an authentication context from the cache.
- Parameters:
key (
OpenStackAuthenticationCacheKey
) – Key to clear.
- get(key)[source]¶
Get an authentication context from the cache.
- Parameters:
key (
OpenStackAuthenticationCacheKey
) – Key to fetch.- Returns:
The cached context for the given key, if present; None if not.
- Return type:
- put(key, context)[source]¶
Put an authentication context into the cache.
- Parameters:
key (
OpenStackAuthenticationCacheKey
) – Key where the context will be stored.context (
OpenStackAuthenticationContext
) – The context to cache.
- class libcloud.common.openstack_identity.OpenStackAuthenticationCacheKey(auth_url, user_id, token_scope, tenant_name, domain_name, tenant_domain_id)¶
Bases:
tuple
Create new instance of OpenStackAuthenticationCacheKey(auth_url, user_id, token_scope, tenant_name, domain_name, tenant_domain_id)
- auth_url¶
Alias for field number 0
- domain_name¶
Alias for field number 4
- tenant_domain_id¶
Alias for field number 5
- tenant_name¶
Alias for field number 3
- token_scope¶
Alias for field number 2
- user_id¶
Alias for field number 1
- class libcloud.common.openstack_identity.OpenStackAuthenticationContext(token, expiration=None, user=None, roles=None, urls=None)[source]¶
Bases:
object
An authentication token and related context.
- class libcloud.common.openstack_identity.OpenStackIdentityConnection(auth_url, user_id, key, tenant_name=None, tenant_domain_id='default', domain_name='Default', token_scope='project', timeout=None, proxy_url=None, parent_conn=None, auth_cache=None)[source]¶
Bases:
ConnectionUserAndKey
Base identity connection class which contains common / shared logic.
Note: This class shouldn’t be instantiated directly.
Initialize user_id and key; set secure to an
int
based on passed value.- add_default_headers(headers)[source]¶
Adds default headers (such as Authorization, X-Foo-Bar) to the passed headers
Should return a dictionary.
- 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.
- clear_cached_auth_context()[source]¶
Clear the cached authentication context.
The context is cleared from fields on this connection and from the external cache, if one is configured.
- 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
- morph_action_hook(action)[source]¶
Here we strip any duplicated leading or traling slashes to prevent typos and other issues where some APIs don’t correctly handle double slashes.
Keep in mind that in some situations, “/” is a vallid path name so we have a module flag which disables this behavior (https://github.com/apache/libcloud/issues/1529).
- responseCls¶
alias of
OpenStackAuthResponse
- class libcloud.common.openstack_identity.OpenStackIdentityDomain(id, name, enabled)[source]¶
Bases:
object
- 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.OpenStackIdentityProject(id, name, description, enabled, domain_id=None)[source]¶
Bases:
object
- class libcloud.common.openstack_identity.OpenStackIdentityRole(id, name, description, enabled)[source]¶
Bases:
object
- class libcloud.common.openstack_identity.OpenStackIdentityUser(id, domain_id, name, email, description, enabled)[source]¶
Bases:
object
- class libcloud.common.openstack_identity.OpenStackIdentityVersion(version, status, updated, url)[source]¶
Bases:
object
- class libcloud.common.openstack_identity.OpenStackIdentity_1_0_Connection(auth_url, user_id, key, tenant_name=None, tenant_domain_id='default', domain_name='Default', token_scope='project', timeout=None, proxy_url=None, parent_conn=None, auth_cache=None)[source]¶
Bases:
OpenStackIdentityConnection
Connection class for Keystone API v1.0.
Initialize user_id and key; set secure to an
int
based on passed value.- 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.
- 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, tenant_domain_id='default', domain_name='Default', token_scope='project', timeout=None, proxy_url=None, parent_conn=None, auth_cache=None)[source]¶
Bases:
OpenStackIdentityConnection
Connection class for Keystone API v1.1.
Initialize user_id and key; set secure to an
int
based on passed value.- 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.
- 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, tenant_domain_id='default', domain_name='Default', token_scope='project', timeout=None, proxy_url=None, parent_conn=None, auth_cache=None)[source]¶
Bases:
OpenStackIdentityConnection
Connection class for Keystone API v2.0.
Initialize user_id and key; set secure to an
int
based on passed value.- authenticate(auth_type='api_key', force=False)[source]¶
Authenticate against the identity API.
- Parameters:
force (
bool
) – Forcefully update the token even if it’s already cached and still valid.
- 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, tenant_domain_id='default', domain_name='Default', token_scope='project', timeout=None, proxy_url=None, parent_conn=None, auth_cache=None)[source]¶
Bases:
OpenStackIdentityConnection
,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.
Initialize user_id and key; set secure to an
int
based on passed value.- 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.
- 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', tenant_domain_id='default', token_scope='project', timeout=None, proxy_url=None, parent_conn=None, auth_cache=None)[source]¶
Bases:
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: When 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_cache (
OpenStackAuthenticationCache
) – Where to cache authentication tokens.
- VALID_TOKEN_SCOPES = ['project', 'domain', 'unscoped']¶
- 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:
- 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:
- 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:
- get_domain(domain_id)[source]¶
Retrieve information about a single domain.
- Parameters:
domain_id (
str
) – ID of domain to retrieve information for.- Return type:
- get_user(user_id)[source]¶
Get a user account by ID.
- Parameters:
user_id – User’s id.
- Returns:
Located user.
- Return type:
- 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
- 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
- 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
- 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
- class libcloud.common.openstack_identity.OpenStackIdentity_3_0_Connection_AppCred(auth_url, user_id, key, tenant_name=None, domain_name=None, tenant_domain_id=None, token_scope=None, timeout=None, proxy_url=None, parent_conn=None, auth_cache=None)[source]¶
Bases:
OpenStackIdentity_3_0_Connection
Connection class for Keystone API v3.x using Application Credentials.
‘user_id’ is the application credential id and ‘key’ is the application credential secret.
Tenant, domain and scope options are ignored as they are contained within the app credential itself and can’t be changed.
- name = 'OpenStack Identity API v3.x with Application Credentials'¶
- class libcloud.common.openstack_identity.OpenStackIdentity_3_0_Connection_OIDC_access_token(auth_url, user_id, key, tenant_name=None, domain_name='Default', tenant_domain_id='default', token_scope='project', timeout=None, proxy_url=None, parent_conn=None, auth_cache=None)[source]¶
Bases:
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 self.domain_name attribute can be used either to select the domain name in case of domain scoped token or to select the project name in case of project scoped token
- 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: When 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_cache (
OpenStackAuthenticationCache
) – Where to cache authentication tokens.
- name = 'OpenStack Identity API v3.x with OIDC support'¶
- responseCls¶
alias of
OpenStackAuthResponse
- 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:
- 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.
- 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']¶
libcloud.common.osc module¶
- class libcloud.common.osc.OSCRequestSignerAlgorithmV4(access_key: str, access_secret: str, version: str, connection)[source]¶
Bases:
OSCRequestSigner
- Parameters:
access_key (
str
) – Access key.access_secret (
str
) – Access secret.version (
str
) – API version.connection (
Connection
) – Connection instance.
libcloud.common.ovh module¶
- class libcloud.common.ovh.OvhConnection(user_id, *args, **kwargs)[source]¶
Bases:
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.
Initialize user_id and key; set secure to an
int
based on passed value.- LOCATIONS = {'BHS1': {'country': 'CA', 'id': 'BHS1', 'name': 'Beauharnois, Quebec 1'}, 'BHS2': {'country': 'CA', 'id': 'BHS2', 'name': 'Beauharnois, Quebec 2'}, 'BHS3': {'country': 'CA', 'id': 'BHS3', 'name': 'Beauharnois, Quebec 3'}, 'BHS4': {'country': 'CA', 'id': 'BHS4', 'name': 'Beauharnois, Quebec 4'}, 'BHS5': {'country': 'CA', 'id': 'BHS5', 'name': 'Beauharnois, Quebec 5'}, 'BHS6': {'country': 'CA', 'id': 'BHS6', 'name': 'Beauharnois, Quebec 6'}, 'DC1': {'country': 'FR', 'id': 'DC1', 'name': 'Paris DC1'}, 'FRA1': {'country': 'DE', 'id': 'FRA1', 'name': 'Frankfurt 1'}, 'GRA1': {'country': 'FR', 'id': 'GRA1', 'name': 'Gravelines 1'}, 'GRA2': {'country': 'FR', 'id': 'GRA2', 'name': 'Gravelines 2'}, 'GSW': {'country': 'FR', 'id': 'GSW', 'name': 'Paris GSW'}, 'HIL1': {'country': 'US', 'id': 'HIL1', 'name': 'Hillsboro, Oregon 1'}, 'LON1': {'country': 'UK', 'id': 'LON1', 'name': 'London 1'}, 'P19': {'country': 'FR', 'id': 'P19', 'name': 'Paris P19'}, 'RBX1': {'country': 'FR', 'id': 'RBX1', 'name': 'Roubaix 1'}, 'RBX2': {'country': 'FR', 'id': 'RBX2', 'name': 'Roubaix 2'}, 'RBX3': {'country': 'FR', 'id': 'RBX3', 'name': 'Roubaix 3'}, 'RBX4': {'country': 'FR', 'id': 'RBX4', 'name': 'Roubaix 4'}, 'RBX5': {'country': 'FR', 'id': 'RBX5', 'name': 'Roubaix 5'}, 'RBX6': {'country': 'FR', 'id': 'RBX6', 'name': 'Roubaix 6'}, 'RBX7': {'country': 'FR', 'id': 'RBX7', 'name': 'Roubaix 7'}, 'SBG1': {'country': 'FR', 'id': 'SBG1', 'name': 'Strasbourg 1'}, 'SBG2': {'country': 'FR', 'id': 'SBG2', 'name': 'Strasbourg 2'}, 'SBG3': {'country': 'FR', 'id': 'SBG3', 'name': 'Strasbourg 3'}, 'SGP1': {'country': 'SG', 'id': 'SGP1', 'name': 'Singapore 1'}, 'SYD1': {'country': 'AU', 'id': 'SYD1', 'name': 'Sydney 1'}, 'VIN1': {'country': 'US', 'id': 'VIN1', 'name': 'Vint Hill, Virginia 1'}, 'WAW1': {'country': 'PL', 'id': 'WAW1', 'name': 'Warsaw 1'}}¶
- 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¶
- 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