keystone.catalog.backends.sql module

class keystone.catalog.backends.sql.Catalog[source]

Bases: keystone.catalog.backends.base.CatalogDriverBase

add_endpoint_group_to_project(endpoint_group_id, project_id)[source]

Add an endpoint group to project association.

Parameters
  • endpoint_group_id (string) – identity of endpoint to associate

  • project_id (string) – identity of project to associate

Raises

keystone.exception.Conflict – If the endpoint group was already added to the project.

Returns

None.

add_endpoint_to_project(endpoint_id, project_id)[source]

Create an endpoint to project association.

Parameters
  • endpoint_id (string) – identity of endpoint to associate

  • project_id (string) – identity of the project to be associated with

Raises

keystone.exception.Conflict: If the endpoint was already added to project.

Returns

None.

check_endpoint_in_project(endpoint_id, project_id)[source]

Check if an endpoint is associated with a project.

Parameters
  • endpoint_id (string) – identity of endpoint to check

  • project_id (string) – identity of the project associated with

Raises

keystone.exception.NotFound – If the endpoint was not found in the project.

Returns

None.

create_endpoint(endpoint_id, endpoint)[source]

Create a new endpoint for a service.

Raises
create_endpoint_group(endpoint_group_id, endpoint_group)[source]

Create an endpoint group.

Parameters

endpoint_group (dictionary) – endpoint group to create

Raises

keystone.exception.Conflict: If a duplicate endpoint group already exists.

Returns

an endpoint group representation.

create_region(region_ref)[source]

Create a new region.

Raises
create_service(service_id, service_ref)[source]

Create a new service.

Raises

keystone.exception.Conflict – If a duplicate service exists.

delete_association_by_endpoint(endpoint_id)[source]

Remove all the endpoints to project association with endpoint.

Parameters

endpoint_id (string) – identity of endpoint to check

Returns

None

delete_association_by_project(project_id)[source]

Remove all the endpoints to project association with project.

Parameters

project_id (string) – identity of the project to check

Returns

None

delete_endpoint(endpoint_id)[source]

Delete an endpoint for a service.

Raises

keystone.exception.EndpointNotFound – If the endpoint doesn’t exist.

delete_endpoint_group(endpoint_group_id)[source]

Delete an endpoint group.

Parameters

endpoint_group_id (string) – identity of endpoint group to delete

Raises

keystone.exception.NotFound – If the endpoint group was not found.

Returns

None.

delete_endpoint_group_association_by_project(project_id)[source]

Remove endpoint group to project associations.

Parameters

project_id (string) – identity of the project to check

Returns

None

delete_region(region_id)[source]

Delete an existing region.

Raises

keystone.exception.RegionNotFound – If the region doesn’t exist.

delete_service(service_id)[source]

Delete an existing service.

Raises

keystone.exception.ServiceNotFound – If the service doesn’t exist.

get_catalog(user_id, project_id)[source]

Retrieve and format the V2 service catalog.

Parameters
  • user_id – The id of the user who has been authenticated for creating service catalog.

  • project_id – The id of the project. ‘project_id’ will be None in the case this being called to create a catalog to go in a domain scoped token. In this case, any endpoint that requires a project_id as part of their URL will be skipped (as would a whole service if, as a consequence, it has no valid endpoints).

Returns

A nested dict representing the service catalog or an empty dict.

get_endpoint(endpoint_id)[source]

Get endpoint by id.

Returns

endpoint_ref dict

Raises

keystone.exception.EndpointNotFound – If the endpoint doesn’t exist.

get_endpoint_group(endpoint_group_id)[source]

Get an endpoint group.

Parameters

endpoint_group_id (string) – identity of endpoint group to retrieve

Raises

keystone.exception.NotFound – If the endpoint group was not found.

Returns

an endpoint group representation.

get_endpoint_group_in_project(endpoint_group_id, project_id)[source]

Get endpoint group to project association.

Parameters
  • endpoint_group_id (string) – identity of endpoint group to retrieve

  • project_id (string) – identity of project to associate

Raises

keystone.exception.NotFound – If the endpoint group to the project association was not found.

Returns

a project endpoint group representation.

get_region(region_id)[source]

Get region by id.

Returns

region_ref dict

Raises

keystone.exception.RegionNotFound – If the region doesn’t exist.

get_service(service_id)[source]

Get service by id.

Returns

service_ref dict

Raises

keystone.exception.ServiceNotFound – If the service doesn’t exist.

get_v3_catalog(user_id, project_id)[source]

Retrieve and format the current V3 service catalog.

Parameters
  • user_id – The id of the user who has been authenticated for creating service catalog.

  • project_id – The id of the project. ‘project_id’ will be None in the case this being called to create a catalog to go in a domain scoped token. In this case, any endpoint that requires a project_id as part of their URL will be skipped.

