public class Backup extends BackupInfo
Represents a Cloud Spanner database backup. Backup
adds a layer of service related
functionality over BackupInfo
.
Methods
create()
public OperationFuture<Backup,CreateBackupMetadata> create()
Creates a backup on the server based on the source of this Backup instance.
Returns
delete()
Deletes this backup on Cloud Spanner.
Exceptions
exists()
Returns true
if a backup with the id of this Backup exists on Cloud
Spanner.
Returns
getIAMPolicy()
public Policy getIAMPolicy()
Returns the IAM Policy for this backup.
Returns
Type | Description |
com.google.cloud.Policy | |
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
listBackupOperations()
public Page<Operation> listBackupOperations()
Returns all long-running backup operations for this Backup.
Returns
reload()
Fetches the backup's current information and returns a new Backup instance. It does not
update this instance.
Returns
Exceptions
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
Returns
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
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.