Class Backup


  • public class Backup
    extends BackupInfo
    Represents a Cloud Spanner database backup. Backup adds a layer of service related functionality over BackupInfo.
    • Method Detail

      • create

        public com.google.api.gax.longrunning.OperationFuture<Backup,​CreateBackupMetadata> create()
        Creates a backup on the server based on the source of this Backup instance.
      • exists

        public boolean exists()
        Returns true if a backup with the id of this Backup exists on Cloud Spanner.
      • 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 BackupInfo.getState(), as this method will make a round-trip to the server and return a value based on the response from the server.
      • 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.
      • restore

        public com.google.api.gax.longrunning.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.
      • listBackupOperations

        public com.google.api.gax.paging.Page<com.google.longrunning.Operation> listBackupOperations()
        Returns all long-running backup operations for this Backup.
      • getIAMPolicy

        public com.google.cloud.Policy getIAMPolicy()
        Returns the IAM Policy for this backup.
      • setIAMPolicy

        public com.google.cloud.Policy setIAMPolicy​(com.google.cloud.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.
      • testIAMPermissions

        public Iterable<String> testIAMPermissions​(Iterable<String> permissions)
        Tests for the given permissions on this backup for the caller.
        Parameters:
        permissions - the permissions to test for. Permissions with wildcards (such as '*', 'spanner.*', 'spanner.instances.*') are not allowed.
        Returns:
        the subset of the tested permissions that the caller is allowed.