CBR API

The Cloud Backup and Recovery Service Class

The CBR high-level interface is available through the cbr member of a Connection object. The ces member will only be added if the otcextensions.sdk.register_otc_extensions(conn) method is called.

Backup Operations

class otcextensions.sdk.cbr.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
backups(**query)

Retrieve a generator of Backups

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned. * checkpoint_id: Restore point ID * dec: Dedicated Cloud * end_time: Time when the backup ends * image_type: Backup type: backup or replication * limit: Number of records displayed per page * marker: ID of the last record displayed * member_status: Backup sharing status * name: Backup name * offset: Offset value * parent_id: Parent backup ID * resource_az: AZ-based filtering * resource_id: Resource ID * resource_name: Resource name * resource_type: Resource Type * sort: sorting * start_time: Time when the backup starts * status: Status * vault_id: Vault ID

Returns:

A generator of backup Backup instances

get_backup(backup)

Get the backup by UUID.

Parameters:

backup – key id or an instance of Backup

Returns:

instance of Backup

find_backup(name_or_id, ignore_missing=True)

Find a single CBR backup by name or id

Parameters:
  • name_or_id – The name or ID of a backup

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the group does not exist. When set to True, no exception will be set when attempting to delete a nonexistent group.

Returns:

None

delete_backup(backup, ignore_missing=True)

Delete a single CBR backup.

Parameters:
  • backup – The value can be the ID of a backup or a Backup instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the group does not exist. When set to True, no exception will be set when attempting to delete a nonexistent backup.

Share Member Operations

class otcextensions.sdk.cbr.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
members(backup, **query)

List share members for a backup

Parameters:
  • backup – The value can be the ID of a backup or a Backup instance.

  • attrs (dict) – Keyword arguments which will be used to create a Member, comprised of the properties on the Member class.

Returns:

The results of config creation

Return type:

Member

get_member(backup, member)

Get one CBR share member by UUID.

Parameters:
  • member – key id or an instance of Member

  • backup – The value can be the ID of a backup or a Backup instance.

Returns:

instance of Member

add_members(backup, members)

Add a list of share members to an existing backup

Parameters:
  • backup – The value can be the ID of a backup or a Backup instance.

  • members (list) – The list contains the project IDs of the backup share members to be added

Returns:

The results are the list of share member objects

update_member(backup, member, status='accepted', vault=None)

Update CBR share members

Parameters:
  • member – The id or an instance of Member

  • backup – The value can be the ID of a backup or a Backup instance.

  • status (str) – status to be updated share member

  • vault – The value can be the ID of a vault or a Vault instance.

delete_member(backup, member, ignore_missing=True)

Delete a single CBR share member.

Parameters:
  • member – The id or an instance of Member

  • backup – The value can be the ID of a backup or a Backup instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the share member does not exist. When set to True, no exception will be set when attempting to delete a nonexistent share member.

Policy Operations

class otcextensions.sdk.cbr.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
policies(**query)

Retrieve a generator of CBR policies

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned. * operation_type: Policy type: backup or replication * vault_id: Vault ID

Returns:

A generator of policies Policy instances

get_policy(policy)

Get the CBR policy by UUID.

Parameters:

policy – key id or an instance of Policy

Returns:

instance of Policy

find_policy(name_or_id, ignore_missing=True)

Find a single CBR policy by name or ID

Parameters:
  • name_or_id – The name or ID of a policy

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the policy does not exist. When set to True, no exception will be set when attempting to delete a nonexistent policy.

Returns:

a Policy instance

create_policy(**attrs)

Creating a CBR policy using attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Policy, comprised of the properties on the Policy class.

Returns:

The results of config creation

Return type:

Policy

update_policy(policy, **attrs)

Update CBR policy attributes

Parameters:
  • policy – The id or an instance of Policy

  • attrs (dict) – attributes for update on Policy

Return type:

Policy

delete_policy(policy, ignore_missing=True)

Delete a single CBR policy.

Parameters:
  • policy – The value can be the ID of a policy or a Policy instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the group does not exist. When set to True, no exception will be set when attempting to delete a nonexistent policy.

Restore Point (Checkpoint) Operations

class otcextensions.sdk.cbr.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
get_checkpoint(checkpoint)

Get the checkpoint by UUID.

Parameters:

checkpoint – key id or an instance of Checkpoint

Returns:

instance of Checkpoint

create_checkpoint(**attrs)

Creating a restore point / checkpoint using attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Checkpoint, comprised of the properties on the Checkpoint class.

Returns:

The results of config creation

Return type:

Checkpoint

Restore Operations

class otcextensions.sdk.cbr.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
restore_data(backup, **attrs)

Restore data using a backup

Parameters:
  • backup – The value can be the ID of a backup or a Backup instance.

  • attrs (dict) – Keyword arguments which will be used to create a Restore, comprised of the properties on the Restore class.

Returns:

The results of config creation

Return type:

Restore

Vault Operations

class otcextensions.sdk.cbr.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
vaults(**query)

Retrieve a generator of Vaults

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned. * cloud_type: Cloud type * id: Vault ID * limit: Number of records displayed per page, range: 1-100 * name: Vault name * object_type: Resource type * offset: Offset value * policy_id: Policy ID * protect_type: Protection type * resource_ids: Resource IDs * status: Status

Returns:

A generator of vault Vault instances

get_vault(vault)

Get the vault by UUID.

Parameters:

vault – key id or an instance of Vault

Returns:

instance of Vault

find_vault(name_or_id, ignore_missing=True)

Find a single CBR vault by name or id

Parameters:
  • name_or_id – The name or ID of a vault

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the group does not exist. When set to True, no exception will be set when attempting to delete a nonexistent vault.

Returns:

None

create_vault(**attrs)

Creating a CBR vault using attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a Vault, comprised of the properties on the Vault class.

Returns:

The results of config creation

Return type:

Vault

update_vault(vault, **attrs)

Update CBR vault attributes

Parameters:
  • vault – The id or an instance of Vault

  • attrs (dict) – attributes for update on Vault

Return type:

Vault

delete_vault(vault, ignore_missing=True)

Delete a single CBR vault.

Parameters:
  • vault – The value can be the ID of a vault or a Vault instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the group does not exist. When set to True, no exception will be set when attempting to delete a nonexistent vault.

unbind_policy(vault, policy)

Disassociate policy from CBR vault

Parameters:
  • vault – The value can be the ID of a vault or a Vault instance.

  • policy – The value can be the ID of a policy or a Policy instance.

bind_policy(vault, policy)

Associate policy to an existing CBR vault

Parameters:
  • vault – The value can be the ID of a vault or a Vault instance.

  • policy – The value can be the ID of a policy or a Policy instance.

associate_resources(vault, resources)

Associate resources to an existing CBR vault

Parameters:
  • vault – The value can be the ID of a vault or a Vault instance.

  • resources – array of resources in the format: id and type

dissociate_resources(vault, resources)

Associate resources to an existing CBR vault

Parameters:
  • vault – The value can be the ID of a vault or a Vault instance.

  • resources – list of resource ids to be released from vault

Task Operations

class otcextensions.sdk.cbr.v3._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
tasks(**query)

List of tasks

Parameters:

query (dict) – Keyword arguments which will be used to create a Task, comprised of the properties on the Task class.

Returns:

A generator of task Task instances

get_task(task)

Get one CBR task by id.

Parameters:
  • member – key id or an instance of Task

  • task – The value can be the ID of a task or a Task instance.

Returns:

instance of Task