keystoneauth1.loading package

Submodules

Module contents

class keystoneauth1.loading.BaseFederationLoader

Bases: BaseV3Loader[V3FederationPluginT]

Base Option handling for federation plugins.

This class defines options and handling that should be common to the V3 identity federation API. It provides the options expected by the keystoneauth1.identity.v3.FederationBaseAuth class.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__doc__ = 'Base Option handling for federation plugins.\n\n    This class defines options and handling that should be common to the V3\n    identity federation API. It provides the options expected by the\n    :py:class:`keystoneauth1.identity.v3.FederationBaseAuth` class.\n    '
__module__ = 'keystoneauth1.loading.identity'
__orig_bases__ = (keystoneauth1.loading.identity.BaseV3Loader[~V3FederationPluginT],)
__parameters__ = (~V3FederationPluginT,)
_abc_impl = <_abc._abc_data object>
get_options() List[Opt]

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

class keystoneauth1.loading.BaseGenericLoader

Bases: BaseIdentityLoader[GenericPluginT]

Base Option handling for generic plugins.

This class defines options and handling that should be common to generic plugins. These plugins target the OpenStack identity service however are designed to be independent of API version. It provides the options expected by the keystoneauth1.identity.v3.BaseGenericPlugin class.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__doc__ = 'Base Option handling for generic plugins.\n\n    This class defines options and handling that should be common to generic\n    plugins. These plugins target the OpenStack identity service however are\n    designed to be independent of API version. It provides the options expected\n    by the :py:class:`keystoneauth1.identity.v3.BaseGenericPlugin` class.\n    '
__module__ = 'keystoneauth1.loading.identity'
__orig_bases__ = (keystoneauth1.loading.identity.BaseIdentityLoader[~GenericPluginT],)
__parameters__ = (~GenericPluginT,)
_abc_impl = <_abc._abc_data object>
get_options() List[Opt]

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

class keystoneauth1.loading.BaseIdentityLoader

Bases: BaseLoader[PluginT]

Base Option handling for identity plugins.

This class defines options and handling that should be common across all plugins that are developed against the OpenStack identity service. It provides the options expected by the keystoneauth1.identity.BaseIdentityPlugin class.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__doc__ = 'Base Option handling for identity plugins.\n\n    This class defines options and handling that should be common across all\n    plugins that are developed against the OpenStack identity service. It\n    provides the options expected by the\n    :py:class:`keystoneauth1.identity.BaseIdentityPlugin` class.\n    '
__module__ = 'keystoneauth1.loading.identity'
__orig_bases__ = (keystoneauth1.loading.base.BaseLoader[~PluginT],)
__parameters__ = (~PluginT,)
_abc_impl = <_abc._abc_data object>
get_options() List[Opt]

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

class keystoneauth1.loading.BaseLoader

Bases: _BaseLoader[BaseAuthPluginT]

__abstractmethods__ = frozenset({'get_options'})
__annotations__ = {}
__doc__ = None
__module__ = 'keystoneauth1.loading.base'
__orig_bases__ = (keystoneauth1.loading.base._BaseLoader[+BaseAuthPluginT],)
__parameters__ = (+BaseAuthPluginT,)
_abc_impl = <_abc._abc_data object>
class keystoneauth1.loading.BaseV2Loader

Bases: BaseIdentityLoader[V2PluginT]

Base Option handling for identity plugins.

This class defines options and handling that should be common to the V2 identity API. It provides the options expected by the keystoneauth1.identity.v2.Auth class.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__doc__ = 'Base Option handling for identity plugins.\n\n    This class defines options and handling that should be common to the V2\n    identity API. It provides the options expected by the\n    :py:class:`keystoneauth1.identity.v2.Auth` class.\n    '
__module__ = 'keystoneauth1.loading.identity'
__orig_bases__ = (keystoneauth1.loading.identity.BaseIdentityLoader[~V2PluginT],)
__parameters__ = (~V2PluginT,)
_abc_impl = <_abc._abc_data object>
get_options() List[Opt]

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

class keystoneauth1.loading.BaseV3Loader

Bases: BaseIdentityLoader[V3PluginT]

Base Option handling for identity plugins.

This class defines options and handling that should be common to the V3 identity API. It provides the options expected by the keystoneauth1.identity.v3.Auth class.

__abstractmethods__ = frozenset({})
__annotations__ = {}
__doc__ = 'Base Option handling for identity plugins.\n\n    This class defines options and handling that should be common to the V3\n    identity API. It provides the options expected by the\n    :py:class:`keystoneauth1.identity.v3.Auth` class.\n    '
__module__ = 'keystoneauth1.loading.identity'
__orig_bases__ = (keystoneauth1.loading.identity.BaseIdentityLoader[~V3PluginT],)
__parameters__ = (~V3PluginT,)
_abc_impl = <_abc._abc_data object>
get_options() List[Opt]

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

load_from_options(**kwargs: Any) V3PluginT

Create a plugin from the arguments retrieved from get_options.

A client can override this function to do argument validation or to handle differences between the registered options and what is required to create the plugin.

class keystoneauth1.loading.Opt(name: str, type: ~typing.Type[~typing.Any] = <class 'str'>, help: str | None = None, secret: bool = False, dest: str | None = None, deprecated: ~typing.List[~keystoneauth1.loading.opts.Opt] | None = None, default: ~typing.Any | None = None, metavar: str | None = None, required: bool = False, prompt: str | None = None)

Bases: object

An option required by an authentication plugin.

Opts provide a means for authentication plugins that are going to be dynamically loaded to specify the parameters that are to be passed to the plugin on initialization.

The Opt specifies information about the way the plugin parameter is to be represented in different loading mechanisms.

When defining an Opt with a - the - should be present in the name parameter. This will automatically be converted to an _ when passing to the plugin initialization. For example, you should specify:

Opt('user-domain-id')

which will pass the value as user_domain_id to the plugin’s initialization.

Parameters:
  • name (str) – The name of the option.

  • type (callable) – The type of the option. This is a callable which is passed the raw option that was loaded (often a string) and is required to return the parameter in the type expected by __init__.

  • help (str) – The help text that is shown along with the option.

  • secret (bool) – If the parameter is secret it should not be printed or logged in debug output.

  • dest (str) – the name of the argument that will be passed to __init__. This allows you to have a different name in loading than is used by the __init__ function. Defaults to the value of name.

  • deprecated (keystoneauth1.loading.Opt) – A list of other options that are deprecated in favour of this one. This ensures the old options are still registered.

  • default – A default value that can be used if one is not provided.

  • metavar (str) – The <metavar> that should be printed in CLI help text.

  • required (bool) – If the option is required to load the plugin. If a required option is not present loading should fail.

  • prompt (str) – If the option can be requested via a prompt (where appropriate) set the string that should be used to prompt with.

__dict__ = mappingproxy({'__module__': 'keystoneauth1.loading.opts', '__doc__': "An option required by an authentication plugin.\n\n    Opts provide a means for authentication plugins that are going to be\n    dynamically loaded to specify the parameters that are to be passed to the\n    plugin on initialization.\n\n    The Opt specifies information about the way the plugin parameter is to be\n    represented in different loading mechanisms.\n\n    When defining an Opt with a - the - should be present in the name\n    parameter. This will automatically be converted to an _ when passing to the\n    plugin initialization. For example, you should specify::\n\n        Opt('user-domain-id')\n\n    which will pass the value as `user_domain_id` to the plugin's\n    initialization.\n\n    :param str name: The name of the option.\n    :param callable type: The type of the option. This is a callable which is\n        passed the raw option that was loaded (often a string) and is required\n        to return the parameter in the type expected by __init__.\n    :param str help: The help text that is shown along with the option.\n    :param bool secret: If the parameter is secret it should not be printed or\n        logged in debug output.\n    :param str dest: the name of the argument that will be passed to __init__.\n        This allows you to have a different name in loading than is used by the\n        __init__ function. Defaults to the value of name.\n    :param keystoneauth1.loading.Opt deprecated: A list of other options that\n        are deprecated in favour of this one. This ensures the old options are\n        still registered.\n    :type opt: list(Opt)\n    :param default: A default value that can be used if one is not provided.\n    :param str metavar: The <metavar> that should be printed in CLI help text.\n    :param bool required: If the option is required to load the plugin. If a\n        required option is not present loading should fail.\n    :param str prompt: If the option can be requested via a prompt (where\n        appropriate) set the string that should be used to prompt with.\n    ", '__init__': <function Opt.__init__>, '__repr__': <function Opt.__repr__>, '_to_oslo_opt': <function Opt._to_oslo_opt>, '__eq__': <function Opt.__eq__>, '_all_opts': <property object>, 'argparse_args': <property object>, 'argparse_default': <property object>, '__dict__': <attribute '__dict__' of 'Opt' objects>, '__weakref__': <attribute '__weakref__' of 'Opt' objects>, '__hash__': None, '__annotations__': {}})
__doc__ = "An option required by an authentication plugin.\n\n    Opts provide a means for authentication plugins that are going to be\n    dynamically loaded to specify the parameters that are to be passed to the\n    plugin on initialization.\n\n    The Opt specifies information about the way the plugin parameter is to be\n    represented in different loading mechanisms.\n\n    When defining an Opt with a - the - should be present in the name\n    parameter. This will automatically be converted to an _ when passing to the\n    plugin initialization. For example, you should specify::\n\n        Opt('user-domain-id')\n\n    which will pass the value as `user_domain_id` to the plugin's\n    initialization.\n\n    :param str name: The name of the option.\n    :param callable type: The type of the option. This is a callable which is\n        passed the raw option that was loaded (often a string) and is required\n        to return the parameter in the type expected by __init__.\n    :param str help: The help text that is shown along with the option.\n    :param bool secret: If the parameter is secret it should not be printed or\n        logged in debug output.\n    :param str dest: the name of the argument that will be passed to __init__.\n        This allows you to have a different name in loading than is used by the\n        __init__ function. Defaults to the value of name.\n    :param keystoneauth1.loading.Opt deprecated: A list of other options that\n        are deprecated in favour of this one. This ensures the old options are\n        still registered.\n    :type opt: list(Opt)\n    :param default: A default value that can be used if one is not provided.\n    :param str metavar: The <metavar> that should be printed in CLI help text.\n    :param bool required: If the option is required to load the plugin. If a\n        required option is not present loading should fail.\n    :param str prompt: If the option can be requested via a prompt (where\n        appropriate) set the string that should be used to prompt with.\n    "
__eq__(other: Any) bool

Define equality operator on option parameters.

__hash__ = None
__init__(name: str, type: ~typing.Type[~typing.Any] = <class 'str'>, help: str | None = None, secret: bool = False, dest: str | None = None, deprecated: ~typing.List[~keystoneauth1.loading.opts.Opt] | None = None, default: ~typing.Any | None = None, metavar: str | None = None, required: bool = False, prompt: str | None = None)
__module__ = 'keystoneauth1.loading.opts'
__repr__() str

Return string representation of option name.

__weakref__

list of weak references to the object (if defined)

property _all_opts: chain[Opt]
_to_oslo_opt() cfg.Opt
property argparse_args: List[str]
property argparse_default: Any
keystoneauth1.loading.get_adapter_conf_options(include_deprecated: bool = True, deprecated_opts: Dict[str, List[cfg.DeprecatedOpt]] | None = None) List[cfg.Opt]
keystoneauth1.loading.get_auth_common_conf_options() List[cfg.Opt]

Get the oslo_config options common for all auth plugins.

These may be useful without being registered for config file generation or to manipulate the options before registering them yourself.

The options that are set are:
auth_type:

The name of the plugin to load.

auth_section:

The config file section to load options from.

Returns:

A list of oslo_config options.

keystoneauth1.loading.get_auth_plugin_conf_options(plugin: BaseLoader[BaseAuthPluginT] | str) List[cfg.Opt]

Get the oslo_config options for a specific plugin.

This will be the list of config options that is registered and loaded by the specified plugin.

Parameters:

plugin (str or keystoneauth1.loading.BaseLoader) – The name of the plugin loader or a plugin loader object

Returns:

A list of oslo_config options.

keystoneauth1.loading.get_available_plugin_loaders() Dict[str, BaseLoader[BaseAuthPluginT]]

Retrieve all the plugin classes available on the system.

Returns:

A dict with plugin entrypoint name as the key and the plugin loader as the value.

Return type:

dict

keystoneauth1.loading.get_available_plugin_names() FrozenSet[str]

Get the names of all the plugins that are available on the system.

This is particularly useful for help and error text to prompt a user for example what plugins they may specify.

Returns:

A list of names.

Return type:

frozenset

keystoneauth1.loading.get_plugin_loader(name: str) BaseLoader[BaseAuthPluginT]

