Class Instance (5.0.0)

Create an Instance object to interact with a Cloud Bigtable instance.

Package

@google-cloud/bigtable

Example


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

Constructors

(constructor)(bigtable, id)

constructor(bigtable: Bigtable, id: string);

Constructs a new instance of the Instance class

Parameters
NameDescription
bigtable Bigtable
id string

Properties

bigtable

bigtable: Bigtable;

id

id: string;

metadata

metadata?: google.bigtable.admin.v2.IInstance;

name

name: string;

Methods

appProfile(name)

appProfile(name: string): AppProfile;

Get a reference to a Bigtable App Profile.

Parameter
NameDescription
name string

The name of the app profile.

Returns
TypeDescription
AppProfile

{AppProfile}

cluster(id)

cluster(id: string): Cluster;

Get a reference to a Bigtable Cluster.

Parameter
NameDescription
id string

The id of the cluster.

Returns
TypeDescription
Cluster

{Cluster}

create(options)

create(options: InstanceOptions): Promise<CreateInstanceResponse>;
Parameter
NameDescription
options InstanceOptions
Returns
TypeDescription
Promise<CreateInstanceResponse>

create(options, callback)

create(options: InstanceOptions, callback: CreateInstanceCallback): void;
Parameters
NameDescription
options InstanceOptions
callback CreateInstanceCallback
Returns
TypeDescription
void

createAppProfile(id, options)

createAppProfile(id: string, options?: AppProfileOptions): Promise<CreateAppProfileResponse>;
Parameters
NameDescription
id string
options AppProfileOptions
Returns
TypeDescription
Promise<CreateAppProfileResponse>

createAppProfile(id, options, callback)

createAppProfile(id: string, options: AppProfileOptions, callback: CreateAppProfileCallback): void;
Parameters
NameDescription
id string
options AppProfileOptions
callback CreateAppProfileCallback
Returns
TypeDescription
void

createAppProfile(id, callback)

createAppProfile(id: string, callback: CreateAppProfileCallback): void;
Parameters
NameDescription
id string
callback CreateAppProfileCallback
Returns
TypeDescription
void

createCluster(id, options)

createCluster(id: string, options?: CreateClusterOptions): Promise<CreateClusterResponse>;
Parameters
NameDescription
id string
options CreateClusterOptions
Returns
TypeDescription
Promise<CreateClusterResponse>

createCluster(id, options, callback)

createCluster(id: string, options: CreateClusterOptions, callback: CreateClusterCallback): void;
Parameters
NameDescription
id string
options CreateClusterOptions
callback CreateClusterCallback
Returns
TypeDescription
void

createCluster(id, callback)

createCluster(id: string, callback: CreateClusterCallback): void;
Parameters
NameDescription
id string
callback CreateClusterCallback
Returns
TypeDescription
void

createTable(id, options)

createTable(id: string, options?: CreateTableOptions): Promise<CreateTableResponse>;
Parameters
NameDescription
id string
options CreateTableOptions
Returns
TypeDescription
Promise<CreateTableResponse>

createTable(id, options, callback)

createTable(id: string, options: CreateTableOptions, callback: CreateTableCallback): void;
Parameters
NameDescription
id string
options CreateTableOptions
callback CreateTableCallback
Returns
TypeDescription
void

createTable(id, callback)

createTable(id: string, callback: CreateTableCallback): void;
Parameters
NameDescription
id string
callback CreateTableCallback
Returns
TypeDescription
void

createTableFromBackup(config)

createTableFromBackup(config: CreateTableFromBackupConfig): Promise<RestoreTableResponse>;
Parameter
NameDescription
config CreateTableFromBackupConfig
Returns
TypeDescription
Promise<RestoreTableResponse>

createTableFromBackup(config, callback)

createTableFromBackup(config: CreateTableFromBackupConfig, callback: RestoreTableCallback): void;
Parameters
NameDescription
config CreateTableFromBackupConfig
callback RestoreTableCallback
Returns
TypeDescription
void

delete(gaxOptions)

delete(gaxOptions?: CallOptions): Promise<DeleteInstanceResponse>;
Parameter
NameDescription
gaxOptions CallOptions
Returns
TypeDescription
Promise<DeleteInstanceResponse>

delete(gaxOptions, callback)

delete(gaxOptions: CallOptions, callback: DeleteInstanceCallback): void;
Parameters
NameDescription
gaxOptions CallOptions
callback DeleteInstanceCallback
Returns
TypeDescription
void

delete(callback)

delete(callback: DeleteInstanceCallback): void;
Parameter
NameDescription
callback DeleteInstanceCallback
Returns
TypeDescription
void

exists(options)

