Skip to content

Commit d799751

Browse files
Correct documentation about instance iterators. (#4044)
1 parent 7ca0721 commit d799751

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

docs/spanner/instance-usage.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ Each instance within a project maps to a named "instance configuration",
1111
specifying the location and other parameters for a set of instances. These
1212
configurations are defined by the server, and cannot be changed.
1313

14-
To list of all instance configurations available to your project, use the
14+
To iterate over all instance configurations available to your project, use the
1515
:meth:`~google.cloud.spanner.client.Client.list_instance_configs`
1616
method of the client:
1717

1818
.. code:: python
1919
20-
configs, token = client.list_instance_configs()
20+
for config in client.list_instance_configs():
21+
# `config` is an instance of `InstanceConfig`
2122
2223
2324
To fetch a single instance configuration, use the
@@ -28,17 +29,24 @@ method of the client:
2829
2930
config = client.get_instance_configuration('config-name')
3031
32+
Each of these methods provide
33+
:class:`~.spanner_admin_instance_v1.types.InstanceConfig` objects.
34+
3135

3236
List Instances
3337
--------------
3438

35-
If you want a comprehensive list of all existing instances, use the
39+
If you want a comprehensive list of all existing instances, iterate over the
3640
:meth:`~google.cloud.spanner.client.Client.list_instances` method of
3741
the client:
3842

3943
.. code:: python
4044
41-
instances, token = client.list_instances()
45+
for instance in client.list_instances():
46+
# `instance` is an instance of `Instance`
47+
48+
This iterator yields :class:`~.spanner_admin_instance_v1.types.Instance`
49+
objects.
4250

4351

4452
Instance Factory
@@ -57,7 +65,7 @@ To create a :class:`~google.cloud.spanner.instance.Instance` object:
5765
- ``configuration_name`` is the name of the instance configuration to which the
5866
instance will be bound. It must be one of the names configured for your
5967
project, discoverable via
60-
:meth:`google.cloud.spanner.client.Client.list_instance_configs`.
68+
:meth:`~google.cloud.spanner.client.Client.list_instance_configs`.
6169

6270
- ``node_count`` is a postitive integral count of the number of nodes used
6371
by the instance. More nodes allows for higher performance, but at a higher

0 commit comments

Comments
 (0)