keystoneauth1.fixture.discovery module

class keystoneauth1.fixture.discovery.Any(*args, **kwargs)

Bases: object

Special type indicating an unconstrained type.

  • Any is assignable to every type.

  • Any assumed to have all methods and attributes.

  • All values are assignable to Any.

Note that all the above statements are true from the point of view of static type checkers. At runtime, Any cannot be used with instance checks.

__annotations_cache__ = {}
__dict__ = mappingproxy({'__module__': 'typing', '__firstlineno__': 588, '__doc__': 'Special type indicating an unconstrained type.\n\n- Any is assignable to every type.\n- Any assumed to have all methods and attributes.\n- All values are assignable to Any.\n\nNote that all the above statements are true from the point of view of\nstatic type checkers. At runtime, Any cannot be used with instance\nchecks.\n', '__new__': <staticmethod(<function Any.__new__>)>, '__static_attributes__': (), '__dict__': <attribute '__dict__' of 'Any' objects>, '__weakref__': <attribute '__weakref__' of 'Any' objects>, '__annotations_cache__': {}})
__doc__ = 'Special type indicating an unconstrained type.\n\n- Any is assignable to every type.\n- Any assumed to have all methods and attributes.\n- All values are assignable to Any.\n\nNote that all the above statements are true from the point of view of\nstatic type checkers. At runtime, Any cannot be used with instance\nchecks.\n'
__firstlineno__ = 588
__module__ = 'typing'
static __new__(cls, *args, **kwargs)
__static_attributes__ = ()
__weakref__

list of weak references to the object

class keystoneauth1.fixture.discovery.DiscoveryBase(id: str, *, status: str | None = None, updated: datetime | None = None)

Bases: dict[str, Any]

The basic version discovery structure.

All version discovery elements should have access to these values.

Parameters:
  • id – The version id for this version entry.

  • status – The status of this entry.

  • updated – When the API was last updated.

__annotate_func__ = None
__annotations_cache__ = {}
__dict__ = mappingproxy({'__module__': 'keystoneauth1.fixture.discovery', '__firstlineno__': 34, '__doc__': 'The basic version discovery structure.\n\nAll version discovery elements should have access to these values.\n\n:param id: The version id for this version entry.\n:param status: The status of this entry.\n:param updated: When the API was last updated.\n', '__init__': <function DiscoveryBase.__init__>, 'id': <property object>, 'status': <property object>, 'updated_str': <property object>, 'updated': <property object>, 'links': <property object>, 'add_link': <function DiscoveryBase.add_link>, 'media_types': <property object>, 'add_media_type': <function DiscoveryBase.add_media_type>, '__static_attributes__': ('id', 'status', 'updated', 'updated_str'), '__orig_bases__': (dict[str, typing.Any],), '__dict__': <attribute '__dict__' of 'DiscoveryBase' objects>, '__weakref__': <attribute '__weakref__' of 'DiscoveryBase' objects>, '__annotations_cache__': {}})
__doc__ = 'The basic version discovery structure.\n\nAll version discovery elements should have access to these values.\n\n:param id: The version id for this version entry.\n:param status: The status of this entry.\n:param updated: When the API was last updated.\n'
__firstlineno__ = 34
__init__(id: str, *, status: str | None = None, updated: datetime | None = None) → None
__module__ = 'keystoneauth1.fixture.discovery'
__orig_bases__ = (dict[str, typing.Any],)
__static_attributes__ = ('id', 'status', 'updated', 'updated_str')
__weakref__

list of weak references to the object

add_link(href: str, rel: str = 'self', type: str | None = None) → Link
add_media_type(base: str, type: str) → MediaType
property id: str
property links: list[Link]
property media_types: list[MediaType]
property status: str | None
property updated: datetime
property updated_str: str | None
class keystoneauth1.fixture.discovery.DiscoveryList(href: str | None = None, v2: bool = True, v3: bool = True, v2_id: str = 'v2.0', v3_id: str = 'v3.0', v2_status: str | None = None, v2_updated: datetime | None = None, v2_html: bool = True, v2_pdf: bool = True, v3_status: str | None = None, v3_updated: datetime | None = None, v3_json: bool = True, v3_xml: bool = True)

