keystone.catalog package

Submodules

keystone.catalog.controllers module

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

Bases: keystone.common.controller.V2Controller

create_endpoint(*args, **kwargs)[source]

Create three v3 endpoint refs based on a legacy ref.

delete_endpoint(*args, **kwargs)[source]

Delete up to three v3 endpoint refs based on a legacy ref ID.

get_endpoints(*args, **kwargs)[source]

Merge matching v3 endpoint refs into legacy refs.

class keystone.catalog.controllers.EndpointFilterV3Controller[source]

Bases: keystone.common.controller.V3Controller

add_endpoint_to_project(context, *args, **kwargs)[source]

Establishes an association between an endpoint and a project.

check_endpoint_in_project(context, *args, **kwargs)[source]

Verifies endpoint is currently associated with given project.

list_endpoints_for_project(context, *args, **kwargs)[source]

List all endpoints currently associated with a given project.

list_projects_for_endpoint(context, *args, **kwargs)[source]

Return a list of projects associated with the endpoint.

remove_endpoint_from_project(context, *args, **kwargs)[source]

Remove the endpoint from the association with given project.

class keystone.catalog.controllers.EndpointGroupV3Controller[source]

Bases: keystone.common.controller.V3Controller

VALID_FILTER_KEYS = ['service_id', 'region_id', 'interface']
classmethod base_url(context, path=None)[source]

Construct a path and pass it to V3Controller.base_url method.

collection_name = 'endpoint_groups'
create_endpoint_group(context, *args, **kwargs)[source]

Creates an Endpoint Group with the associated filters.

delete_endpoint_group(context, *args, **kwargs)[source]

Delete endpoint_group.

get_endpoint_group(context, *args, **kwargs)[source]

Retrieve the endpoint group associated with the id if exists.

list_endpoint_groups(context, *args, **kwargs)[source]

List all endpoint groups.

list_endpoint_groups_for_project(context, *args, **kwargs)[source]

List all endpoint groups associated with a given project.

list_endpoints_associated_with_endpoint_group(context, *args, **kwargs)[source]

List all the endpoints filtered by a specific endpoint group.

list_projects_associated_with_endpoint_group(context, *args, **kwargs)[source]

List all projects associated with endpoint group.

member_name = 'endpoint_group'
update_endpoint_group(context, *args, **kwargs)[source]

Update fixed values and/or extend the filters.

class keystone.catalog.controllers.EndpointV3[source]

Bases: keystone.common.controller.V3Controller

collection_name = 'endpoints'
create_endpoint(context, *args, **kwargs)[source]
delete_endpoint(context, *args, **kwargs)[source]
classmethod filter_endpoint(ref)[source]
get_endpoint(context, *args, **kwargs)[source]
list_endpoints(context, **kwargs)[source]
member_name = 'endpoint'
update_endpoint(context, *args, **kwargs)[source]
classmethod wrap_member(context, ref)[source]
class keystone.catalog.controllers.ProjectEndpointGroupV3Controller[source]

Bases: keystone.common.controller.V3Controller

add_endpoint_group_to_project(context, *args, **kwargs)[source]

Creates an association between an endpoint group and project.

collection_name = 'project_endpoint_groups'
get_endpoint_group_in_project(context, *args, **kwargs)[source]

Retrieve the endpoint group associated with the id if exists.

member_name = 'project_endpoint_group'
remove_endpoint_group_from_project(context, *args, **kwargs)[source]

Remove the endpoint group from associated project.

class keystone.catalog.controllers.RegionV3(*args, **kwargs)[source]

Bases: keystone.common.controller.V3Controller

collection_name = 'regions'
create_region(context, *args, **kwargs)[source]
create_region_with_id(context, region_id, region)[source]

Create a region with a user-specified ID.

This method is unprotected because it depends on self.create_region to enforce policy.

delete_region(context, *args, **kwargs)[source]
get_region(context, *args, **kwargs)[source]
list_regions(context, **kwargs)[source]
member_name = 'region'
update_region(context, *args, **kwargs)[source]
class keystone.catalog.controllers.Service(*args, **kwargs)[source]

Bases: keystone.common.controller.V2Controller

create_service(*args, **kwargs)[source]
delete_service(*args, **kwargs)[source]
get_service(*args, **kwargs)[source]
get_services(*args, **kwargs)[source]
class keystone.catalog.controllers.ServiceV3[source]

Bases: keystone.common.controller.V3Controller

collection_name = 'services'
create_service(context, *args, **kwargs)[source]
delete_service(context, *args, **kwargs)[source]
get_service(context, *args, **kwargs)[source]
list_services(context, **kwargs)[source]
member_name = 'service'
update_service(context, *args, **kwargs)[source]

keystone.catalog.core module

Main entry point into the Catalog service.

class keystone.catalog.core.CatalogDriverV8[source]

Bases: object

Interface description for the Catalog driver.

add_endpoint_group_to_project(endpoint_group_id, project_id)[source]

Adds 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]

Checks 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_ref)[source]

Creates a new endpoint for a service.

Raises:
create_endpoint_group(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]

Creates a new region.

Raises:
create_service(service_id, service_ref)[source]

Creates a new service.

Raises keystone.exception.Conflict:
 If a duplicate service exists.
delete_association_by_endpoint(endpoint_id)[source]

Removes 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]

Removes 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]

Deletes 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]

Deletes an existing region.

Raises keystone.exception.RegionNotFound:
 If the region doesn’t exist.
delete_service(service_id)[source]

Deletes an existing service.

Raises keystone.exception.ServiceNotFound:
 If the service doesn’t exist.
get_catalog(user_id, tenant_id)[source]

Retrieve and format the current service catalog.

Example:

{ 'RegionOne':
    {'compute': {
        'adminURL': u'http://host:8774/v1.1/tenantid',
        'internalURL': u'http://host:8774/v1.1/tenant_id',
        'name': 'Compute Service',
        'publicURL': u'http://host:8774/v1.1/tenantid'},
     'ec2': {
        'adminURL': 'http://host:8773/services/Admin',
        'internalURL': 'http://host:8773/services/Cloud',
        'name': 'EC2 Service',
        'publicURL': 'http://host:8773/services/Cloud'}}
Returns:A nested dict representing the service catalog or an empty dict.
Raises keystone.exception.NotFound:
 If the endpoint doesn’t exist.
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, tenant_id)[source]

Retrieve and format the current V3 service catalog.

The default implementation builds the V3 catalog from the V2 catalog.

Example:

[
    {
        "endpoints": [
        {
            "interface": "public",
            "id": "--endpoint-id--",
            "region": "RegionOne",
            "url": "http://external:8776/v1/--project-id--"
        },
        {
            "interface": "internal",
            "id": "--endpoint-id--",
            "region": "RegionOne",
            "url": "http://internal:8776/v1/--project-id--"
        }],
    "id": "--service-id--",
    "type": "volume"
}]
Returns:A list representing the service catalog or an empty list
Raises keystone.exception.NotFound:
 If the endpoint doesn’t exist.
list_endpoint_groups()[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]

Removes 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.core.Manager(*args, **kwargs)[source]

Bases: keystone.common.manager.Manager

Default pivot point for the Catalog backend.

See keystone.common.manager.Manager for more details on how this dynamically calls the backend.

add_endpoint_group_to_project(*args, **kwargs)[source]
add_endpoint_to_project(*args, **kwargs)[source]
create_endpoint(*args, **kwargs)[source]
create_region(*args, **kwargs)[source]
create_service(*args, **kwargs)[source]
delete_endpoint(*args, **kwargs)[source]
delete_region(*args, **kwargs)[source]
delete_service(*args, **kwargs)[source]
driver_namespace = 'keystone.catalog'
get_catalog(*args, **kwargs)[source]
get_endpoint(*args, **kwargs)[source]
get_endpoint_groups_for_project(*args, **kwargs)[source]
get_endpoints_filtered_by_endpoint_group(*args, **kwargs)[source]
get_region(*args, **kwargs)[source]
get_service(*args, **kwargs)[source]
get_v3_catalog(*args, **kwargs)[source]
list_endpoints(*args, **kwargs)[source]
list_endpoints_for_project(*args, **kwargs)[source]

