l.c.a.AbiquoConnection(ConnectionUserAndKey, PollingConnection) : class documentation

Part of libcloud.common.abiquo View Source View In Hierarchy

A Connection to Abiquo API.

Basic L{ConnectionUserAndKey} connection with L{PollingConnection} features
for asynchronous tasks.
Method add_default_headers Add Basic Authentication header to all the requests.
Method get_poll_request_kwargs Manage polling request arguments.
Method has_completed Decide if the asynchronous job has ended.

Inherited from PollingConnection:

Method async_request No summary
Method get_request_kwargs Arguments which are passed to the initial request() call inside async_request.

Inherited from Connection (via PollingConnection):

Method __init__ Undocumented
Method set_context Undocumented
Method connect Establish a connection with the API server.
Method user_agent_append Append a token to a user agent string.
Method request Request a given `action`.
Method morph_action_hook Undocumented
Method add_default_params Adds default parameters (such as API key, version, etc.) to the passed `params`
Method pre_connect_hook 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.
Method encode_data Encode body data.
Method _tuple_from_url Undocumented
Method _user_agent Undocumented
def add_default_headers(self, headers): (source)
Add Basic Authentication header to all the requests.

It injects the 'Authorization: Basic Base64String===' header
in each request

@type  headers: C{dict}
@param headers: Default input headers
@rtype          C{dict}
@return:        Default input headers with the 'Authorization'
                header
def get_poll_request_kwargs(self, response, context, request_kwargs): (source)
Manage polling request arguments.

Return keyword arguments which are passed to the L{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.

@type    response:       C{xml.etree.ElementTree}
@keyword response:       Object returned by poll request.
@type    request_kwargs: C{dict}
@keyword request_kwargs: Default request arguments and headers
@rtype:                  C{dict}
@return:                 Modified keyword arguments
def has_completed(self, response): (source)
Decide if the asynchronous job has ended.

@type  response: C{xml.etree.ElementTree}
@param response: Response object returned by poll request
@rtype:          C{bool}
@return:         Whether the job has completed
API Documentation for libcloud, generated by pydoctor at 2013-03-28 10:45:49.