Bases: dict[str, Any]

A List of version elements.

Creates a correctly structured list of identity service endpoints for use in testing with discovery.

Parameters:
  • href – The url that this should be based at.

  • v2 – Add a v2 element.

  • v3 – Add a v3 element.

  • v2_status – The status to use for the v2 element.

  • v2_updated – The update time to use for the v2 element.

  • v2_html – True to add a html link to the v2 element.

  • v2_pdf – True to add a pdf link to the v2 element.

  • v3_status – The status to use for the v3 element.

  • v3_updated – The update time to use for the v3 element.

  • v3_json – True to add a html link to the v2 element.

  • v3_xml – True to add a pdf link to the v2 element.

TEST_URL = 'http://keystone.host:5000/'
__annotations_cache__ = {}
__dict__ = mappingproxy({'__module__': 'keystoneauth1.fixture.discovery', '__firstlineno__': 357, '__doc__': 'A List of version elements.\n\nCreates a correctly structured list of identity service endpoints for\nuse in testing with discovery.\n\n:param href: The url that this should be based at.\n:param v2: Add a v2 element.\n:param v3: Add a v3 element.\n:param v2_status: The status to use for the v2 element.\n:param v2_updated: The update time to use for the v2 element.\n:param v2_html: True to add a html link to the v2 element.\n:param v2_pdf: True to add a pdf link to the v2 element.\n:param v3_status: The status to use for the v3 element.\n:param v3_updated: The update time to use for the v3 element.\n:param v3_json: True to add a html link to the v2 element.\n:param v3_xml: True to add a pdf link to the v2 element.\n', 'TEST_URL': 'http://keystone.host:5000/', '__init__': <function DiscoveryList.__init__>, 'versions': <property object>, 'add_version': <function DiscoveryList.add_version>, 'add_v2': <function DiscoveryList.add_v2>, 'add_v3': <function DiscoveryList.add_v3>, 'add_microversion': <function DiscoveryList.add_microversion>, 'add_nova_microversion': <function DiscoveryList.add_nova_microversion>, '__static_attributes__': (), '__orig_bases__': (dict[str, typing.Any],), '__dict__': <attribute '__dict__' of 'DiscoveryList' objects>, '__weakref__': <attribute '__weakref__' of 'DiscoveryList' objects>, '__annotations_cache__': {}})
__doc__ = 'A List of version elements.\n\nCreates a correctly structured list of identity service endpoints for\nuse in testing with discovery.\n\n:param href: The url that this should be based at.\n:param v2: Add a v2 element.\n:param v3: Add a v3 element.\n:param v2_status: The status to use for the v2 element.\n:param v2_updated: The update time to use for the v2 element.\n:param v2_html: True to add a html link to the v2 element.\n:param v2_pdf: True to add a pdf link to the v2 element.\n:param v3_status: The status to use for the v3 element.\n:param v3_updated: The update time to use for the v3 element.\n:param v3_json: True to add a html link to the v2 element.\n:param v3_xml: True to add a pdf link to the v2 element.\n'
__firstlineno__ = 357
__init__(href: str | None = None, v2: bool = True, v3: bool = True, v2_id: str = 'v2.0', v3_id: str = 'v3.0', v2_status: str | None = None, v2_updated: datetime | None = None, v2_html: bool = True, v2_pdf: bool = True, v3_status: str | None = None, v3_updated: datetime | None = None, v3_json: bool = True, v3_xml: bool = True) → None
__module__ = 'keystoneauth1.fixture.discovery'
__orig_bases__ = (dict[str, typing.Any],)
__static_attributes__ = ()
__weakref__

list of weak references to the object

add_microversion(href: str, id: str, *, min_version: str = '', max_version: str = '', status: str | None = None, updated: datetime | None = None) → MicroversionDiscovery

Add a microversion version to the list.