exists(options?: CallOptions): Promise<InstanceExistsResponse>;
Parameter
NameDescription
options CallOptions
Returns
TypeDescription
Promise<InstanceExistsResponse>

exists(options, callback)

exists(options: CallOptions, callback: InstanceExistsCallback): void;
Parameters
NameDescription
options CallOptions
callback InstanceExistsCallback
Returns
TypeDescription
void

exists(callback)

exists(callback: InstanceExistsCallback): void;
Parameter
NameDescription
callback InstanceExistsCallback
Returns
TypeDescription
void

get(gaxOptions)

get(gaxOptions?: CallOptions): Promise<GetInstanceResponse>;
Parameter
NameDescription
gaxOptions CallOptions
Returns
TypeDescription
Promise<GetInstanceResponse>

get(gaxOptions, callback)

get(gaxOptions: CallOptions, callback: GetInstanceCallback): void;
Parameters
NameDescription
gaxOptions CallOptions
callback GetInstanceCallback
Returns
TypeDescription
void

get(callback)

get(callback: GetInstanceCallback): void;
Parameter
NameDescription
callback GetInstanceCallback
Returns
TypeDescription
void

getAppProfiles(options)

getAppProfiles(options?: CallOptions): Promise<GetAppProfilesResponse>;
Parameter
NameDescription
options CallOptions
Returns
TypeDescription
Promise<GetAppProfilesResponse>

getAppProfiles(options, callback)

getAppProfiles(options: CallOptions, callback: GetAppProfilesCallback): void;
Parameters
NameDescription
options CallOptions
callback GetAppProfilesCallback
Returns
TypeDescription
void

getAppProfiles(callback)

getAppProfiles(callback: GetAppProfilesCallback): void;
Parameter
NameDescription
callback GetAppProfilesCallback
Returns
TypeDescription
void

getAppProfilesStream(gaxOptions)

getAppProfilesStream(gaxOptions?: CallOptions): NodeJS.ReadableStream;

Get AppProfile objects for all the App Profiles in your Cloud Bigtable instance as a readable object stream.

Parameter
NameDescription
gaxOptions CallOptions

Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. for a complete list of options.

Returns
TypeDescription
NodeJS.ReadableStream

{stream}

Example

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

instance.getAppProfilesStream()
  .on('error', console.error)
  .on('data', function(appProfile) {
    // appProfile is a AppProfile object.
  })
  .on('end', () => {
    // All appProfiles retrieved.
  });

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

getBackups(options)

getBackups(options?: GetBackupsOptions): Promise<GetBackupsResponse>;
Parameter
NameDescription
options GetBackupsOptions
Returns
TypeDescription
Promise<GetBackupsResponse>

getBackups(options, callback)

getBackups(options: GetBackupsOptions, callback: GetBackupsCallback): void;
Parameters
NameDescription
options GetBackupsOptions
callback GetBackupsCallback
Returns
TypeDescription
void

getBackups(callback)

getBackups(callback: GetBackupsCallback): void;
Parameter
NameDescription
callback GetBackupsCallback
Returns
TypeDescription
void

getBackupsStream(options)

getBackupsStream(options?: GetBackupsOptions): NodeJS.ReadableStream;

Get Cloud Bigtable Backup instances within this instance. This returns both completed and pending backups as a readable stream.

Parameter
NameDescription
options GetBackupsOptions

Configuration object. See for a complete list of options.

Returns
TypeDescription
NodeJS.ReadableStream

