Instance
Source: instance.
Create an Instance object to interact with a Cloud Bigtable instance.
Property
Methods
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
cluster(id) → Cluster
Get a reference to a Bigtable Cluster.
Parameter
| Name | Type | Optional | Description |
|---|---|---|---|
|
id |
string |
|
The id of the cluster. |
- Returns
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 |
|
Values in
|
||||||||||||||||||||
|
callback |
function() |
|
The callback function. Values in
|
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
|
||||||||||||||||||||||||
|
callback |
function() |
|
The callback function. Values in
|
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
|
||||||||||||||||||||
|
callback |
function() |
|
The callback function. Values in
|
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
|
||||||||||||||||
|
callback |
function() |
|
The callback function. Values in
|
- See also
- Throws
-
errorIf 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
|
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
|
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
|
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
|
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
|
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
|
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
|
||||||||||||||||||||||||||||
|
callback |
function() |
|
The callback function. Values in
|
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
|
||||||||||||
|
gaxOptions |
object |
Yes |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions. |
||||||||||||
|
callback |
function() |
|
The callback function. Values in
|
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