Class Cluster (6.0.0)

Create a cluster object to interact with your cluster.

Package

@google-cloud/bigtable

Example

const{Bigtable}=require('@google-cloud/bigtable');constbigtable=newBigtable();constinstance=bigtable.instance('my-instance');constcluster=instance.cluster('my-cluster');

Constructors

(constructor)(instance, id)

constructor(instance:Instance,id:string);

Constructs a new instance of theCluster class

Parameters
NameDescription
instanceInstance
idstring

Properties

bigtable

bigtable:Bigtable;

id

id:string;

instance

instance:Instance;

metadata

metadata?:ICluster;

name

name:string;

Methods

backup(id)

backup(id:string):Backup;

Get a reference to a Bigtable Cluster.

Parameter
NameDescription
idstring

The backup name or id.

Returns
TypeDescription
Backup

{Backup}

create()

create():Promise<CreateClusterResponse>;
Returns
TypeDescription
Promise<CreateClusterResponse>

create(options)

create(options:CreateClusterOptions):Promise<CreateClusterResponse>;
Parameter
NameDescription
optionsCreateClusterOptions
Returns
TypeDescription
Promise<CreateClusterResponse>

create(callback)

create(callback:CreateClusterCallback):void;
Parameter
NameDescription
callbackCreateClusterCallback
Returns
TypeDescription
void

create(options, callback)

create(options:CreateClusterOptions,callback:CreateClusterCallback):void;
Parameters
NameDescription
optionsCreateClusterOptions
callbackCreateClusterCallback
Returns
TypeDescription
void

createBackup(id, config)

createBackup(id:string,config:CreateBackupConfig):Promise<CreateBackupResponse>;
Parameters
NameDescription
idstring
configCreateBackupConfig
Returns
TypeDescription
Promise<CreateBackupResponse>

createBackup(id, config, callback)

createBackup(id:string,config:CreateBackupConfig,callback:CreateBackupCallback):void;
Parameters
NameDescription
idstring
configCreateBackupConfig
callbackCreateBackupCallback
Returns
TypeDescription
void

delete()

delete():Promise<ApiResponse>;
Returns
TypeDescription
Promise<ApiResponse>

delete(gaxOptions)

delete(gaxOptions:CallOptions):Promise<ApiResponse>;
Parameter
NameDescription
gaxOptionsCallOptions
Returns
TypeDescription
Promise<ApiResponse>

delete(callback)

delete(callback:DeleteClusterCallback):void;
Parameter
NameDescription
callbackDeleteClusterCallback
Returns
TypeDescription
void

delete(gaxOptions, callback)

delete(gaxOptions:CallOptions,callback:DeleteClusterCallback):void;
Parameters
NameDescription
gaxOptionsCallOptions
callbackDeleteClusterCallback
Returns
TypeDescription
void

exists()

exists():Promise<BooleanResponse>;
Returns
TypeDescription
Promise<BooleanResponse>

exists(gaxOptions)

exists(gaxOptions:CallOptions):Promise<BooleanResponse>;
Parameter
NameDescription
gaxOptionsCallOptions
Returns
TypeDescription
Promise<BooleanResponse>

exists(callback)

exists(callback:ExistsClusterCallback):void;
Parameter
NameDescription
callbackExistsClusterCallback
Returns
TypeDescription
void

exists(gaxOptions, callback)

exists(gaxOptions:CallOptions,callback:ExistsClusterCallback):void;
Parameters
NameDescription
gaxOptionsCallOptions
callbackExistsClusterCallback
Returns
TypeDescription
void

get()

get():Promise<GetClusterResponse>;
Returns
TypeDescription
Promise<GetClusterResponse>

get(gaxOptions)

get(gaxOptions:CallOptions):Promise<GetClusterResponse>;
Parameter
NameDescription
gaxOptionsCallOptions
Returns
TypeDescription
Promise<GetClusterResponse>

get(callback)

get(callback:GetClusterCallback):void;
Parameter
NameDescription
callbackGetClusterCallback
Returns
TypeDescription
void

get(gaxOptions, callback)

get(gaxOptions:CallOptions,callback:GetClusterCallback):void;
Parameters
NameDescription
gaxOptionsCallOptions
callbackGetClusterCallback
Returns
TypeDescription
void

getBackups(options)

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

getBackups(options, callback)

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

getBackups(callback)

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

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
NameDescription
optionsGetBackupsOptions

Configuration object. See for a complete list of options.

Returns
TypeDescription
NodeJS.ReadableStream

{ReadableStream

Example
const{Bigtable}=require('@google-cloud/bigtable');constbigtable=newBigtable();constinstance=bigtable.instance('my-instance');constcluster=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)

staticgetLocation_(project:string,location:string):string;

Formats zone location.

Parameters
NameDescription
projectstring

The project ID.

locationstring

The zone location.

Returns
TypeDescription
string

{string}

Example
Cluster.getLocation_('my-project','us-central1-b');// 'projects/my-project/locations/us-central1-b'

getMetadata()

getMetadata():Promise<GetClusterMetadataResponse>;
Returns
TypeDescription
Promise<GetClusterMetadataResponse>

getMetadata(gaxOptions)

getMetadata(gaxOptions:CallOptions):Promise<GetClusterMetadataResponse>;
Parameter
NameDescription
gaxOptionsCallOptions
Returns
TypeDescription
Promise<GetClusterMetadataResponse>

getMetadata(callback)

getMetadata(callback:GetClusterMetadataCallback):void;
Parameter
NameDescription
callbackGetClusterMetadataCallback
Returns
TypeDescription
void

getMetadata(gaxOptions, callback)

getMetadata(gaxOptions:CallOptions,callback:GetClusterMetadataCallback):void;
Parameters
NameDescription
gaxOptionsCallOptions
callbackGetClusterMetadataCallback
Returns
TypeDescription
void

getStorageType_(type)

staticgetStorageType_(type:string):number;

Maps the storage type to the proper integer.

Parameter
NameDescription
typestring

The storage type (hdd, ssd).

Returns
TypeDescription
number

{number}

Example
Cluster.getStorageType_('ssd');// 1

setMetadata(metadata, gaxOptions)

setMetadata(metadata:SetClusterMetadataOptions,gaxOptions?:CallOptions):Promise<SetClusterMetadataResponse>;
Parameters
NameDescription
metadataSetClusterMetadataOptions
gaxOptionsCallOptions
Returns
TypeDescription
Promise<SetClusterMetadataResponse>

setMetadata(metadata, callback)

setMetadata(metadata:SetClusterMetadataOptions,callback:SetClusterMetadataCallback):void;
Parameters
NameDescription
metadataSetClusterMetadataOptions
callbackSetClusterMetadataCallback
Returns
TypeDescription
void

setMetadata(metadata, gaxOptions, callback)

setMetadata(metadata:SetClusterMetadataOptions,gaxOptions:CallOptions,callback:SetClusterMetadataCallback):void;
Parameters
NameDescription
metadataSetClusterMetadataOptions
gaxOptionsCallOptions
callbackSetClusterMetadataCallback
Returns
TypeDescription
void

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.