Backup

Backup

Interact with backups like get detailed information from BigTable, create a backup, or restore a backup to a table.

Constructor

new Backup(cluster, name)

Parameters:
Name Type Description
cluster Cluster

The parent instance of this backup.

name string

Name of the backup.

Example
```
const {Bigtable} = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance('my-instance');
const cluster = instance.cluster('my-cluster');
const backup = cluster.backup('my-backup');
```

Members

endDate

A Date-compatible PreciseDate representing the time that the backup was finished.

expireDate

A Date-compatible PreciseDate representing the expiration time of this backup.

id

A unique backup string, e.g. "my-backup".

name

The full path of the backup which is in the form of: projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}.

startDate

A Date-compatible PreciseDate representing the time that this backup was started.

Methods

create(config, callbackopt) → {void|Promise.<CreateBackupResponse>}

Starts creating a new Cloud Bigtable Backup.

The returned long-running operation can be used to track creation of the backup. Cancelling the returned operation will stop the creation and delete the backup.

Parameters:
Name Type Attributes Description
config CreateBackupConfig

Configuration object.

Properties
Name Type Attributes Description
expireTime BackupTimestamp

When the backup will be automatically deleted.

table string | Table

Table to create the backup from.

gaxOptions CallOptions <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

callback CreateBackupCallback <optional>

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

backup Backup

The newly created Backup.

operation Operation

An operation object that can be used to check the status of the request.

apiResponse object

The full API response.

Returns:
Type Description
void | Promise.<CreateBackupResponse>
Example

include:samples/api-reference-doc-snippets/backups.create.js

region_tag:bigtable_api_create_backup

delete(gaxOptionsOrCallbackopt, callbackopt) → {void|Promise.<DeleteBackupResponse>}

Deletes this pending or completed Cloud Bigtable backup.

Parameters:
Name Type Attributes Description
gaxOptionsOrCallback CallOptions | DeleteBackupCallback <optional>
callback DeleteBackupCallback <optional>

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

apiResponse object

The full API response.

Returns:
Type Description
void | Promise.<DeleteBackupResponse>
Example

include:samples/api-reference-doc-snippets/backups.delete.js

region_tag:bigtable_api_delete_backup

exists(gaxOptionsopt, callback)

Check if a backup exists.

Parameters:
Name Type Attributes Description
gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

exists boolean

Whether the backup exists or not.

get(gaxOptionsopt, callback)

Get a backup if it exists.

Parameters:
Name Type Attributes Description
gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

backup Backup

The Backup instance.

apiResponse object

The full API response.

Example

include:samples/api-reference-doc-snippets/backups.get.js

region_tag:bigtable_api_get_backup

getIamPolicy(optionsopt, cbopt, policy)

Parameters:
Name Type Attributes Description
options object <optional>

Configuration object.

Properties
Name Type Attributes Description
gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

requestedPolicyVersion number <optional>

The policy format version to be returned. Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected. Requests for policies with any conditional bindings must specify version 3. Policies without any conditional bindings may specify any valid value or leave the field unset.

cb function <optional>

The callback function.

callback.error error <nullable>

An error returned while making this request.

policy Policy

The policy.

Example

include:samples/api-reference-doc-snippets/instance.js

region_tag:bigtable_api_get_table_Iam_policy

getMetadata(gaxOptionsopt, callback)

Get a backup if it exists.

Parameters:
Name Type Attributes Description
gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

callback function

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

metadata object

The metadata.

apiResponse object

The full API response.

Example

include:samples/api-reference-doc-snippets/backups.get.js

region_tag:bigtable_api_get_backup

restore(tableId, gaxOptionsOrCallbackopt, callbackopt) → {void|Promise.<RestoreTableResponse>}

Create a new table by restoring from this completed backup.

The new table must be in the same instance as the instance containing the backup. The returned long-running operation can be used to track the progress of the operation, and to cancel it.

Parameters:
Name Type Attributes Description
tableId string

The id of the table to create and restore to. This table must not already exist.

gaxOptionsOrCallback CallOptions | RestoreTableCallback <optional>
callback RestoreTableCallback <optional>

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

table Table

The newly created Table.

operation Operation

An operation object that can be used to check the status of the request.

apiResponse object

The full API response.

Returns:
Type Description
void | Promise.<RestoreTableResponse>
Example

include:samples/api-reference-doc-snippets/backups.restore.js

region_tag:bigtable_api_restore_backup

restoreTo(config, tableId, instanceopt, gaxOptionsopt, callbackopt) → {void|Promise.<RestoreTableResponse>}

Create a new table by restoring from this completed backup.

The returned long-running operation can be used to track the progress of the operation, and to cancel it.

Parameters:
Name Type Attributes Description
config RestoreTableConfig

Configuration object.

tableId string

The id of the table to create and restore to. This table must not already exist.

instance Instance | string <optional>

Instance in which the new table will be created and restored to. Instance must be in the same project as the project containing backup. If omitted the instance containing the backup will be used instead.

gaxOptions CallOptions <optional>

Request configuration options, outlined here: https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html.

callback RestoreTableCallback <optional>

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

table Table

The newly created Table.

operation Operation

An operation object that can be used to check the status of the request.

apiResponse object

The full API response.

Returns:
Type Description
void | Promise.<RestoreTableResponse>

setIamPolicy(gaxOptionsopt, callbackopt, policy)

Parameters:
Name Type Attributes Description
gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

callback function <optional>

The callback function.

Properties
Name Type Attributes Description
error error <nullable>

An error returned while making this request.

policy Policy

The policy.

Example

include:samples/api-reference-doc-snippets/instance.js

region_tag:bigtable_api_set_instance_Iam_policy

setMetadata(metadata, gaxOptionsOrCallbackopt, callbackopt) → {void|Promise.<BackupSetMetadataResponse>}

Updates this pending or completed Cloud Bigtable Backup.

Parameters:
Name Type Attributes Description
metadata ModifiableBackupFields

The fields to be updated.

gaxOptionsOrCallback CallOptions | BackupSetMetadataCallback <optional>
callback BackupSetMetadataCallback <optional>

The callback function.

Properties
Name Type Attributes Description
err error <nullable>

An error returned while making this request.

callback.apiResponse object

The full API response.

Returns:
Type Description
void | Promise.<BackupSetMetadataResponse>
Example

include:samples/api-reference-doc-snippets/backups.update.js

region_tag:bigtable_api_update_backup

testIamPermissions(permissions, gaxOptionsopt, callbackopt, permissions)

Parameters:
Name Type Attributes Description
permissions string | Array.<string>

The permission(s) to test for.

gaxOptions object <optional>

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html.

callback function <optional>

The callback function.

Properties
Name Type Attributes Description
error error <nullable>

An error returned while making this request.

permissions Array.<string>

A subset of permissions that the caller is allowed.

Example

include:samples/api-reference-doc-snippets/instance.js

region_tag:bigtable_api_test_table_Iam_permissions