Constructor

Cluster

new Cluster(instance, id)

Parameter

instance

Instance

The parent instance of this cluster.

id

string

Id of the cluster.

Example

const Bigtable = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance('my-instance');
const cluster = instance.cluster('my-cluster');

Methods

create

create(options, callback)

Create a cluster.

Parameter

options

Optional

object

See Instance#createCluster.

callback

Optional

function()

The callback function.

Values in callback have the following properties:

Parameter

err

error

An error returned while making this request.

Value may be null.

apiResponse

object

The full API response.

Examples

const Bigtable = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const cluster = instance.cluster(clusterId);

cluster
  .create()
  .then(result => {
    const cluster = result[0];
    const operation = result[1];
    const apiResponse = result[2];
  })
  .catch(err => {
    // Handle the error.
  });

delete

delete(gaxOptions, callback)

Delete the cluster.

Parameter

gaxOptions

Optional

object

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

callback

Optional

function()

The callback function.

Values in callback have the following properties:

Parameter

err

error

An error returned while making this request.

Value may be null.

apiResponse

object

The full API response.

Examples

const Bigtable = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const cluster = instance.cluster(clusterId);

cluster
  .delete()
  .then(result => {
    const apiResponse = result[0];
  })
  .catch(err => {
    // Handle the error.
  });

exists

exists(gaxOptions, callback)

Check if a cluster exists.

Parameter

gaxOptions

Optional

object

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

callback

function()

The callback function.

Values in callback have the following properties:

Parameter

err

error

An error returned while making this request.

Value may be null.

exists

boolean

Whether the cluster exists or not.

Examples

const Bigtable = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const cluster = instance.cluster(clusterId);

cluster
  .exists()
  .then(result => {
    const exists = result[0];
  })
  .catch(err => {
    // Handle the error.
  });

get

get(gaxOptions, callback)

Get a cluster if it exists.

Parameter

gaxOptions

Optional

object

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

callback

function()

The callback function.

Values in callback have the following properties:

Parameter

err

error

An error returned while making this request.

Value may be null.

apiResponse

object

The full API response.

Examples

const Bigtable = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const cluster = instance.cluster(clusterId);

cluster
  .get()
  .then(result => {
    const cluster = result[0];
    const apiResponse = result[1];
  })
  .catch(err => {
    // Handle the error.
  });

getMetadata

getMetadata(gaxOptions, callback)

Get the cluster metadata.

Parameter

gaxOptions

Optional

object

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

callback

function()

The callback function.

Values in callback have the following properties:

Parameter

err

error

An error returned while making this request.

Value may be null.

metadata

object

The metadata.

apiResponse

object

The full API response.

Examples

const Bigtable = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const cluster = instance.cluster(clusterId);

cluster
  .getMetadata()
  .then(result => {
    const metadata = result[0];
    const apiResponse = result[1];
  })
  .catch(err => {
    // Handle the error.
  });

setMetadata

setMetadata(metadata, gaxOptions, callback)

Set the cluster metadata.

Parameter

metadata

object

See Instance#createCluster for the available metadata options.

gaxOptions

Optional

object

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

callback

function()

The callback function.

Values in callback have the following properties:

Parameter

err

error

An error returned while making this request.

Value may be null.

operation

Operation

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

apiResponse

object

The full API response.

Examples

const Bigtable = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance(instanceId);
const cluster = instance.cluster(clusterId);

const metadata = {
  nodes: 4,
};

cluster
  .setMetadata(metadata)
  .then(result => {
    const operation = result[0];
    const apiResponse = result[1];
  })
  .catch(err => {
    // Handle the error.
  });