Returns

A list representing the service catalog or an empty list

list_endpoint_groups(hints)[source]

List all endpoint groups.

Returns

None.

list_endpoint_groups_for_project(project_id)[source]

List all endpoint group to project associations for a project.

Parameters

project_id (string) – identity of project to associate

Returns

None.

list_endpoints(hints)[source]

List all endpoints.

Parameters

hints – contains the list of filters yet to be satisfied. Any filters satisfied here will be removed so that the caller will know if any filters remain.

Returns

list of endpoint_refs or an empty list.

list_endpoints_for_project(project_id)[source]

List all endpoints associated with a project.

Parameters

project_id (string) – identity of the project to check

Returns

a list of identity endpoint ids or an empty list.

list_projects_associated_with_endpoint_group(endpoint_group_id)[source]

List all projects associated with endpoint group.

Parameters

endpoint_group_id (string) – identity of endpoint to associate

Returns

None.

list_projects_for_endpoint(endpoint_id)[source]

List all projects associated with an endpoint.

Parameters

endpoint_id (string) – identity of endpoint to check

Returns

a list of projects or an empty list.

list_regions(hints)[source]

List all regions.

Parameters

hints – contains the list of filters yet to be satisfied. Any filters satisfied here will be removed so that the caller will know if any filters remain.

Returns

list of region_refs or an empty list.

list_services(hints)[source]

List all services.

Parameters

hints – contains the list of filters yet to be satisfied. Any filters satisfied here will be removed so that the caller will know if any filters remain.

Returns

list of service_refs or an empty list.

remove_endpoint_from_project(endpoint_id, project_id)[source]

Remove an endpoint to project association.

Parameters
  • endpoint_id (string) – identity of endpoint to remove

  • project_id (string) – identity of the project associated with

Raises

keystone.exception.NotFound – If the endpoint was not found in the project.

Returns

None.

remove_endpoint_group_from_project(endpoint_group_id, project_id)[source]

Remove an endpoint to project association.

Parameters
  • endpoint_group_id (string) – identity of endpoint to associate

  • project_id (string) – identity of project to associate

Raises

keystone.exception.NotFound – If endpoint group project association was not found.

Returns

None.

update_endpoint(endpoint_id, endpoint_ref)[source]

Get endpoint by id.

Returns

endpoint_ref dict

Raises
update_endpoint_group(endpoint_group_id, endpoint_group)[source]

Update an endpoint group.

Parameters
  • endpoint_group_id (string) – identity of endpoint group to retrieve

  • endpoint_group (dictionary) – A full or partial endpoint_group

Raises

keystone.exception.NotFound – If the endpoint group was not found.

Returns

an endpoint group representation.

update_region(region_id, region_ref)[source]

Update region by id.

Returns

region_ref dict

Raises

keystone.exception.RegionNotFound – If the region doesn’t exist.

update_service(service_id, service_ref)[source]

Update service by id.

Returns

service_ref dict

Raises

keystone.exception.ServiceNotFound – If the service doesn’t exist.

class keystone.catalog.backends.sql.Endpoint(*args, **kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base, keystone.common.sql.core.ModelDictMixinWithExtras

attributes = ['id', 'interface', 'region_id', 'service_id', 'url', 'legacy_endpoint_id', 'enabled']
enabled
extra
classmethod from_dict(endpoint_dict)[source]

Override from_dict to set enabled if missing.

id
interface
legacy_endpoint_id
region_id
service_id
url
class keystone.catalog.backends.sql.EndpointGroup(*args, **kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base, keystone.common.sql.core.ModelDictMixin

Endpoint Groups table.

attributes = ['id', 'name', 'description', 'filters']
description
filters
id
mutable_attributes = frozenset({'description', 'filters', 'name'})
name
class keystone.catalog.backends.sql.ProjectEndpoint(*args, **kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base, keystone.common.sql.core.ModelDictMixin

project-endpoint relationship table.

attributes = ['endpoint_id', 'project_id']
endpoint_id
project_id
class keystone.catalog.backends.sql.ProjectEndpointGroupMembership(*args, **kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base, keystone.common.sql.core.ModelDictMixin

Project to Endpoint group relationship table.

attributes = ['endpoint_group_id', 'project_id']
endpoint_group_id
project_id
class keystone.catalog.backends.sql.Region(*args, **kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base, keystone.common.sql.core.ModelDictMixinWithExtras

attributes = ['id', 'description', 'parent_region_id']
description
endpoints
extra
id
parent_region_id
class keystone.catalog.backends.sql.Service(*args, **kwargs)[source]

Bases: sqlalchemy.orm.decl_api.Base, keystone.common.sql.core.ModelDictMixinWithExtras

attributes = ['id', 'type', 'enabled']
enabled
endpoints
extra
id
type