The parameters are the same as MicroversionDiscovery.

add_nova_microversion(href: str, id: str, *, min_version: str = '', version: str = '', status: str | None = None, updated: datetime | None = None) → NovaMicroversionDiscovery

Add a nova microversion version to the list.

The parameters are the same as NovaMicroversionDiscovery.

add_v2(href: str, id: str = 'v2.0', *, html: bool = True, pdf: bool = True, status: str | None = None, updated: datetime | None = None) → V2Discovery

Add a v2 version to the list.

The parameters are the same as V2Discovery.

add_v3(href: str, id: str = 'v3.0', *, json: bool = True, xml: bool = True, status: str | None = None, updated: datetime | None = None) → V3Discovery

Add a v3 version to the list.

The parameters are the same as V3Discovery.

add_version(version: DiscoveryBase) → None

Add a new version structure to the list.

Parameters:

version – A new version structure to add to the list.

property versions: list[DiscoveryBase]
class keystoneauth1.fixture.discovery.Link

Bases: TypedDict

__annotate_func__()
__dict__ = mappingproxy({'__module__': 'keystoneauth1.fixture.discovery', '__firstlineno__': 23, '__static_attributes__': (), '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of 'Link' objects>, '__weakref__': <attribute '__weakref__' of 'Link' objects>, '__doc__': None, '__required_keys__': frozenset({'rel', 'href'}), '__optional_keys__': frozenset({'type'}), '__readonly_keys__': frozenset(), '__mutable_keys__': frozenset({'rel', 'type', 'href'}), '__total__': True, '__annotations_cache__': {'href': <class 'str'>, 'rel': <class 'str'>, 'type': typing.NotRequired[str]}})
__doc__ = None
__firstlineno__ = 23
__module__ = 'keystoneauth1.fixture.discovery'
__mutable_keys__ = frozenset({'href', 'rel', 'type'})
__optional_keys__ = frozenset({'type'})
__orig_bases__ = (<function TypedDict>,)
__readonly_keys__ = frozenset({})
__required_keys__ = frozenset({'href', 'rel'})
__static_attributes__ = ()
__total__ = True
__weakref__

list of weak references to the object

href: str
rel: str
type: NotRequired[str]
class keystoneauth1.fixture.discovery.MediaType

Bases: TypedDict

__annotate_func__()
__dict__ = mappingproxy({'__module__': 'keystoneauth1.fixture.discovery', '__firstlineno__': 29, '__static_attributes__': (), '__orig_bases__': (<function TypedDict>,), '__dict__': <attribute '__dict__' of 'MediaType' objects>, '__weakref__': <attribute '__weakref__' of 'MediaType' objects>, '__doc__': None, '__required_keys__': frozenset({'base', 'type'}), '__optional_keys__': frozenset(), '__readonly_keys__': frozenset(), '__mutable_keys__': frozenset({'base', 'type'}), '__total__': True, '__annotations_cache__': {'base': <class 'str'>, 'type': <class 'str'>}})
__doc__ = None
__firstlineno__ = 29
__module__ = 'keystoneauth1.fixture.discovery'
__mutable_keys__ = frozenset({'base', 'type'})
__optional_keys__ = frozenset({})
__orig_bases__ = (<function TypedDict>,)
__readonly_keys__ = frozenset({})
__required_keys__ = frozenset({'base', 'type'})
__static_attributes__ = ()
__total__ = True
__weakref__

list of weak references to the object

base: str
type: str
class keystoneauth1.fixture.discovery.MicroversionDiscovery(href: str, id: str, *, min_version: str = '', max_version: str = '', status: str | None = None, updated: datetime | None = None)

Bases: DiscoveryBase

A Version element that has microversions.

Provides some default values and helper methods for creating a microversion endpoint version structure. Clients should use this instead of creating their own structures.

Parameters:
  • href – The url that this entry should point to.

  • id – The version id that should be reported.

  • min_version – The minimum supported microversion. (optional)

  • max_version – The maximum supported microversion. (optional)

__annotate_func__ = None
__annotations_cache__ = {}
__doc__ = 'A Version element that has microversions.\n\nProvides some default values and helper methods for creating a microversion\nendpoint version structure. Clients should use this instead of creating\ntheir own structures.\n\n:param href: The url that this entry should point to.\n:param id: The version id that should be reported.\n:param min_version: The minimum supported microversion. (optional)\n:param max_version: The maximum supported microversion. (optional)\n'
__firstlineno__ = 140
__init__(href: str, id: str, *, min_version: str = '', max_version: str = '', status: str | None = None, updated: datetime | None = None) → None
__module__ = 'keystoneauth1.fixture.discovery'
__static_attributes__ = ('max_version', 'min_version')
property max_version: str
property min_version: str
class keystoneauth1.fixture.discovery.NovaMicroversionDiscovery(href: str, id: str, *, min_version: str = '', version: str = '', status: str | None = None, updated: datetime | None = None)

Bases: DiscoveryBase

A Version element with nova-style microversions.

Provides some default values and helper methods for creating a microversion endpoint version structure. Clients should use this instead of creating their own structures.

Parameters:
  • href – The url that this entry should point to.

  • id – The version id that should be reported.

  • min_version – The minimum microversion supported. (optional)

  • version – The maximum microversion supported. (optional)

__annotate_func__ = None
__annotations_cache__ = {}
__doc__ = 'A Version element with nova-style microversions.\n\nProvides some default values and helper methods for creating a microversion\nendpoint version structure. Clients should use this instead of creating\ntheir own structures.\n\n:param href: The url that this entry should point to.\n:param id: The version id that should be reported.\n:param min_version: The minimum microversion supported. (optional)\n:param version: The maximum microversion supported. (optional)\n'
__firstlineno__ = 189
__init__(href: str, id: str, *, min_version: str = '', version: str = '', status: str | None = None, updated: datetime | None = None) → None
__module__ = 'keystoneauth1.fixture.discovery'
__static_attributes__ = ('min_version', 'version')
property min_version: str
property version: str
keystoneauth1.fixture.discovery.TypedDict(typename, fields=<sentinel>, /, *, total=True)

A simple typed namespace. At runtime it is equivalent to a plain dict.

TypedDict creates a dictionary type such that a type checker will expect all instances to have a certain set of keys, where each key is associated with a value of a consistent type. This expectation is not checked at runtime.

Usage:

>>> class Point2D(TypedDict):
...     x: int
...     y: int
...     label: str
...
>>> a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
>>> b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check
>>> Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')
True

The type info can be accessed by calling annotationlib.get_annotations(Point2D), and via the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets. TypedDict supports an additional equivalent form:

Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})

