karbor.db.sqlalchemy package¶
Subpackages¶
Submodules¶
karbor.db.sqlalchemy.api module¶
Implementation of SQLAlchemy backend.
Ensures a request has permission to access the given project.
Ensures a request has permission to access the given quota class.
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.
quota_class_create
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_class_destroy
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_class_destroy_all_by_name
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_class_get
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_class_get_all_by_name
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_class_update
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_create
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_destroy
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_destroy_all_by_project
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_get
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_get_all_by_project
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_reserve
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_update
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_usage_create
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_usage_get
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
quota_usage_get_all_by_project
(*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()
andauthorize_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.
reservation_commit
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
reservation_create
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
reservation_destroy
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
reservation_expire
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
reservation_get
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
reservation_get_all_by_project
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
reservation_rollback
(*args, **kwargs)¶
-
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
(context, log_id, values)¶ 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
(context, operation_id, values)¶ Update the ScheduledOperationState record with the most recent data.
-
karbor.db.sqlalchemy.api.
scheduled_operation_update
(context, id, values)¶ 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_args
(*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_execution_create
(context, trigger_id, time)¶
-
karbor.db.sqlalchemy.api.
trigger_execution_delete
(context, id, trigger_id)¶
-
karbor.db.sqlalchemy.api.
trigger_execution_get_next
(context)¶
-
karbor.db.sqlalchemy.api.
trigger_execution_update
(context, id, old_time, new_time)¶
-
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
(context, id, values)¶ Update the Trigger record with the most recent data.
-
karbor.db.sqlalchemy.api.
verification_create
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
verification_destroy
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
verification_get
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
verification_get_all
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
verification_get_all_by_project
(*args, **kwargs)¶
-
karbor.db.sqlalchemy.api.
verification_update
(*args, **kwargs)¶
karbor.db.sqlalchemy.models module¶
SQLAlchemy models for karbor data.
-
class
karbor.db.sqlalchemy.models.
CheckpointRecord
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a checkpoint record.
-
checkpoint_id
¶
-
checkpoint_status
¶
-
create_by
¶
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
extend_info
¶
-
id
¶
-
operation_id
¶
-
plan_id
¶
-
project_id
¶
-
provider_id
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
KarborBase
¶ Bases:
oslo_db.sqlalchemy.models.TimestampMixin
,oslo_db.sqlalchemy.models.ModelBase
Base class for karbor Models.
-
delete
(session)¶ Delete this object.
-
deleted
= Column(None, Boolean(), table=None, default=ColumnDefault(False))¶
-
deleted_at
= Column(None, DateTime(), table=None)¶
-
metadata
= None¶
-
-
class
karbor.db.sqlalchemy.models.
OperationLog
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a operation log.
-
checkpoint_id
¶
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
ended_at
¶
-
error_info
¶
-
extra_info
¶
-
id
¶
-
operation_type
¶
-
plan_id
¶
-
project_id
¶
-
provider_id
¶
-
restore_id
¶
-
scheduled_operation_id
¶
-
started_at
¶
-
status
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
Plan
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a Plan.
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
description
¶
-
id
¶
-
name
¶
-
parameters
¶
-
project_id
¶
-
provider_id
¶
-
status
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
Quota
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a single quota override for a project.
If there is no row for a given project id and resource, then the default for the quota class is used. If there is no row for a given quota class and resource, then the default for the deployment is used. If the row is present but the hard limit is Null, then the resource is unlimited.
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
hard_limit
¶
-
id
¶
-
project_id
¶
-
resource
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
QuotaClass
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a single quota override for a quota class.
If there is no row for a given quota class and resource, then the default for the deployment is used. If the row is present but the hard limit is Null, then the resource is unlimited.
-
class_name
¶
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
hard_limit
¶
-
id
¶
-
resource
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
QuotaUsage
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents the current usage for a given resource.
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
id
¶
-
in_use
¶
-
project_id
¶
-
reserved
¶
-
resource
¶
-
property
total
¶
-
until_refresh
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
Reservation
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a resource reservation for quotas.
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
delta
¶
-
expire
¶
-
id
¶
-
project_id
¶
-
resource
¶
-
updated_at
¶
-
usage_id
¶
-
uuid
¶
-
-
class
karbor.db.sqlalchemy.models.
Resource
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a resource in a plan.
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
id
¶
-
plan
¶
-
plan_id
¶
-
resource_extra_info
¶
-
resource_id
¶
-
resource_name
¶
-
resource_type
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
Restore
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a Restore.
-
checkpoint_id
¶
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
id
¶
-
parameters
¶
-
project_id
¶
-
provider_id
¶
-
resources_reason
¶
-
resources_status
¶
-
restore_target
¶
-
status
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
ScheduledOperation
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a scheduled operation.
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
description
¶
-
enabled
¶
-
id
¶
-
name
¶
-
operation_definition
¶
-
operation_type
¶
-
project_id
¶
-
trigger
¶
-
trigger_id
¶
-
updated_at
¶
-
user_id
¶
-
-
class
karbor.db.sqlalchemy.models.
ScheduledOperationLog
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a scheduled operation log.
-
actual_start_time
¶
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
end_time
¶
-
expect_start_time
¶
-
extend_info
¶
-
id
¶
-
operation_id
¶
-
state
¶
-
triggered_time
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
ScheduledOperationState
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a scheduled operation state.
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
end_time_for_run
¶
-
id
¶
-
operation
¶
-
operation_id
¶
-
service_id
¶
-
state
¶
-
trust_id
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
Service
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a running service on a host.
-
binary
¶
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
disabled
¶
-
disabled_reason
¶
-
host
¶
-
id
¶
-
modified_at
¶
-
report_count
¶
-
rpc_available_version
¶
-
rpc_current_version
¶
-
topic
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
Trigger
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a trigger.
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
id
¶
-
name
¶
-
project_id
¶
-
properties
¶
-
type
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
TriggerExecution
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a future trigger execition
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
execution_time
¶
-
id
¶
-
trigger_id
¶
-
updated_at
¶
-
-
class
karbor.db.sqlalchemy.models.
Verification
(**kwargs)¶ Bases:
sqlalchemy.ext.declarative.api.Base
,karbor.db.sqlalchemy.models.KarborBase
Represents a Verification.
-
checkpoint_id
¶
-
created_at
¶
-
deleted
¶
-
deleted_at
¶
-
id
¶
-
parameters
¶
-
project_id
¶
-
provider_id
¶
-
resources_reason
¶
-
resources_status
¶
-
status
¶
-
updated_at
¶
-
-
karbor.db.sqlalchemy.models.
register_models
()¶ Register Models and create metadata.
Called from karbor.db.sqlalchemy.__init__ as part of loading the driver, it will never need to be called explicitly elsewhere unless the connection is lost and needs to be reestablished.