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.

exceptions: Dict[str, Type[Exception]] = {}
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 or False

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.

get_request_params(params, method='GET', path='/')[source]
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.

get_request_headers(params, headers, method='GET', path='/', data=None)[source]
get_request_params(params, method='GET', path='/')[source]
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.

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.

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.

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.

version: str | None = None