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.

Return type:

list

plugin_class

alias of GnocchiBasicPlugin

class gnocchiclient.auth.GnocchiBasicPlugin(user, endpoint)

Bases: BaseAuthPlugin

Basic authentication plugin for Gnocchi.

get_auth_ref(session, **kwargs)

Return the authentication reference of an auth plugin.

There are no required kwargs. They are passed directly to the auth plugin and they are implementation specific.

Parameters:

session (keystoneauth1.session.session) – A session object to be used for communication

get_endpoint(session, **kwargs)

Return an endpoint for the client.

There are no required keyword arguments to get_endpoint as 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 (keystoneauth1.session.Session) – The session object that the auth_plugin belongs to.

Returns:

The base URL that will be used to talk to the required service or None if not available.

Return type:

string

get_headers(session, **kwargs)

Fetch authentication headers for message.

This is a more generalized replacement of the older get_token to allow plugins to specify different or additional authentication headers to the OpenStack standard ‘X-Auth-Token’ header.

How the authentication headers are obtained is up to the plugin. If the headers are still valid they may be re-used, retrieved from cache or the plugin may invoke an authentication request against a server.

The default implementation of get_headers 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.

There are no required kwargs. They are passed directly to the auth plugin and they are implementation specific.

Returning None will 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 (keystoneauth1.session.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.

Return type:

dict

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.

Return type:

list

plugin_class

alias of GnocchiNoAuthPlugin

class gnocchiclient.auth.GnocchiNoAuthPlugin(user_id, project_id, roles, endpoint)

Bases: BaseAuthPlugin

No 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.

There are no required kwargs. They are passed directly to the auth plugin and they are implementation specific.

Parameters:

session (keystoneauth1.session.session) – A session object to be used for communication

get_endpoint(session, **kwargs)

Return an endpoint for the client.

There are no required keyword arguments to get_endpoint as 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 (keystoneauth1.session.Session) – The session object that the auth_plugin belongs to.

Returns:

The base URL that will be used to talk to the required service or None if not available.

Return type:

string

get_headers(session, **kwargs)

Fetch authentication headers for message.

This is a more generalized replacement of the older get_token to allow plugins to specify different or additional authentication headers to the OpenStack standard ‘X-Auth-Token’ header.

How the authentication headers are obtained is up to the plugin. If the headers are still valid they may be re-used, retrieved from cache or the plugin may invoke an authentication request against a server.

The default implementation of get_headers 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.

There are no required kwargs. They are passed directly to the auth plugin and they are implementation specific.

Returning None will 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 (keystoneauth1.session.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.

Return type:

dict

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 (keystoneauth1.session.Session) – A session object so the plugin can make HTTP calls.

Returns:

A project identifier or None if one is not available.

Return type:

str

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 (keystoneauth1.session.Session) – A session object so the plugin can make HTTP calls.

Returns:

A user identifier or None if one is not available.

Return type:

str

class gnocchiclient.auth.GnocchiOpt(name, type=<class 'str'>, help=None, secret=False, dest=None, deprecated=None, default=None, metavar=None, required=False, prompt=None)

Bases: Opt

property argparse_args
property argparse_default