Skip to content

Commit 9cec031

Browse files
docs: Add documentation for enums (#407)
* docs: Add documentation for enums fix: Add context manager return types chore: Update gapic-generator-python to v1.8.1 PiperOrigin-RevId: 503210727 Source-Link: googleapis/googleapis@a391fd1 Source-Link: googleapis/googleapis-gen@0080f83 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 4919578 commit 9cec031

File tree

7 files changed

+286
-15
lines changed

7 files changed

+286
-15
lines changed

google/cloud/datastore_admin_v1/services/datastore_admin/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ def sample_list_indexes():
12401240
# Done; return the response.
12411241
return response
12421242

1243-
def __enter__(self):
1243+
def __enter__(self) -> "DatastoreAdminClient":
12441244
return self
12451245

12461246
def __exit__(self, type, value, traceback):

google/cloud/datastore_admin_v1/types/datastore_admin.py

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,20 @@
4646

4747

4848
class OperationType(proto.Enum):
49-
r"""Operation types."""
49+
r"""Operation types.
50+
51+
Values:
52+
OPERATION_TYPE_UNSPECIFIED (0):
53+
Unspecified.
54+
EXPORT_ENTITIES (1):
55+
ExportEntities.
56+
IMPORT_ENTITIES (2):
57+
ImportEntities.
58+
CREATE_INDEX (3):
59+
CreateIndex.
60+
DELETE_INDEX (4):
61+
DeleteIndex.
62+
"""
5063
OPERATION_TYPE_UNSPECIFIED = 0
5164
EXPORT_ENTITIES = 1
5265
IMPORT_ENTITIES = 2
@@ -75,7 +88,33 @@ class CommonMetadata(proto.Message):
7588
"""
7689

7790
class State(proto.Enum):
78-
r"""The various possible states for an ongoing Operation."""
91+
r"""The various possible states for an ongoing Operation.
92+
93+
Values:
94+
STATE_UNSPECIFIED (0):
95+
Unspecified.
96+
INITIALIZING (1):
97+
Request is being prepared for processing.
98+
PROCESSING (2):
99+
Request is actively being processed.
100+
CANCELLING (3):
101+
Request is in the process of being cancelled
102+
after user called
103+
google.longrunning.Operations.CancelOperation on
104+
the operation.
105+
FINALIZING (4):
106+
Request has been processed and is in its
107+
finalization stage.
108+
SUCCESSFUL (5):
109+
Request has completed successfully.
110+
FAILED (6):
111+
Request has finished being processed, but
112+
encountered an error.
113+
CANCELLED (7):
114+
Request has finished being cancelled after
115+
user called
116+
google.longrunning.Operations.CancelOperation.
117+
"""
79118
STATE_UNSPECIFIED = 0
80119
INITIALIZING = 1
81120
PROCESSING = 2

google/cloud/datastore_admin_v1/types/index.py

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,72 @@ class Index(proto.Message):
5050
class AncestorMode(proto.Enum):
5151
r"""For an ordered index, specifies whether each of the entity's
5252
ancestors will be included.
53+
54+
Values:
55+
ANCESTOR_MODE_UNSPECIFIED (0):
56+
The ancestor mode is unspecified.
57+
NONE (1):
58+
Do not include the entity's ancestors in the
59+
index.
60+
ALL_ANCESTORS (2):
61+
Include all the entity's ancestors in the
62+
index.
5363
"""
5464
ANCESTOR_MODE_UNSPECIFIED = 0
5565
NONE = 1
5666
ALL_ANCESTORS = 2
5767

5868
class Direction(proto.Enum):
59-
r"""The direction determines how a property is indexed."""
69+
r"""The direction determines how a property is indexed.
70+
71+
Values:
72+
DIRECTION_UNSPECIFIED (0):
73+
The direction is unspecified.
74+
ASCENDING (1):
75+
The property's values are indexed so as to
76+
support sequencing in ascending order and also
77+
query by <, >, <=, >=, and =.
78+
DESCENDING (2):
79+
The property's values are indexed so as to
80+
support sequencing in descending order and also
81+
query by <, >, <=, >=, and =.
82+
"""
6083
DIRECTION_UNSPECIFIED = 0
6184
ASCENDING = 1
6285
DESCENDING = 2
6386

6487
class State(proto.Enum):
65-
r"""The possible set of states of an index."""
88+
r"""The possible set of states of an index.
89+
90+
Values:
91+
STATE_UNSPECIFIED (0):
92+
The state is unspecified.
93+
CREATING (1):
94+
The index is being created, and cannot be
95+
used by queries. There is an active long-running
96+
operation for the index. The index is updated
97+
when writing an entity.
98+
Some index data may exist.
99+
READY (2):
100+
The index is ready to be used.
101+
The index is updated when writing an entity.
102+
The index is fully populated from all stored
103+
entities it applies to.
104+
DELETING (3):
105+
The index is being deleted, and cannot be
106+
used by queries. There is an active long-running
107+
operation for the index. The index is not
108+
updated when writing an entity. Some index data
109+
may exist.
110+
ERROR (4):
111+
The index was being created or deleted, but
112+
something went wrong. The index cannot by used
113+
by queries. There is no active long-running
114+
operation for the index, and the most recently
115+
finished long-running operation failed. The
116+
index is not updated when writing an entity.
117+
Some index data may exist.
118+
"""
66119
STATE_UNSPECIFIED = 0
67120
CREATING = 1
68121
READY = 2

google/cloud/datastore_admin_v1/types/migration.py

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,50 @@
3030

3131

3232
class MigrationState(proto.Enum):
33-
r"""States for a migration."""
33+
r"""States for a migration.
34+
35+
Values:
36+
MIGRATION_STATE_UNSPECIFIED (0):
37+
Unspecified.
38+
RUNNING (1):
39+
The migration is running.
40+
PAUSED (2):
41+
The migration is paused.
42+
COMPLETE (3):
43+
The migration is complete.
44+
"""
3445
MIGRATION_STATE_UNSPECIFIED = 0
3546
RUNNING = 1
3647
PAUSED = 2
3748
COMPLETE = 3
3849

3950

4051
class MigrationStep(proto.Enum):
41-
r"""Steps in a migration."""
52+
r"""Steps in a migration.
53+
54+
Values:
55+
MIGRATION_STEP_UNSPECIFIED (0):
56+
Unspecified.
57+
PREPARE (6):
58+
Pre-migration: the database is prepared for
59+
migration.
60+
START (1):
61+
Start of migration.
62+
APPLY_WRITES_SYNCHRONOUSLY (7):
63+
Writes are applied synchronously to at least
64+
one replica.
65+
COPY_AND_VERIFY (2):
66+
Data is copied to Cloud Firestore and then
67+
verified to match the data in Cloud Datastore.
68+
REDIRECT_EVENTUALLY_CONSISTENT_READS (3):
69+
Eventually-consistent reads are redirected to
70+
Cloud Firestore.
71+
REDIRECT_STRONGLY_CONSISTENT_READS (4):
72+
Strongly-consistent reads are redirected to
73+
Cloud Firestore.
74+
REDIRECT_WRITES (5):
75+
Writes are redirected to Cloud Firestore.
76+
"""
4277
MIGRATION_STEP_UNSPECIFIED = 0
4378
PREPARE = 6
4479
START = 1
@@ -96,7 +131,18 @@ class MigrationProgressEvent(proto.Message):
96131
"""
97132

98133
class ConcurrencyMode(proto.Enum):
99-
r"""Concurrency modes for transactions in Cloud Firestore."""
134+
r"""Concurrency modes for transactions in Cloud Firestore.
135+
136+
Values:
137+
CONCURRENCY_MODE_UNSPECIFIED (0):
138+
Unspecified.
139+
PESSIMISTIC (1):
140+
Pessimistic concurrency.
141+
OPTIMISTIC (2):
142+
Optimistic concurrency.
143+
OPTIMISTIC_WITH_ENTITY_GROUPS (3):
144+
Optimistic concurrency with entity groups.
145+
"""
100146
CONCURRENCY_MODE_UNSPECIFIED = 0
101147
PESSIMISTIC = 1
102148
OPTIMISTIC = 2

google/cloud/datastore_v1/services/datastore/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ def sample_reserve_ids():
13591359
# Done; return the response.
13601360
return response
13611361

1362-
def __enter__(self):
1362+
def __enter__(self) -> "DatastoreClient":
13631363
return self
13641364

13651365
def __exit__(self, type, value, traceback):

google/cloud/datastore_v1/types/datastore.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,19 @@ class CommitRequest(proto.Message):
498498
"""
499499

500500
class Mode(proto.Enum):
501-
r"""The modes available for commits."""
501+
r"""The modes available for commits.
502+
503+
Values:
504+
MODE_UNSPECIFIED (0):
505+
Unspecified. This value must not be used.
506+
TRANSACTIONAL (1):
507+
Transactional: The mutations are either all applied, or none
508+
are applied. Learn about transactions
509+
`here <https://cloud.google.com/datastore/docs/concepts/transactions>`__.
510+
NON_TRANSACTIONAL (2):
511+
Non-transactional: The mutations may not
512+
apply as all or none.
513+
"""
502514
MODE_UNSPECIFIED = 0
503515
TRANSACTIONAL = 1
504516
NON_TRANSACTIONAL = 2
@@ -839,7 +851,16 @@ class ReadOptions(proto.Message):
839851
"""
840852

841853
class ReadConsistency(proto.Enum):
842-
r"""The possible values for read consistencies."""
854+
r"""The possible values for read consistencies.
855+
856+
Values:
857+
READ_CONSISTENCY_UNSPECIFIED (0):
858+
Unspecified. This value must not be used.
859+
STRONG (1):
860+
Strong consistency.
861+
EVENTUAL (2):
862+
Eventual consistency.
863+
"""
843864
READ_CONSISTENCY_UNSPECIFIED = 0
844865
STRONG = 1
845866
EVENTUAL = 2

0 commit comments

Comments
 (0)