Package google.spanner.admin.database.v1

Index

DatabaseAdmin

Cloud Spanner Database Admin API

The Cloud Spanner Database Admin API can be used to create, drop, and list databases. It also enables updating the schema of pre-existing databases. It can be also used to create, delete and list backups for a database and to restore from an existing backup.

CreateBackup

rpc CreateBackup(CreateBackupRequest) returns (Operation)

Starts creating a new Cloud Spanner Backup. The returned backup long-running operation will have a name of the format projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id> and can be used to track creation of the backup. The metadata field type is CreateBackupMetadata. The response field type is Backup, if successful. Cancelling the returned operation will stop the creation and delete the backup. There can be only one pending backup creation per database. Backup creation of different databases can run concurrently.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the database resource:

  • spanner.databases.createBackup

Requires the following IAM permission on the parent resource:

  • spanner.backups.create

For more information, see the IAM documentation.

CreateDatabase

rpc CreateDatabase(CreateDatabaseRequest) returns (Operation)

Creates a new Cloud Spanner database and starts to prepare it for serving. The returned long-running operation will have a name of the format <database_name>/operations/<operation_id> and can be used to track preparation of the database. The metadata field type is CreateDatabaseMetadata. The response field type is Database, if successful.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

DeleteBackup

rpc DeleteBackup(DeleteBackupRequest) returns (Empty)

Deletes a pending or completed Backup.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

DropDatabase

rpc DropDatabase(DropDatabaseRequest) returns (Empty)

Drops (aka deletes) a Cloud Spanner database. Completed backups for the database will be retained according to their expire_time.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

GetBackup

rpc GetBackup(GetBackupRequest) returns (Backup)

Gets metadata on a pending or completed Backup.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

GetDatabase

rpc GetDatabase(GetDatabaseRequest) returns (Database)

Gets the state of a Cloud Spanner database.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

GetDatabaseDdl

rpc GetDatabaseDdl(GetDatabaseDdlRequest) returns (GetDatabaseDdlResponse)

Returns the schema of a Cloud Spanner database as a list of formatted DDL statements. This method does not show pending schema updates, those may be queried using the Operations API.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

GetIamPolicy

rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy)

Gets the access control policy for a database or backup resource. Returns an empty policy if a database or backup exists but does not have a policy set.

Authorization requires spanner.databases.getIamPolicy permission on resource. For backups, authorization requires spanner.backups.getIamPolicy permission on resource.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ListBackupOperations

rpc ListBackupOperations(ListBackupOperationsRequest) returns (ListBackupOperationsResponse)

Lists the backup long-running operations in the given instance. A backup operation has a name of the form projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations. Operations returned are ordered by operation.metadata.value.progress.start_time in descending order starting from the most recently started operation.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ListBackups

rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse)

Lists completed and pending backups. Backups returned are ordered by create_time in descending order, starting from the most recent create_time.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ListDatabaseOperations

rpc ListDatabaseOperations(ListDatabaseOperationsRequest) returns (ListDatabaseOperationsResponse)

Lists database longrunning-operations. A database operation has a name of the form projects/<project>/instances/<instance>/databases/<database>/operations/<operation>. The long-running operation metadata field type metadata.type_url describes the type of the metadata. Operations returned include those that have completed/failed/canceled within the last 7 days, and pending operations.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

ListDatabases

rpc ListDatabases(ListDatabasesRequest) returns (ListDatabasesResponse)

Lists Cloud Spanner databases.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

RestoreDatabase

rpc RestoreDatabase(RestoreDatabaseRequest) returns (Operation)

Create a new database by restoring from a completed backup. The new database must be in the same project and in an instance with the same instance configuration as the instance containing the backup. The returned database long-running operation has a name of the format projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>, and can be used to track the progress of the operation, and to cancel it. The metadata field type is RestoreDatabaseMetadata. The response type is Database, if successful. Cancelling the returned operation will stop the restore and delete the database. There can be only one database being restored into an instance at a time. Once the restore operation completes, a new restore operation can be initiated, without waiting for the optimize operation associated with the first restore to complete.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

SetIamPolicy

rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy)

Sets the access control policy on a database or backup resource. Replaces any existing policy.

Authorization requires spanner.databases.setIamPolicy permission on resource. For backups, authorization requires spanner.backups.setIamPolicy permission on resource.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

TestIamPermissions

rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse)

Returns permissions that the caller has on the specified database or backup resource.

Attempting this RPC on a non-existent Cloud Spanner database will result in a NOT_FOUND error if the user has spanner.databases.list permission on the containing Cloud Spanner instance. Otherwise returns an empty set of permissions. Calling this method on a backup that does not exist will result in a NOT_FOUND error if the user has spanner.backups.list permission on the containing instance.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

