Constructor
new Cluster(instance, id)
Parameters:
Name | Type | Description |
---|---|---|
instance |
Instance |
The parent instance of this cluster. |
id |
string |
Id of the cluster. |
- Source:
Methods
create(optionsopt, callbackopt)
Create a cluster.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
|||||||||||||
callback |
function |
<optional> |
The callback function. Properties
|
- Source:
Example
const clusterOptions = {
location: 'us-central1-c',
nodes: 3,
storage: 'ssd',
};
const [cluster] = await instance.createCluster(clusterID, clusterOptions);
console.log(`Cluster created: ${cluster.id}`);
delete(gaxOptionsopt, callbackopt)
Delete the cluster.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
<optional> |
The callback function. Properties
|
- Source:
Example
console.log(); //for just a new-line
console.log(`Deleting Cluster`);
await cluster.delete();
console.log(`Cluster deleted: ${cluster.id}`);
exists(gaxOptionsopt, callback)
Check if a cluster exists.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
The callback function. Properties
|
- Source:
Example
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(gaxOptionsopt, callback)
Get a cluster if it exists.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||
callback |
function |
The callback function. Properties
|
- Source:
Example
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(gaxOptionsopt, callback)
Get the cluster metadata.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||||||
callback |
function |
The callback function. Properties
|
- Source:
Example
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(metadata, gaxOptionsopt, callback)
Set the cluster metadata.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
metadata |
object |
See Instance#createCluster for the available metadata options. |
|||||||||||||||||
gaxOptions |
object |
<optional> |
Request configuration options, outlined here: https://googleapis.github.io/gax-nodejs/CallSettings.html. |
||||||||||||||||
callback |
function |
The callback function. Properties
|
- Source:
Example
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.
});