By default, all keys must be present in a TypedDict. It is possible to override this by using the NotRequired and Required special forms:

class Point2D(TypedDict):
    x: int               # the "x" key must always be present (Required is the default)
    y: NotRequired[int]  # the "y" key can be omitted

This means that a Point2D TypedDict can have the “y” key omitted, but the “x” key must be present. Items are required by default, so the Required special form is not necessary in this example. In addition, the total argument to the TypedDict function can be used to make all items not required:

class Point2D(TypedDict, total=False):
    x: int
    y: int

This means that a Point2D TypedDict can have any of the keys omitted. A type checker is only expected to support a literal False or True as the value of the total argument. True is the default, and makes all items defined in the class body be required. The Required special form can be used to mark individual keys as required in a total=False TypedDict.

The ReadOnly special form can be used to mark individual keys as immutable for type checkers:

class DatabaseUser(TypedDict):
    id: ReadOnly[int]  # the "id" key must not be modified
    username: str      # the "username" key can be changed

See PEPs 589, 655, and 705 for more information.

class keystoneauth1.fixture.discovery.V2Discovery(href: str, id: str = 'v2.0', *, html: bool = True, pdf: bool = True, status: str | None = None, updated: datetime | None = None)

Bases: DiscoveryBase

A Version element for a V2 identity service endpoint.

