As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Types for Google Cloud Spanner Admin Database v1 API

class google.cloud.spanner_admin_database_v1.types.Backup(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A backup of a Cloud Spanner database.

database

Required for the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] operation. Name of the database from which this backup was created. This needs to be in the same instance as the backup. Values are of the form projects/<project>/instances/<instance>/databases/<database>.

Type

str

version_time

The backup will contain an externally consistent copy of the database at the timestamp specified by version_time. If version_time is not specified, the system will set version_time to the create_time of the backup.

Type

google.protobuf.timestamp_pb2.Timestamp

expire_time

Required for the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] operation. The expiration time of the backup, with microseconds granularity that must be at least 6 hours and at most 366 days from the time the CreateBackup request is processed. Once the expire_time has passed, the backup is eligible to be automatically deleted by Cloud Spanner to free the resources used by the backup.

Type

google.protobuf.timestamp_pb2.Timestamp

name

Output only for the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] operation. Required for the [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup] operation.

A globally unique identifier for the backup which cannot be changed. Values are of the form projects/<project>/instances/<instance>/backups/[a-z][a-z0-9_\-]*[a-z0-9] The final segment of the name must be between 2 and 60 characters in length.

The backup is stored in the location(s) specified in the instance configuration of the instance containing the backup, identified by the prefix of the backup name of the form projects/<project>/instances/<instance>.

Type

str

create_time

Output only. The time the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] request is received. If the request does not specify version_time, the version_time of the backup will be equivalent to the create_time.

Type

google.protobuf.timestamp_pb2.Timestamp

size_bytes

Output only. Size of the backup in bytes.

Type

int

state

Output only. The current state of the backup.

Type

google.cloud.spanner_admin_database_v1.types.Backup.State

referencing_databases

Output only. The names of the restored databases that reference the backup. The database names are of the form projects/<project>/instances/<instance>/databases/<database>. Referencing databases may exist in different instances. The existence of any referencing database prevents the backup from being deleted. When a restored database from the backup enters the READY state, the reference to the backup is removed.

Type

Sequence[str]

encryption_info

Output only. The encryption information for the backup.

Type

google.cloud.spanner_admin_database_v1.types.EncryptionInfo

database_dialect

Output only. The database dialect information for the backup.

Type

google.cloud.spanner_admin_database_v1.types.DatabaseDialect

class State(value)[source]

Bases: proto.enums.Enum

Indicates the current state of the backup.

CREATING = 1
READY = 2
STATE_UNSPECIFIED = 0
class google.cloud.spanner_admin_database_v1.types.BackupInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Information about a backup.

backup

Name of the backup.

Type

str

version_time

The backup contains an externally consistent copy of source_database at the timestamp specified by version_time. If the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] request did not specify version_time, the version_time of the backup is equivalent to the create_time.

Type

google.protobuf.timestamp_pb2.Timestamp

create_time

The time the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] request was received.

Type

google.protobuf.timestamp_pb2.Timestamp

source_database

Name of the database the backup was created from.

Type

str

class google.cloud.spanner_admin_database_v1.types.CreateBackupEncryptionConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Encryption configuration for the backup to create.

encryption_type

Required. The encryption type of the backup.

Type

google.cloud.spanner_admin_database_v1.types.CreateBackupEncryptionConfig.EncryptionType

kms_key_name

Optional. The Cloud KMS key that will be used to protect the backup. This field should be set only when [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] is CUSTOMER_MANAGED_ENCRYPTION. Values are of the form projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>.

Type

str

class EncryptionType(value)[source]

Bases: proto.enums.Enum

Encryption types for the backup.

CUSTOMER_MANAGED_ENCRYPTION = 3
ENCRYPTION_TYPE_UNSPECIFIED = 0
GOOGLE_DEFAULT_ENCRYPTION = 2
USE_DATABASE_ENCRYPTION = 1
class google.cloud.spanner_admin_database_v1.types.CreateBackupMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata type for the operation returned by [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].

name

The name of the backup being created.

Type

str

database

The name of the database the backup is created from.

Type

str

progress

The progress of the [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup] operation.

Type

google.cloud.spanner_admin_database_v1.types.OperationProgress

cancel_time

