2.42.0 (latest) 2.41.0 2.40.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.1 2.29.0 2.28.1 2.26.0 2.25.0 2.24.0 2.23.1 2.22.0 2.21.0 2.20.0 2.19.0 2.18.1 2.17.0 2.16.0 2.15.0 2.14.1 2.13.2 2.12.0 2.11.3 2.10.1 2.9.0 2.8.1 2.7.1 2.6.0 2.5.2 2.4.0 2.3.3 2.2.0 2.1.0 2.0.0 1.7.3 1.6.1 1.5.1 1.4.0 1.3.0 1.2.1 1.1.0 1.0.0 0.34.0

    Backup(
        backup_id,
        instance,
        cluster_id=None,
        table_id=None,
        expire_time=None,
        encryption_info=None,
    )

Representation of a Google Cloud Bigtable Backup.

A :class: `Backup` can be used to:

- `create` the backup
- `update` the backup
- `delete` the backup

| ## Parameters ||
|---|---|
| **Name** | **Description** |
| `backup_id` | `str` The ID of the backup. |
| `instance` | `https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.instance.Instance` The Instance that owns this Backup. |
| `cluster_id` | `str` (Optional) The ID of the Cluster that contains this Backup. Required for calling 'delete', 'exists' etc. methods. |
| `table_id` | `str` (Optional) The ID of the Table that the Backup is for. Required if the 'create' method will be called. |
| `expire_time` | `` `datetime.datetime` `` (Optional) The expiration time after which the Backup will be automatically deleted. Required if the `create` method will be called. |

## Properties

### cluster

The ID of the \[parent\] cluster used in requests.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | The ID of the cluster containing the Backup. |

### encryption_info

Encryption info for this Backup.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `EncryptionInfo` | The encryption information for this backup. |

### end_time

The time this Backup was finished.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` `datetime.datetime` `` | A 'datetime' object representing the time when the creation of this Backup was finished. |

### expire_time

Expiration time used in the creation requests.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` `datetime.datetime` `` | A 'datetime' object representing the expiration time of this Backup. |

### name

<br />

Backup name used in requests.

The Backup name is of the form

<br />

    `"projects/../instances/../clusters/../backups/{backup_id}"`

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `ValueError` | If the 'cluster' has not been set. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | The Backup name. |

### parent

<br />

Name of the parent cluster used in requests.

<br />

> [!NOTE]
> **Note:** This property will return None if `cluster` is not set.

The parent name is of the form

<br />

<br />

    `"projects/{project}/instances/{instance_id}/clusters/{cluster}"`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | A full path to the parent cluster. |

### size_bytes

The size of this Backup, in bytes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | The size of this Backup, in bytes. |

### source_table

<br />

The full name of the Table from which this Backup is created.

<br />

> [!NOTE]
> **Note:** This property will return None if `table_id` is not set.

The table name is of the form

<br />

<br />

    `"projects/../instances/../tables/{source_table}"`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `str` | The Table name. |

### start_time

The time this Backup was started.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` `datetime.datetime` `` | A 'datetime' object representing the time when the creation of this Backup had started. |

### state

The current state of this Backup.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `State` | The current state of this Backup. |

## Methods

### create

    create(cluster_id=None)

Creates this backup within its instance.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cluster_id` | `str` (Optional) The ID of the Cluster for the newly created Backup. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `Conflict` | if the Backup already exists |
| `NotFound` | if the Instance owning the Backup does not exist |
| `BadRequest` | if the `table` or `expire_time` values are invalid, or `expire_time` is not set |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` `google.api_core.operation.Operation` `` | A future to be used to poll the status of the 'create' request |

### delete

    delete()

Delete this Backup.

### exists

    exists()

Tests whether this Backup exists.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` | True if the Backup exists, else False. |

### from_pb

    from_pb(backup_pb, instance)

Creates a Backup instance from a protobuf message.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `backup_pb` | `` `table.Backup` `` A Backup protobuf object. |
| `instance` | `https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.instance.Instance` The Instance that owns the Backup. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `ValueError` | If the backup name does not match the expected format or the parsed project ID does not match the project ID on the Instance's client, or if the parsed instance ID does not match the Instance ID. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.backup.Backup` | The backup parsed from the protobuf response. |

### get

    get()

Retrieves metadata of a pending or completed Backup.

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `google.api_core.exceptions.GoogleAPICallError` | If the request failed for any reason. |
| `google.api_core.exceptions.RetryError` | If the request failed due to a retryable error and retry attempts failed. |
| `ValueError` | If the parameters are invalid. |

### get_iam_policy

    get_iam_policy()

Gets the IAM access control policy for this backup.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Policy` | The current IAM policy of this backup. |

### reload

    reload()

Refreshes the stored backup properties.

### restore

    restore(table_id, instance_id=None)

Creates a new Table by restoring from this Backup. The new Table
can be created in the same Instance as the Instance containing the
Backup, or another Instance whose ID can be specified in the arguments.
The returned Table `long-running operation` can be used to track the
progress of the operation and to cancel it. The `response` type is
`Table`, if successful.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `table_id` | `str` The ID of the Table to create and restore to. This Table must not already exist. |
| `instance_id` | `str` (Optional) The ID of the Instance to restore the backup into, if different from the current one. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `google.api_core.exceptions.AlreadyExists` | If the table already exists. |
| `google.api_core.exceptions.GoogleAPICallError` | If the request failed for any reason. |
| `google.api_core.exceptions.RetryError` | If the request failed due to a retryable error and retry attempts failed. |
| `ValueError` | If the parameters are invalid. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` `google.api_core.operation.Operation` `` | A future to be used to poll the status of the 'restore' request. |

### set_iam_policy

    set_iam_policy(policy)

Sets the IAM access control policy for this backup. Replaces any
existing policy.

For more information about policy, please see documentation of
class `google.cloud.bigtable.policy.Policy`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `policy` | `Policy` A new IAM policy to replace the current IAM policy of this backup. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Policy` | The current IAM policy of this backup. |

### test_iam_permissions

    test_iam_permissions(permissions)

Tests whether the caller has the given permissions for this backup.
Returns the permissions that the caller has.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `permissions` | `list` The set of permissions to check for the `resource`. Permissions with wildcards (such as '*' or 'storage.* ') are not allowed. For more information see `IAM Overview https://cloud.google.com/iam/docs/overview#permissions`*. `Bigtable Permissions https://cloud.google.com/bigtable/docs/access-control`*. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `list` | A List(string) of permissions allowed on the backup. |

### update_expire_time

    update_expire_time(new_expire_time)

Update the expire time of this Backup.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `new_expire_time` | `` `datetime.datetime` `` the new expiration time timestamp |