troveclient.compat.client module¶
-
class
troveclient.compat.client.
Dbaas
(username, api_key, tenant=None, auth_url=None, service_type='database', service_name=None, service_url=None, insecure=False, auth_strategy='keystone', region_name=None, client_cls=<class 'troveclient.compat.client.TroveHTTPClient'>)¶ Bases:
object
Top-level object to access the Rackspace Database as a Service API.
Create an instance with your creds:
>> red = Dbaas(USERNAME, API_KEY, TENANT, AUTH_URL, SERVICE_NAME, SERVICE_URL)
Then call methods on its managers:
>> red.instances.list() ... >> red.flavors.list() ...
&c.
-
authenticate
()¶ Authenticate against the server.
This is called to perform an authentication to retrieve a token.
Returns on success; raises
exceptions.Unauthorized
if the credentials are wrong.
-
get_timings
()¶
-
set_management_url
(url)¶
-
-
class
troveclient.compat.client.
TroveHTTPClient
(user, password, tenant, auth_url, service_name, service_url=None, auth_strategy=None, insecure=False, timeout=None, proxy_tenant_id=None, proxy_token=None, region_name=None, endpoint_type='publicURL', service_type=None, timings=False)¶ Bases:
httplib2.Http
-
USER_AGENT
= 'python-troveclient'¶
-
authenticate
()¶ Auths the client and gets a token. May optionally set a service url.
The client will get auth errors until the authentication step occurs. Additionally, if a service_url was not explicitly given in the clients __init__ method, one will be obtained from the auth service.
-
authenticate_with_token
(token, service_url=None)¶
-
delete
(url, **kwargs)¶
-
get
(url, **kwargs)¶
-
get_timings
()¶
-
http_log
(args, kwargs, resp, body)¶
-
morph_request
(kwargs)¶
-
morph_response_body
(raw_body)¶
-
patch
(url, **kwargs)¶
-
post
(url, **kwargs)¶
-
pretty_log
(args, kwargs, resp, body)¶
-
put
(url, **kwargs)¶
-
raise_error_from_status
(resp, body)¶
-
request
(*args, **kwargs)¶ Performs a single HTTP request. The ‘uri’ is the URI of the HTTP resource and can begin with either ‘http’ or ‘https’. The value of ‘uri’ must be an absolute URI.
The ‘method’ is the HTTP method to perform, such as GET, POST, DELETE, etc. There is no restriction on the methods allowed.
The ‘body’ is the entity body to be sent with the request. It is a string object.
Any extra headers that are to be sent with the request should be provided in the ‘headers’ dictionary.
The maximum number of redirect to follow before raising an exception is ‘redirections. The default is 5.
The return value is a tuple of (response, content), the first being and instance of the ‘Response’ class, the second being a string that contains the response entity body.
-
simple_log
(args, kwargs, resp, body)¶
-
-
troveclient.compat.client.
log_to_streamhandler
(stream=None)¶