The gnocchiclient.auth Module¶
- class gnocchiclient.auth.GnocchiBasicLoader¶
Bases:
BaseLoader- get_options()¶
Return the list of parameters associated with the auth plugin.
This list may be used to generate CLI or config arguments.
- Returns:
A list of Param objects describing available plugin parameters.
- plugin_class¶
alias of
GnocchiBasicPlugin
- class gnocchiclient.auth.GnocchiBasicPlugin(user, endpoint)¶
Bases:
BaseAuthPluginBasic authentication plugin for Gnocchi.
- get_auth_ref(session, **kwargs)¶
Return the authentication reference of an auth plugin.
- Parameters:
session – A session object to be used for communication
- Returns:
An access info object if supported.
- get_endpoint(session, **kwargs)¶
Return an endpoint for the client.
There are no required keyword arguments to
get_endpointas a plugin implementation should use best effort with the information available to determine the endpoint. However there are certain standard options that will be generated by the clients and should be used by plugins:service_type: what sort of service is required.service_name: the name of the service in the catalog.interface: what visibility the endpoint should have.region_name: the region the endpoint exists in.
- Parameters:
session – The session object that the auth_plugin belongs to.
kwargs – Ignored.
- Returns:
The base URL that will be used to talk to the required service or None if not available.
- get_headers(session, **kwargs)¶
Fetch authentication headers for request.
This is a more generalized replacement of the older
get_token()to allow plugins to specify different or additional authentication headers to the OpenStack standardX-Auth-Tokenheader.How the authentication headers are obtained is up to the plugin. If the headers are still valid they may be reused, retrieved from cache or the plugin may invoke an authentication request against a server.
The default implementation calls the
get_token()method to enable older style plugins to continue functioning unchanged. Subclasses should feel free to completely override this function to provide the headers that they want.Returning
Nonewill indicate that no token was able to be retrieved and that authorization was a failure. Adding no authentication data can be achieved by returning an empty dictionary.- Parameters:
session – The session object that the auth_plugin belongs to.
- Returns:
Headers that are set to authenticate a message or None for failure. Note that when checking this value that the empty dict is a valid, non-failure response.
- class gnocchiclient.auth.GnocchiNoAuthLoader¶
Bases:
BaseLoader- get_options()¶
Return the list of parameters associated with the auth plugin.
This list may be used to generate CLI or config arguments.
- Returns:
A list of Param objects describing available plugin parameters.
- plugin_class¶
alias of
GnocchiNoAuthPlugin
- class gnocchiclient.auth.GnocchiNoAuthPlugin(user_id, project_id, roles, endpoint)¶
Bases:
BaseAuthPluginNo authentication plugin for Gnocchi.
This is a keystoneauth plugin that instead of doing authentication, it just fill the ‘x-user-id’ and ‘x-project-id’ headers with the user provided one.
- get_auth_ref(session, **kwargs)¶
Return the authentication reference of an auth plugin.
- Parameters:
session – A session object to be used for communication
- Returns:
An access info object if supported.
- get_endpoint(session, **kwargs)¶
Return an endpoint for the client.
There are no required keyword arguments to
get_endpointas a plugin implementation should use best effort with the information available to determine the endpoint. However there are certain standard options that will be generated by the clients and should be used by plugins:service_type: what sort of service is required.service_name: the name of the service in the catalog.interface: what visibility the endpoint should have.region_name: the region the endpoint exists in.
- Parameters:
session – The session object that the auth_plugin belongs to.
kwargs – Ignored.
- Returns:
The base URL that will be used to talk to the required service or None if not available.
- get_headers(session, **kwargs)¶
Fetch authentication headers for request.
This is a more generalized replacement of the older
get_token()to allow plugins to specify different or additional authentication headers to the OpenStack standardX-Auth-Tokenheader.How the authentication headers are obtained is up to the plugin. If the headers are still valid they may be reused, retrieved from cache or the plugin may invoke an authentication request against a server.
The default implementation calls the
get_token()method to enable older style plugins to continue functioning unchanged. Subclasses should feel free to completely override this function to provide the headers that they want.Returning
Nonewill indicate that no token was able to be retrieved and that authorization was a failure. Adding no authentication data can be achieved by returning an empty dictionary.- Parameters:
session – The session object that the auth_plugin belongs to.
- Returns:
Headers that are set to authenticate a message or None for failure. Note that when checking this value that the empty dict is a valid, non-failure response.
- get_project_id(session, **kwargs)¶
Return the project id that we are authenticated to.
Wherever possible the project id should be inferred from the token however there are certain URLs and other places that require access to the currently authenticated project id.
- Parameters:
session – A session object so the plugin can make HTTP calls.
- Returns:
A project identifier or None if one is not available.
- get_user_id(session, **kwargs)¶
Return a unique user identifier of the plugin.
Wherever possible the user id should be inferred from the token however there are certain URLs and other places that require access to the currently authenticated user id.
- Parameters:
session – A session object so the plugin can make HTTP calls.
- Returns:
A user identifier or None if one is not available.
- class gnocchiclient.auth.GnocchiOpt(name: str, type: type[Any] = <class 'str'>, help: str | None = None, secret: bool = False, dest: str | None = None, deprecated: list[Opt] | None = None, default: Any = None, metavar: str | None = None, required: bool = False, prompt: str | None = None)¶
Bases:
Opt- property argparse_args¶
- property argparse_default¶