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.

The connector uses polling to monitor the long-running operation, which might generate additional billable steps. The polling policy for the long-running operation can be configured. For example, if you set skip_polling to True, the connector invocation call is non-blocking if the initial request succeeds; otherwise, retries might occur.

For more information about connector-specific parameters (connector_params), see Invoke a connector call.

For more information about retries and long-running operations, see Understand connectors.

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

encryptionConfig.kmsKeyNames

string

Optional. Specifies the KMS configuration for the one or more keys used to protect the backup. Values are of the form projects//locations//keyRings//cryptoKeys/. The keys referenced by kms_key_names must fully cover all regions of the backup's instance configuration. Some examples: * For regional (single-region) instance configurations, specify a regional location KMS key. * For multi-region instance configurations of type GOOGLE_MANAGED, either specify a multi-region location KMS key or multiple regional location KMS keys that cover all regions in the instance configuration. * For an instance configuration of type USER_MANAGED, specify only regional location KMS keys to cover each region in the instance configuration. Multi-region location KMS keys aren't supported for USER_MANAGED type instance configurations.

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: ...
            kmsKeyNames: ...
        body:
            database: ...
            expireTime: ...
            versionTime: ...
    result: createResult

JSON

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