# Class Backup (6.118.0)

6.118.0 (latest) 6.116.0 6.111.1 6.108.0 6.107.0 6.103.0 6.102.1 6.101.1 6.100.0 6.99.0 6.98.1 6.97.1 6.96.1 6.95.1 6.94.0 6.93.0 6.89.0 6.88.0 6.87.0 6.86.0 6.85.0 6.83.0 6.82.0 6.80.1 6.79.0 6.77.0 6.74.1 6.72.0 6.71.0 6.69.0 6.68.0 6.66.0 6.65.1 6.62.0 6.60.0 6.58.0 6.57.0 6.56.0 6.55.0 6.54.0 6.53.0 6.52.1 6.51.0 6.50.1 6.49.0 6.25.1 6.24.0 6.23.4 6.22.0 6.21.2 6.20.0 6.19.1 6.18.0 6.17.4 6.14.1

    public class Backup extends BackupInfo

Represents a Cloud Spanner database backup. `Backup` adds a layer of service related
functionality over `BackupInfo`.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> [BackupInfo](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo) \> Backup

## Inherited Members

[BackupInfo.equals(Object)](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_equals_java_lang_Object_) [BackupInfo.getDatabase()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getDatabase__) [BackupInfo.getEncryptionConfig()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getEncryptionConfig__) [BackupInfo.getEncryptionInfo()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getEncryptionInfo__) [BackupInfo.getExpireTime()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getExpireTime__) [BackupInfo.getId()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getId__) [BackupInfo.getInstanceId()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getInstanceId__) [BackupInfo.getMaxExpireTime()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getMaxExpireTime__) [BackupInfo.getProto()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getProto__) [BackupInfo.getReferencingBackups()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getReferencingBackups__) [BackupInfo.getSize()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getSize__) [BackupInfo.getState()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getState__) [BackupInfo.getVersionTime()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_getVersionTime__) [BackupInfo.hashCode()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_hashCode__) [BackupInfo.toString()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.BackupInfo#com_google_cloud_spanner_BackupInfo_toString__) [Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Methods

### create()

    public OperationFuture<Backup,CreateBackupMetadata> create()

Creates a backup on the server based on the source of this [Backup](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Backup) instance.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Backup,https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.admin.database.v1.CreateBackupMetadata>` |   |

### delete()

    public void delete()

Deletes this backup on Cloud Spanner.

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerException` |   |

### exists()

    public boolean exists()

Returns `true` if a backup with the id of this [Backup](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Backup) exists on Cloud
Spanner.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getIAMPolicy()

    public Policy getIAMPolicy()

Returns the IAM Policy for this backup.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.cloud.Policy` |   |

### isReady()

    public boolean isReady()

Returns `true` if this backup is ready to use. The value returned by this method
could be out-of-sync with the value returned by [#getState()](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.admin.database.v1.Backup#com_google_spanner_admin_database_v1_Backup_getState__), as this method will make a
round-trip to the server and return a value based on the response from the server.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### listBackupOperations()

    public Page<Operation> listBackupOperations()

Returns all long-running backup operations for this [Backup](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Backup).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.paging.Page.html<https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.longrunning.Operation.html>` |   |

### reload()

    public Backup reload()

Fetches the backup's current information and returns a new [Backup](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Backup) instance. It does not
update this instance.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Backup` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.SpannerException` |   |

### restore(DatabaseId database)

    public OperationFuture<Database,RestoreDatabaseMetadata> restore(DatabaseId database)

Restores this backup to the specified database. The database must not already exist and will be
created by this call. The database may be created in a different instance than where the backup
is stored.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `database` | `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.DatabaseId` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/gax/latest/com.google.api.gax.longrunning.OperationFuture.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Database,https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.spanner.admin.database.v1.RestoreDatabaseMetadata>` |   |

### setIAMPolicy(Policy policy)

    public Policy setIAMPolicy(Policy policy)

Updates the IAM policy for this backup and returns the resulting policy. It is highly
recommended to first get the current policy and base the updated policy on the returned policy.
See Policy.Builder#setEtag(String) for information on the recommended read-modify-write
cycle.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `policy` | `com.google.cloud.Policy` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.cloud.Policy` |   |

### testIAMPermissions(Iterable\<String\> permissions)

    public Iterable<String> testIAMPermissions(Iterable<String> permissions)

Tests for the given permissions on this backup for the caller.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `permissions` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` the permissions to test for. Permissions with wildcards (such as '*', 'spanner.*', 'spanner.instances.\*') are not allowed. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` | the subset of the tested permissions that the caller is allowed. |

### toBuilder()

    public Backup.Builder toBuilder()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Backup.Builder` |   |

### updateExpireTime()

    public void updateExpireTime()

Updates the expire time of this backup on Cloud Spanner. If this [Backup](https://docs.cloud.google.com/java/docs/reference/google-cloud-spanner/latest/com.google.cloud.spanner.Backup) does not have
an expire time, the method will throw an IllegalStateException.