Method: googleapis.spanner.v1.projects.instances.backups.create

Starts creating a new Cloud Spanner Backup. The returned backup long-running operation will have a name of the format projects//instances//backups//operations/ 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.

This method waits—the workflow execution is paused—until the operation is complete, fails, or times out. The default timeout value is 1800 seconds (30 minutes) and can be changed to a maximum value of 31536000 seconds (one year) for long-running operations using the connector_params field. See the Connectors reference.

The connector uses polling to monitor the long-running operation, which might generate additional billable steps. For more information about retries and long-running operations, refer to Understand connectors.

The polling policy for the long-running operation can be configured. To set the connector-specific parameters (connector_params), refer to Invoke a connector call.

Arguments

Parameters
parent

string

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 projects//instances/.

backupId

string

Required. The id of the backup to be created. The backup_id appended to parent forms the full backup name of the form projects//instances//backups/.

encryptionConfig.encryptionType

enum

Required. The encryption type of the backup.

Enum type. Can be one of the following:
ENCRYPTION_TYPE_UNSPECIFIED Unspecified. Do not use.
USE_DATABASE_ENCRYPTION Use the same encryption configuration as the database. This is the default option when encryption_config is empty. For example, if the database is using Customer_Managed_Encryption, the backup will be using the same Cloud KMS key as the database.
GOOGLE_DEFAULT_ENCRYPTION Use Google default encryption.
CUSTOMER_MANAGED_ENCRYPTION Use customer managed encryption. If specified, kms_key_name must contain a valid Cloud KMS key.
encryptionConfig.kmsKeyName

string

Optional. The Cloud KMS key that will be used to protect the backup. This field should be set only when encryption_type is CUSTOMER_MANAGED_ENCRYPTION. Values are of the form projects//locations//keyRings//cryptoKeys/.

body

object (Backup)

Required.

Raised exceptions

Exceptions
ConnectionError In case of a network problem (such as DNS failure or refused connection).
HttpError If the response status is >= 400 (excluding 429 and 503).
TimeoutError If a long-running operation takes longer to finish than the specified timeout limit.
TypeError If an operation or function receives an argument of the wrong type.
ValueError If an operation or function receives an argument of the right type but an inappropriate value. For example, a negative timeout.
OperationError If the long-running operation finished unsuccessfully.
ResponseTypeError If the long-running operation returned a response of the wrong type.

Response

If successful, the response contains an instance of Operation.

Subworkflow snippet

Some fields might be optional or required. To identify required fields, refer to the API documentation.

YAML

- create:
    call: googleapis.spanner.v1.projects.instances.backups.create
    args:
        parent: ...
        backupId: ...
        encryptionConfig:
            encryptionType: ...
            kmsKeyName: ...
        body:
            database: ...
            expireTime: ...
            versionTime: ...
    result: createResult

JSON

[
  {
    "create": {
      "call": "googleapis.spanner.v1.projects.instances.backups.create",
      "args": {
        "parent": "...",
        "backupId": "...",
        "encryptionConfig": {
          "encryptionType": "...",
          "kmsKeyName": "..."
        },
        "body": {
          "database": "...",
          "expireTime": "...",
          "versionTime": "..."
        }
      },
      "result": "createResult"
    }
  }
]