{ReadableStream

Example

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

instance.getBackupsStream()
  .on('error', console.error)
  .on('data', function(backup) {
    // backup is a Backup object.
  })
  .on('end', () => {
    // All backups retrieved.
  });

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

getClusters(options)

getClusters(options?: CallOptions): Promise<GetClustersResponse>;
Parameter
NameDescription
options CallOptions
Returns
TypeDescription
Promise<GetClustersResponse>

getClusters(options, callback)

getClusters(options: CallOptions, callback: GetClustersCallback): void;
Parameters
NameDescription
options CallOptions
callback GetClustersCallback
Returns
TypeDescription
void

getClusters(callback)

getClusters(callback: GetClustersCallback): void;
Parameter
NameDescription
callback GetClustersCallback
Returns
TypeDescription
void

getIamPolicy(options)

getIamPolicy(options?: GetIamPolicyOptions): Promise<[Policy]>;
Parameter
NameDescription
options GetIamPolicyOptions
Returns
TypeDescription
Promise<[Policy]>

getIamPolicy(options, callback)

getIamPolicy(options: GetIamPolicyOptions, callback: GetIamPolicyCallback): void;
Parameters
NameDescription
options GetIamPolicyOptions
callback GetIamPolicyCallback
Returns
TypeDescription
void

getMetadata(options)

getMetadata(options?: CallOptions): Promise<GetInstanceMetadataResponse>;
Parameter
NameDescription
options CallOptions
Returns
TypeDescription
Promise<GetInstanceMetadataResponse>

getMetadata(options, callback)

getMetadata(options: CallOptions, callback: GetInstanceMetadataCallback): void;
Parameters
NameDescription
options CallOptions
callback GetInstanceMetadataCallback
Returns
TypeDescription
void

getMetadata(callback)

getMetadata(callback: GetInstanceMetadataCallback): void;
Parameter
NameDescription
callback GetInstanceMetadataCallback
Returns
TypeDescription
void

getTables(options)

getTables(options?: GetTablesOptions): Promise<GetTablesResponse>;
Parameter
NameDescription
options GetTablesOptions
Returns
TypeDescription
Promise<GetTablesResponse>

getTables(options, callback)

getTables(options: GetTablesOptions, callback: GetTablesCallback): void;
Parameters
NameDescription
options GetTablesOptions
callback GetTablesCallback
Returns
TypeDescription
void

getTables(callback)

getTables(callback: GetTablesCallback): void;
Parameter
NameDescription
callback GetTablesCallback
Returns
TypeDescription
void

getTablesStream(options)

getTablesStream(options?: GetTablesOptions): NodeJS.ReadableStream;

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

Parameter
NameDescription
options GetTablesOptions

Query object. See for a complete list of options.

Returns
TypeDescription
NodeJS.ReadableStream

{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', () => {
    // 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();
  });

getTypeType_(type)

static getTypeType_(type?: string): number;

Maps the instance type to the proper integer.

Parameter
NameDescription
type string

The instance type (production, development).

Returns
TypeDescription
number

{number}

Example

Instance.getTypeType_('production');
// 1

setIamPolicy(policy, gaxOptions)

setIamPolicy(policy: Policy, gaxOptions?: CallOptions): Promise<SetIamPolicyResponse>;
Parameters
NameDescription
policy Policy
gaxOptions CallOptions
Returns
TypeDescription
Promise<SetIamPolicyResponse>

setIamPolicy(policy, gaxOptions, callback)

setIamPolicy(policy: Policy, gaxOptions: CallOptions, callback: SetIamPolicyCallback): void;
Parameters
NameDescription
policy Policy
gaxOptions CallOptions
callback SetIamPolicyCallback
Returns
TypeDescription
void

setIamPolicy(policy, callback)

setIamPolicy(policy: Policy, callback: SetIamPolicyCallback): void;
Parameters
NameDescription
policy Policy
callback SetIamPolicyCallback
Returns
TypeDescription
void

setMetadata(metadata, options)

setMetadata(metadata: IInstance, options?: CallOptions): Promise<SetInstanceMetadataResponse>;
Parameters
NameDescription
metadata IInstance
options CallOptions
Returns
TypeDescription
Promise<SetInstanceMetadataResponse>

setMetadata(metadata, options, callback)

setMetadata(metadata: IInstance, options: CallOptions, callback: SetInstanceMetadataCallback): void;
Parameters
NameDescription
metadata IInstance
options CallOptions
callback SetInstanceMetadataCallback
Returns
TypeDescription
void

setMetadata(metadata, callback)

setMetadata(metadata: IInstance, callback: SetInstanceMetadataCallback): void;
Parameters
NameDescription
metadata IInstance
callback SetInstanceMetadataCallback
Returns
TypeDescription
void

table(id)

table(id: string): Table;

Get a reference to a Bigtable table.

Parameter
NameDescription
id string

Unique identifier of the table.

Returns
TypeDescription
Table

{Table}

Example

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

testIamPermissions(permissions, gaxOptions)

testIamPermissions(permissions: string | string[], gaxOptions?: CallOptions): Promise<TestIamPermissionsResponse>;
Parameters
NameDescription
permissions string | string[]
gaxOptions CallOptions
Returns
TypeDescription
Promise<TestIamPermissionsResponse>

testIamPermissions(permissions, callback)

testIamPermissions(permissions: string | string[], callback: TestIamPermissionsCallback): void;
Parameters
NameDescription
permissions string | string[]
callback TestIamPermissionsCallback
Returns
TypeDescription
void

testIamPermissions(permissions, gaxOptions, callback)

testIamPermissions(permissions: string | string[], gaxOptions: CallOptions, callback: TestIamPermissionsCallback): void;
Parameters
NameDescription
permissions string | string[]
gaxOptions CallOptions
callback TestIamPermissionsCallback
Returns
TypeDescription
void