Instance#
User friendly container for Google Cloud Bigtable Instance.
-
class
google.cloud.bigtable.instance.
Instance
(instance_id, client, location_id='see-existing-cluster', display_name=None, serve_nodes=3)[source]# Bases:
object
Representation of a Google Cloud Bigtable Instance.
We can use a
Instance
to:Note
For now, we leave out the
default_storage_type
(an enum) which if not sent will end up asdata_v2_pb2.STORAGE_SSD
.Parameters: - instance_id (str) – The ID of the instance.
- client (
Client
) – The client that owns the instance. Provides authorization and a project ID. - location_id (str) – ID of the location in which the instance will be created. Required for instances which do not yet exist.
- display_name (str) – (Optional) The display name for the instance in the Cloud Console UI. (Must be between 4 and 30 characters.) If this value is not set in the constructor, will fall back to the instance ID.
- serve_nodes (int) – (Optional) The number of nodes in the instance’s cluster; used to set up the instance’s cluster.
-
cluster
(cluster_id, serve_nodes=3)[source]# Factory to create a cluster associated with this client.
Parameters: Return type: Returns: The cluster owned by this client.
-
copy
()[source]# Make a copy of this instance.
Copies the local data stored as simple types and copies the client attached to this instance.
Return type: Instance
Returns: A copy of the current instance.
-
create
()[source]# Create this instance.
Note
Uses the
project
andinstance_id
on the currentInstance
in addition to thedisplay_name
. To change them before creating, reset the values viainstance.display_name = 'New display name' instance.instance_id = 'i-changed-my-mind'
before calling
create()
.Return type: Operation
Returns: The long-running operation corresponding to the create operation.
-
delete
()[source]# Delete this instance.
Marks a instance and all of its tables for permanent deletion in 7 days.
Immediately upon completion of the request:
- Billing will cease for all of the instance’s reserved resources.
- The instance’s
delete_time
field will be set 7 days in the future.
Soon afterward:
- All tables within the instance will become unavailable.
At the instance’s
delete_time
:- The instance and all of its tables will immediately and irrevocably disappear from the API, and their data will be permanently deleted.
-
classmethod
from_pb
(instance_pb, client)[source]# Creates a instance instance from a protobuf.
Parameters: - instance_pb (
instance_pb2.Instance
) – A instance protobuf object. - client (
Client
) – The client that owns the instance.
Return type: Returns: The instance parsed from the protobuf response.
Raises: ValueError
if the instance name does not matchprojects/{project}/instances/{instance_id}
or if the parsed project ID does not match the project ID on the client.- instance_pb (
-
list_clusters
()[source]# Lists clusters in this instance.
Return type: tuple Returns: A pair of results, the first is a list of Cluster
s returned and the second is a list of strings (the failed locations in the request).
-
list_tables
()[source]# List the tables in this instance.
Return type: list of Table
Returns: The list of tables owned by the instance. Raises: ValueError
if one of the returned tables has a name that is not of the expected format.
-
name
# Instance name used in requests.
Note
This property will not change if
instance_id
does not, but the return value is not cached.The instance name is of the form
"projects/{project}/instances/{instance_id}"
Return type: str Returns: The instance name.