The time at which cancellation of this operation was received. [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients can use [Operations.GetOperation][google.longrunning.Operations.GetOperation] or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED.

Type

google.protobuf.timestamp_pb2.Timestamp

class google.cloud.spanner_admin_database_v1.types.CreateBackupRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [CreateBackup][google.spanner.admin.database.v1.DatabaseAdmin.CreateBackup].

parent

Required. The name of the instance in which the backup will be created. This must be the same instance that contains the database the backup will be created from. The backup will be stored in the location(s) specified in the instance configuration of this instance. Values are of the form projects/<project>/instances/<instance>.

Type

str

backup_id

Required. The id of the backup to be created. The backup_id appended to parent forms the full backup name of the form projects/<project>/instances/<instance>/backups/<backup_id>.

Type

str

backup

Required. The backup to create.

Type

google.cloud.spanner_admin_database_v1.types.Backup

encryption_config

Optional. The encryption configuration used to encrypt the backup. If this field is not specified, the backup will use the same encryption configuration as the database by default, namely [encryption_type][google.spanner.admin.database.v1.CreateBackupEncryptionConfig.encryption_type] = USE_DATABASE_ENCRYPTION.

Type

google.cloud.spanner_admin_database_v1.types.CreateBackupEncryptionConfig

class google.cloud.spanner_admin_database_v1.types.CreateDatabaseMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata type for the operation returned by [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].

database

The database being created.

Type

str

class google.cloud.spanner_admin_database_v1.types.CreateDatabaseRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [CreateDatabase][google.spanner.admin.database.v1.DatabaseAdmin.CreateDatabase].

parent

Required. The name of the instance that will serve the new database. Values are of the form projects/<project>/instances/<instance>.

Type

str

create_statement

Required. A CREATE DATABASE statement, which specifies the ID of the new database. The database ID must conform to the regular expression [a-z][a-z0-9_\-]*[a-z0-9] and be between 2 and 30 characters in length. If the database ID is a reserved word or if it contains a hyphen, the database ID must be enclosed in backticks (`).

Type

str

extra_statements

Optional. A list of DDL statements to run inside the newly created database. Statements can create tables, indexes, etc. These statements execute atomically with the creation of the database: if there is an error in any statement, the database is not created.

Type

Sequence[str]

encryption_config

Optional. The encryption configuration for the database. If this field is not specified, Cloud Spanner will encrypt/decrypt all data at rest using Google default encryption.

Type

google.cloud.spanner_admin_database_v1.types.EncryptionConfig

database_dialect

Optional. The dialect of the Cloud Spanner Database.

Type

google.cloud.spanner_admin_database_v1.types.DatabaseDialect

class google.cloud.spanner_admin_database_v1.types.Database(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

A Cloud Spanner database.

name

Required. The name of the database. Values are of the form projects/<project>/instances/<instance>/databases/<database>, where <database> is as specified in the CREATE DATABASE statement. This name can be passed to other API methods to identify the database.

Type

str

state

Output only. The current database state.

Type

google.cloud.spanner_admin_database_v1.types.Database.State

create_time

Output only. If exists, the time at which the database creation started.

Type

google.protobuf.timestamp_pb2.Timestamp

restore_info

Output only. Applicable only for restored databases. Contains information about the restore source.

Type

google.cloud.spanner_admin_database_v1.types.RestoreInfo

encryption_config

Output only. For databases that are using customer managed encryption, this field contains the encryption configuration for the database. For databases that are using Google default or other types of encryption, this field is empty.

Type

google.cloud.spanner_admin_database_v1.types.EncryptionConfig

encryption_info

Output only. For databases that are using customer managed encryption, this field contains the encryption information for the database, such as encryption state and the Cloud KMS key versions that are in use. For databases that are using Google default or other types of encryption, this field is empty.

This field is propagated lazily from the backend. There might be a delay from when a key version is being used and when it appears in this field.

Type

Sequence[google.cloud.spanner_admin_database_v1.types.EncryptionInfo]

version_retention_period

Output only. The period in which Cloud Spanner retains all versions of data for the database. This is the same as the value of version_retention_period database option set using [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl]. Defaults to 1 hour, if not set.

Type

str

earliest_version_time

Output only. Earliest timestamp at which older versions of the data can be read. This value is continuously updated by Cloud Spanner and becomes stale the moment it is queried. If you are using this value to recover data, make sure to account for the time from the moment when the value is queried to the moment when you initiate the recovery.

Type

google.protobuf.timestamp_pb2.Timestamp

default_leader

Output only. The read-write region which contains the database’s leader replicas.

This is the same as the value of default_leader database option set using DatabaseAdmin.CreateDatabase or DatabaseAdmin.UpdateDatabaseDdl. If not explicitly set, this is empty.

Type

str

database_dialect

Output only. The dialect of the Cloud Spanner Database.

Type

google.cloud.spanner_admin_database_v1.types.DatabaseDialect

class State(value)[source]

Bases: proto.enums.Enum

Indicates the current state of the database.

CREATING = 1
READY = 2
READY_OPTIMIZING = 3
STATE_UNSPECIFIED = 0
class google.cloud.spanner_admin_database_v1.types.DatabaseDialect(value)[source]

Bases: proto.enums.Enum

Indicates the dialect type of a database.

DATABASE_DIALECT_UNSPECIFIED = 0
GOOGLE_STANDARD_SQL = 1
POSTGRESQL = 2
class google.cloud.spanner_admin_database_v1.types.DeleteBackupRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [DeleteBackup][google.spanner.admin.database.v1.DatabaseAdmin.DeleteBackup].

name

Required. Name of the backup to delete. Values are of the form projects/<project>/instances/<instance>/backups/<backup>.

Type

str

class google.cloud.spanner_admin_database_v1.types.DropDatabaseRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].

database

Required. The database to be dropped.

Type

str

class google.cloud.spanner_admin_database_v1.types.EncryptionConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Encryption configuration for a Cloud Spanner database.

kms_key_name

The Cloud KMS key to be used for encrypting and decrypting the database. Values are of the form projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>.

Type

str

class google.cloud.spanner_admin_database_v1.types.EncryptionInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Encryption information for a Cloud Spanner database or backup.

encryption_type

Output only. The type of encryption.

Type

google.cloud.spanner_admin_database_v1.types.EncryptionInfo.Type

encryption_status

Output only. If present, the status of a recent encrypt/decrypt call on underlying data for this database or backup. Regardless of status, data is always encrypted at rest.

Type

google.rpc.status_pb2.Status

kms_key_version

Output only. A Cloud KMS key version that is being used to protect the database or backup.

Type

str

class Type(value)[source]

Bases: proto.enums.Enum

Possible encryption types.

CUSTOMER_MANAGED_ENCRYPTION = 2
GOOGLE_DEFAULT_ENCRYPTION = 1
TYPE_UNSPECIFIED = 0
class google.cloud.spanner_admin_database_v1.types.GetBackupRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [GetBackup][google.spanner.admin.database.v1.DatabaseAdmin.GetBackup].

name

Required. Name of the backup. Values are of the form projects/<project>/instances/<instance>/backups/<backup>.

Type

str

class google.cloud.spanner_admin_database_v1.types.GetDatabaseDdlRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].

database

Required. The database whose schema we wish to get. Values are of the form projects/<project>/instances/<instance>/databases/<database>

Type

str

class google.cloud.spanner_admin_database_v1.types.GetDatabaseDdlResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The response for [GetDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabaseDdl].

statements

A list of formatted DDL statements defining the schema of the database specified in the request.

Type

Sequence[str]

class google.cloud.spanner_admin_database_v1.types.GetDatabaseRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [GetDatabase][google.spanner.admin.database.v1.DatabaseAdmin.GetDatabase].

name

Required. The name of the requested database. Values are of the form projects/<project>/instances/<instance>/databases/<database>.

Type

str

class google.cloud.spanner_admin_database_v1.types.ListBackupOperationsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].

parent

Required. The instance of the backup operations. Values are of the form projects/<project>/instances/<instance>.

Type

str

filter

An expression that filters the list of returned backup operations.

A filter expression consists of a field name, a comparison operator, and a value for filtering. The value must be a string, a number, or a boolean. The comparison operator must be one of: <, >, <=, >=, !=, =, or :. Colon : is the contains operator. Filter rules are not case sensitive.

The following fields in the [operation][google.longrunning.Operation] are eligible for filtering:

  • name - The name of the long-running operation

  • done - False if the operation is in progress, else true.

  • metadata.@type - the type of metadata. For example, the type string for [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata] is type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata.

  • metadata.<field_name> - any field in metadata.value.

  • error - Error associated with the long-running operation.

  • response.@type - the type of response.

  • response.<field_name> - any field in response.value.

You can combine multiple expressions by enclosing each expression in parentheses. By default, expressions are combined with AND logic, but you can specify AND, OR, and NOT logic explicitly.

Here are a few examples:

  • done:true - The operation is complete.

  • metadata.database:prod - The database the backup was taken from has a name containing the string “prod”.

  • (metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.CreateBackupMetadata) AND (metadata.name:howl) AND (metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND (error:*) - Returns operations where:

    • The operation’s metadata type is [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].

    • The backup name contains the string “howl”.

    • The operation started before 2018-03-28T14:50:00Z.

    • The operation resulted in an error.

Type

str

page_size

Number of operations to be returned in the response. If 0 or less, defaults to the server’s maximum allowed page size.

Type

int

page_token

If non-empty, page_token should contain a [next_page_token][google.spanner.admin.database.v1.ListBackupOperationsResponse.next_page_token] from a previous [ListBackupOperationsResponse][google.spanner.admin.database.v1.ListBackupOperationsResponse] to the same parent and with the same filter.

Type

str

class google.cloud.spanner_admin_database_v1.types.ListBackupOperationsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The response for [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations].

operations

The list of matching backup [long-running operations][google.longrunning.Operation]. Each operation’s name will be prefixed by the backup’s name and the operation’s [metadata][google.longrunning.Operation.metadata] will be of type [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata]. Operations returned include those that are pending or have completed/failed/canceled within the last 7 days. Operations returned are ordered by operation.metadata.value.progress.start_time in descending order starting from the most recently started operation.

Type

Sequence[google.longrunning.operations_pb2.Operation]

next_page_token

next_page_token can be sent in a subsequent [ListBackupOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListBackupOperations] call to fetch more of the matching metadata.

Type

str

property raw_page
class google.cloud.spanner_admin_database_v1.types.ListBackupsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].

parent

Required. The instance to list backups from. Values are of the form projects/<project>/instances/<instance>.

Type

str

filter

An expression that filters the list of returned backups.

A filter expression consists of a field name, a comparison operator, and a value for filtering. The value must be a string, a number, or a boolean. The comparison operator must be one of: <, >, <=, >=, !=, =, or :. Colon : is the contains operator. Filter rules are not case sensitive.

The following fields in the [Backup][google.spanner.admin.database.v1.Backup] are eligible for filtering:

  • name

  • database

  • state

  • create_time (and values are of the format YYYY-MM-DDTHH:MM:SSZ)

  • expire_time (and values are of the format YYYY-MM-DDTHH:MM:SSZ)

  • version_time (and values are of the format YYYY-MM-DDTHH:MM:SSZ)

  • size_bytes

You can combine multiple expressions by enclosing each expression in parentheses. By default, expressions are combined with AND logic, but you can specify AND, OR, and NOT logic explicitly.

Here are a few examples:

  • name:Howl - The backup’s name contains the string “howl”.

  • database:prod - The database’s name contains the string “prod”.

  • state:CREATING - The backup is pending creation.

  • state:READY - The backup is fully created and ready for use.

  • (name:howl) AND (create_time < \"2018-03-28T14:50:00Z\") - The backup name contains the string “howl” and create_time of the backup is before 2018-03-28T14:50:00Z.

  • expire_time < \"2018-03-28T14:50:00Z\" - The backup expire_time is before 2018-03-28T14:50:00Z.

  • size_bytes > 10000000000 - The backup’s size is greater than 10GB

Type

str

page_size

Number of backups to be returned in the response. If 0 or less, defaults to the server’s maximum allowed page size.

Type

int

page_token

If non-empty, page_token should contain a [next_page_token][google.spanner.admin.database.v1.ListBackupsResponse.next_page_token] from a previous [ListBackupsResponse][google.spanner.admin.database.v1.ListBackupsResponse] to the same parent and with the same filter.

Type

str

class google.cloud.spanner_admin_database_v1.types.ListBackupsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The response for [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups].

backups

The list of matching backups. Backups returned are ordered by create_time in descending order, starting from the most recent create_time.

Type

Sequence[google.cloud.spanner_admin_database_v1.types.Backup]

next_page_token

next_page_token can be sent in a subsequent [ListBackups][google.spanner.admin.database.v1.DatabaseAdmin.ListBackups] call to fetch more of the matching backups.

Type

str

property raw_page
class google.cloud.spanner_admin_database_v1.types.ListDatabaseOperationsRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].

parent

Required. The instance of the database operations. Values are of the form projects/<project>/instances/<instance>.

Type

str

filter

An expression that filters the list of returned operations.

A filter expression consists of a field name, a comparison operator, and a value for filtering. The value must be a string, a number, or a boolean. The comparison operator must be one of: <, >, <=, >=, !=, =, or :. Colon : is the contains operator. Filter rules are not case sensitive.

The following fields in the [Operation][google.longrunning.Operation] are eligible for filtering:

  • name - The name of the long-running operation

  • done - False if the operation is in progress, else true.

  • metadata.@type - the type of metadata. For example, the type string for [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata] is type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata.

  • metadata.<field_name> - any field in metadata.value.

  • error - Error associated with the long-running operation.

  • response.@type - the type of response.

  • response.<field_name> - any field in response.value.

You can combine multiple expressions by enclosing each expression in parentheses. By default, expressions are combined with AND logic. However, you can specify AND, OR, and NOT logic explicitly.

Here are a few examples:

  • done:true - The operation is complete.

  • (metadata.@type=type.googleapis.com/google.spanner.admin.database.v1.RestoreDatabaseMetadata) AND (metadata.source_type:BACKUP) AND (metadata.backup_info.backup:backup_howl) AND (metadata.name:restored_howl) AND (metadata.progress.start_time < \"2018-03-28T14:50:00Z\") AND (error:*) - Return operations where:

    • The operation’s metadata type is [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].

    • The database is restored from a backup.

    • The backup name contains “backup_howl”.

    • The restored database’s name contains “restored_howl”.

    • The operation started before 2018-03-28T14:50:00Z.

    • The operation resulted in an error.

Type

str

page_size

Number of operations to be returned in the response. If 0 or less, defaults to the server’s maximum allowed page size.

Type

int

page_token

If non-empty, page_token should contain a [next_page_token][google.spanner.admin.database.v1.ListDatabaseOperationsResponse.next_page_token] from a previous [ListDatabaseOperationsResponse][google.spanner.admin.database.v1.ListDatabaseOperationsResponse] to the same parent and with the same filter.

Type

str

class google.cloud.spanner_admin_database_v1.types.ListDatabaseOperationsResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The response for [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations].

operations

The list of matching database [long-running operations][google.longrunning.Operation]. Each operation’s name will be prefixed by the database’s name. The operation’s [metadata][google.longrunning.Operation.metadata] field type metadata.type_url describes the type of the metadata.

Type

Sequence[google.longrunning.operations_pb2.Operation]

next_page_token

next_page_token can be sent in a subsequent [ListDatabaseOperations][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabaseOperations] call to fetch more of the matching metadata.

Type

str

property raw_page
class google.cloud.spanner_admin_database_v1.types.ListDatabasesRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].

parent

Required. The instance whose databases should be listed. Values are of the form projects/<project>/instances/<instance>.

Type

str

page_size

Number of databases to be returned in the response. If 0 or less, defaults to the server’s maximum allowed page size.

Type

int

page_token

If non-empty, page_token should contain a [next_page_token][google.spanner.admin.database.v1.ListDatabasesResponse.next_page_token] from a previous [ListDatabasesResponse][google.spanner.admin.database.v1.ListDatabasesResponse].

Type

str

class google.cloud.spanner_admin_database_v1.types.ListDatabasesResponse(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The response for [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases].

databases

Databases that matched the request.

Type

Sequence[google.cloud.spanner_admin_database_v1.types.Database]

next_page_token

next_page_token can be sent in a subsequent [ListDatabases][google.spanner.admin.database.v1.DatabaseAdmin.ListDatabases] call to fetch more of the matching databases.

Type

str

property raw_page
class google.cloud.spanner_admin_database_v1.types.OperationProgress(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Encapsulates progress related information for a Cloud Spanner long running operation.

progress_percent

Percent completion of the operation. Values are between 0 and 100 inclusive.

Type

int

start_time

Time the request was received.

Type

google.protobuf.timestamp_pb2.Timestamp

end_time

If set, the time at which this operation failed or was completed successfully.

Type

google.protobuf.timestamp_pb2.Timestamp

class google.cloud.spanner_admin_database_v1.types.OptimizeRestoredDatabaseMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata type for the long-running operation used to track the progress of optimizations performed on a newly restored database. This long-running operation is automatically created by the system after the successful completion of a database restore, and cannot be cancelled.

name

Name of the restored database being optimized.

Type

str

progress

The progress of the post-restore optimizations.

Type

google.cloud.spanner_admin_database_v1.types.OperationProgress

class google.cloud.spanner_admin_database_v1.types.RestoreDatabaseEncryptionConfig(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Encryption configuration for the restored database.

encryption_type

Required. The encryption type of the restored database.

Type

google.cloud.spanner_admin_database_v1.types.RestoreDatabaseEncryptionConfig.EncryptionType

kms_key_name

Optional. The Cloud KMS key that will be used to encrypt/decrypt the restored database. This field should be set only when [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] is CUSTOMER_MANAGED_ENCRYPTION. Values are of the form projects/<project>/locations/<location>/keyRings/<key_ring>/cryptoKeys/<kms_key_name>.

Type

str

class EncryptionType(value)[source]

Bases: proto.enums.Enum

Encryption types for the database to be restored.

CUSTOMER_MANAGED_ENCRYPTION = 3
ENCRYPTION_TYPE_UNSPECIFIED = 0
GOOGLE_DEFAULT_ENCRYPTION = 2
USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1
class google.cloud.spanner_admin_database_v1.types.RestoreDatabaseMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata type for the long-running operation returned by [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].

name

Name of the database being created and restored to.

Type

str

source_type

The type of the restore source.

Type

google.cloud.spanner_admin_database_v1.types.RestoreSourceType

backup_info

Information about the backup used to restore the database.

This field is a member of oneof source_info.

Type

google.cloud.spanner_admin_database_v1.types.BackupInfo

progress

The progress of the [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase] operation.

Type

google.cloud.spanner_admin_database_v1.types.OperationProgress

cancel_time

The time at which cancellation of this operation was received. [Operations.CancelOperation][google.longrunning.Operations.CancelOperation] starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients can use [Operations.GetOperation][google.longrunning.Operations.GetOperation] or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to Code.CANCELLED.

Type

google.protobuf.timestamp_pb2.Timestamp

optimize_database_operation_name

If exists, the name of the long-running operation that will be used to track the post-restore optimization process to optimize the performance of the restored database, and remove the dependency on the restore source. The name is of the form projects/<project>/instances/<instance>/databases/<database>/operations/<operation> where the is the name of database being created and restored to. The metadata type of the long-running operation is [OptimizeRestoredDatabaseMetadata][google.spanner.admin.database.v1.OptimizeRestoredDatabaseMetadata]. This long-running operation will be automatically created by the system after the RestoreDatabase long-running operation completes successfully. This operation will not be created if the restore was not successful.

Type

str

class google.cloud.spanner_admin_database_v1.types.RestoreDatabaseRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [RestoreDatabase][google.spanner.admin.database.v1.DatabaseAdmin.RestoreDatabase].

parent

Required. The name of the instance in which to create the restored database. This instance must be in the same project and have the same instance configuration as the instance containing the source backup. Values are of the form projects/<project>/instances/<instance>.

Type

str

database_id

Required. The id of the database to create and restore to. This database must not already exist. The database_id appended to parent forms the full database name of the form projects/<project>/instances/<instance>/databases/<database_id>.

Type

str

backup

Name of the backup from which to restore. Values are of the form projects/<project>/instances/<instance>/backups/<backup>.

This field is a member of oneof source.

Type

str

encryption_config

Optional. An encryption configuration describing the encryption type and key resources in Cloud KMS used to encrypt/decrypt the database to restore to. If this field is not specified, the restored database will use the same encryption configuration as the backup by default, namely [encryption_type][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig.encryption_type] = USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION.

Type

google.cloud.spanner_admin_database_v1.types.RestoreDatabaseEncryptionConfig

class google.cloud.spanner_admin_database_v1.types.RestoreInfo(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Information about the database restore.

source_type

The type of the restore source.

Type

google.cloud.spanner_admin_database_v1.types.RestoreSourceType

backup_info

Information about the backup used to restore the database. The backup may no longer exist.

This field is a member of oneof source_info.

Type

google.cloud.spanner_admin_database_v1.types.BackupInfo

class google.cloud.spanner_admin_database_v1.types.RestoreSourceType(value)[source]

Bases: proto.enums.Enum

Indicates the type of the restore source.

BACKUP = 1
TYPE_UNSPECIFIED = 0
class google.cloud.spanner_admin_database_v1.types.UpdateBackupRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

The request for [UpdateBackup][google.spanner.admin.database.v1.DatabaseAdmin.UpdateBackup].

backup

Required. The backup to update. backup.name, and the fields to be updated as specified by update_mask are required. Other fields are ignored. Update is only supported for the following fields:

  • backup.expire_time.

Type

google.cloud.spanner_admin_database_v1.types.Backup

update_mask

Required. A mask specifying which fields (e.g. expire_time) in the Backup resource should be updated. This mask is relative to the Backup resource, not to the request message. The field mask must always be specified; this prevents any future fields from being erased accidentally by clients that do not know about them.

Type

google.protobuf.field_mask_pb2.FieldMask

class google.cloud.spanner_admin_database_v1.types.UpdateDatabaseDdlMetadata(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Metadata type for the operation returned by [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl].

database

The database being modified.

Type

str

statements

For an update this list contains all the statements. For an individual statement, this list contains only that statement.

Type

Sequence[str]

commit_timestamps

Reports the commit timestamps of all statements that have succeeded so far, where commit_timestamps[i] is the commit timestamp for the statement statements[i].

Type

Sequence[google.protobuf.timestamp_pb2.Timestamp]

throttled

Output only. When true, indicates that the operation is throttled e.g due to resource constraints. When resources become available the operation will resume and this field will be false again.

Type

bool

progress

The progress of the [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] operations. Currently, only index creation statements will have a continuously updating progress. For non-index creation statements, progress[i] will have start time and end time populated with commit timestamp of operation, as well as a progress of 100% once the operation has completed. progress[i] is the operation progress for statements[i].

Type

Sequence[google.cloud.spanner_admin_database_v1.types.OperationProgress]

class google.cloud.spanner_admin_database_v1.types.UpdateDatabaseDdlRequest(mapping=None, *, ignore_unknown_fields=False, **kwargs)[source]

Bases: proto.message.Message

Enqueues the given DDL statements to be applied, in order but not necessarily all at once, to the database schema at some point (or points) in the future. The server checks that the statements are executable (syntactically valid, name tables that exist, etc.) before enqueueing them, but they may still fail upon later execution (e.g., if a statement from another batch of statements is applied first and it conflicts in some way, or if there is some data-related problem like a NULL value in a column to which NOT NULL would be added). If a statement fails, all subsequent statements in the batch are automatically cancelled.

Each batch of statements is assigned a name which can be used with the [Operations][google.longrunning.Operations] API to monitor progress. See the [operation_id][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.operation_id] field for more details.

database

Required. The database to update.

Type

str

statements

Required. DDL statements to be applied to the database.

Type

Sequence[str]

operation_id

If empty, the new update request is assigned an automatically-generated operation ID. Otherwise, operation_id is used to construct the name of the resulting [Operation][google.longrunning.Operation].

Specifying an explicit operation ID simplifies determining whether the statements were executed in the event that the [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] call is replayed, or the return value is otherwise lost: the [database][google.spanner.admin.database.v1.UpdateDatabaseDdlRequest.database] and operation_id fields can be combined to form the [name][google.longrunning.Operation.name] of the resulting [longrunning.Operation][google.longrunning.Operation]: <database>/operations/<operation_id>.

operation_id should be unique within the database, and must be a valid identifier: [a-z][a-z0-9_]*. Note that automatically-generated operation IDs always begin with an underscore. If the named operation already exists, [UpdateDatabaseDdl][google.spanner.admin.database.v1.DatabaseAdmin.UpdateDatabaseDdl] returns ALREADY_EXISTS.

Type

str