UpdateBackup

rpc UpdateBackup(UpdateBackupRequest) returns (Backup)

Updates a pending or completed Backup.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • spanner.backups.update

For more information, see the IAM documentation.

UpdateDatabaseDdl

rpc UpdateDatabaseDdl(UpdateDatabaseDdlRequest) returns (Operation)

Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc. The returned long-running operation will have a name of the format <database_name>/operations/<operation_id> and can be used to track execution of the schema change(s). The metadata field type is UpdateDatabaseDdlMetadata. The operation has no response.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/spanner.admin
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

Backup

A backup of a Cloud Spanner database.

Fields
database

string

Required for the 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>.

expire_time

Timestamp

Required for the 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.

name

string

Output only for the CreateBackup operation. Required for the 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>.

create_time

Timestamp

Output only. The backup will contain an externally consistent copy of the database at the timestamp specified by create_time. create_time is approximately the time the CreateBackup request is received.

size_bytes

int64

Output only. Size of the backup in bytes.

state

State

Output only. The current state of the backup.

referencing_databases[]

string

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.

State

Indicates the current state of the backup.

Enums
STATE_UNSPECIFIED Not specified.
CREATING The pending backup is still being created. Operations on the backup may fail with FAILED_PRECONDITION in this state.
READY The backup is complete and ready for use.

BackupInfo

Information about a backup.

Fields
backup

string

Name of the backup.

create_time

Timestamp

The backup contains an externally consistent copy of source_database at the timestamp specified by create_time.

source_database

string

Name of the database the backup was created from.

CreateBackupMetadata

Metadata type for the operation returned by CreateBackup.

Fields
name

string

The name of the backup being created.

database

string

The name of the database the backup is created from.

progress

OperationProgress

The progress of the CreateBackup operation.

cancel_time

Timestamp

The time at which cancellation of this operation was received. 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 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][] value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.

CreateBackupRequest

The request for CreateBackup.

Fields
parent

string

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>.

Authorization requires the following IAM permission on the specified resource parent:

  • spanner.backups.create
backup_id

string

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>.

backup

Backup

Required. The backup to create.

CreateDatabaseMetadata

Metadata type for the operation returned by CreateDatabase.

Fields
database

string

The database being created.

CreateDatabaseRequest

The request for CreateDatabase.

Fields
parent

string

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

Authorization requires the following IAM permission on the specified resource parent:

  • spanner.databases.create
create_statement

