Class Cluster (3.8.0)
Stay organized with collections
Save and categorize content based on your preferences.
Create a cluster object to interact with your cluster.
Package
@google-cloud/bigtable
Example
const {Bigtable} = require('@google-cloud/bigtable');
const bigtable = new Bigtable();
const instance = bigtable.instance('my-instance');
const cluster = instance.cluster('my-cluster');
Constructors
(constructor)(instance, id)
constructor(instance: Instance, id: string);
Constructs a new instance of the Cluster
class
Parameters
Name | Description |
instance |
Instance
|
id |
string
|
Properties
bigtable
id
instance
name
Methods
backup(id)
backup(id: string): Backup;
Get a reference to a Bigtable Cluster.
Parameter
Name | Description |
id |
string
The backup name or id.
|
Returns
create()
create(): Promise<CreateClusterResponse>;
Returns
create(options)
create(options: CreateClusterOptions): Promise<CreateClusterResponse>;
Parameter
Returns
create(callback)
create(callback: CreateClusterCallback): void;
Parameter
Returns
create(options, callback)
create(options: CreateClusterOptions, callback: CreateClusterCallback): void;
Parameters
Returns
createBackup(id, config)
createBackup(id: string, config: CreateBackupConfig): Promise<CreateBackupResponse>;
Parameters
Name | Description |
id |
string
|
config |
CreateBackupConfig
|
Returns
createBackup(id, config, callback)
createBackup(id: string, config: CreateBackupConfig, callback: CreateBackupCallback): void;
Parameters
Returns
delete()
delete(): Promise<ApiResponse>;
Returns
delete(gaxOptions)
delete(gaxOptions: CallOptions): Promise<ApiResponse>;
Parameter
Name | Description |
gaxOptions |
CallOptions
|
Returns
delete(callback)
delete(callback: DeleteClusterCallback): void;
Parameter
Returns
delete(gaxOptions, callback)
delete(gaxOptions: CallOptions, callback: DeleteClusterCallback): void;
Parameters
Returns
exists()
exists(): Promise<BooleanResponse>;
Returns
exists(gaxOptions)
exists(gaxOptions: CallOptions): Promise<BooleanResponse>;
Parameter
Name | Description |
gaxOptions |
CallOptions
|
Returns
exists(callback)
exists(callback: ExistsClusterCallback): void;
Parameter
Returns
exists(gaxOptions, callback)
exists(gaxOptions: CallOptions, callback: ExistsClusterCallback): void;
Parameters
Returns
get()
get(): Promise<GetClusterResponse>;
Returns
get(gaxOptions)
get(gaxOptions: CallOptions): Promise<GetClusterResponse>;
Parameter
Name | Description |
gaxOptions |
CallOptions
|
Returns
get(callback)
get(callback: GetClusterCallback): void;
Parameter
Returns
get(gaxOptions, callback)
get(gaxOptions: CallOptions, callback: GetClusterCallback): void;
Parameters
Returns
getBackups(options)
getBackups(options?: GetBackupsOptions): Promise<GetBackupsResponse>;
Parameter
Returns
getBackups(options, callback)
getBackups(options: GetBackupsOptions, callback: GetBackupsCallback): void;
Parameters
Returns
getBackups(callback)
getBackups(callback: GetBackupsCallback): void;
Parameter
Returns
getBackupsStream(options)
getBackupsStream(options?: GetBackupsOptions): NodeJS.ReadableStream;
Lists Cloud Bigtable backups within this cluster. Provides both completed and pending backups as a readable object 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');
const cluster = instance.cluster('my-cluster');
cluster.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.
//-
cluster.getBackupsStream()
.on('data', function(backup) {
this.end();
});
getLocation_(project, location)
static getLocation_(project: string, location: string): string;
Parameters
Name | Description |
project |
string
The project ID.
|
location |
string
The zone location.
|
Returns
Type | Description |
string | {string}
|
Example
Cluster.getLocation_('my-project', 'us-central1-b');
// 'projects/my-project/locations/us-central1-b'
getMetadata(): Promise<GetClusterMetadataResponse>;
Returns
getMetadata(gaxOptions: CallOptions): Promise<GetClusterMetadataResponse>;
Parameter
Name | Description |
gaxOptions |
CallOptions
|
Returns
getMetadata(callback: GetClusterMetadataCallback): void;
Parameter
Returns
getMetadata(gaxOptions: CallOptions, callback: GetClusterMetadataCallback): void;
Parameters
Returns
getStorageType_(type)
static getStorageType_(type: string): number;
Maps the storage type to the proper integer.
Parameter
Name | Description |
type |
string
The storage type (hdd, ssd).
|
Returns
Type | Description |
number | {number}
|
Example
Cluster.getStorageType_('ssd');
// 1
setMetadata(metadata: SetClusterMetadataOptions, gaxOptions?: CallOptions): Promise<SetClusterMetadataResponse>;
Parameters
Name | Description |
metadata |
SetClusterMetadataOptions
|
gaxOptions |
CallOptions
|
Returns
setMetadata(metadata: SetClusterMetadataOptions, callback: SetClusterMetadataCallback): void;
Parameters
Returns
setMetadata(metadata: SetClusterMetadataOptions, gaxOptions: CallOptions, callback: SetClusterMetadataCallback): void;
Parameters
Returns
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-19 UTC.
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-09-19 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-19 UTC."]]