original_docstring: Restore from a backup to this database.
  
          :type source: :class:`~google.cloud.spanner_v1.backup.Backup`
          :param source: the path of the source being restored from.
  
          :rtype: :class:`~google.api_core.operation.Operation`
          :returns: a future used to poll the status of the create request
          :raises Conflict: if the database already exists
          :raises NotFound:
              if the instance owning the database does not exist, or
              if the backup being restored from does not exist
          :raises ValueError: if backup is not set
          
docstring: Restore from a backup to this database.
docstring_tokens: Restore from a backup to this database .
code: def restore(self, source):
          """Restore from a backup to this database.
  
          :type source: :class:`~google.cloud.spanner_v1.backup.Backup`
          :param source: the path of the source being restored from.
  
          :rtype: :class:`~google.api_core.operation.Operation`
          :returns: a future used to poll the status of the create request
          :raises Conflict: if the database already exists
          :raises NotFound:
              if the instance owning the database does not exist, or
              if the backup being restored from does not exist
          :raises ValueError: if backup is not set
          """
          if source is None:
              raise ValueError("Restore source not specified")
          if type(self._encryption_config) == dict:
              self._encryption_config = RestoreDatabaseEncryptionConfig(
                  **self._encryption_config
              )
          if (
              self.encryption_config
              and self.encryption_config.kms_key_name
              and self.encryption_config.encryption_type
              != RestoreDatabaseEncryptionConfig.EncryptionType.CUSTOMER_MANAGED_ENCRYPTION
          ):
              raise ValueError("kms_key_name only used with CUSTOMER_MANAGED_ENCRYPTION")
          api = self._instance._client.database_admin_api
          metadata = _metadata_with_prefix(self.name)
          request = RestoreDatabaseRequest(
              parent=self._instance.name,
              database_id=self.database_id,
              backup=source.name,
              encryption_config=self._encryption_config or None,
          )
          future = api.restore_database(request=request, metadata=metadata,)
          return future
code_tokens: def restore ( self , source ) : if source is None : raise ValueError ( "Restore source not specified" ) if type ( self . _encryption_config ) == dict : self . _encryption_config = RestoreDatabaseEncryptionConfig ( ** self . _encryption_config ) if ( self . encryption_config and self . encryption_config . kms_key_name and self . encryption_config . encryption_type != RestoreDatabaseEncryptionConfig . EncryptionType . CUSTOMER_MANAGED_ENCRYPTION ) : raise ValueError ( "kms_key_name only used with CUSTOMER_MANAGED_ENCRYPTION" ) api = self . _instance . _client . database_admin_api metadata = _metadata_with_prefix ( self . name ) request = RestoreDatabaseRequest ( parent = self . _instance . name , database_id = self . database_id , backup = source . name , encryption_config = self . _encryption_config or None , ) future = api . restore_database ( request = request , metadata = metadata , ) return future
short_docstring: Restore from a backup to this database.
short_docstring_tokens: Restore from a backup to this database .
comment: """Restore from a backup to this database.
  
          :type source: :class:`~google.cloud.spanner_v1.backup.Backup`
          :param source: the path of the source being restored from.
  
          :rtype: :class:`~google.api_core.operation.Operation`
          :returns: a future used to poll the status of the create request
          :raises Conflict: if the database already exists
          :raises NotFound:
              if the instance owning the database does not exist, or
              if the backup being restored from does not exist
          :raises ValueError: if backup is not set
          """