Skip to content

Commit 830f325

Browse files
docs: Add documentation for enums (#886)
* 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> Co-authored-by: Astha Mohta <35952883+asthamohta@users.noreply.github.com>
1 parent ae92f0d commit 830f325

File tree

14 files changed

+327
-18
lines changed

14 files changed

+327
-18
lines changed

google/cloud/spanner_admin_database_v1/services/database_admin/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3064,7 +3064,7 @@ def sample_list_database_roles():
30643064
# Done; return the response.
30653065
return response
30663066

3067-
def __enter__(self):
3067+
def __enter__(self) -> "DatabaseAdminClient":
30683068
return self
30693069

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

google/cloud/spanner_admin_database_v1/types/backup.py

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,17 @@ class Backup(proto.Message):
132132
"""
133133

134134
class State(proto.Enum):
135-
r"""Indicates the current state of the backup."""
135+
r"""Indicates the current state of the backup.
136+
137+
Values:
138+
STATE_UNSPECIFIED (0):
139+
Not specified.
140+
CREATING (1):
141+
The pending backup is still being created. Operations on the
142+
backup may fail with ``FAILED_PRECONDITION`` in this state.
143+
READY (2):
144+
The backup is complete and ready for use.
145+
"""
136146
STATE_UNSPECIFIED = 0
137147
CREATING = 1
138148
READY = 2
@@ -810,7 +820,24 @@ class CreateBackupEncryptionConfig(proto.Message):
810820
"""
811821

812822
class EncryptionType(proto.Enum):
813-
r"""Encryption types for the backup."""
823+
r"""Encryption types for the backup.
824+
825+
Values:
826+
ENCRYPTION_TYPE_UNSPECIFIED (0):
827+
Unspecified. Do not use.
828+
USE_DATABASE_ENCRYPTION (1):
829+
Use the same encryption configuration as the database. This
830+
is the default option when
831+
[encryption_config][google.spanner.admin.database.v1.CreateBackupEncryptionConfig]
832+
is empty. For example, if the database is using
833+
``Customer_Managed_Encryption``, the backup will be using
834+
the same Cloud KMS key as the database.
835+
GOOGLE_DEFAULT_ENCRYPTION (2):
836+
Use Google default encryption.
837+
CUSTOMER_MANAGED_ENCRYPTION (3):
838+
Use customer managed encryption. If specified,
839+
``kms_key_name`` must contain a valid Cloud KMS key.
840+
"""
814841
ENCRYPTION_TYPE_UNSPECIFIED = 0
815842
USE_DATABASE_ENCRYPTION = 1
816843
GOOGLE_DEFAULT_ENCRYPTION = 2
@@ -842,7 +869,25 @@ class CopyBackupEncryptionConfig(proto.Message):
842869
"""
843870

844871
class EncryptionType(proto.Enum):
845-
r"""Encryption types for the backup."""
872+
r"""Encryption types for the backup.
873+
874+
Values:
875+
ENCRYPTION_TYPE_UNSPECIFIED (0):
876+
Unspecified. Do not use.
877+
USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION (1):
878+
This is the default option for
879+
[CopyBackup][google.spanner.admin.database.v1.DatabaseAdmin.CopyBackup]
880+
when
881+
[encryption_config][google.spanner.admin.database.v1.CopyBackupEncryptionConfig]
882+
is not specified. For example, if the source backup is using
883+
``Customer_Managed_Encryption``, the backup will be using
884+
the same Cloud KMS key as the source backup.
885+
GOOGLE_DEFAULT_ENCRYPTION (2):
886+
Use Google default encryption.
887+
CUSTOMER_MANAGED_ENCRYPTION (3):
888+
Use customer managed encryption. If specified,
889+
``kms_key_name`` must contain a valid Cloud KMS key.
890+
"""
846891
ENCRYPTION_TYPE_UNSPECIFIED = 0
847892
USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1
848893
GOOGLE_DEFAULT_ENCRYPTION = 2

google/cloud/spanner_admin_database_v1/types/common.py

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,17 @@
3333

3434

3535
class DatabaseDialect(proto.Enum):
36-
r"""Indicates the dialect type of a database."""
36+
r"""Indicates the dialect type of a database.
37+
38+
Values:
39+
DATABASE_DIALECT_UNSPECIFIED (0):
40+
Default value. This value will create a database with the
41+
GOOGLE_STANDARD_SQL dialect.
42+
GOOGLE_STANDARD_SQL (1):
43+
Google standard SQL.
44+
POSTGRESQL (2):
45+
PostgreSQL supported SQL.
46+
"""
3747
DATABASE_DIALECT_UNSPECIFIED = 0
3848
GOOGLE_STANDARD_SQL = 1
3949
POSTGRESQL = 2
@@ -104,7 +114,23 @@ class EncryptionInfo(proto.Message):
104114
"""
105115

106116
class Type(proto.Enum):
107-
r"""Possible encryption types."""
117+
r"""Possible encryption types.
118+
119+
Values:
120+
TYPE_UNSPECIFIED (0):
121+
Encryption type was not specified, though
122+
data at rest remains encrypted.
123+
GOOGLE_DEFAULT_ENCRYPTION (1):
124+
The data is encrypted at rest with a key that
125+
is fully managed by Google. No key version or
126+
status will be populated. This is the default
127+
state.
128+
CUSTOMER_MANAGED_ENCRYPTION (2):
129+
The data is encrypted at rest with a key that is managed by
130+
the customer. The active version of the key.
131+
``kms_key_version`` will be populated, and
132+
``encryption_status`` may be populated.
133+
"""
108134
TYPE_UNSPECIFIED = 0
109135
GOOGLE_DEFAULT_ENCRYPTION = 1
110136
CUSTOMER_MANAGED_ENCRYPTION = 2

google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,15 @@
5353

5454

5555
class RestoreSourceType(proto.Enum):
56-
r"""Indicates the type of the restore source."""
56+
r"""Indicates the type of the restore source.
57+
58+
Values:
59+
TYPE_UNSPECIFIED (0):
60+
No restore associated.
61+
BACKUP (1):
62+
A backup was used as the source of the
63+
restore.
64+
"""
5765
TYPE_UNSPECIFIED = 0
5866
BACKUP = 1
5967

@@ -153,7 +161,29 @@ class Database(proto.Message):
153161
"""
154162

155163
class State(proto.Enum):
156-
r"""Indicates the current state of the database."""
164+
r"""Indicates the current state of the database.
165+
166+
Values:
167+
STATE_UNSPECIFIED (0):
168+
Not specified.
169+
CREATING (1):
170+
The database is still being created. Operations on the
171+
database may fail with ``FAILED_PRECONDITION`` in this
172+
state.
173+
READY (2):
174+
The database is fully created and ready for
175+
use.
176+
READY_OPTIMIZING (3):
177+
The database is fully created and ready for use, but is
178+
still being optimized for performance and cannot handle full
179+
load.
180+
181+
In this state, the database still references the backup it
182+
was restore from, preventing the backup from being deleted.
183+
When optimizations are complete, the full performance of the
184+
database will be restored, and the database will transition
185+
to ``READY`` state.
186+
"""
157187
STATE_UNSPECIFIED = 0
158188
CREATING = 1
159189
READY = 2
@@ -723,7 +753,21 @@ class RestoreDatabaseEncryptionConfig(proto.Message):
723753
"""
724754

725755
class EncryptionType(proto.Enum):
726-
r"""Encryption types for the database to be restored."""
756+
r"""Encryption types for the database to be restored.
757+
758+
Values:
759+
ENCRYPTION_TYPE_UNSPECIFIED (0):
760+
Unspecified. Do not use.
761+
USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION (1):
762+
This is the default option when
763+
[encryption_config][google.spanner.admin.database.v1.RestoreDatabaseEncryptionConfig]
764+
is not specified.
765+
GOOGLE_DEFAULT_ENCRYPTION (2):
766+
Use Google default encryption.
767+
CUSTOMER_MANAGED_ENCRYPTION (3):
768+
Use customer managed encryption. If specified,
769+
``kms_key_name`` must must contain a valid Cloud KMS key.
770+
"""
727771
ENCRYPTION_TYPE_UNSPECIFIED = 0
728772
USE_CONFIG_DEFAULT_OR_BACKUP_ENCRYPTION = 1
729773
GOOGLE_DEFAULT_ENCRYPTION = 2

google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2480,7 +2480,7 @@ def sample_test_iam_permissions():
24802480
# Done; return the response.
24812481
return response
24822482

2483-
def __enter__(self):
2483+
def __enter__(self) -> "InstanceAdminClient":
24842484
return self
24852485

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

google/cloud/spanner_admin_instance_v1/types/spanner_instance_admin.py

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,36 @@ class ReplicaType(proto.Enum):
7272
r"""Indicates the type of replica. See the `replica types
7373
documentation <https://cloud.google.com/spanner/docs/replication#replica_types>`__
7474
for more details.
75+
76+
Values:
77+
TYPE_UNSPECIFIED (0):
78+
Not specified.
79+
READ_WRITE (1):
80+
Read-write replicas support both reads and writes. These
81+
replicas:
82+
83+
- Maintain a full copy of your data.
84+
- Serve reads.
85+
- Can vote whether to commit a write.
86+
- Participate in leadership election.
87+
- Are eligible to become a leader.
88+
READ_ONLY (2):
89+
Read-only replicas only support reads (not writes).
90+
Read-only replicas:
91+
92+
- Maintain a full copy of your data.
93+
- Serve reads.
94+
- Do not participate in voting to commit writes.
95+
- Are not eligible to become a leader.
96+
WITNESS (3):
97+
Witness replicas don't support reads but do participate in
98+
voting to commit writes. Witness replicas:
99+
100+
- Do not maintain a full copy of data.
101+
- Do not serve reads.
102+
- Vote whether to commit writes.
103+
- Participate in leader election but are not eligible to
104+
become leader.
75105
"""
76106
TYPE_UNSPECIFIED = 0
77107
READ_WRITE = 1
@@ -184,13 +214,32 @@ class InstanceConfig(proto.Message):
184214
"""
185215

186216
class Type(proto.Enum):
187-
r"""The type of this configuration."""
217+
r"""The type of this configuration.
218+
219+
Values:
220+
TYPE_UNSPECIFIED (0):
221+
Unspecified.
222+
GOOGLE_MANAGED (1):
223+
Google managed configuration.
224+
USER_MANAGED (2):
225+
User managed configuration.
226+
"""
188227
TYPE_UNSPECIFIED = 0
189228
GOOGLE_MANAGED = 1
190229
USER_MANAGED = 2
191230

192231
class State(proto.Enum):
193-
r"""Indicates the current state of the instance config."""
232+
r"""Indicates the current state of the instance config.
233+
234+
Values:
235+
STATE_UNSPECIFIED (0):
236+
Not specified.
237+
CREATING (1):
238+
The instance config is still being created.
239+
READY (2):
240+
The instance config is fully created and
241+
ready to be used to create instances.
242+
"""
194243
STATE_UNSPECIFIED = 0
195244
CREATING = 1
196245
READY = 2
@@ -335,7 +384,20 @@ class Instance(proto.Message):
335384
"""
336385

337386
class State(proto.Enum):
338-
r"""Indicates the current state of the instance."""
387+
r"""Indicates the current state of the instance.
388+
389+
Values:
390+
STATE_UNSPECIFIED (0):
391+
Not specified.
392+
CREATING (1):
393+
The instance is still being created.
394+
Resources may not be available yet, and
395+
operations such as database creation may not
396+
work.
397+
READY (2):
398+
The instance is fully created and ready to do
399+
work such as creating databases.
400+
"""
339401
STATE_UNSPECIFIED = 0
340402
CREATING = 1
341403
READY = 2

google/cloud/spanner_v1/services/spanner/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2115,7 +2115,7 @@ def sample_partition_read():
21152115
# Done; return the response.
21162116
return response
21172117

2118-
def __enter__(self):
2118+
def __enter__(self) -> "SpannerClient":
21192119
return self
21202120

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

google/cloud/spanner_v1/types/query_plan.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ class Kind(proto.Enum):
7676
r"""The kind of [PlanNode][google.spanner.v1.PlanNode]. Distinguishes
7777
between the two different kinds of nodes that can appear in a query
7878
plan.
79+
80+
Values:
81+
KIND_UNSPECIFIED (0):
82+
Not specified.
83+
RELATIONAL (1):
84+
Denotes a Relational operator node in the expression tree.
85+
Relational operators represent iterative processing of rows
86+
during query execution. For example, a ``TableScan``
87+
operation that reads rows from a table.
88+
SCALAR (2):
89+
Denotes a Scalar node in the expression tree.
90+
Scalar nodes represent non-iterable entities in
91+
the query plan. For example, constants or
92+
arithmetic operators appearing inside predicate
93+
expressions or references to column names.
7994
"""
8095
KIND_UNSPECIFIED = 0
8196
RELATIONAL = 1

google/cloud/spanner_v1/types/spanner.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,19 @@ class Priority(proto.Enum):
343343
priorities, Cloud Spanner does not guarantee to process the
344344
higher priority operations first. There may be other constraints
345345
to satisfy, such as order of operations.
346+
347+
Values:
348+
PRIORITY_UNSPECIFIED (0):
349+
``PRIORITY_UNSPECIFIED`` is equivalent to ``PRIORITY_HIGH``.
350+
PRIORITY_LOW (1):
351+
This specifies that the request is low
352+
priority.
353+
PRIORITY_MEDIUM (2):
354+
This specifies that the request is medium
355+
priority.
356+
PRIORITY_HIGH (3):
357+
This specifies that the request is high
358+
priority.
346359
"""
347360
PRIORITY_UNSPECIFIED = 0
348361
PRIORITY_LOW = 1
@@ -464,7 +477,20 @@ class ExecuteSqlRequest(proto.Message):
464477
"""
465478

466479
class QueryMode(proto.Enum):
467-
r"""Mode in which the statement must be processed."""
480+
r"""Mode in which the statement must be processed.
481+
482+
Values:
483+
NORMAL (0):
484+
The default mode. Only the statement results
485+
are returned.
486+
PLAN (1):
487+
This mode returns only the query plan,
488+
without any results or execution statistics
489+
information.
490+
PROFILE (2):
491+
This mode returns both the query plan and the
492+
execution statistics along with the results.
493+
"""
468494
NORMAL = 0
469495
PLAN = 1
470496
PROFILE = 2

google/cloud/spanner_v1/types/transaction.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,21 @@ class ReadWrite(proto.Message):
411411
class ReadLockMode(proto.Enum):
412412
r"""``ReadLockMode`` is used to set the read lock mode for read-write
413413
transactions.
414+
415+
Values:
416+
READ_LOCK_MODE_UNSPECIFIED (0):
417+
Default value.
418+
If the value is not specified, the pessimistic
419+
read lock is used.
420+
PESSIMISTIC (1):
421+
Pessimistic lock mode.
422+
Read locks are acquired immediately on read.
423+
OPTIMISTIC (2):
424+
Optimistic lock mode.
425+
Locks for reads within the transaction are not
426+
acquired on read. Instead the locks are acquired
427+
on a commit to validate that read/queried data
428+
has not changed since the transaction started.
414429
"""
415430
READ_LOCK_MODE_UNSPECIFIED = 0
416431
PESSIMISTIC = 1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy