keystoneauth1.loading.opts module

class keystoneauth1.loading.opts.Opt(name, type=<class 'str'>, help=None, secret=False, dest=None, deprecated=None, default=None, metavar=None, required=False, prompt=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.

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

property argparse_args
property argparse_default