Cloud Spanner Database Admin API.
The Cloud Spanner Database Admin API can be used to:
- create, drop, and list databases
- update the schema of pre-existing databases
- create, delete, copy and list backups for a database
- restore a database from an existing backup
Equality
Instances of this class created via copy-construction or copy-assignment always compare equal. Instances created with equal std::shared_ptr<*Connection>
objects compare equal. Objects that compare equal share the same underlying resources.
Performance
Creating a new instance of this class is a relatively expensive operation, new objects establish new connections to the service. In contrast, copy-construction, move-construction, and the corresponding assignment operations are relatively efficient as the copies share all underlying resources.
Thread Safety
Concurrent access to different instances of this class, even if they compare equal, is guaranteed to work. Two or more threads operating on the same instance of this class is not guaranteed to work. Since copy-construction and move-construction is a relatively efficient operation, consider using such a copy when using this class from multiple threads.
Constructors
DatabaseAdminClient(DatabaseAdminClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DatabaseAdminClient const &
|
DatabaseAdminClient(DatabaseAdminClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DatabaseAdminClient &&
|
DatabaseAdminClient(std::shared_ptr< DatabaseAdminConnection >, Options)
Parameters | |
---|---|
Name | Description |
connection |
std::shared_ptr< DatabaseAdminConnection >
|
opts |
Options
|
Operators
operator=(DatabaseAdminClient const &)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DatabaseAdminClient const &
|
Returns | |
---|---|
Type | Description |
DatabaseAdminClient & |
operator=(DatabaseAdminClient &&)
Copy and move support
Parameter | |
---|---|
Name | Description |
|
DatabaseAdminClient &&
|
Returns | |
---|---|
Type | Description |
DatabaseAdminClient & |
Functions
ListDatabases(std::string const &, Options)
Lists Cloud Spanner databases.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The instance whose databases should be listed. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::spanner::admin::database::v1::Database > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListDatabases(google::spanner::admin::database::v1::ListDatabasesRequest, Options)
Lists Cloud Spanner databases.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::ListDatabasesRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::spanner::admin::database::v1::Database > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
CreateDatabase(std::string const &, std::string const &, Options)
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.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The name of the instance that will serve the new database. Values are of the form |
create_statement |
std::string const &
Required. A |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Database > > |
A |
CreateDatabase(ExperimentalTag, NoAwaitTag, std::string const &, std::string const &, Options)
Creates a new Cloud Spanner database and starts to prepare it for serving.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
parent |
std::string const &
|
create_statement |
std::string const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
CreateDatabase(google::spanner::admin::database::v1::CreateDatabaseRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::CreateDatabaseRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Database > > |
A |
CreateDatabase(ExperimentalTag, NoAwaitTag, google::spanner::admin::database::v1::CreateDatabaseRequest const &, Options)
Creates a new Cloud Spanner database and starts to prepare it for serving.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
request |
google::spanner::admin::database::v1::CreateDatabaseRequest const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
CreateDatabase(ExperimentalTag, google::longrunning::Operation const &, Options)
Creates a new Cloud Spanner database and starts to prepare it for serving.
This method accepts a google::longrunning::Operation
that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
operation |
google::longrunning::Operation const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Database > > |
GetDatabase(std::string const &, Options)
Gets the state of a Cloud Spanner database.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. The name of the requested database. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::spanner::admin::database::v1::Database > |
the result of the RPC. The response message type (google.spanner.admin.database.v1.Database) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetDatabase(google::spanner::admin::database::v1::GetDatabaseRequest const &, Options)
Gets the state of a Cloud Spanner database.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::GetDatabaseRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::spanner::admin::database::v1::Database > |
the result of the RPC. The response message type (google.spanner.admin.database.v1.Database) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UpdateDatabase(google::spanner::admin::database::v1::Database const &, google::protobuf::FieldMask const &, Options)
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/<project>/instances/<instance>/databases/<database>/operations/<operation_id>
and can be used to track the database modification. The metadata field type is UpdateDatabaseMetadata. The response field type is Database, if successful.
Parameters | |
---|---|
Name | Description |
database |
google::spanner::admin::database::v1::Database const &
Required. The database to update. The |
update_mask |
google::protobuf::FieldMask const &
Required. The list of fields to update. Currently, only |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Database > > |
A |
UpdateDatabase(ExperimentalTag, NoAwaitTag, google::spanner::admin::database::v1::Database const &, google::protobuf::FieldMask const &, Options)
Updates a Cloud Spanner database.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
database |
google::spanner::admin::database::v1::Database const &
|
update_mask |
google::protobuf::FieldMask const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
UpdateDatabase(google::spanner::admin::database::v1::UpdateDatabaseRequest const &, Options)
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/<project>/instances/<instance>/databases/<database>/operations/<operation_id>
and can be used to track the database modification. The metadata field type is UpdateDatabaseMetadata. The response field type is Database, if successful.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::UpdateDatabaseRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Database > > |
A |
UpdateDatabase(ExperimentalTag, NoAwaitTag, google::spanner::admin::database::v1::UpdateDatabaseRequest const &, Options)
Updates a Cloud Spanner database.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
request |
google::spanner::admin::database::v1::UpdateDatabaseRequest const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
UpdateDatabase(ExperimentalTag, google::longrunning::Operation const &, Options)
Updates a Cloud Spanner database.
This method accepts a google::longrunning::Operation
that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
operation |
google::longrunning::Operation const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Database > > |
UpdateDatabaseDdl(std::string const &, std::vector< std::string > const &, Options)
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.
Parameters | |
---|---|
Name | Description |
database |
std::string const &
Required. The database to update. |
statements |
std::vector< std::string > const &
Required. DDL statements to be applied to the database. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata > > |
A |
UpdateDatabaseDdl(ExperimentalTag, NoAwaitTag, std::string const &, std::vector< std::string > const &, Options)
Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
database |
std::string const &
|
statements |
std::vector< std::string > const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
UpdateDatabaseDdl(google::spanner::admin::database::v1::UpdateDatabaseDdlRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::UpdateDatabaseDdlRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata > > |
A |
UpdateDatabaseDdl(ExperimentalTag, NoAwaitTag, google::spanner::admin::database::v1::UpdateDatabaseDdlRequest const &, Options)
Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
request |
google::spanner::admin::database::v1::UpdateDatabaseDdlRequest const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
UpdateDatabaseDdl(ExperimentalTag, google::longrunning::Operation const &, Options)
Updates the schema of a Cloud Spanner database by creating/altering/dropping tables, columns, indexes, etc.
This method accepts a google::longrunning::Operation
that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
operation |
google::longrunning::Operation const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::UpdateDatabaseDdlMetadata > > |
DropDatabase(std::string const &, Options)
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.
Parameters | |
---|---|
Name | Description |
database |
std::string const &
Required. The database to be dropped. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
DropDatabase(google::spanner::admin::database::v1::DropDatabaseRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::DropDatabaseRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
GetDatabaseDdl(std::string const &, Options)
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.
Parameters | |
---|---|
Name | Description |
database |
std::string const &
Required. The database whose schema we wish to get. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::spanner::admin::database::v1::GetDatabaseDdlResponse > |
the result of the RPC. The response message type (google.spanner.admin.database.v1.GetDatabaseDdlResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetDatabaseDdl(google::spanner::admin::database::v1::GetDatabaseDdlRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::GetDatabaseDdlRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::spanner::admin::database::v1::GetDatabaseDdlResponse > |
the result of the RPC. The response message type (google.spanner.admin.database.v1.GetDatabaseDdlResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
SetIamPolicy(std::string const &, google::iam::v1::Policy const &, Options)
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.
Parameters | |
---|---|
Name | Description |
resource |
std::string const &
REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
policy |
google::iam::v1::Policy const &
REQUIRED: The complete policy to be applied to the |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
SetIamPolicy(std::string const &, IamUpdater const &, Options)
Updates the IAM policy for resource
using an optimistic concurrency control loop.
The loop fetches the current policy for resource
, and passes it to updater
, which should return the new policy. This new policy should use the current etag so that the read-modify-write cycle can detect races and rerun the update when there is a mismatch. If the new policy does not have an etag, the existing policy will be blindly overwritten. If updater
does not yield a policy, the control loop is terminated and kCancelled is returned.
Parameters | |
---|---|
Name | Description |
resource |
std::string const &
Required. The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field. |
updater |
IamUpdater const &
Required. Functor to map the current policy to a new one. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
google::iam::v1::Policy |
SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::iam::v1::SetIamPolicyRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetIamPolicy(std::string const &, Options)
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.
Parameters | |
---|---|
Name | Description |
resource |
std::string const &
REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::iam::v1::GetIamPolicyRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::Policy > |
the result of the RPC. The response message type (google.iam.v1.Policy) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
TestIamPermissions(std::string const &, std::vector< std::string > const &, Options)
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.
Parameters | |
---|---|
Name | Description |
resource |
std::string const &
REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field. |
permissions |
std::vector< std::string > const &
The set of permissions to check for the |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::TestIamPermissionsResponse > |
the result of the RPC. The response message type (google.iam.v1.TestIamPermissionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::iam::v1::TestIamPermissionsRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::iam::v1::TestIamPermissionsResponse > |
the result of the RPC. The response message type (google.iam.v1.TestIamPermissionsResponse) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
CreateBackup(std::string const &, google::spanner::admin::database::v1::Backup const &, std::string const &, Options)
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.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
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 |
backup |
google::spanner::admin::database::v1::Backup const &
Required. The backup to create. |
backup_id |
std::string const &
Required. The id of the backup to be created. The |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Backup > > |
A |
CreateBackup(ExperimentalTag, NoAwaitTag, std::string const &, google::spanner::admin::database::v1::Backup const &, std::string const &, Options)
Starts creating a new Cloud Spanner Backup.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
parent |
std::string const &
|
backup |
google::spanner::admin::database::v1::Backup const &
|
backup_id |
std::string const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
CreateBackup(google::spanner::admin::database::v1::CreateBackupRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::CreateBackupRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Backup > > |
A |
CreateBackup(ExperimentalTag, NoAwaitTag, google::spanner::admin::database::v1::CreateBackupRequest const &, Options)
Starts creating a new Cloud Spanner Backup.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
request |
google::spanner::admin::database::v1::CreateBackupRequest const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
CreateBackup(ExperimentalTag, google::longrunning::Operation const &, Options)
Starts creating a new Cloud Spanner Backup.
This method accepts a google::longrunning::Operation
that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
operation |
google::longrunning::Operation const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Backup > > |
CopyBackup(std::string const &, std::string const &, std::string const &, google::protobuf::Timestamp const &, Options)
Starts copying a 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 copying of the backup. The operation is associated with the destination backup. The metadata field type is CopyBackupMetadata. The response field type is Backup, if successful. Cancelling the returned operation will stop the copying and delete the destination backup. Concurrent CopyBackup requests can run on the same source backup.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The name of the destination instance that will contain the backup copy. Values are of the form: |
backup_id |
std::string const &
Required. The id of the backup copy. The |
source_backup |
std::string const &
Required. The source backup to be copied. The source backup needs to be in READY state for it to be copied. Once CopyBackup is in progress, the source backup cannot be deleted or cleaned up on expiration until CopyBackup is finished. Values are of the form: |
expire_time |
google::protobuf::Timestamp const &
Required. The expiration time of the backup in microsecond granularity. The expiration time must be at least 6 hours and at most 366 days from the |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Backup > > |
A |
CopyBackup(ExperimentalTag, NoAwaitTag, std::string const &, std::string const &, std::string const &, google::protobuf::Timestamp const &, Options)
Starts copying a Cloud Spanner Backup.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
parent |
std::string const &
|
backup_id |
std::string const &
|
source_backup |
std::string const &
|
expire_time |
google::protobuf::Timestamp const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
CopyBackup(google::spanner::admin::database::v1::CopyBackupRequest const &, Options)
Starts copying a 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 copying of the backup. The operation is associated with the destination backup. The metadata field type is CopyBackupMetadata. The response field type is Backup, if successful. Cancelling the returned operation will stop the copying and delete the destination backup. Concurrent CopyBackup requests can run on the same source backup.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::CopyBackupRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Backup > > |
A |
CopyBackup(ExperimentalTag, NoAwaitTag, google::spanner::admin::database::v1::CopyBackupRequest const &, Options)
Starts copying a Cloud Spanner Backup.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
request |
google::spanner::admin::database::v1::CopyBackupRequest const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
CopyBackup(ExperimentalTag, google::longrunning::Operation const &, Options)
Starts copying a Cloud Spanner Backup.
This method accepts a google::longrunning::Operation
that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
operation |
google::longrunning::Operation const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Backup > > |
GetBackup(std::string const &, Options)
Gets metadata on a pending or completed Backup.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. Name of the backup. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::spanner::admin::database::v1::Backup > |
the result of the RPC. The response message type (google.spanner.admin.database.v1.Backup) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
GetBackup(google::spanner::admin::database::v1::GetBackupRequest const &, Options)
Gets metadata on a pending or completed Backup.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::GetBackupRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::spanner::admin::database::v1::Backup > |
the result of the RPC. The response message type (google.spanner.admin.database.v1.Backup) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UpdateBackup(google::spanner::admin::database::v1::Backup const &, google::protobuf::FieldMask const &, Options)
Updates a pending or completed Backup.
Parameters | |
---|---|
Name | Description |
backup |
google::spanner::admin::database::v1::Backup const &
Required. The backup to update.
|
update_mask |
google::protobuf::FieldMask const &
Required. A mask specifying which fields (e.g. |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::spanner::admin::database::v1::Backup > |
the result of the RPC. The response message type (google.spanner.admin.database.v1.Backup) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
UpdateBackup(google::spanner::admin::database::v1::UpdateBackupRequest const &, Options)
Updates a pending or completed Backup.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::UpdateBackupRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StatusOr< google::spanner::admin::database::v1::Backup > |
the result of the RPC. The response message type (google.spanner.admin.database.v1.Backup) is mapped to a C++ class using the Protobuf mapping rules. If the request fails, the |
DeleteBackup(std::string const &, Options)
Deletes a pending or completed Backup.
Parameters | |
---|---|
Name | Description |
name |
std::string const &
Required. Name of the backup to delete. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
DeleteBackup(google::spanner::admin::database::v1::DeleteBackupRequest const &, Options)
Deletes a pending or completed Backup.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::DeleteBackupRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
Status |
a |
ListBackups(std::string const &, Options)
Lists completed and pending backups.
Backups returned are ordered by create_time
in descending order, starting from the most recent create_time
.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The instance to list backups from. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::spanner::admin::database::v1::Backup > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListBackups(google::spanner::admin::database::v1::ListBackupsRequest, Options)
Lists completed and pending backups.
Backups returned are ordered by create_time
in descending order, starting from the most recent create_time
.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::ListBackupsRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::spanner::admin::database::v1::Backup > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
RestoreDatabase(std::string const &, std::string const &, std::string const &, Options)
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.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
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 |
database_id |
std::string const &
Required. The id of the database to create and restore to. This database must not already exist. The |
backup |
std::string const &
Name of the backup from which to restore. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Database > > |
A |
RestoreDatabase(ExperimentalTag, NoAwaitTag, std::string const &, std::string const &, std::string const &, Options)
Create a new database by restoring from a completed backup.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
parent |
std::string const &
|
database_id |
std::string const &
|
backup |
std::string const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
RestoreDatabase(google::spanner::admin::database::v1::RestoreDatabaseRequest const &, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::RestoreDatabaseRequest const &
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Database > > |
A |
RestoreDatabase(ExperimentalTag, NoAwaitTag, google::spanner::admin::database::v1::RestoreDatabaseRequest const &, Options)
Create a new database by restoring from a completed backup.
Specifying the NoAwaitTag
immediately returns the [google::longrunning::Operation
] that corresponds to the Long Running Operation that has been started. No polling for operation status occurs.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
|
NoAwaitTag
|
request |
google::spanner::admin::database::v1::RestoreDatabaseRequest const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
StatusOr< google::longrunning::Operation > |
RestoreDatabase(ExperimentalTag, google::longrunning::Operation const &, Options)
Create a new database by restoring from a completed backup.
This method accepts a google::longrunning::Operation
that corresponds to a previously started Long Running Operation (LRO) and polls the status of the LRO in the background.
Parameters | |
---|---|
Name | Description |
|
ExperimentalTag
|
operation |
google::longrunning::Operation const &
|
opts |
Options
|
Returns | |
---|---|
Type | Description |
future< StatusOr< google::spanner::admin::database::v1::Database > > |
ListDatabaseOperations(std::string const &, Options)
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.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The instance of the database operations. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::longrunning::Operation > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListDatabaseOperations(google::spanner::admin::database::v1::ListDatabaseOperationsRequest, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::ListDatabaseOperationsRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::longrunning::Operation > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListBackupOperations(std::string const &, Options)
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.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The instance of the backup operations. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::longrunning::Operation > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListBackupOperations(google::spanner::admin::database::v1::ListBackupOperationsRequest, Options)
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.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::ListBackupOperationsRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::longrunning::Operation > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListDatabaseRoles(std::string const &, Options)
Lists Cloud Spanner database roles.
Parameters | |
---|---|
Name | Description |
parent |
std::string const &
Required. The database whose roles should be listed. Values are of the form |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::spanner::admin::database::v1::DatabaseRole > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |
ListDatabaseRoles(google::spanner::admin::database::v1::ListDatabaseRolesRequest, Options)
Lists Cloud Spanner database roles.
Parameters | |
---|---|
Name | Description |
request |
google::spanner::admin::database::v1::ListDatabaseRolesRequest
Unary RPCs, such as the one wrapped by this function, receive a single |
opts |
Options
Optional. Override the class-level options, such as retry and backoff policies. |
Returns | |
---|---|
Type | Description |
StreamRange< google::spanner::admin::database::v1::DatabaseRole > |
a StreamRange to iterate of the results. See the documentation of this type for details. In brief, this class has |