The karbor.db.sqlalchemy.api Module

The karbor.db.sqlalchemy.api Module

Implementation of SQLAlchemy backend.

karbor.db.sqlalchemy.api.authorize_project_context(context, project_id)

Ensures a request has permission to access the given project.

karbor.db.sqlalchemy.api.authorize_user_context(context, user_id)

Ensures a request has permission to access the given user.

karbor.db.sqlalchemy.api.checkpoint_record_create(*args, **kwargs)
karbor.db.sqlalchemy.api.checkpoint_record_destroy(*args, **kwargs)
karbor.db.sqlalchemy.api.checkpoint_record_get(*args, **kwargs)
karbor.db.sqlalchemy.api.checkpoint_record_get_all_by_filters_sort(context, filters, limit=None, marker=None, sort_keys=None, sort_dirs=None)
karbor.db.sqlalchemy.api.checkpoint_record_update(*args, **kwargs)
karbor.db.sqlalchemy.api.dispose_engine()
karbor.db.sqlalchemy.api.get_backend()

The backend is this module itself.

karbor.db.sqlalchemy.api.get_by_id(*args, **kwargs)
karbor.db.sqlalchemy.api.get_engine()
karbor.db.sqlalchemy.api.get_session(**kwargs)
karbor.db.sqlalchemy.api.is_admin_context(context)

Indicates if the request context is an administrator.

karbor.db.sqlalchemy.api.is_user_context(context)

Indicates if the request context is a normal user.

karbor.db.sqlalchemy.api.is_valid_model_filters(model, filters)

Return True if filter values exist on the model

Parameters:
  • model – a karbor model
  • filters – dictionary of filters
karbor.db.sqlalchemy.api.model_query(context, *args, **kwargs)

Query helper that accounts for context’s read_deleted field.

Parameters:
  • context – context to query under
  • session – if present, the session to use
  • read_deleted – if present, overrides context’s read_deleted field.
  • project_only – if present and context is user-type, then restrict query to match the context’s project_id.
karbor.db.sqlalchemy.api.operation_log_create(*args, **kwargs)
karbor.db.sqlalchemy.api.operation_log_destroy(*args, **kwargs)
karbor.db.sqlalchemy.api.operation_log_get(*args, **kwargs)
karbor.db.sqlalchemy.api.operation_log_get_all(*args, **kwargs)
karbor.db.sqlalchemy.api.operation_log_get_all_by_project(*args, **kwargs)
karbor.db.sqlalchemy.api.operation_log_update(*args, **kwargs)
karbor.db.sqlalchemy.api.plan_create(*args, **kwargs)
karbor.db.sqlalchemy.api.plan_destroy(*args, **kwargs)
karbor.db.sqlalchemy.api.plan_get(*args, **kwargs)
karbor.db.sqlalchemy.api.plan_get_all(*args, **kwargs)
karbor.db.sqlalchemy.api.plan_get_all_by_project(*args, **kwargs)
karbor.db.sqlalchemy.api.plan_resources_update(*args, **kwargs)
karbor.db.sqlalchemy.api.plan_update(*args, **kwargs)
karbor.db.sqlalchemy.api.process_sort_params(sort_keys, sort_dirs, default_keys=None, default_dir='asc')

Process the sort parameters to include default keys.

Creates a list of sort keys and a list of sort directions. Adds the default keys to the end of the list if they are not already included.

When adding the default keys to the sort keys list, the associated direction is: 1) The first element in the ‘sort_dirs’ list (if specified), else 2) ‘default_dir’ value (Note that ‘asc’ is the default value since this is the default in sqlalchemy.utils.paginate_query)

Parameters:
  • sort_keys – List of sort keys to include in the processed list
  • sort_dirs – List of sort directions to include in the processed list
  • default_keys – List of sort keys that need to be included in the processed list, they are added at the end of the list if not already specified.
  • default_dir – Sort direction associated with each of the default keys that are not supplied, used when they are added to the processed list
Returns:

list of sort keys, list of sort directions

Raises:

exception.InvalidInput – If more sort directions than sort keys are specified or if an invalid sort direction is specified

karbor.db.sqlalchemy.api.purge_deleted_rows(*args, **kwargs)
karbor.db.sqlalchemy.api.require_admin_context(f)

