Property

new Instance(bigtable, id)

Example

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

Parameters

Name Type Optional Description

bigtable

 

 

The parent Bigtable object of this instance.

id

 

 

Id of the instance.

Property

getTablesStream

Get Table objects for all the tables in your Cloud Bigtable instance as a readable object stream.

Example

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

instance.getTablesStream()
  .on('error', console.error)
  .on('data', function(table) {
    // table is a Table object.
  })
  .on('end', function() {
    // All tables retrieved.
  });

//-
// If you anticipate many results, you can end a stream early to prevent
// unnecessary processing and API requests.
//-
instance.getTablesStream()
  .on('data', function(table) {
    this.end();
  });

Parameter

Name Type Optional Description

query

object

Yes

Configuration object. See Instance#getTables for a complete list of options.

Returns

stream 

Methods

appProfile(name) → AppProfile

Get a reference to a Bigtable App Profile.

Parameter

Name Type Optional Description

name

string

 

The name of the app profile.

Returns

AppProfile 

cluster(id) → Cluster

Get a reference to a Bigtable Cluster.

Parameter

Name Type Optional Description

id

string

 

The id of the cluster.

Returns

Cluster 

create(options, callback)

Create an instance.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_create_instance

Parameters

Name Type Optional Description

options

object

 

See Bigtable#createInstance.

Values in options have the following properties:

Name Type Optional Description

gaxOptions

object

Yes

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

callback

function()

 

The callback function.

Values in callback have the following properties:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

instance

Instance

 

The newly created instance.

operation

Operation

 

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

apiResponse

object

 

The full API response.

createAppProfile(id, options, callback)

Create an app profile.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_create_app_profile

Parameters

Name Type Optional Description

id

string

 

The name to be used when referring to the new app profile within its instance.

options

object

 

AppProfile creation options.

Values in options have the following properties:

Name Type Optional Description

routing

('any' or Cluster)

 

The routing policy for all read/write requests which use this app profile. This can be either the string 'any' or a cluster of an instance. This value is required when creating the app profile and optional when setting the metadata.

gaxOptions

object

Yes

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

allowTransactionalWrites

boolean

Yes

Whether or not CheckAndMutateRow and ReadModifyWriteRow requests are allowed by this app profile. It is unsafe to send these requests to the same table/row/column in multiple clusters. This is only used when the routing value is a cluster.

description

string

Yes

The long form description of the use case for this AppProfile.

ignoreWarnings

string

Yes

Whether to ignore safety checks when creating the app profile

callback

function()

 

The callback function.

Values in callback have the following properties:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

appProfile

Cluster

 

The newly created app profile.

createCluster(id, options, callback)

Create a cluster.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_create_cluster

Parameters

Name Type Optional Description

id

string

 

The id to be used when referring to the new cluster within its instance.

options

object

 

Cluster creation options.

Values in options have the following properties:

Name Type Optional Description

gaxOptions

object

Yes

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

location

string

 

The location where this cluster's nodes and storage reside. For best performance clients should be located as as close as possible to this cluster. Currently only zones are supported.

nodes

number

 

The number of nodes allocated to this cluster. More nodes enable higher throughput and more consistent performance.

storage

string

Yes

The type of storage used by this cluster to serve its parent instance's tables. Options are 'hdd' or 'ssd'.

callback

function()

 

The callback function.

Values in callback have the following properties:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

cluster

Cluster

 

The newly created cluster.

operation

Operation

 

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

createTable(id[, options], callback)

Create a table on your Bigtable instance.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_create_table

Parameters

Name Type Optional Description

id

string

 

Unique identifier of the table.

options

object

Yes

Table creation options.

Values in options have the following properties:

Name Type Optional Description

families

(object or Array of string)

Yes

Column families to be created within the table.

gaxOptions

object

Yes

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

splits

Array of string

Yes

Initial split keys.

callback

function()

 

The callback function.

Values in callback have the following properties:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

table

Table

 

The newly created table.

apiResponse

object

 

The full API response.

See also

Designing Your Schema

Splitting Keys

Throws

error 

If a id is not provided.

delete([gaxOptions][, callback])

Delete the instance.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_del_instance

Parameters

Name Type Optional Description

gaxOptions

object

Yes

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

callback

function()

Yes

The callback function.

Values in callback have the following properties:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

apiResponse

object

 

The full API response.

exists([gaxOptions], callback)

Check if an instance exists.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_exists_instance

Parameters

Name Type Optional Description

gaxOptions

object

Yes

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:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

exists

boolean

 

Whether the instance exists or not.

get([gaxOptions], callback)

Get an instance if it exists.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_get_instance

Parameters

Name Type Optional Description

gaxOptions

object

Yes

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:

Name Type Optional Description

error

error

 

An error returned while making this request.

Value can be null.

instance

Instance

 

The Instance object.

apiResponse

object

 

The resource as it exists in the API.

getAppProfiles([gaxOptions], callback)

Get App Profile objects for this instance.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_get_app_profiles

Parameters

Name Type Optional Description

gaxOptions

object

Yes

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:

Name Type Optional Description

error

error

 

An error returned while making this request.

Value can be null.

appProfiles

Array of AppProfile

 

List of all AppProfiles.

apiResponse

object

 

The full API response.

getClusters([gaxOptions], callback)

Get Cluster objects for all of your clusters.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_get_clusters

Parameters

Name Type Optional Description

gaxOptions

object

Yes

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:

Name Type Optional Description

error

error

 

An error returned while making this request.

Value can be null.

clusters

Array of Cluster

 

List of all Clusters.

apiResponse

object

 

The full API response.

getMetadata([gaxOptions], callback)

Get the instance metadata.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_get_instance_metadata

Parameters

Name Type Optional Description

gaxOptions

object

Yes

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:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

metadata

object

 

The metadata.

getTables([options], callback)

Get Table objects for all the tables in your Cloud Bigtable instance.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_get_tables

Parameters

Name Type Optional Description

options

object

Yes

Query object.

Values in options have the following properties:

Name Type Optional Description

autoPaginate

boolean

Yes

Have pagination handled automatically.

Defaults to true.

gaxOptions

object

Yes

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

maxApiCalls

number

Yes

Maximum number of API calls to make.

maxResults

number

Yes

Maximum number of items to return.

pageToken

string

Yes

A previously-returned page token representing part of a larger set of results to view.

view

string

Yes

View over the table's fields. Possible options are 'name', 'schema' or 'full'. Default: 'name'.

callback

function()

 

The callback function.

Values in callback have the following properties:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

tables

Array of Table

 

List of all Table objects.These objects contains only table name & id but is not a complete representation of a table.

apiResponse

object

 

The full API response.

setMetadata(metadata[, gaxOptions], callback)

Set the instance metadata.

Example

include:samples/document-snippets/instance.js

region_tag:bigtable_set_meta_data

Parameters

Name Type Optional Description

metadata

object

 

Metadata object.

Values in metadata have the following properties:

Name Type Optional Description

displayName

string

 

The descriptive name for this instance as it appears in UIs. It can be changed at any time, but should be kept globally unique to avoid confusion.

gaxOptions

object

Yes

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

callback

function()

 

The callback function.

Values in callback have the following properties:

Name Type Optional Description

err

error

 

An error returned while making this request.

Value can be null.

apiResponse

object

 

The full API response.

table(id) → Table

Get a reference to a Bigtable table.

Example

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

Parameter

Name Type Optional Description

id

string

 

Unique identifier of the table.

Returns

Table