Class Backup (6.54.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
TypeDescription
OperationFuture<Backup,CreateBackupMetadata>

delete()

public void delete()

Deletes this backup on Cloud Spanner.

Exceptions
TypeDescription
SpannerException

exists()

public boolean exists()

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

Returns
TypeDescription
boolean

getIAMPolicy()

public Policy getIAMPolicy()

Returns the IAM Policy for this backup.

Returns
TypeDescription
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
TypeDescription
boolean

listBackupOperations()

public Page<Operation> listBackupOperations()

Returns all long-running backup operations for this Backup.

Returns
TypeDescription
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
TypeDescription
Backup
Exceptions
TypeDescription
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
NameDescription
databaseDatabaseId
Returns
TypeDescription
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
NameDescription
policycom.google.cloud.Policy
Returns
TypeDescription
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
NameDescription
permissionsIterable<String>

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

Returns
TypeDescription
Iterable<String>

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

toBuilder()

public Backup.Builder toBuilder()
Returns
TypeDescription
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.