2.42.0 (latest) 2.41.0 2.40.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.1 2.29.0 2.28.1 2.26.0 2.25.0 2.24.0 2.23.1 2.22.0 2.21.0 2.20.0 2.19.0 2.18.1 2.17.0 2.16.0 2.15.0 2.14.1 2.13.2 2.12.0 2.11.3 2.10.1 2.9.0 2.8.1 2.7.1 2.6.0 2.5.2 2.4.0 2.3.3 2.2.0 2.1.0 2.0.0 1.7.3 1.6.1 1.5.1 1.4.0 1.3.0 1.2.1 1.1.0 1.0.0 0.34.0

    Cluster(
        cluster_id,
        instance,
        location_id=None,
        serve_nodes=None,
        default_storage_type=None,
        kms_key_name=None,
        _state=None,
        min_serve_nodes=None,
        max_serve_nodes=None,
        cpu_utilization_percent=None,
    )

Representation of a Google Cloud Bigtable Cluster.

We can use a `Cluster` to:

- `reload` itself
- `create` itself
- `update` itself
- `delete` itself
- `disable_autoscaling` itself

| ## Parameters ||
|---|---|
| **Name** | **Description** |
| `cluster_id` | `str` The ID of the cluster. |
| `instance` | `https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.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 for manual scaling. If any of the autoscaling configuration are specified, then the autoscaling configuration will take precedent. |
| `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`. |
| `min_serve_nodes` | `int` (Optional) The minimum number of nodes to be set in the cluster for autoscaling. Must be 1 or greater. If specified, this configuration takes precedence over `serve_nodes`. If specified, then `max_serve_nodes` and `cpu_utilization_percent` must be specified too. |
| `max_serve_nodes` | `int` (Optional) The maximum number of nodes to be set in the cluster for autoscaling. If specified, this configuration takes precedence over `serve_nodes`. If specified, then `min_serve_nodes` and `cpu_utilization_percent` must be specified too. |

## Properties

### kms_key_name

str: Customer managed encryption key for the cluster.

### name

<br />

Cluster name used in requests.

<br />

> [!NOTE]
> **Note:** This property will not change if `_instance` and `cluster_id` do not, but the return value is not cached.

For example:

<br />

.. 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

<br />

    `"projects/{project}/instances/{instance}/clusters/{cluster_id}"`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `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

> [!NOTE]
> **Note:** Uses the `project`, `instance` and `cluster_id` on the current `Cluster` in addition to the `serve_nodes`. To change them before creating, reset the values via .. code:: python cluster.serve_nodes = 8 cluster.cluster_id = 'i-changed-my-mind' before calling `create`.

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `` `ValueErro `` |   |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` `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_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.

### disable_autoscaling

    disable_autoscaling(serve_nodes)

Disable autoscaling by specifying the number of nodes.

For example:

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `serve_nodes` | `int` The number of nodes in the cluster. |

### 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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` | True if the table exists, else False. |

### from_pb

    from_pb(cluster_pb, instance)

Creates a 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

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `cluster_pb` | `` `instance.Cluster` `` An instance protobuf object. |
| `instance` | `https://docs.cloud.google.com/python/docs/reference/bigtable/latest/google.cloud.bigtable.instance.Instance` The instance that owns the cluster. |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `` `ValueErro `` |   |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` `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

> [!NOTE]
> **Note:** Updates the `serve_nodes`. If you'd like to change them before updating, reset the values via .. code:: python cluster.serve_nodes = 8 before calling `update`. If autoscaling is already enabled, manual scaling will be silently ignored. To disable autoscaling and enable manual scaling, use the `disable_autoscaling` instead.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `` `Operation` `` | The long-running operation corresponding to the update operation. |