Retrieve a plugin class by its entrypoint name.

Parameters:

name (str) – The name of the object to get.

Returns:

An auth plugin class.

Return type:

keystoneauth1.loading.BaseLoader

Raises:

keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin – if a plugin cannot be created.

keystoneauth1.loading.get_plugin_options(name: str) List[opts.Opt]

Get the options for a specific plugin.

This will be the list of options that is registered and loaded by the specified plugin.

Returns:

A list of keystoneauth1.loading.Opt options.

Raises:

keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin – if a plugin cannot be created.

keystoneauth1.loading.get_session_conf_options(deprecated_opts: Dict[str, List[cfg.DeprecatedOpt]] | None = None) List[cfg.Opt]
keystoneauth1.loading.load_adapter_from_conf_options(conf: cfg.ConfigOpts, group: str, **kwargs: Any) Adapter
keystoneauth1.loading.load_auth_from_argparse_arguments(namespace: Namespace, **kwargs: Any) plugin.BaseAuthPluginT | None

Retrieve the created plugin from the completed argparse results.

Loads and creates the auth plugin from the information parsed from the command line by argparse.

Parameters:

namespace (Namespace) – The result from CLI parsing.

Returns:

An auth plugin, or None if a name is not provided.

Return type:

keystoneauth1.plugin.BaseAuthPlugin

Raises:

keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin – if a plugin cannot be created.

keystoneauth1.loading.load_auth_from_conf_options(conf: cfg.ConfigOpts, group: str, **kwargs: Any) keystoneauth1.plugin.BaseAuthPlugin | None

Load a plugin from an oslo_config CONF object.

Each plugin will register their own required options and so there is no standard list and the plugin should be consulted.

The base options should have been registered with register_conf_options before this function is called.

Parameters:
Returns:

An authentication Plugin or None if a name is not provided

Return type:

keystoneauth1.plugin.BaseAuthPlugin

Raises:

keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin – if a plugin cannot be created.

keystoneauth1.loading.load_session_from_argparse_arguments(namespace: Namespace, **kwargs: Any) Session
keystoneauth1.loading.load_session_from_conf_options(conf: cfg.ConfigOpts, group: str, **kwargs: Any) Session
keystoneauth1.loading.register_adapter_argparse_arguments(parser: ArgumentParser, service_type: str | None = None) None
keystoneauth1.loading.register_adapter_conf_options(conf: cfg.ConfigOpts, group: str, include_deprecated: bool = True, deprecated_opts: Dict[str, List[cfg.DeprecatedOpt]] | None = None) List[cfg.Opt]
keystoneauth1.loading.register_auth_argparse_arguments(parser: ArgumentParser, argv: List[str], default: Any = None) BaseLoader[plugin.BaseAuthPluginT] | None

Register CLI options needed to create a plugin.

The function inspects the provided arguments so that it can also register the options required for that specific plugin if available.

Parameters:
  • parser (argparse.ArgumentParser) – the parser to attach argparse options to.

  • argv (list) – the arguments provided to the appliation.

  • default (str/class) – a default plugin name or a plugin object to use if one isn’t specified by the CLI. default: None.

Returns:

The plugin class that will be loaded or None if not provided.

Return type:

keystoneauth1.loader.BaseLoader

Raises:

keystoneauth1.exceptions.auth_plugins.NoMatchingPlugin – if a plugin cannot be created.

keystoneauth1.loading.register_auth_conf_options(conf: cfg.ConfigOpts, group: str) None

Register the oslo_config options that are needed for a plugin.

This only registers the basic options shared by all plugins. Options that are specific to a plugin are loaded just before they are read.

The defined options are:

  • auth_type: the name of the auth plugin that will be used for

    authentication.

  • auth_section: the group from which further auth plugin options should be

    taken. If section is not provided then the auth plugin options will be taken from the same group as provided in the parameters.

Parameters:
keystoneauth1.loading.register_service_adapter_argparse_arguments(parser: ArgumentParser, service_type: str) None
keystoneauth1.loading.register_session_argparse_arguments(parser: ArgumentParser) None
keystoneauth1.loading.register_session_conf_options(conf: cfg.ConfigOpts, group: str, deprecated_opts: Dict[str, List[cfg.DeprecatedOpt]] | None = None) List[cfg.Opt]