Class Cluster (1.5.1)

Cluster(
    cluster_id,
    instance,
    location_id=None,
    serve_nodes=None,
    default_storage_type=None,
    _state=None,
)

Representation of a Google Cloud Bigtable Cluster.

We can use a Cluster to:

  • reload itself
  • create itself
  • update itself
  • delete itself

Parameters

NameDescription
cluster_id str

The ID of the cluster.

instance Instance

The instance where the cluster resides.

location_id str

(Creation Only) The location where this cluster's nodes and storage reside . For best performance, clients should be located as close as possible to this cluster. For list of supported locations refer to https://cloud.google.com/bigtable/docs/locations

serve_nodes int

(Optional) The number of nodes in the cluster.

default_storage_type int

(Optional) The type of storage Possible values are represented by the following constants: :data:google.cloud.bigtable.enums.StorageType.SSD. :data:google.cloud.bigtable.enums.StorageType.HDD, Defaults to :data:google.cloud.bigtable.enums.StorageType.UNSPECIFIED.

_state int

(OutputOnly) The current state of the cluster. Possible values are represented by the following constants: :data:google.cloud.bigtable.enums.Cluster.State.NOT_KNOWN. :data:google.cloud.bigtable.enums.Cluster.State.READY. :data:google.cloud.bigtable.enums.Cluster.State.CREATING. :data:google.cloud.bigtable.enums.Cluster.State.RESIZING. :data:google.cloud.bigtable.enums.Cluster.State.DISABLED.

Properties

name

Cluster name used in requests.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_cluster_name] :end-before: [END bigtable_cluster_name] :dedent: 4

The cluster name is of the form

`"projects/{project}/instances/{instance}/clusters/{cluster_id}"`
Returns
TypeDescription
strThe cluster name.

state

google.cloud.bigtable.enums.Cluster.State: state of cluster.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_cluster_state] :end-before: [END bigtable_cluster_state] :dedent: 4

Methods

create

create()

Create this cluster.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_create_cluster] :end-before: [END bigtable_create_cluster] :dedent: 4

Returns
TypeDescription
google.api_core.operation.OperationThe long-running operation corresponding to the create operation.

delete

delete()

Delete this cluster.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_delete_cluster] :end-before: [END bigtable_delete_cluster] :dedent: 4

Marks a cluster and all of its tables for permanent deletion in 7 days.

Immediately upon completion of the request:

  • Billing will cease for all of the cluster's reserved resources.
  • The cluster's delete_time field will be set 7 days in the future.

Soon afterward:

  • All tables within the cluster will become unavailable.

At the cluster's delete_time:

  • The cluster and all of its tables will immediately and irrevocably disappear from the API, and their data will be permanently deleted.

exists

exists()

Check whether the cluster already exists.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_check_cluster_exists] :end-before: [END bigtable_check_cluster_exists] :dedent: 4

Returns
TypeDescription
boolTrue if the table exists, else False.

from_pb

from_pb(cluster_pb, instance)

Creates an cluster instance from a protobuf.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_cluster_from_pb] :end-before: [END bigtable_cluster_from_pb] :dedent: 4

Parameters
NameDescription
cluster_pb instance_pb2.Cluster

An instance protobuf object.

instance Instance

The instance that owns the cluster.

Exceptions
TypeDescription
`ValueErro
Returns
TypeDescription
ClusterThe Cluster parsed from the protobuf response.

reload

reload()

Reload the metadata for this cluster.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_reload_cluster] :end-before: [END bigtable_reload_cluster] :dedent: 4

update

update()

Update this cluster.

For example:

.. literalinclude:: snippets.py :start-after: [START bigtable_update_cluster] :end-before: [END bigtable_update_cluster] :dedent: 4

Returns
TypeDescription
OperationThe long-running operation corresponding to the update operation.