Provides some default values and helper methods for creating a v2.0 endpoint version structure. Clients should use this instead of creating their own structures.

Parameters:
  • href – The url that this entry should point to.

  • id – The version id that should be reported. (optional) Defaults to ‘v2.0’.

  • html – Add HTML describedby links to the structure.

  • pdf – Add PDF describedby links to the structure.

_DESC_URL = 'https://developer.openstack.org/api-ref/identity/v2/'
__annotations_cache__ = {}
__doc__ = "A Version element for a V2 identity service endpoint.\n\nProvides some default values and helper methods for creating a v2.0\nendpoint version structure. Clients should use this instead of creating\ntheir own structures.\n\n:param href: The url that this entry should point to.\n:param id: The version id that should be reported. (optional) Defaults to\n    'v2.0'.\n:param html: Add HTML describedby links to the structure.\n:param pdf: Add PDF describedby links to the structure.\n\n"
__firstlineno__ = 240
__init__(href: str, id: str = 'v2.0', *, html: bool = True, pdf: bool = True, status: str | None = None, updated: datetime | None = None)
__module__ = 'keystoneauth1.fixture.discovery'
__static_attributes__ = ()
add_html_description() → None

Add the HTML described by links.

The standard structure includes a link to a HTML document with the API specification. Add it to this entry.

add_pdf_description() → None

Add the PDF described by links.

The standard structure includes a link to a PDF document with the API specification. Add it to this entry.

class keystoneauth1.fixture.discovery.V3Discovery(href: str, id: str = 'v3.0', *, json: bool = True, xml: bool = True, status: str | None = None, updated: datetime | None = None)

Bases: DiscoveryBase

A Version element for a V3 identity service endpoint.

Provides some default values and helper methods for creating a v3 endpoint version structure. Clients should use this instead of creating their own structures.

Parameters:
  • href – The url that this entry should point to.

  • id – The version id that should be reported. (optional) Defaults to ‘v3.0’.

  • json – Add JSON media-type elements to the structure.

  • xml – Add XML media-type elements to the structure.

__annotations_cache__ = {}
__doc__ = "A Version element for a V3 identity service endpoint.\n\nProvides some default values and helper methods for creating a v3\nendpoint version structure. Clients should use this instead of creating\ntheir own structures.\n\n:param href: The url that this entry should point to.\n:param id: The version id that should be reported. (optional) Defaults to\n    'v3.0'.\n:param json: Add JSON media-type elements to the structure.\n:param xml: Add XML media-type elements to the structure.\n"
__firstlineno__ = 301
__init__(href: str, id: str = 'v3.0', *, json: bool = True, xml: bool = True, status: str | None = None, updated: datetime | None = None)
__module__ = 'keystoneauth1.fixture.discovery'
__static_attributes__ = ()
add_json_media_type() → None

Add the JSON media-type links.

The standard structure includes a list of media-types that the endpoint supports. Add JSON to the list.

add_xml_media_type() → None

Add the XML media-type links.

The standard structure includes a list of media-types that the endpoint supports. Add XML to the list.

class keystoneauth1.fixture.discovery.VersionDiscovery(href: str, id: str, *, status: str | None = None, updated: datetime | None = None)

Bases: DiscoveryBase

A Version element for non-keystone services without microversions.

Provides some default values and helper methods for creating a microversion endpoint version structure. Clients should use this instead of creating their own structures.

Parameters:
  • href – The url that this entry should point to.

  • id – The version id that should be reported.

__annotations_cache__ = {}
__doc__ = 'A Version element for non-keystone services without microversions.\n\nProvides some default values and helper methods for creating a microversion\nendpoint version structure. Clients should use this instead of creating\ntheir own structures.\n\n:param href: The url that this entry should point to.\n:param id: The version id that should be reported.\n'
__firstlineno__ = 116
__init__(href: str, id: str, *, status: str | None = None, updated: datetime | None = None) → None
__module__ = 'keystoneauth1.fixture.discovery'
__static_attributes__ = ()