Cloud Spanner V1 Client - Class Database (1.56.0)

Reference documentation and code samples for the Cloud Spanner V1 Client class Database.

A Cloud Spanner database.

Generated from protobuf message google.spanner.admin.database.v1.Database

Methods

__construct

Constructor.

Parameters
NameDescription
data array

Optional. Data for populating the Message object.

↳ 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 int

Output only. The current database state.

↳ create_time Google\Protobuf\Timestamp

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

↳ restore_info Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo

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

↳ encryption_config Google\Cloud\Spanner\Admin\Database\V1\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.

↳ encryption_info array<Google\Cloud\Spanner\Admin\Database\V1\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.

↳ version_retention_period 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 version_retention_period database option set using UpdateDatabaseDdl. Defaults to 1 hour, if not set.

↳ earliest_version_time Google\Protobuf\Timestamp

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.

↳ default_leader string

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.

↳ database_dialect int

Output only. The dialect of the Cloud Spanner Database.

getName

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.

Returns
TypeDescription
string

setName

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.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getState

Output only. The current database state.

Returns
TypeDescription
int

setState

Output only. The current database state.

Parameter
NameDescription
var int
Returns
TypeDescription
$this

getCreateTime

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

Returns
TypeDescription
Google\Protobuf\Timestamp|null

hasCreateTime

clearCreateTime

setCreateTime

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

Parameter
NameDescription
var Google\Protobuf\Timestamp
Returns
TypeDescription
$this

getRestoreInfo

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

Returns
TypeDescription
Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo|null

hasRestoreInfo

clearRestoreInfo

setRestoreInfo

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

Parameter
NameDescription
var Google\Cloud\Spanner\Admin\Database\V1\RestoreInfo
Returns
TypeDescription
$this

getEncryptionConfig

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.

Returns
TypeDescription
Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig|null

hasEncryptionConfig

clearEncryptionConfig

setEncryptionConfig

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.

Parameter
NameDescription
var Google\Cloud\Spanner\Admin\Database\V1\EncryptionConfig
Returns
TypeDescription
$this

getEncryptionInfo

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.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setEncryptionInfo

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.

Parameter
NameDescription
var array<Google\Cloud\Spanner\Admin\Database\V1\EncryptionInfo>
Returns
TypeDescription
$this

getVersionRetentionPeriod

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. Defaults to 1 hour, if not set.

Returns
TypeDescription
string

setVersionRetentionPeriod

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. Defaults to 1 hour, if not set.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getEarliestVersionTime

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.

Returns
TypeDescription
Google\Protobuf\Timestamp|null

hasEarliestVersionTime

clearEarliestVersionTime

setEarliestVersionTime

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.

Parameter
NameDescription
var Google\Protobuf\Timestamp
Returns
TypeDescription
$this

getDefaultLeader

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.

Returns
TypeDescription
string

setDefaultLeader

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.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getDatabaseDialect

Output only. The dialect of the Cloud Spanner Database.

Returns
TypeDescription
int

setDatabaseDialect

Output only. The dialect of the Cloud Spanner Database.

Parameter
NameDescription
var int
Returns
TypeDescription
$this