Instance Admin API#
Warning
gRPC is required for using the Cloud Bigtable API. As of May 2016,
grpcio is only supported in Python 2.7, so importing
gcloud.bigtable in other versions of Python will fail.
After creating a Client, you can
interact with individual instances for a project.
List Intances#
If you want a comprehensive list of all existing intances, make a
ListInstances API request with
Client.list_intances():
intances = client.list_intances()
Instance Factory#
To create a Instance object:
instance = client.instance(instance_id, display_name=display_name)
display_name is optional. When not provided,
display_name defaults to the instance_id value.
Even if this Instance already
has been created with the API, you’ll want this object to use as a
parent of a Table just as the
Client is used as the parent of
a Instance.
Create a new Instance#
After creating the instance object, make a CreateInstance API request
with create():
instance.display_name = 'My very own instance'
instance.create()
Check on Current Operation#
Note
When modifying a instance (via a CreateInstance request), the Bigtable
API will return a long-running operation and a corresponding
Operation object
will be returned by
create() <gcloud.bigtable.instance.Instance.create>`().
You can check if a long-running operation (for a
create() has finished
by making a GetOperation request with
Operation.finished():
>>> operation = instance.create()
>>> operation.finished()
True
Note
Once an Operation object
has returned True from
finished(), the
object should not be re-used. Subsequent calls to
finished()
will result in a ValueError.
Get metadata for an existing Instance#
After creating the instance object, make a GetInstance API request
with reload():
instance.reload()
This will load display_name for the existing instance object.
Update an existing Instance#
After creating the instance object, make an UpdateInstance API request
with update():
client.display_name = 'New display_name'
instance.update()
Next Step#
Now we go down the hierarchy from
Instance to a
Table.
Head next to learn about the Table Admin API.