keystoneauth1.access.service_catalog module¶
-
class
keystoneauth1.access.service_catalog.
ServiceCatalog
(catalog: list) Bases:
object
Helper methods for dealing with a Keystone Service Catalog.
-
__abstractmethods__
= frozenset({'from_token', 'is_interface_match'})
-
__dict__
= mappingproxy({'__module__': 'keystoneauth1.access.service_catalog', '__doc__': 'Helper methods for dealing with a Keystone Service Catalog.', '__init__': <function ServiceCatalog.__init__>, 'from_token': <classmethod object>, '_get_endpoint_region': <function ServiceCatalog._get_endpoint_region>, 'catalog': <property object>, 'is_interface_match': <function ServiceCatalog.is_interface_match>, 'normalize_interface': <staticmethod object>, '_normalize_endpoints': <function ServiceCatalog._normalize_endpoints>, '_denormalize_endpoints': <function ServiceCatalog._denormalize_endpoints>, 'normalize_catalog': <function ServiceCatalog.normalize_catalog>, '_get_interface_list': <function ServiceCatalog._get_interface_list>, 'get_endpoints_data': <function ServiceCatalog.get_endpoints_data>, '_endpoints_by_type': <function ServiceCatalog._endpoints_by_type>, 'get_endpoints': <function ServiceCatalog.get_endpoints>, 'get_endpoint_data_list': <function ServiceCatalog.get_endpoint_data_list>, 'get_urls': <function ServiceCatalog.get_urls>, 'url_for': <function ServiceCatalog.url_for>, 'endpoint_data_for': <function ServiceCatalog.endpoint_data_for>, '__dict__': <attribute '__dict__' of 'ServiceCatalog' objects>, '__weakref__': <attribute '__weakref__' of 'ServiceCatalog' objects>, '__abstractmethods__': frozenset({'from_token', 'is_interface_match'}), '_abc_impl': <_abc._abc_data object>, '__annotations__': {}})
-
__doc__
= 'Helper methods for dealing with a Keystone Service Catalog.'
-
__init__
(catalog: list) Initialize self. See help(type(self)) for accurate signature.
-
__module__
= 'keystoneauth1.access.service_catalog'
-
__weakref__
list of weak references to the object (if defined)
-
_abc_impl
= <_abc._abc_data object>
-
_denormalize_endpoints
(endpoints: list) → list Return original endpoint description dicts.
Takes a list of EndpointData objects and returns the original dict that was returned from the catalog.
- Parameters
endpoints (list) – List of keystoneauth1.discover.EndpointData
- Returns
List of endpoint description dicts in original catalog format
-
_endpoints_by_type
(requested: Optional[str], endpoints: dict) → dict Get the approrpriate endpoints from the list of given endpoints.
Per the service type alias rules:
If a user requests a service by its proper name and that matches, win.
If a user requests a service by its proper name and only a single alias matches, win.
If a user requests a service by its proper name and more than one alias matches, choose the first alias from the list given.
Do the “first alias” match after the other filters, as they might limit the number of choices for us otherwise.
- Parameters
requested (str) – The service_type as requested by the user.
endpoints (dict) – A dictionary keyed by found service_type. Values are opaque to this method.
- Returns
Dict of service_type/endpoints filtered for the appropriate service_type based on alias matching rules.
-
_get_endpoint_region
(endpoint: dict) → Optional[str]
-
_get_interface_list
(interface: Optional[Union[str, list, tuple, set]]) → list
-
_normalize_endpoints
(endpoints: list) → list Translate endpoint description dicts into v3 form.
Takes a raw endpoint description from the catalog and changes it to be in v3 format. It also saves a copy of the data in raw_endpoint so that it can be returned by methods that expect the actual original data.
- Parameters
endpoints (list) – List of endpoint description dicts
- Returns
List of endpoint description dicts in v3 format
-
property
catalog
Return the raw service catalog content, mostly useful for debugging.
Applications should avoid this and use accessor methods instead. However, there are times when inspecting the raw catalog can be useful for analysis and other reasons.
-
endpoint_data_for
(service_type: Optional[str] = None, interface: Optional[Union[str, list, tuple, set]] = 'public', region_name: Optional[str] = None, service_name: Optional[str] = None, service_id: Optional[str] = None, endpoint_id: Optional[str] = None) → keystoneauth1.discover.EndpointData Fetch endpoint data from the service catalog.
Fetch the specified endpoint data from the service catalog for a particular endpoint attribute. If no attribute is given, return the first endpoint of the specified type.
- Valid interface types: public or publicURL,
internal or internalURL, admin or ‘adminURL`
- Parameters
service_type (string) – Service type of the endpoint.
interface – Type of endpoint. Can be a single value or a list of values. If it’s a list of values, they will be looked for in order of preference.
region_name (string) – Region of the endpoint.
service_name (string) – The assigned name of the service.
service_id (string) – The identifier of a service.
endpoint_id (string) – The identifier of an endpoint.
-
abstract classmethod
from_token
(token: dict) → typing_extensions.Self Retrieve the service catalog from a token.
- Parameters
token –
- Returns
A service catalog.
-
get_endpoint_data_list
(service_type: Optional[str] = None, interface: Optional[Union[str, list, tuple, set]] = 'public', region_name: Optional[str] = None, service_name: Optional[str] = None, service_id: Optional[str] = None, endpoint_id: Optional[str] = None) → list Fetch a flat list of matching EndpointData objects.
Fetch the endpoints from the service catalog for a particular endpoint attribute. If no attribute is given, return the first endpoint of the specified type.
- Valid interface types: public or publicURL,
internal or internalURL, admin or ‘adminURL`
- Parameters
service_type (string) – Service type of the endpoint.
interface – Type of endpoint. Can be a single value or a list of values. If it’s a list of values, they will be looked for in order of preference.
region_name (string) – Region of the endpoint.
service_name (string) – The assigned name of the service.
service_id (string) – The identifier of a service.
endpoint_id (string) – The identifier of an endpoint.
- Returns
a list of matching EndpointData objects
- Return type
list(keystoneauth1.discover.EndpointData)
-
get_endpoints
(service_type: Optional[str] = None, interface: Optional[Union[str, list, tuple, set]] = None, region_name: Optional[str] = None, service_name: Optional[str] = None, service_id: Optional[str] = None, endpoint_id: Optional[str] = None) → dict Fetch and filter endpoint data for the specified service(s).
Returns endpoints for the specified service (or all) containing the specified type (or all) and region (or all) and service name.
If there is no name in the service catalog the service_name check will be skipped. This allows compatibility with services that existed before the name was available in the catalog.
Returns a dict keyed by service_type with a list of endpoint dicts
-
get_endpoints_data
(service_type: Optional[str] = None, interface: Optional[Union[str, list, tuple, set]] = None, region_name: Optional[str] = None, service_name: Optional[str] = None, service_id: Optional[str] = None, endpoint_id: Optional[str] = None) → dict Fetch and filter endpoint data for the specified service(s).
Returns endpoints for the specified service (or all) containing the specified type (or all) and region (or all) and service name.
If there is no name in the service catalog the service_name check will be skipped. This allows compatibility with services that existed before the name was available in the catalog.
- Valid interface types: public or publicURL,
internal or internalURL, admin or ‘adminURL`
- Parameters
service_type (string) – Service type of the endpoint.
interface – Type of endpoint. Can be a single value or a list of values. If it’s a list of values, they will be looked for in order of preference.
region_name (string) – Region of the endpoint.
service_name (string) – The assigned name of the service.
service_id (string) – The identifier of a service.
endpoint_id (string) – The identifier of an endpoint.
- Returns
a dict, keyed by service_type, of lists of EndpointData
-
get_urls
(service_type: Optional[str] = None, interface: Optional[Union[str, list, tuple, set]] = 'public', region_name: Optional[str] = None, service_name: Optional[str] = None, service_id: Optional[str] = None, endpoint_id: Optional[str] = None) → tuple Fetch endpoint urls from the service catalog.
Fetch the urls of endpoints from the service catalog for a particular endpoint attribute. If no attribute is given, return the url of the first endpoint of the specified type.
- Valid interface types: public or publicURL,
internal or internalURL, admin or ‘adminURL`
- Parameters
service_type (string) – Service type of the endpoint.
interface – Type of endpoint. Can be a single value or a list of values. If it’s a list of values, they will be looked for in order of preference.
region_name (string) – Region of the endpoint.
service_name (string) – The assigned name of the service.
service_id (string) – The identifier of a service.
endpoint_id (string) – The identifier of an endpoint.
- Returns
tuple of urls
-
abstract
is_interface_match
(endpoint: dict, interface: str) → bool Helper function to normalize endpoint matching across v2 and v3.
- Returns
True if the provided endpoint matches the required interface otherwise False.
-
normalize_catalog
() → list Return the catalog normalized into v3 format.
-
static
normalize_interface
(interface: str) → str Handle differences in the way v2 and v3 catalogs specify endpoint.
Both v2 and v3 must be able to handle the endpoint style of the other. For example v2 must be able to handle a ‘public’ interface and v3 must be able to handle a ‘publicURL’ interface.
- Returns
the endpoint string in the format appropriate for this service catalog.
-
url_for
(service_type: Optional[str] = None, interface: Optional[Union[str, list, tuple, set]] = 'public', region_name: Optional[str] = None, service_name: Optional[str] = None, service_id: Optional[str] = None, endpoint_id: Optional[str] = None) → Optional[str] Fetch an endpoint from the service catalog.
Fetch the specified endpoint from the service catalog for a particular endpoint attribute. If no attribute is given, return the first endpoint of the specified type.
- Valid interface types: public or publicURL,
internal or internalURL, admin or ‘adminURL`
- Parameters
service_type (string) – Service type of the endpoint.
interface – Type of endpoint. Can be a single value or a list of values. If it’s a list of values, they will be looked for in order of preference.
region_name (string) – Region of the endpoint.
service_name (string) – The assigned name of the service.
service_id (string) – The identifier of a service.
endpoint_id (string) – The identifier of an endpoint.
-
-
class
keystoneauth1.access.service_catalog.
ServiceCatalogV2
(catalog: list) Bases:
keystoneauth1.access.service_catalog.ServiceCatalog
An object for encapsulating the v2 service catalog.
The object is created using raw v2 auth token from Keystone.
-
__abstractmethods__
= frozenset({})
-
__doc__
= 'An object for encapsulating the v2 service catalog.\n\n The object is created using raw v2 auth token from Keystone.\n '
-
__module__
= 'keystoneauth1.access.service_catalog'
-
_abc_impl
= <_abc._abc_data object>
-
_denormalize_endpoints
(endpoints: list) → list Return original endpoint description dicts.
Takes a list of EndpointData objects and returns the original dict that was returned from the catalog.
- Parameters
endpoints (list) – List of keystoneauth1.discover.EndpointData
- Returns
List of endpoint description dicts in original catalog format
-
_normalize_endpoints
(endpoints: list) → list Translate endpoint description dicts into v3 form.
Takes a raw endpoint description from the catalog and changes it to be in v3 format. It also saves a copy of the data in raw_endpoint so that it can be returned by methods that expect the actual original data.
- Parameters
endpoints (list) – List of endpoint description dicts
- Returns
List of endpoint description dicts in v3 format
-
classmethod
from_token
(token: dict) → typing_extensions.Self Retrieve the service catalog from a token.
- Parameters
token –
- Returns
A service catalog.
-
is_interface_match
(endpoint: dict, interface: str) → bool Helper function to normalize endpoint matching across v2 and v3.
- Returns
True if the provided endpoint matches the required interface otherwise False.
-
static
normalize_interface
(interface: str) → str Handle differences in the way v2 and v3 catalogs specify endpoint.
Both v2 and v3 must be able to handle the endpoint style of the other. For example v2 must be able to handle a ‘public’ interface and v3 must be able to handle a ‘publicURL’ interface.
- Returns
the endpoint string in the format appropriate for this service catalog.
-
-
class
keystoneauth1.access.service_catalog.
ServiceCatalogV3
(catalog: list) Bases:
keystoneauth1.access.service_catalog.ServiceCatalog
An object for encapsulating the v3 service catalog.
The object is created using raw v3 auth token from Keystone.
-
__abstractmethods__
= frozenset({})
-
__doc__
= 'An object for encapsulating the v3 service catalog.\n\n The object is created using raw v3 auth token from Keystone.\n '
-
__module__
= 'keystoneauth1.access.service_catalog'
-
_abc_impl
= <_abc._abc_data object>
-
classmethod
from_token
(token: dict) → typing_extensions.Self Retrieve the service catalog from a token.
- Parameters
token –
- Returns
A service catalog.
-
is_interface_match
(endpoint: dict, interface: str) → bool Helper function to normalize endpoint matching across v2 and v3.
- Returns
True if the provided endpoint matches the required interface otherwise False.
-
static
normalize_interface
(interface: str) → str Handle differences in the way v2 and v3 catalogs specify endpoint.
Both v2 and v3 must be able to handle the endpoint style of the other. For example v2 must be able to handle a ‘public’ interface and v3 must be able to handle a ‘publicURL’ interface.
- Returns
the endpoint string in the format appropriate for this service catalog.
-