Bases: HTTPClient
Client for the OpenStack Keystone v2.0 API.
username (string) – Username for authentication. (optional)
password (string) – Password for authentication. (optional)
token (string) – Token for authentication. (optional)
tenant_id (string) – Tenant id. (optional)
tenant_name (string) – Tenant name. (optional)
auth_url (string) – Keystone service endpoint for authorization.
region_name (string) – Name of a region to select when choosing an endpoint from the service catalog.
endpoint (string) – A user-supplied endpoint URL for the keystone service. Lazy-authentication is possible for API service calls if endpoint is set at instantiation.(optional)
timeout (integer) – Allows customization of the timeout for client http requests. (optional)
original_ip (string) – The original IP of the requesting user which will be sent to Keystone in a ‘Forwarded’ header. (optional)
cert (string) – Path to the Privacy Enhanced Mail (PEM) file which contains the corresponding X.509 client certificate needed to established two-way SSL connection with the identity service. (optional)
key (string) – Path to the Privacy Enhanced Mail (PEM) file which contains the unencrypted client private key needed to established two-way SSL connection with the identity service. (optional)
cacert (string) – Path to the Privacy Enhanced Mail (PEM) file which contains the trusted authority X.509 certificates needed to established SSL connection with the identity service. (optional)
insecure (boolean) – Does not perform X.509 certificate validation when establishing SSL connection with identity service. default: False (optional)
auth_ref (dict) – To allow for consumers of the client to manage their own caching strategy, you may initialize a client with a previously captured auth_reference (token)
debug (boolean) – Enables debug logging of all request and responses to keystone. default False (option)
Warning
If debug is enabled, it may show passwords in plain text as a part of its output.
Warning
Constructing an instance of this class without a session is deprecated as of the 1.7.0 release and will be removed in the 2.0.0 release.
The client can be created and used like a user or in a strictly bootstrap mode. Normal operation expects a username, password, auth_url, and tenant_name or id to be provided. Other values will be lazily loaded as needed from the service catalog.
Example:
>>> from keystoneauth1.identity import v2
>>> from keystoneauth1 import session
>>> from keystoneclient.v2_0 import client
>>> auth = v2.Password(auth_url=KEYSTONE_URL,
... username=USER,
... password=PASS,
... tenant_name=TENANT_NAME)
>>> sess = session.Session(auth=auth)
>>> keystone = client.Client(session=sess)
>>> keystone.tenants.list()
...
>>> user = keystone.users.get(USER_ID)
>>> user.delete()
Once authenticated, you can store and attempt to re-use the authenticated token. the auth_ref property on the client returns as a dictionary-like-object so that you can export and cache it, re-using it when initiating another client:
>>> from keystoneauth1.identity import v2
>>> from keystoneauth1 import session
>>> from keystoneclient.v2_0 import client
>>> auth = v2.Password(auth_url=KEYSTONE_URL,
... username=USER,
... password=PASS,
... tenant_name=TENANT_NAME)
>>> sess = session.Session(auth=auth)
>>> keystone = client.Client(session=sess)
>>> auth_ref = keystone.auth_ref
>>> # pickle or whatever you like here
>>> new_client = client.Client(auth_ref=auth_ref)
Alternatively, you can provide the administrative token configured in
keystone and an endpoint to communicate with directly. See
(admin_token
in keystone.conf
) In this case, authenticate()
is not needed, and no service catalog will be loaded.
Example:
>>> from keystoneauth1.identity import v2
>>> from keystoneauth1 import session
>>> from keystoneclient.v2_0 import client
>>> auth = v2.Token(auth_url='http://localhost:35357/v2.0',
... token='12345secret7890')
>>> sess = session.Session(auth=auth)
>>> keystone = client.Client(session=sess)
>>> keystone.tenants.list()
Authenticate against the v2 Identity API.
If a token is provided it will be used in preference over username and password.
access.AccessInfo if authentication was successful.
keystoneclient.exceptions.AuthorizationFailure – if unable to authenticate or validate the existing authorization token
Bases: ManagerWithFind
Create a new access/secret pair for the user/tenant pair.
object of type EC2
Delete an access/secret pair for a user.
Bases: Resource
Represents a Keystone endpoint.
Bases: ManagerWithFind
Manager class for manipulating Keystone endpoints.
Create a new endpoint.
Delete an endpoint.
List all available endpoints.
Bases: Resource
Represents an Identity API extension.
Bases: ManagerWithFind
Manager class for listing Identity API extensions.
List all available extensions.
Bases: Resource
Represents a Keystone role.
Bases: ManagerWithFind
Manager class for manipulating Keystone roles.
Add a role to a user.
If tenant is specified, the role is added just for that tenant, otherwise the role is added globally.
Create a role.
Delete a role.
List all available roles.
Remove a role from a user.
If tenant is specified, the role is removed just for that tenant, otherwise the role is removed from the user’s global roles.
Bases: Resource
Represents a Keystone service.
Bases: Resource
Represents a Keystone tenant.
id: a uuid that identifies the tenant
name: tenant name
description: tenant description
enabled: boolean to indicate if tenant is enabled
Bases: ManagerWithFind
Manager class for manipulating Keystone tenants.
Add a user to a tenant with the given role.
Create a new tenant.
Delete a tenant.
Get a list of tenants.
limit (integer) – maximum number to return. (optional)
marker (string) – use when specifying a limit and making multiple calls for querying. (optional)
list of Tenant
List users for a tenant.
Remove the specified role from the user on the tenant.
Update a tenant with a new name and description.
Bases: Resource
Bases: Manager
Return the revoked tokens response.
The response will be a dict containing ‘signed’ which is a CMS-encoded document.
Fetch the data about a token from the identity server.
token (str) – The token id.
dict
Validate a token.
token – Token to be validated. This can be an instance of
keystoneclient.access.AccessInfo
or a string
token_id.
Bases: Resource
Represents a Keystone user.
Bases: ManagerWithFind
Manager class for manipulating Keystone users.
Create a user.
Delete a user.
Get a list of users (optionally limited to a tenant).
list of User
Update user data.
Supported arguments include name
, email
, and enabled
.
Update enabled-ness.
Update password.
Update password.
Update default tenant.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.