ProjectsInstancesDatabases
class ProjectsInstancesDatabases extends Resource (View source)
The "databases" collection of methods.
Typical usage is:
$spannerService = new Google\Service\Spanner(...);
$databases = $spannerService->projects_instances_databases;
Methods
ChangeQuorum
is strictly restricted to databases that use dual-region
instance configurations. Initiates a background operation to change the
quorum of a database from dual-region mode to single-region mode or vice
versa. The returned long-running operation has a name of the format
projects//instances//databases//operations/
and can be used to track
execution of the ChangeQuorum
. The metadata field type is
ChangeQuorumMetadata. Authorization requires spanner.databases.changequorum
permission on the resource database. (databases.changequorum)
Creates a new Spanner database and starts to prepare it for serving. The
returned long-running operation will have a name of the format /operations/
and can be used to track preparation of the database. The metadata field type
is CreateDatabaseMetadata. The response field type is Database, if
successful. (databases.create)
Drops (aka deletes) a Cloud Spanner database. Completed backups for the
database will be retained according to their expire_time
. Note: Cloud
Spanner might continue to accept requests for a few seconds after the
database has been deleted. (databases.dropDatabase)
Gets the state of a Cloud Spanner database. (databases.get)
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. (databases.getDdl)
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.
Request a specific scan with Database-specific data for Cloud Key Visualizer.
Lists Cloud Spanner databases. (databases.listProjectsInstancesDatabases)
Updates a Cloud Spanner database. The returned long-running operation can be
used to track the progress of updating the database. If the named database
does not exist, returns NOT_FOUND
. While the operation is pending: The
database's reconciling field is set to true. Cancelling the operation is
best-effort. If the cancellation succeeds, the operation metadata's
cancel_time is set, the updates are reverted, and the operation terminates
with a CANCELLED
status. New UpdateDatabase requests will return a
FAILED_PRECONDITION
error until the pending operation is done (returns
successfully or with error). Reading the database via the API continues to
give the pre-request values. Upon completion of the returned operation: The
new values are in effect and readable via the API. The database's
reconciling field becomes false. The returned long-running operation will
have a name of the format projects//instances//databases//operations/
and
can be used to track the database modification. The metadata field type is
UpdateDatabaseMetadata. The response field type is Database, if successful.
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//instances//databases//operations/
, 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.
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.
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. (databases.testIamPermissions)
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 /operations/
and can be used to track execution of the
schema change(s). The metadata field type is UpdateDatabaseDdlMetadata. The
operation has no response. (databases.updateDdl)
Details
Operation
changequorum(string $name, ChangeQuorumRequest $postBody, array $optParams = [])
ChangeQuorum
is strictly restricted to databases that use dual-region
instance configurations. Initiates a background operation to change the
quorum of a database from dual-region mode to single-region mode or vice
versa. The returned long-running operation has a name of the format
projects//instances//databases//operations/
and can be used to track
execution of the ChangeQuorum
. The metadata field type is
ChangeQuorumMetadata. Authorization requires spanner.databases.changequorum
permission on the resource database. (databases.changequorum)
Operation
create(string $parent, CreateDatabaseRequest $postBody, array $optParams = [])
Creates a new Spanner database and starts to prepare it for serving. The
returned long-running operation will have a name of the format /operations/
and can be used to track preparation of the database. The metadata field type
is CreateDatabaseMetadata. The response field type is Database, if
successful. (databases.create)
SpannerEmpty
dropDatabase(string $database, array $optParams = [])
Drops (aka deletes) a Cloud Spanner database. Completed backups for the
database will be retained according to their expire_time
. Note: Cloud
Spanner might continue to accept requests for a few seconds after the
database has been deleted. (databases.dropDatabase)
Database
get(string $name, array $optParams = [])
Gets the state of a Cloud Spanner database. (databases.get)
GetDatabaseDdlResponse
getDdl(string $database, array $optParams = [])
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. (databases.getDdl)
Policy
getIamPolicy(string $resource, GetIamPolicyRequest $postBody, array $optParams = [])
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. (databases.getIamPolicy)
Scan
getScans(string $name, array $optParams = [])
Request a specific scan with Database-specific data for Cloud Key Visualizer.
(databases.getScans)
ListDatabasesResponse
listProjectsInstancesDatabases(string $parent, array $optParams = [])
Lists Cloud Spanner databases. (databases.listProjectsInstancesDatabases)
Operation
patch(string $name, Database $postBody, array $optParams = [])
Updates a Cloud Spanner database. The returned long-running operation can be
used to track the progress of updating the database. If the named database
does not exist, returns NOT_FOUND
. While the operation is pending: The
database's reconciling field is set to true. Cancelling the operation is
best-effort. If the cancellation succeeds, the operation metadata's
cancel_time is set, the updates are reverted, and the operation terminates
with a CANCELLED
status. New UpdateDatabase requests will return a
FAILED_PRECONDITION
error until the pending operation is done (returns
successfully or with error). Reading the database via the API continues to
give the pre-request values. Upon completion of the returned operation: The
new values are in effect and readable via the API. The database's
reconciling field becomes false. The returned long-running operation will
have a name of the format projects//instances//databases//operations/
and
can be used to track the database modification. The metadata field type is
UpdateDatabaseMetadata. The response field type is Database, if successful.
(databases.patch)
Operation
restore(string $parent, RestoreDatabaseRequest $postBody, array $optParams = [])
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//instances//databases//operations/
, 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. (databases.restore)
Policy
setIamPolicy(string $resource, SetIamPolicyRequest $postBody, array $optParams = [])
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.
(databases.setIamPolicy)
TestIamPermissionsResponse
testIamPermissions(string $resource, TestIamPermissionsRequest $postBody, array $optParams = [])
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. (databases.testIamPermissions)
Operation
updateDdl(string $database, UpdateDatabaseDdlRequest $postBody, array $optParams = [])
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 /operations/
and can be used to track execution of the
schema change(s). The metadata field type is UpdateDatabaseDdlMetadata. The
operation has no response. (databases.updateDdl)