REST Resource: projects.instances.databases

Resource: Database

A Cloud Spanner database.

JSON representation
{
  "name": string,
  "state": enum (State),
  "createTime": string,
  "restoreInfo": {
    object (RestoreInfo)
  },
  "encryptionConfig": {
    object (EncryptionConfig)
  },
  "encryptionInfo": [
    {
      object (EncryptionInfo)
    }
  ],
  "versionRetentionPeriod": string,
  "earliestVersionTime": string,
  "defaultLeader": string,
  "databaseDialect": enum (DatabaseDialect)
}
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

enum (State)

Output only. The current database state.

createTime

string (Timestamp format)

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

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

restoreInfo

object (RestoreInfo)

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

encryptionConfig

object (EncryptionConfig)

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.

encryptionInfo[]

object (EncryptionInfo)

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.

versionRetentionPeriod

string

Output only. The period in which Cloud Spanner retains all versions of data for the database. This is the same as the value of versionRetentionPeriod database option set using databases.updateDdl. Defaults to 1 hour, if not set.

earliestVersionTime

string (Timestamp format)

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.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

defaultLeader

string

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

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

databaseDialect

enum (DatabaseDialect)

Output only. The dialect of the Cloud Spanner database.

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.

RestoreInfo

Information about the database restore.

JSON representation
{
  "sourceType": enum (RestoreSourceType),
  "backupInfo": {
    object (BackupInfo)
  }
}
Fields
sourceType

enum (RestoreSourceType)

The type of the restore source.

backupInfo

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

BackupInfo

Information about a backup.

JSON representation
{
  "backup": string,
  "versionTime": string,
  "createTime": string,
  "sourceDatabase": string
}
Fields
backup

string

Name of the backup.

versionTime

string (Timestamp format)

The backup contains an externally consistent copy of sourceDatabase at the timestamp specified by versionTime. If the backups.create request did not specify versionTime, the versionTime of the backup is equivalent to the createTime.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

createTime

string (Timestamp format)

The time the backups.create request was received.

A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".

sourceDatabase

string

Name of the database the backup was created from.

EncryptionConfig

Encryption configuration for a Cloud Spanner database.

JSON representation
{
  "kmsKeyName": string
}
Fields
kmsKeyName

string

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

Methods

create

Creates a new Cloud Spanner database and starts to prepare it for serving.

dropDatabase

Drops (aka deletes) a Cloud Spanner database.

get

Gets the state of a Cloud Spanner database.

getDdl

Returns the schema of a Cloud Spanner database as a list of formatted DDL statements.

getIamPolicy

Gets the access control policy for a database or backup resource.

list

Lists Cloud Spanner databases.

restore

Create a new database by restoring from a completed backup.

setIamPolicy

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

testIamPermissions

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

updateDdl

Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc.