# API Reference

class os_service_types.ServiceTypes(session: sessions.Session | None = None, only_remote: bool = False, warn: bool = False)

  Encapsulation of the OpenStack Service Types Authority data.

  The Service Types Authority data will be either pulled from its remote location or from local files as is appropriate.

  If the user passes a Session, remote data will be fetched. If the user does not do that, local builtin data will be used.

  Parameters:

    - session – An object that behaves like a requests.sessions.Session or a keystoneauth1.session.Session that provides a get method and returns an object that behaves like a requests.models.Response. Optional. If session is omitted, no remote actions will be performed.

    - only_remote (bool) – By default if there is a problem fetching data remotely the builtin data will be returned as a fallback. only_remote will cause remote failures to raise an error instead of falling back. Optional, defaults to False.

    - warn (bool) – Emit warnings when a non-official service_type is provided. This provides an easy way for consuming applications to warn users when they are using old types.

  Raises:

    - ValueError – If session is None and only_remote is True

    - IOError – If session is given and only_remote is True and there is an error fetching remote data.

  property all_types_by_service_type: dict[str, list[str]]

    Mapping of official service type to official type and aliases.

  property forward: dict[str, list[str]]

    Mapping service-type names to their aliases.

  get_aliases(service_type: str) → list[str]

    Returns the list of aliases for a given official service-type.

    Parameters:

      service_type – An official service-type.

    Returns:

      List of aliases, or empty list if there are none.

  get_all_service_data_for_project(project_name: str) → list[Service]

    Return the information for every service associated with a project.

    Parameters:

      name (str) – A repository or project name in the form `'openstack/{project}'` or just `'{project}'`.

    Raises:

      ValueError – If project_name is None

    Returns:

      list of dicts

  get_all_types(service_type: str) → list[str]

    Get a list of official types and all known aliases.

    Parameters:

      service_type (str) – The service-type or alias to get data for.

    Returns dict:

      Service data for the service or None if not found.

  get_official_service_data(service_type: str) → Service | None

    Get the service data for an official service_type.

    Parameters:

      service_type (str) – The official service-type to get data for.

    Returns dict:

      Service data for the service or None if not found.

  get_project_name(service_type: str) → str | None

    Return the OpenStack project name for a given service_type.

    Parameters:

      service_type (str) – An official service-type or alias.

    Returns:

      The OpenStack project name or None if there is no match.

  get_service_data(service_type: str) → Service | None

    Get the service data for a given service_type.

    Parameters:

      service_type (str) – The service-type or alias to get data for.

    Returns dict:

      Service data for the service or None if not found.

  get_service_data_for_project(project_name: str) → Service | None

    Return the service information associated with a project.

    Parameters:

      name (str) – A repository or project name in the form `'openstack/{project}'` or just `'{project}'`.

    Raises:

      ValueError – If project_name is None

    Returns:

      dict or None if not found

  get_service_type(service_type: str, permissive: bool = False) → str | None

    Given a possible service_type, return the official type.

    Parameters:

      - service_type – A potential service-type.

      - permissive – Return the original type if the given service_type is not found.

    Returns:

      The official service-type, or None if there is no match.

  is_alias(service_type: str) → bool

    Is the given service-type an alias?

    Parameters:

      service_type (str) – The service-type to test.

    Returns bool:

      True if it’s an alias type, False otherwise.

  is_known(service_type: str) → bool

    Is the given service-type an official type or an alias?

    Parameters:

      service_type (str) – The service-type to test.

    Returns bool:

      True if it’s a known type, False otherwise.

  is_match(requested: str, found: str) → bool

    Does a requested service-type match one found in the catalog?

    A requested service-type matches a service-type in the catalog if it is either a direct match, if the service-type in the catalog is an official type and the requested type is one of its aliases, or if the requested type is an official type and the type in the catalog is one of its aliases.

    A requested alias cannot match a different alias because there are historical implications related to versioning to some historical aliases that cannot be safely reasoned about in an automatic fashion.

    Parameters:

      - requested (str) – A service-type that someone is looking for.

      - found (str) – A service-type found in a catalog

    Returns bool:

      True if the service-type being requested matches the entry in the catalog. False if it does not.

  is_official(service_type: str) → bool

    Is the given service-type an official service-type?

    Parameters:

      service_type (str) – The service-type to test.

    Returns bool:

      True if it’s an official type, False otherwise.

  property primary_service_by_project: dict[str, Service]

    Mapping of project name to the primary associated service.

  property reverse: dict[str, str]

    Mapping aliases to their service-type names.

  property service_types_by_project: dict[str, list[str]]

    Mapping of project name to a list of all associated service-types.

  property services: list[Service]

    Full service-type data listing.

  property url: str

    The URL from which the data was retrieved.

  property version: str

    The version of the data.

this page last updated: 2026-03-26 16:38:04

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