Decorator to require admin request context.

The first argument to the wrapped function must be the context.

karbor.db.sqlalchemy.api.require_context(f)

Decorator to require any user or admin context.

This does no authorization for user or project access matching, see authorize_project_context() and authorize_user_context().

The first argument to the wrapped function must be the context.

karbor.db.sqlalchemy.api.require_plan_exists(f)

Decorator to require the specified plan to exist.

Requires the wrapped function to use context and plan_id as their first two arguments.

karbor.db.sqlalchemy.api.restore_create(*args, **kwargs)
karbor.db.sqlalchemy.api.restore_destroy(*args, **kwargs)
karbor.db.sqlalchemy.api.restore_get(*args, **kwargs)
karbor.db.sqlalchemy.api.restore_get_all(*args, **kwargs)
karbor.db.sqlalchemy.api.restore_get_all_by_project(*args, **kwargs)
karbor.db.sqlalchemy.api.restore_update(*args, **kwargs)
karbor.db.sqlalchemy.api.scheduled_operation_create(context, values)
karbor.db.sqlalchemy.api.scheduled_operation_delete(context, id)

Delete a ScheduledOperation record.

karbor.db.sqlalchemy.api.scheduled_operation_get(context, id, columns_to_join=[])
karbor.db.sqlalchemy.api.scheduled_operation_get_all_by_filters_sort(context, filters, limit=None, marker=None, sort_keys=None, sort_dirs=None)
karbor.db.sqlalchemy.api.scheduled_operation_log_create(context, values)
karbor.db.sqlalchemy.api.scheduled_operation_log_delete(context, log_id)

Delete a ScheduledOperationLog record.

karbor.db.sqlalchemy.api.scheduled_operation_log_delete_oldest(context, operation_id, retained_num, excepted_states)
karbor.db.sqlalchemy.api.scheduled_operation_log_get(context, log_id)
karbor.db.sqlalchemy.api.scheduled_operation_log_get_all_by_filters_sort(context, filters, limit=None, marker=None, sort_keys=None, sort_dirs=None)
karbor.db.sqlalchemy.api.scheduled_operation_log_update(*args, **kwargs)

Update the ScheduledOperationLog record with the most recent data.

karbor.db.sqlalchemy.api.scheduled_operation_state_create(context, values)
karbor.db.sqlalchemy.api.scheduled_operation_state_delete(context, operation_id)

Delete a ScheduledOperationState record.

karbor.db.sqlalchemy.api.scheduled_operation_state_get(context, operation_id, columns_to_join=[])
karbor.db.sqlalchemy.api.scheduled_operation_state_get_all_by_filters_sort(context, filters, limit=None, marker=None, sort_keys=None, sort_dirs=None, columns_to_join=[])
karbor.db.sqlalchemy.api.scheduled_operation_state_update(*args, **kwargs)

Update the ScheduledOperationState record with the most recent data.

karbor.db.sqlalchemy.api.scheduled_operation_update(*args, **kwargs)

Update the ScheduledOperation record with the most recent data.

karbor.db.sqlalchemy.api.service_create(*args, **kwargs)
karbor.db.sqlalchemy.api.service_destroy(*args, **kwargs)
karbor.db.sqlalchemy.api.service_get(*args, **kwargs)
karbor.db.sqlalchemy.api.service_get_all(*args, **kwargs)
karbor.db.sqlalchemy.api.service_get_all_by_topic(*args, **kwargs)
karbor.db.sqlalchemy.api.service_get_by_args(*args, **kwargs)
karbor.db.sqlalchemy.api.service_get_by_host_and_topic(*args, **kwargs)
karbor.db.sqlalchemy.api.service_update(*args, **kwargs)
karbor.db.sqlalchemy.api.trigger_create(context, values)
karbor.db.sqlalchemy.api.trigger_delete(context, id)

Delete a Trigger record.

karbor.db.sqlalchemy.api.trigger_get(context, id)
karbor.db.sqlalchemy.api.trigger_get_all_by_filters_sort(context, filters, limit=None, marker=None, sort_keys=None, sort_dirs=None)
karbor.db.sqlalchemy.api.trigger_update(*args, **kwargs)

Update the Trigger record with the most recent data.

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.