- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- RestoreDatabaseEncryptionConfig
- EncryptionType
- Try it!
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/<operationId>
, 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.
HTTP request
POST https://spanner.googleapis.com/v1/{parent=projects/*/instances/*}/databases:restore
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
parent |
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 Authorization requires the following IAM permission on the specified resource
|
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "databaseId": string, "encryptionConfig": { object ( |
Fields | |
---|---|
database |
Required. The id of the database to create and restore to. This database must not already exist. The |
encryption |
Optional. An encryption configuration describing the encryption type and key resources in Cloud KMS used to encrypt/decrypt the database to restore to. If this field is not specified, the restored database will use the same encryption configuration as the backup by default, namely |
Union field source . Required. The source from which to restore. source can be only one of the following: |
|
backup |
Name of the backup from which to restore. Values are of the form Authorization requires the following IAM permission on the specified resource
|
Response body
If successful, the response body contains an instance of 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.
RestoreDatabaseEncryptionConfig
Encryption configuration for the restored database.
JSON representation |
---|
{
"encryptionType": enum ( |
Fields | |
---|---|
encryption |
Required. The encryption type of the restored database. |
kms |
Optional. The Cloud KMS key that will be used to encrypt/decrypt the restored database. This field should be set only when |
kms |
Optional. Specifies the KMS configuration for one or more keys used to encrypt the database. Values have the form The keys referenced by
|
EncryptionType
Encryption types for the database to be restored.
Enums | |
---|---|
ENCRYPTION_TYPE_UNSPECIFIED |
Unspecified. Do not use. |
USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION |
This is the default option when encryptionConfig is not specified. |
GOOGLE_DEFAULT_ENCRYPTION |
Use Google default encryption. |
CUSTOMER_MANAGED_ENCRYPTION |
Use customer managed encryption. If specified, kmsKeyName must must contain a valid Cloud KMS key. |