OpenStack Client interface. Handles the REST calls and responses.
troveclient.apiclient.client.
BaseClient
(http_client, extensions=None)¶Bases: object
Top-level object to access the OpenStack API.
This client uses HTTPClient
to send requests. HTTPClient
will handle a bunch of issues such as authentication.
cached_endpoint
= None¶client_request
(method, url, **kwargs)¶delete
(url, **kwargs)¶endpoint_type
= None¶get
(url, **kwargs)¶get_class
(api_name, version, version_map)¶Returns the client class for the requested API version
Parameters: |
|
---|---|
Return type: | a client class for the requested API version |
head
(url, **kwargs)¶patch
(url, **kwargs)¶post
(url, **kwargs)¶put
(url, **kwargs)¶service_type
= None¶troveclient.apiclient.client.
HTTPClient
(auth_plugin, region_name=None, endpoint_type='publicURL', original_ip=None, verify=True, cert=None, timeout=None, timings=False, keyring_saver=None, debug=False, user_agent=None, http=None)¶Bases: object
This client handles sending HTTP requests to OpenStack servers.
Features:
add_client
(base_client_instance)¶Add a new instance of BaseClient
descendant.
self will store a reference to base_client_instance.
Example:
>>> def test_clients():
... from keystoneclient.auth import keystone
... from openstack.common.apiclient import client
... auth = keystone.KeystoneAuthPlugin(
... username="user", password="pass", tenant_name="tenant",
... auth_url="http://auth:5000/v2.0")
... openstack_client = client.HTTPClient(auth)
... # create nova client
... from novaclient.v1_1 import client
... client.Client(openstack_client)
... # create keystone client
... from keystoneclient.v2_0 import client
... client.Client(openstack_client)
... # use them
... openstack_client.identity.tenants.list()
... openstack_client.compute.servers.list()
authenticate
()¶client_request
(client, method, url, **kwargs)¶Send an http request using client’s endpoint and specified url.
If request was rejected as unauthorized (possibly because the token is expired), issue one authorization attempt and send the request once again.
Parameters: |
|
---|
concat_url
(endpoint, url)¶Concatenate endpoint and final URL.
E.g., “http://keystone/v2.0/” and “/tokens” are concatenated to “http://keystone/v2.0/tokens”.
Parameters: |
|
---|
get_timings
()¶request
(method, url, **kwargs)¶Send an http request with the specified characteristics.
Wrapper around requests.Session.request to handle tasks such as setting headers, JSON encoding/decoding, and error handling.
Parameters: |
|
---|
reset_timings
()¶serialize
(kwargs)¶user_agent
= 'troveclient.apiclient'¶Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.