Class Instance (6.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
Name
Description
bigtable
id
string

Properties

bigtable

  bigtable 
 : 
  
 Bigtable 
 ; 
 

id

  id 
 : 
  
 string 
 ; 
 
  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
Name
Description
name
string

The name of the app profile.

Returns
Type
Description

{AppProfile}

cluster(id)

  cluster 
 ( 
 id 
 : 
  
 string 
 ) 
 : 
  
 Cluster 
 ; 
 

Get a reference to a Bigtable Cluster.

Parameter
Name
Description
id
string

The id of the cluster.

Returns
Type
Description

{Cluster}

create(options)

  create 
 ( 
 options 
 : 
  
 InstanceOptions 
 ) 
 : 
  
 Promise<CreateInstanceResponse> 
 ; 
 
Parameter
Name
Description
options
Returns
Type
Description

create(options, callback)

  create 
 ( 
 options 
 : 
  
 InstanceOptions 
 , 
  
 callback 
 : 
  
 CreateInstanceCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
Returns
Type
Description
void

createAppProfile(id, options)

  createAppProfile 
 ( 
 id 
 : 
  
 string 
 , 
  
 options 
 ?: 
  
 AppProfileOptions 
 ) 
 : 
  
 Promise<CreateAppProfileResponse> 
 ; 
 
Parameters
Name
Description
id
string
Returns
Type
Description

createAppProfile(id, options, callback)

  createAppProfile 
 ( 
 id 
 : 
  
 string 
 , 
  
 options 
 : 
  
 AppProfileOptions 
 , 
  
 callback 
 : 
  
 CreateAppProfileCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
id
string
Returns
Type
Description
void

createAppProfile(id, callback)

  createAppProfile 
 ( 
 id 
 : 
  
 string 
 , 
  
 callback 
 : 
  
 CreateAppProfileCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
id
string
Returns
Type
Description
void

createCluster(id, options)

  createCluster 
 ( 
 id 
 : 
  
 string 
 , 
  
 options 
 ?: 
  
 CreateClusterOptions 
 ) 
 : 
  
 Promise<CreateClusterResponse> 
 ; 
 
Parameters
Name
Description
id
string
Returns
Type
Description
Promise < CreateClusterResponse >

createCluster(id, options, callback)

  createCluster 
 ( 
 id 
 : 
  
 string 
 , 
  
 options 
 : 
  
 CreateClusterOptions 
 , 
  
 callback 
 : 
  
 CreateClusterCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
id
string
Returns
Type
Description
void

createCluster(id, callback)

  createCluster 
 ( 
 id 
 : 
  
 string 
 , 
  
 callback 
 : 
  
 CreateClusterCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
id
string
Returns
Type
Description
void

createTable(id, options)

  createTable 
 ( 
 id 
 : 
  
 string 
 , 
  
 options 
 ?: 
  
 CreateTableOptions 
 ) 
 : 
  
 Promise<CreateTableResponse> 
 ; 
 
Parameters
Name
Description
id
string
Returns
Type
Description
Promise < CreateTableResponse >

createTable(id, options, callback)

  createTable 
 ( 
 id 
 : 
  
 string 
 , 
  
 options 
 : 
  
 CreateTableOptions 
 , 
  
 callback 
 : 
  
 CreateTableCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
id
string
Returns
Type
Description
void

createTable(id, callback)

  createTable 
 ( 
 id 
 : 
  
 string 
 , 
  
 callback 
 : 
  
 CreateTableCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
id
string
Returns
Type
Description
void

createTableFromBackup(config)

  createTableFromBackup 
 ( 
 config 
 : 
  
 CreateTableFromBackupConfig 
 ) 
 : 
  
 Promise<RestoreTableResponse> 
 ; 
 
Parameter
Name
Description
config
CreateTableFromBackupConfig
Returns
Type
Description
Promise < RestoreTableResponse >

createTableFromBackup(config, callback)

  createTableFromBackup 
 ( 
 config 
 : 
  
 CreateTableFromBackupConfig 
 , 
  
 callback 
 : 
  
 RestoreTableCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
config
CreateTableFromBackupConfig
Returns
Type
Description
void

delete(gaxOptions)

  delete 
 ( 
 gaxOptions 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise<DeleteInstanceResponse> 
 ; 
 
Parameter
Name
Description
gaxOptions
CallOptions
Returns
Type
Description

delete(gaxOptions, callback)

  delete 
 ( 
 gaxOptions 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 DeleteInstanceCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
gaxOptions
CallOptions
Returns
Type
Description
void

delete(callback)

  delete 
 ( 
 callback 
 : 
  
 DeleteInstanceCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
void

exists(options)

  exists 
 ( 
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise<InstanceExistsResponse> 
 ; 
 
Parameter
Name
Description
options
CallOptions
Returns
Type
Description

exists(options, callback)

  exists 
 ( 
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 InstanceExistsCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
Returns
Type
Description
void

exists(callback)

  exists 
 ( 
 callback 
 : 
  
 InstanceExistsCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
void

get(gaxOptions)

  get 
 ( 
 gaxOptions 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise<GetInstanceResponse> 
 ; 
 
Parameter
Name
Description
gaxOptions
CallOptions
Returns
Type
Description
Promise < GetInstanceResponse >

get(gaxOptions, callback)

  get 
 ( 
 gaxOptions 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 GetInstanceCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
gaxOptions
CallOptions
Returns
Type
Description
void

get(callback)

  get 
 ( 
 callback 
 : 
  
 GetInstanceCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
void

getAppProfiles(options)

  getAppProfiles 
 ( 
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise<GetAppProfilesResponse> 
 ; 
 
Parameter
Name
Description
options
CallOptions
Returns
Type
Description

getAppProfiles(options, callback)

  getAppProfiles 
 ( 
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 GetAppProfilesCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
Returns
Type
Description
void

getAppProfiles(callback)

  getAppProfiles 
 ( 
 callback 
 : 
  
 GetAppProfilesCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
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
Name
Description
gaxOptions
CallOptions

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

Returns
Type
Description
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
Name
Description
Returns
Type
Description
Promise < GetBackupsResponse >

getBackups(options, callback)

  getBackups 
 ( 
 options 
 : 
  
 GetBackupsOptions 
 , 
  
 callback 
 : 
  
 GetBackupsCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
Returns
Type
Description
void

getBackups(callback)

  getBackups 
 ( 
 callback 
 : 
  
 GetBackupsCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
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
Name
Description
options
GetBackupsOptions

Configuration object. See for a complete list of options.

Returns
Type
Description
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
Name
Description
options
CallOptions
Returns
Type
Description
Promise < GetClustersResponse >

getClusters(options, callback)

  getClusters 
 ( 
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 GetClustersCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
Returns
Type
Description
void

getClusters(callback)

  getClusters 
 ( 
 callback 
 : 
  
 GetClustersCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
void

getIamPolicy(options)

  getIamPolicy 
 ( 
 options 
 ?: 
  
 GetIamPolicyOptions 
 ) 
 : 
  
 Promise 
< [ 
 Policy 
 ]>; 
 
Parameter
Name
Description
Returns
Type
Description
Promise <[ Policy ]>

getIamPolicy(options, callback)

  getIamPolicy 
 ( 
 options 
 : 
  
 GetIamPolicyOptions 
 , 
  
 callback 
 : 
  
 GetIamPolicyCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
Returns
Type
Description
void
  getMetadata 
 ( 
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise<GetInstanceMetadataResponse> 
 ; 
 
Parameter
Name
Description
options
CallOptions
Returns
Type
Description
  getMetadata 
 ( 
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 GetInstanceMetadataCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
options
CallOptions
Returns
Type
Description
void
  getMetadata 
 ( 
 callback 
 : 
  
 GetInstanceMetadataCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
void

getTables(options)

  getTables 
 ( 
 options 
 ?: 
  
 GetTablesOptions 
 ) 
 : 
  
 Promise<GetTablesResponse> 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
Promise < GetTablesResponse >

getTables(options, callback)

  getTables 
 ( 
 options 
 : 
  
 GetTablesOptions 
 , 
  
 callback 
 : 
  
 GetTablesCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
Returns
Type
Description
void

getTables(callback)

  getTables 
 ( 
 callback 
 : 
  
 GetTablesCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameter
Name
Description
Returns
Type
Description
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
Name
Description
options
GetTablesOptions

Query object. See for a complete list of options.

Returns
Type
Description
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
Name
Description
type
string

The instance type (production, development).

Returns
Type
Description
number

{number}

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

setIamPolicy(policy, gaxOptions)

  setIamPolicy 
 ( 
 policy 
 : 
  
 Policy 
 , 
  
 gaxOptions 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise<SetIamPolicyResponse> 
 ; 
 
Parameters
Name
Description
policy
gaxOptions
CallOptions
Returns
Type
Description
Promise < SetIamPolicyResponse >

setIamPolicy(policy, gaxOptions, callback)

  setIamPolicy 
 ( 
 policy 
 : 
  
 Policy 
 , 
  
 gaxOptions 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 SetIamPolicyCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
policy
gaxOptions
CallOptions
Returns
Type
Description
void

setIamPolicy(policy, callback)

  setIamPolicy 
 ( 
 policy 
 : 
  
 Policy 
 , 
  
 callback 
 : 
  
 SetIamPolicyCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
policy
Returns
Type
Description
void
  setMetadata 
 ( 
 metadata 
 : 
  
 IInstance 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise<SetInstanceMetadataResponse> 
 ; 
 
Parameters
Name
Description
metadata
options
CallOptions
Returns
Type
Description
  setMetadata 
 ( 
 metadata 
 : 
  
 IInstance 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 SetInstanceMetadataCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
metadata
options
CallOptions
Returns
Type
Description
void
  setMetadata 
 ( 
 metadata 
 : 
  
 IInstance 
 , 
  
 callback 
 : 
  
 SetInstanceMetadataCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
metadata
Returns
Type
Description
void

table(id)

  table 
 ( 
 id 
 : 
  
 string 
 ) 
 : 
  
 Table 
 ; 
 

Get a reference to a Bigtable table.

Parameter
Name
Description
id
string

Unique identifier of the table.

Returns
Type
Description

{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
Name
Description
permissions
string | string[]
gaxOptions
CallOptions
Returns
Type
Description

testIamPermissions(permissions, callback)

  testIamPermissions 
 ( 
 permissions 
 : 
  
 string 
  
 | 
  
 string 
 [], 
  
 callback 
 : 
  
 TestIamPermissionsCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
permissions
string | string[]
Returns
Type
Description
void

testIamPermissions(permissions, gaxOptions, callback)

  testIamPermissions 
 ( 
 permissions 
 : 
  
 string 
  
 | 
  
 string 
 [], 
  
 gaxOptions 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 TestIamPermissionsCallback 
 ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
permissions
string | string[]
gaxOptions
CallOptions
Returns
Type
Description
void

view(tableName, viewName)

  view 
 ( 
 tableName 
 : 
  
 string 
 , 
  
 viewName 
 : 
  
 string 
 ) 
 : 
  
 AuthorizedView 
 ; 
 

Gets an Authorized View object for making authorized view grpc calls.

Parameters
Name
Description
tableName
string

The name for the Table

viewName
string

The name for the Authorized view

Returns
Type
Description
AuthorizedView
Create a Mobile Website
View Site in Mobile | Classic
Share by: