Bases: object
Base class for authentication plugins.
An authentication plugin needs to override at least the authenticate method to be a valid plugin.
Add options that are common for several plugins.
Populate the parser with the options for this plugin.
Authenticate using plugin defined method.
The method usually analyses self.opts and performs a request to authentication server.
Parameters: | http_client (HTTPClient) – client object that needs authentication |
---|---|
Raises: | AuthorizationFailure |
Return option name and value.
Parameters: |
|
---|
Parse the actual auth-system options if any.
This method is expected to populate the attribute self.opts with a dict containing the options and values needed to make authentication.
Check if all required options are present.
Raises: | AuthPluginOptionsMissing |
---|
Return token and endpoint.
Parameters: | |
---|---|
Returns: | tuple of token and endpoint strings |
Raises: | EndpointException |
Discover the available auth-systems.
This won’t take into account the old style auth-systems.
Load options needed by the available auth-systems into a parser.
This function will try to populate the parser with options from the available plugins.
Load required plugin and populate it with options.
Try to guess auth system if it is not specified. Systems are tried in alphabetical order.
Raises: | AuthPluginOptionsMissing |
---|
Base utilities to build API operation managers and objects on top of.
Bases: keystoneclient.openstack.common.apiclient.base.HookableMixin
Basic manager type providing common operations.
Managers interact with a particular type of API (servers, flavors, images, etc.) and provide CRUD operations for them.
Bases: keystoneclient.openstack.common.apiclient.base.BaseManager
Base manager class for manipulating entities.
Children of this class are expected to define a collection_key and key.
Builds a resource URL for the given kwargs.
Given an example collection where collection_key = ‘entities’ and key = ‘entity’, the following URL’s could be generated.
By default, the URL will represent a collection of entities, e.g.:
/entities
If kwargs contains an entity_id, then the URL will represent a specific member, e.g.:
/entities/{entity_id}
Parameters: | base_url – if provided, the generated URL will be appended to it |
---|
Find a single item with attributes matching **kwargs.
Parameters: | base_url – if provided, the generated URL will be appended to it |
---|
List the collection.
Parameters: | base_url – if provided, the generated URL will be appended to it |
---|
Update an element.
Parameters: | base_url – if provided, the generated URL will be appended to it |
---|
Bases: keystoneclient.openstack.common.apiclient.base.HookableMixin
Extension descriptor.
Bases: object
Mixin so classes can register and run hooks.
Add a new hook of specified type.
Parameters: |
|
---|
Run all hooks of specified type.
Parameters: |
|
---|
Bases: keystoneclient.openstack.common.apiclient.base.BaseManager
Manager with additional find()/findall() methods.
Find a single item with attributes matching **kwargs.
This isn’t very efficient: it loads the entire list then filters on the Python side.
Find all items with attributes matching **kwargs.
This isn’t very efficient: it loads the entire list then filters on the Python side.
Return id if argument is a Resource.
Abstracts the common pattern of allowing both an object or an object’s ID (UUID) as a parameter when dealing with relationships.
OpenStack Client interface. Handles the REST calls and responses.
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.
Returns the client class for the requested API version
Parameters: |
|
---|---|
Return type: | a client class for the requested API version |
Bases: object
This client handles sending HTTP requests to OpenStack servers.
Features:
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()
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: |
|
---|
Concatenate endpoint and final URL.
E.g., “http://keystone/v2.0/” and “/tokens” are concatenated to “http://keystone/v2.0/tokens”.
Parameters: |
|
---|
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: |
|
---|
Exception definitions.
A fake server that “responds” to API methods with pre-canned responses.
All of these responses come from the spec, so if for some reason the spec’s wrong the tests might raise AssertionError. I’ve indicated in comments the places where actual behavior differs from the spec.
Bases: keystoneclient.openstack.common.apiclient.client.HTTPClient
Assert than an API method was just called.
Assert than an API method was called anytime in the test.
Bases: requests.models.Response
Wrap requests.Response and provide a convenient initialization.
Look for resource in a given manager.
Used as a helper for the _find_* methods. Example:
def _find_hypervisor(cs, hypervisor):
#Get a hypervisor by name or ID.
return cliutils.find_resource(cs.hypervisors, hypervisor)