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.
Bases: object
Base class for OpenStack resources (tenant, user, etc.).
This is pretty much just a bag for attributes.
Human-readable ID which can be used for bash completion.
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: - share authentication information between several clients to different
services (e.g., for compute and image clients);
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.
param client: instance of BaseClient descendant param method: method of HTTP request param url: URL of HTTP request param kwargs: any other parameter that can be passed to
‘ HTTPClient.request
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.
param method: method of HTTP request param url: URL of HTTP request param kwargs: any other parameter that can be passed to
Exception definitions.
Bases: keystoneclient.openstack.common.apiclient.exceptions.EndpointException
Found more than one matching endpoint in Service Catalog.
Bases: keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure
Auth plugin misses some options.
Bases: keystoneclient.openstack.common.apiclient.exceptions.AuthorizationFailure
User has specified a AuthSystem that is not installed.
Bases: keystoneclient.openstack.common.apiclient.exceptions.ClientException
Cannot authorize API client.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HttpServerError
HTTP 502 - Bad Gateway.
The server was acting as a gateway or proxy and received an invalid response from the upstream server.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 400 - Bad Request.
The request cannot be fulfilled due to bad syntax.
Bases: exceptions.Exception
The base exception class for all exceptions this library raises.
Bases: keystoneclient.openstack.common.apiclient.exceptions.ClientException
Error in CLI tool.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 409 - Conflict.
Indicates that the request could not be processed because of conflict in the request, such as an edit conflict.
Bases: keystoneclient.openstack.common.apiclient.exceptions.ClientException
Cannot connect to API service.
Bases: keystoneclient.openstack.common.apiclient.exceptions.ClientException
Something is rotten in Service Catalog.
Bases: keystoneclient.openstack.common.apiclient.exceptions.EndpointException
Could not find requested endpoint in Service Catalog.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 417 - Expectation Failed.
The server cannot meet the requirements of the Expect request-header field.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 403 - Forbidden.
The request was a valid request, but the server is refusing to respond to it.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HttpServerError
HTTP 504 - Gateway Timeout.
The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 410 - Gone.
Indicates that the resource requested is no longer available and will not be available again.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HttpError
Client-side HTTP error.
Exception for cases in which the client seems to have erred.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HttpError
HTTP Redirection.
Bases: keystoneclient.openstack.common.apiclient.exceptions.ClientException
The base exception class for all HTTP exceptions.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HttpServerError
HTTP 501 - Not Implemented.
The server either does not recognize the request method, or it lacks the ability to fulfill the request.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HttpError
Server-side HTTP error.
Exception for cases in which the server is aware that it has erred or is incapable of performing the request.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HttpServerError
HTTP 505 - HttpVersion Not Supported.
The server does not support the HTTP protocol version used in the request.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HttpServerError
HTTP 500 - Internal Server Error.
A generic error message, given when no more specific message is suitable.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 411 - Length Required.
The request did not specify the length of its content, which is required by the requested resource.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 405 - Method Not Allowed.
A request was made of a resource using a request method not supported by that resource.
Bases: keystoneclient.openstack.common.apiclient.exceptions.ClientException
Supplied arguments are not sufficient for calling a function.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPRedirection
HTTP 300 - Multiple Choices.
Indicates multiple options for the resource that the client may follow.
Bases: keystoneclient.openstack.common.apiclient.exceptions.ClientException
Multiple entities found instead of one.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 406 - Not Acceptable.
The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 404 - Not Found.
The requested resource could not be found but may be available again in the future.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 402 - Payment Required.
Reserved for future use.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 412 - Precondition Failed.
The server does not meet one of the preconditions that the requester put on the request.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 407 - Proxy Authentication Required.
The client must first authenticate itself with the proxy.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 413 - Request Entity Too Large.
The request is larger than the server is willing or able to process.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 408 - Request Timeout.
The server timed out waiting for the request.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 414 - Request-URI Too Long.
The URI provided was too long for the server to process.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 416 - Requested Range Not Satisfiable.
The client has asked for a portion of the file, but the server cannot supply that portion.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HttpServerError
HTTP 503 - Service Unavailable.
The server is currently unavailable.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 401 - Unauthorized.
Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet been provided.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 422 - Unprocessable Entity.
The request was well-formed but was unable to be followed due to semantic errors.
Bases: keystoneclient.openstack.common.apiclient.exceptions.HTTPClientError
HTTP 415 - Unsupported Media Type.
The request entity has a media type which the server or resource does not support.
Bases: keystoneclient.openstack.common.apiclient.exceptions.ClientException
User is trying to use an unsupported version of the API.
Bases: keystoneclient.openstack.common.apiclient.exceptions.ClientException
Error in validation on API client side.
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.