Class Cluster (2.3.3)
Stay organized with collections
Save and categorize content based on your preferences.
Cluster(
cluster_id,
instance,
location_id=None,
serve_nodes=None,
default_storage_type=None,
kms_key_name=None,
_state=None,
)Representation of a Google Cloud Bigtable Cluster.
We can use a Cluster to:
reloaditselfcreateitselfupdateitselfdeleteitself
Parameters
cluster_id
str
The ID of the cluster.
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.
kms_key_name
str
(Optional, Creation Only) The name of the KMS customer managed encryption key (CMEK) to use for at-rest encryption of data in this cluster. If omitted, Google's default encryption will be used. If specified, the requirements for this key are: 1) The Cloud Bigtable service account associated with the project that contains the cluster must be granted the cloudkms.cryptoKeyEncrypterDecrypter role on the CMEK. 2) Only regional keys can be used and the region of the CMEK key must match the region of the cluster. 3) All clusters within an instance must use the same CMEK key.
_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
kms_key_name
str: Customer managed encryption key for the cluster.
name
Cluster name used in requests.
For example:.. literalinclude:: snippets.py :start-after: [START bigtable_api_cluster_name] :end-before: [END bigtable_api_cluster_name] :dedent: 4
The cluster name is of the form
`"projects/{project}/instances/{instance}/clusters/{cluster_id}"`
str
The cluster name.
state
google.cloud.bigtable.enums.Cluster.State: state of cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_cluster_state] :end-before: [END bigtable_api_cluster_state] :dedent: 4
Methods
create
create()Create this cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_create_cluster] :end-before: [END bigtable_api_create_cluster] :dedent: 4
google.api_core.operation.Operation
The long-running operation corresponding to the create operation.
delete
delete()Delete this cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_delete_cluster] :end-before: [END bigtable_api_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_timefield 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_api_check_cluster_exists] :end-before: [END bigtable_api_check_cluster_exists] :dedent: 4
bool
True 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_api_cluster_from_pb] :end-before: [END bigtable_api_cluster_from_pb] :dedent: 4
cluster_pb
instance.Cluster
An instance protobuf object.
`ValueErro
Cluster
The Cluster parsed from the protobuf response.
reload
reload()Reload the metadata for this cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_reload_cluster] :end-before: [END bigtable_api_reload_cluster] :dedent: 4
update
update()Update this cluster.
For example:
.. literalinclude:: snippets.py :start-after: [START bigtable_api_update_cluster] :end-before: [END bigtable_api_update_cluster] :dedent: 4
Operation
The long-running operation corresponding to the update operation.