List all endpoints associated with a project.

Parameters:project_id (string) – project identifier to check
Returns:a list of endpoint ids or an empty list.
list_regions(*args, **kwargs)[source]
list_services(*args, **kwargs)[source]
remove_endpoint_from_project(*args, **kwargs)[source]
remove_endpoint_group_from_project(*args, **kwargs)[source]
update_endpoint(*args, **kwargs)[source]
update_region(*args, **kwargs)[source]
update_service(*args, **kwargs)[source]
keystone.catalog.core.check_endpoint_url(url)[source]

Check substitution of url.

The invalid urls are as follows: urls with substitutions that is not in the whitelist

Check the substitutions in the URL to make sure they are valid and on the whitelist.

Parameters:url (str) – the URL to validate
Return type:None
Raises keystone.exception.URLValidationError:
 if the URL is invalid
keystone.catalog.core.format_url(url, substitutions, silent_keyerror_failures=None)[source]

Formats a user-defined URL with the given substitutions.

Parameters:
  • url (string) – the URL to be formatted
  • substitutions (dict) – the dictionary used for substitution
  • silent_keyerror_failures (list) – keys for which we should be silent if there is a KeyError exception on substitution attempt
Returns:

a formatted URL

keystone.catalog.routers module

class keystone.catalog.routers.Routers[source]

Bases: keystone.common.wsgi.RoutersBase

API for the keystone catalog.

The API Endpoint Filter looks like:

PUT /OS-EP-FILTER/projects/{project_id}/endpoints/{endpoint_id}
GET /OS-EP-FILTER/projects/{project_id}/endpoints/{endpoint_id}
HEAD /OS-EP-FILTER/projects/{project_id}/endpoints/{endpoint_id}
DELETE /OS-EP-FILTER/projects/{project_id}/endpoints/{endpoint_id}
GET /OS-EP-FILTER/endpoints/{endpoint_id}/projects
GET /OS-EP-FILTER/projects/{project_id}/endpoints
GET /OS-EP-FILTER/projects/{project_id}/endpoint_groups

GET /OS-EP-FILTER/endpoint_groups
POST /OS-EP-FILTER/endpoint_groups
GET /OS-EP-FILTER/endpoint_groups/{endpoint_group_id}
HEAD /OS-EP-FILTER/endpoint_groups/{endpoint_group_id}
PATCH /OS-EP-FILTER/endpoint_groups/{endpoint_group_id}
DELETE /OS-EP-FILTER/endpoint_groups/{endpoint_group_id}

GET /OS-EP-FILTER/endpoint_groups/{endpoint_group_id}/projects
GET /OS-EP-FILTER/endpoint_groups/{endpoint_group_id}/endpoints

PUT /OS-EP-FILTER/endpoint_groups/{endpoint_group}/projects/
    {project_id}
GET /OS-EP-FILTER/endpoint_groups/{endpoint_group}/projects/
    {project_id}
HEAD /OS-EP-FILTER/endpoint_groups/{endpoint_group}/projects/
    {project_id}
DELETE /OS-EP-FILTER/endpoint_groups/{endpoint_group}/projects/
    {project_id}
PATH_ENDPOINT_GROUPS = '/endpoint_groups/{endpoint_group_id}'
PATH_ENDPOINT_GROUP_PROJECTS = '/endpoint_groups/{endpoint_group_id}/projects/{project_id}'
PATH_PREFIX = '/OS-EP-FILTER'
PATH_PROJECT_ENDPOINT = '/projects/{project_id}/endpoints/{endpoint_id}'
append_v3_routers(mapper, routers)[source]

keystone.catalog.schema module

Module contents