Class Backup (6.82.0)

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 > BackupInfo > Backup

Methods

create()

public OperationFuture<Backup,CreateBackupMetadata> create()

Creates a backup on the server based on the source of this Backup instance.

Returns
Type Description
OperationFuture<Backup,CreateBackupMetadata>

delete()

public void delete()

Deletes this backup on Cloud Spanner.

Exceptions
Type Description
SpannerException

exists()

public boolean exists()

Returns true if a backup with the id of this Backup exists on Cloud Spanner.

Returns
Type Description
boolean

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(), 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
boolean

listBackupOperations()

public Page<Operation> listBackupOperations()

Returns all long-running backup operations for this Backup.

Returns
Type Description
Page<Operation>

reload()

public Backup reload()

Fetches the backup's current information and returns a new Backup instance. It does not update this instance.

Returns
Type Description
Backup
Exceptions
Type Description
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 DatabaseId
Returns
Type Description
OperationFuture<Database,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 Iterable<String>

the permissions to test for. Permissions with wildcards (such as '', 'spanner.', 'spanner.instances.*') are not allowed.

Returns
Type Description
Iterable<String>

the subset of the tested permissions that the caller is allowed.

toBuilder()

public Backup.Builder toBuilder()
Returns
Type Description
Backup.Builder

updateExpireTime()

public void updateExpireTime()

Updates the expire time of this backup on Cloud Spanner. If this Backup does not have an expire time, the method will throw an IllegalStateException.