string

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 (`).

extra_statements[]

string

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.

Database

A Cloud Spanner database.

Fields
name

string

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.

state

State

Output only. The current database state.

create_time

Timestamp

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

restore_info

RestoreInfo

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

State

Indicates the current state of the database.

Enums
STATE_UNSPECIFIED Not specified.
CREATING The database is still being created. Operations on the database may fail with FAILED_PRECONDITION in this state.
READY The database is fully created and ready for use.
READY_OPTIMIZING

The database is fully created and ready for use, but is still being optimized for performance and cannot handle full load.

In this state, the database still references the backup it was restore from, preventing the backup from being deleted. When optimizations are complete, the full performance of the database will be restored, and the database will transition to READY state.

DeleteBackupRequest

The request for DeleteBackup.

Fields
name

string

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

Authorization requires the following IAM permission on the specified resource name:

  • spanner.backups.delete

DropDatabaseRequest

The request for DropDatabase.

Fields
database

string

Required. The database to be dropped.

Authorization requires the following IAM permission on the specified resource database:

  • spanner.databases.drop

GetBackupRequest

The request for GetBackup.

Fields
name

string

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

Authorization requires the following IAM permission on the specified resource name:

  • spanner.backups.get

GetDatabaseDdlRequest

The request for GetDatabaseDdl.

Fields
database

string

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

Authorization requires the following IAM permission on the specified resource database:

  • spanner.databases.getDdl

GetDatabaseDdlResponse

The response for GetDatabaseDdl.

Fields
statements[]

string

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

GetDatabaseRequest

The request for GetDatabase.

Fields
name

string

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

Authorization requires the following IAM permission on the specified resource name:

  • spanner.databases.get

ListBackupOperationsRequest

The request for ListBackupOperations.

Fields
parent

string

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

Authorization requires the following IAM permission on the specified resource parent:

  • spanner.backupOperations.list
filter

string

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 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 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.
    • The backup name contains the string "howl".
    • The operation started before 2018-03-28T14:50:00Z.
    • The operation resulted in an error.
page_size

int32

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

page_token

string

If non-empty, page_token should contain a next_page_token from a previous ListBackupOperationsResponse to the same parent and with the same filter.

ListBackupOperationsResponse

The response for ListBackupOperations.

Fields
operations[]

Operation

The list of matching backup long-running operations. Each operation's name will be prefixed by the backup's name and the operation's metadata will be of type 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.

next_page_token

string

next_page_token can be sent in a subsequent ListBackupOperations call to fetch more of the matching metadata.

ListBackupsRequest

The request for ListBackups.

Fields
parent

string

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

Authorization requires the following IAM permission on the specified resource parent:

  • spanner.backups.list
filter

string

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 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)
  • 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
page_size

int32

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

page_token

string

If non-empty, page_token should contain a next_page_token from a previous ListBackupsResponse to the same parent and with the same filter.

ListBackupsResponse

The response for ListBackups.

Fields
backups[]

Backup

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

next_page_token

string

next_page_token can be sent in a subsequent ListBackups call to fetch more of the matching backups.

ListDatabaseOperationsRequest

The request for ListDatabaseOperations.

Fields
parent

string

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

Authorization requires the following IAM permission on the specified resource parent:

  • spanner.databaseOperations.list
filter

string

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 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 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.
    • 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.
page_size

int32

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

page_token

string

If non-empty, page_token should contain a next_page_token from a previous ListDatabaseOperationsResponse to the same parent and with the same filter.

ListDatabaseOperationsResponse

The response for ListDatabaseOperations.

Fields
operations[]

Operation

The list of matching database long-running operations. Each operation's name will be prefixed by the database's name. The operation's metadata field type metadata.type_url describes the type of the metadata.

next_page_token

string

next_page_token can be sent in a subsequent ListDatabaseOperations call to fetch more of the matching metadata.

ListDatabasesRequest

The request for ListDatabases.

Fields
parent

string

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

Authorization requires the following IAM permission on the specified resource parent:

  • spanner.databases.list
page_size

int32

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

page_token

string

If non-empty, page_token should contain a next_page_token from a previous ListDatabasesResponse.

ListDatabasesResponse

The response for ListDatabases.

Fields
databases[]

Database

Databases that matched the request.

next_page_token

string

next_page_token can be sent in a subsequent ListDatabases call to fetch more of the matching databases.

OperationProgress

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

Fields
progress_percent

int32

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

start_time

Timestamp

Time the request was received.

end_time

Timestamp

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

OptimizeRestoredDatabaseMetadata

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.

Fields
name

string

Name of the restored database being optimized.

progress

OperationProgress

The progress of the post-restore optimizations.

RestoreDatabaseMetadata

Metadata type for the long-running operation returned by RestoreDatabase.

Fields
name

string

Name of the database being created and restored to.

source_type

RestoreSourceType

The type of the restore source.

progress

OperationProgress

The progress of the RestoreDatabase operation.

cancel_time

Timestamp

The time at which cancellation of this operation was received. 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 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 value with a google.rpc.Status.code of 1, corresponding to Code.CANCELLED.

optimize_database_operation_name

string

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. 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.

backup_info

BackupInfo

Information about the backup used to restore the database.

RestoreDatabaseRequest

The request for RestoreDatabase.

Fields
parent

string

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>.

Authorization requires the following IAM permission on the specified resource parent:

  • spanner.databases.create
database_id

string

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>.

backup

string

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

Authorization requires the following IAM permission on the specified resource backup:

  • spanner.backups.restoreDatabase

RestoreInfo

Information about the database restore.

Fields
source_type

RestoreSourceType

The type of the restore source.

backup_info

BackupInfo

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

RestoreSourceType

Indicates the type of the restore source.

Enums
TYPE_UNSPECIFIED No restore associated.
BACKUP A backup was used as the source of the restore.

UpdateBackupRequest

The request for UpdateBackup.

Fields
backup

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.

update_mask

FieldMask

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.

UpdateDatabaseDdlMetadata

Metadata type for the operation returned by UpdateDatabaseDdl.

Fields
database

string

The database being modified.

statements[]

string

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

commit_timestamps[]

Timestamp

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].

UpdateDatabaseDdlRequest

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 API to monitor progress. See the operation_id field for more details.

Fields
database

string

Required. The database to update.

Authorization requires the following IAM permission on the specified resource database:

  • spanner.databases.updateDdl
statements[]

string

Required. DDL statements to be applied to the database.

operation_id

string

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.

Specifying an explicit operation ID simplifies determining whether the statements were executed in the event that the UpdateDatabaseDdl call is replayed, or the return value is otherwise lost: the database and operation_id fields can be combined to form the name of the resulting 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 returns ALREADY_EXISTS.