keystone.resource.backends.sql module

keystone.resource.backends.sql module

class keystone.resource.backends.sql.Project(*args, **kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, keystone.common.sql.core.ModelDictMixinWithExtras

attributes = ['id', 'name', 'domain_id', 'description', 'enabled', 'parent_id', 'is_domain', 'tags']
description
domain_id
enabled
extra
id
is_domain
name
parent_id
tags
to_dict(include_extra_dict=False)[source]

Return the model’s attributes as a dictionary.

If include_extra_dict is True, ‘extra’ attributes are literally included in the resulting dictionary twice, for backwards-compatibility with a broken implementation.

class keystone.resource.backends.sql.ProjectTag(*args, **kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Base, keystone.common.sql.core.ModelDictMixin

attributes = ['project_id', 'name']
name
project_id
to_dict()[source]

Return the model’s attributes as a dictionary.

class keystone.resource.backends.sql.Resource[source]

Bases: keystone.resource.backends.base.ResourceDriverBase

check_project_depth(max_depth)[source]

Check the projects depth in the backend whether exceed the limit.

Parameters:max_depth (integer) – the limit depth that project depth should not exceed.
Returns:the exceeded project’s id or None if no exceeding.
create_project(**kwargs)[source]

Create a new project.

Parameters:
  • project_id – This parameter can be ignored.
  • project (dict) – The new project

Project schema:

type: object
properties:
    id:
        type: string
    name:
        type: string
    domain_id:
        type: [string, null]
    description:
        type: string
    enabled:
        type: boolean
    parent_id:
        type: string
    is_domain:
        type: boolean
required: [id, name, domain_id]
additionalProperties: true

If the project doesn’t match the schema the behavior is undefined.

The driver can impose requirements such as the maximum length of a field. If these requirements are not met the behavior is undefined.

Raises:keystone.exception.Conflict – if the project id already exists or the name already exists for the domain_id.
default_assignment_driver()[source]
delete_project(**kwargs)[source]

Delete an existing project.

Raises:keystone.exception.ProjectNotFound – if project_id does not exist
delete_projects_from_ids(**kwargs)[source]

Delete a given list of projects.

Deletes a list of projects. Ensures no project on the list exists after it is successfully called. If an empty list is provided, the it is silently ignored. In addition, if a project ID in the list of project_ids is not found in the backend, no exception is raised, but a message is logged.

get_project(project_id)[source]

Get a project by ID.

Returns:project_ref
Raises:keystone.exception.ProjectNotFound – if project_id does not exist
get_project_by_name(project_name, domain_id)[source]

Get a project by name.

Returns:project_ref
Raises:keystone.exception.ProjectNotFound – if a project with the project_name does not exist within the domain
is_leaf_project(project_id)[source]

Check if a project is a leaf in the hierarchy.

Parameters:project_id – the driver will check if this project is a leaf in the hierarchy.
Raises:keystone.exception.ProjectNotFound – if project_id does not exist
list_project_ids_from_domain_ids(domain_ids)[source]

List project ids for the provided list of domain ids.

Parameters:domain_ids – list of domain ids
Returns:a list of project ids owned by the specified domain ids.

This method is used internally by the assignment manager to bulk read a set of project ids given a list of domain ids.

list_project_parents(project_id)[source]

List all parents from a project by its ID.

Parameters:project_id – the driver will list the parents of this project.
Returns:a list of project_refs or an empty list.
Raises:keystone.exception.ProjectNotFound – if project_id does not exist
list_projects(hints, *args, **kwargs)[source]

List projects in the system.

Parameters:hints – filter hints which the driver should implement if at all possible.
Returns:a list of project_refs or an empty list.
list_projects_acting_as_domain(hints)[source]

List all projects acting as domains.

Parameters:hints – filter hints which the driver should implement if at all possible.
Returns:a list of project_refs or an empty list.
list_projects_by_tags(filters)[source]
list_projects_from_ids(ids)[source]

List projects for the provided list of ids.

Parameters:project_ids – list of ids
Returns:a list of project_refs.

This method is used internally by the assignment manager to bulk read a set of projects given their ids.

list_projects_in_domain(domain_id)[source]

List projects in the domain.

Parameters:domain_id – the driver MUST only return projects within this domain.
Returns:a list of project_refs or an empty list.
list_projects_in_subtree(project_id)[source]

List all projects in the subtree of a given project.

Parameters:project_id – the driver will get the subtree under this project.
Returns:a list of project_refs or an empty list
Raises:keystone.exception.ProjectNotFound – if project_id does not exist
update_project(**kwargs)[source]

Update an existing project.

Raises:
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.