# keystoneauth1.access.service_catalog module

class keystoneauth1.access.service_catalog.ServiceCatalog(catalog: list[dict[str, Any]])

  Bases: `object`

  Helper methods for dealing with a Keystone Service Catalog.

  __abstractmethods__ = frozenset({'from_token', 'is_interface_match'})
  __annotations_cache__ = {}
  __dict__ = mappingproxy({'__module__': 'keystoneauth1.access.service_catalog', '__firstlineno__': 31, '__doc__': 'Helper methods for dealing with a Keystone Service Catalog.', '__init__': <function ServiceCatalog.__init__>, 'from_token': <classmethod(<function ServiceCatalog.from_token>)>, '_get_endpoint_region': <function ServiceCatalog._get_endpoint_region>, 'catalog': <property object>, 'is_interface_match': <function ServiceCatalog.is_interface_match>, 'normalize_interface': <staticmethod(<function ServiceCatalog.normalize_interface>)>, '_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>, '__static_attributes__': ('_catalog',), '__dict__': <attribute '__dict__' of 'ServiceCatalog' objects>, '__weakref__': <attribute '__weakref__' of 'ServiceCatalog' objects>, '__abstractmethods__': frozenset({'is_interface_match', 'from_token'}), '_abc_impl': <_abc._abc_data object>, '__annotations_cache__': {}})
  __doc__ = 'Helper methods for dealing with a Keystone Service Catalog.'
  __firstlineno__ = 31
  __init__(catalog: list[dict[str, Any]])
  __module__ = 'keystoneauth1.access.service_catalog'
  __static_attributes__ = ('_catalog',)
  __weakref__

    list of weak references to the object

  _abc_impl = <_abc._abc_data object>
  _denormalize_endpoints(endpoints: list[EndpointData]) → list[str | None]

    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: str | None, endpoints: dict[str, list[EndpointData]]) → dict[str, list[EndpointData]]

    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[str, str]) → str | None
  _get_interface_list(interface: str | list[str] | tuple[str] | set[str] | None) → list[str]
  _normalize_endpoints(endpoints: list[dict[str, Any]]) → list[dict[str, Any]]

    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: list[dict[str, Any]]

    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: str | None = None, interface: str | list[str] | tuple[str] | set[str] | None = 'public', region_name: str | None = None, service_name: str | None = None, service_id: str | None = None, endpoint_id: str | None = None) → 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.

  abstractmethod classmethod from_token(token: dict[str, Any]) → Self

    Retrieve the service catalog from a token.

    Parameters:

      token

    Returns:

      A service catalog.

  get_endpoint_data_list(service_type: str | None = None, interface: str | list[str] | tuple[str] | set[str] | None = 'public', region_name: str | None = None, service_name: str | None = None, service_id: str | None = None, endpoint_id: str | None = None) → list[EndpointData]

    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: str | None = None, interface: str | list[str] | tuple[str] | set[str] | None = None, region_name: str | None = None, service_name: str | None = None, service_id: str | None = None, endpoint_id: str | None = None) → dict[str, list[str | None]]

    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: str | None = None, interface: str | list[str] | tuple[str] | set[str] | None = None, region_name: str | None = None, service_name: str | None = None, service_id: str | None = None, endpoint_id: str | None = None) → dict[str, list[EndpointData]]

    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: str | None = None, interface: str | list[str] | tuple[str] | set[str] | None = 'public', region_name: str | None = None, service_name: str | None = None, service_id: str | None = None, endpoint_id: str | None = None) → tuple[str | None, ...]

    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

  abstractmethod is_interface_match(endpoint: dict[str, str], 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[dict[str, Any]]

    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: str | None = None, interface: str | list[str] | tuple[str] | set[str] | None = 'public', region_name: str | None = None, service_name: str | None = None, service_id: str | None = None, endpoint_id: str | None = None) → str | None

    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[dict[str, Any]])

  Bases: `ServiceCatalog`

  An object for encapsulating the v2 service catalog.

  The object is created using raw v2 auth token from Keystone.

  __abstractmethods__ = frozenset({})
  __annotations_cache__ = {}
  __doc__ = 'An object for encapsulating the v2 service catalog.\n\nThe object is created using raw v2 auth token from Keystone.\n'
  __firstlineno__ = 535
  __module__ = 'keystoneauth1.access.service_catalog'
  __static_attributes__ = ()
  _abc_impl = <_abc._abc_data object>
  _denormalize_endpoints(endpoints: list[EndpointData]) → list[str | None]

    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[dict[str, Any]]) → list[dict[str, Any]]

    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[str, Any]) → Self

    Retrieve the service catalog from a token.

    Parameters:

      token

    Returns:

      A service catalog.

  is_interface_match(endpoint: dict[str, str], 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[dict[str, Any]])

  Bases: `ServiceCatalog`

  An object for encapsulating the v3 service catalog.

  The object is created using raw v3 auth token from Keystone.

  __abstractmethods__ = frozenset({})
  __annotations_cache__ = {}
  __doc__ = 'An object for encapsulating the v3 service catalog.\n\nThe object is created using raw v3 auth token from Keystone.\n'
  __firstlineno__ = 619
  __module__ = 'keystoneauth1.access.service_catalog'
  __static_attributes__ = ()
  _abc_impl = <_abc._abc_data object>
  classmethod from_token(token: dict[str, Any]) → Self

    Retrieve the service catalog from a token.

    Parameters:

      token

    Returns:

      A service catalog.

  is_interface_match(endpoint: dict[str, str], 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.

this page last updated: 2026-03-25 21:01:07

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug