keystoneauth1.access.service_catalog module

keystoneauth1.access.service_catalog module

class keystoneauth1.access.service_catalog.ServiceCatalog(catalog)

Bases: object

Helper methods for dealing with a Keystone Service Catalog.

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=None, interface='public', region_name=None, service_name=None, service_id=None, endpoint_id=None)

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.

get_endpoint_data_list(service_type=None, interface='public', region_name=None, service_name=None, service_id=None, endpoint_id=None)

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=None, interface=None, region_name=None, service_name=None, service_id=None, endpoint_id=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=None, interface=None, region_name=None, service_name=None, service_id=None, endpoint_id=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.

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)

Returns

a dict, keyed by service_type, of lists of EndpointData

get_urls(service_type=None, interface='public', region_name=None, service_name=None, service_id=None, endpoint_id=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

abstract is_interface_match(endpoint, interface)

Helper function to normalize endpoint matching across v2 and v3.

Returns

True if the provided endpoint matches the required interface otherwise False.

normalize_catalog()

Return the catalog normalized into v3 format.

static normalize_interface(self, interface)

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=None, interface='public', region_name=None, service_name=None, service_id=None, endpoint_id=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)

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.

classmethod from_token(token)
is_interface_match(endpoint, interface)

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)

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)

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.

classmethod from_token(token)
is_interface_match(endpoint, interface)

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)

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.

Creative Commons Attribution 3.0 License

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