Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit 650c291

Browse files
docs: Add documentation for enums (#244)
* 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: https://github.com/googleapis/googleapis-gen/commit/0080f830dec37c3384157082bce279e37079ea58 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 7d26477 commit 650c291

File tree

6 files changed

+249
-18
lines changed

6 files changed

+249
-18
lines changed

google/cloud/redis_v1/services/cloud_redis/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,7 @@ def sample_reschedule_maintenance():
19161916
# Done; return the response.
19171917
return response
19181918

1919-
def __enter__(self):
1919+
def __enter__(self) -> "CloudRedisClient":
19201920
return self
19211921

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

google/cloud/redis_v1/types/cloud_redis.py

Lines changed: 110 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,36 @@ class Instance(proto.Message):
247247
"""
248248

249249
class State(proto.Enum):
250-
r"""Represents the different states of a Redis instance."""
250+
r"""Represents the different states of a Redis instance.
251+
252+
Values:
253+
STATE_UNSPECIFIED (0):
254+
Not set.
255+
CREATING (1):
256+
Redis instance is being created.
257+
READY (2):
258+
Redis instance has been created and is fully
259+
usable.
260+
UPDATING (3):
261+
Redis instance configuration is being
262+
updated. Certain kinds of updates may cause the
263+
instance to become unusable while the update is
264+
in progress.
265+
DELETING (4):
266+
Redis instance is being deleted.
267+
REPAIRING (5):
268+
Redis instance is being repaired and may be
269+
unusable.
270+
MAINTENANCE (6):
271+
Maintenance is being performed on this Redis
272+
instance.
273+
IMPORTING (8):
274+
Redis instance is importing data
275+
(availability may be affected).
276+
FAILING_OVER (9):
277+
Redis instance is failing over (availability
278+
may be affected).
279+
"""
251280
STATE_UNSPECIFIED = 0
252281
CREATING = 1
253282
READY = 2
@@ -259,25 +288,71 @@ class State(proto.Enum):
259288
FAILING_OVER = 9
260289

261290
class Tier(proto.Enum):
262-
r"""Available service tiers to choose from"""
291+
r"""Available service tiers to choose from
292+
293+
Values:
294+
TIER_UNSPECIFIED (0):
295+
Not set.
296+
BASIC (1):
297+
BASIC tier: standalone instance
298+
STANDARD_HA (3):
299+
STANDARD_HA tier: highly available primary/replica instances
300+
"""
263301
TIER_UNSPECIFIED = 0
264302
BASIC = 1
265303
STANDARD_HA = 3
266304

267305
class ConnectMode(proto.Enum):
268-
r"""Available connection modes."""
306+
r"""Available connection modes.
307+
308+
Values:
309+
CONNECT_MODE_UNSPECIFIED (0):
310+
Not set.
311+
DIRECT_PEERING (1):
312+
Connect via direct peering to the Memorystore
313+
for Redis hosted service.
314+
PRIVATE_SERVICE_ACCESS (2):
315+
Connect your Memorystore for Redis instance
316+
using Private Service Access. Private services
317+
access provides an IP address range for multiple
318+
Google Cloud services, including Memorystore.
319+
"""
269320
CONNECT_MODE_UNSPECIFIED = 0
270321
DIRECT_PEERING = 1
271322
PRIVATE_SERVICE_ACCESS = 2
272323

273324
class TransitEncryptionMode(proto.Enum):
274-
r"""Available TLS modes."""
325+
r"""Available TLS modes.
326+
327+
Values:
328+
TRANSIT_ENCRYPTION_MODE_UNSPECIFIED (0):
329+
Not set.
330+
SERVER_AUTHENTICATION (1):
331+
Client to Server traffic encryption enabled
332+
with server authentication.
333+
DISABLED (2):
334+
TLS is disabled for the instance.
335+
"""
275336
TRANSIT_ENCRYPTION_MODE_UNSPECIFIED = 0
276337
SERVER_AUTHENTICATION = 1
277338
DISABLED = 2
278339

279340
class ReadReplicasMode(proto.Enum):
280-
r"""Read replicas mode."""
341+
r"""Read replicas mode.
342+
343+
Values:
344+
READ_REPLICAS_MODE_UNSPECIFIED (0):
345+
If not set, Memorystore Redis backend will default to
346+
READ_REPLICAS_DISABLED.
347+
READ_REPLICAS_DISABLED (1):
348+
If disabled, read endpoint will not be
349+
provided and the instance cannot scale up or
350+
down the number of replicas.
351+
READ_REPLICAS_ENABLED (2):
352+
If enabled, read endpoint will be provided
353+
and the instance can scale up and down the
354+
number of replicas. Not valid for basic tier.
355+
"""
281356
READ_REPLICAS_MODE_UNSPECIFIED = 0
282357
READ_REPLICAS_DISABLED = 1
283358
READ_REPLICAS_ENABLED = 2
@@ -435,7 +510,22 @@ class RescheduleMaintenanceRequest(proto.Message):
435510
"""
436511

437512
class RescheduleType(proto.Enum):
438-
r"""Reschedule options."""
513+
r"""Reschedule options.
514+
515+
Values:
516+
RESCHEDULE_TYPE_UNSPECIFIED (0):
517+
Not set.
518+
IMMEDIATE (1):
519+
If the user wants to schedule the maintenance
520+
to happen now.
521+
NEXT_AVAILABLE_WINDOW (2):
522+
If the user wants to use the existing
523+
maintenance policy to find the next available
524+
window.
525+
SPECIFIC_TIME (3):
526+
If the user wants to reschedule the
527+
maintenance to a specific time.
528+
"""
439529
RESCHEDULE_TYPE_UNSPECIFIED = 0
440530
IMMEDIATE = 1
441531
NEXT_AVAILABLE_WINDOW = 2
@@ -956,6 +1046,20 @@ class FailoverInstanceRequest(proto.Message):
9561046
class DataProtectionMode(proto.Enum):
9571047
r"""Specifies different modes of operation in relation to the
9581048
data retention.
1049+
1050+
Values:
1051+
DATA_PROTECTION_MODE_UNSPECIFIED (0):
1052+
Defaults to LIMITED_DATA_LOSS if a data protection mode is
1053+
not specified.
1054+
LIMITED_DATA_LOSS (1):
1055+
Instance failover will be protected with data
1056+
loss control. More specifically, the failover
1057+
will only be performed if the current
1058+
replication offset diff between primary and
1059+
replica is under a certain threshold.
1060+
FORCE_DATA_LOSS (2):
1061+
Instance failover will be performed without
1062+
data loss control.
9591063
"""
9601064
DATA_PROTECTION_MODE_UNSPECIFIED = 0
9611065
LIMITED_DATA_LOSS = 1

google/cloud/redis_v1beta1/services/cloud_redis/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ def sample_reschedule_maintenance():
19171917
# Done; return the response.
19181918
return response
19191919

1920-
def __enter__(self):
1920+
def __enter__(self) -> "CloudRedisClient":
19211921
return self
19221922

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

google/cloud/redis_v1beta1/types/cloud_redis.py

Lines changed: 135 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,36 @@ class Instance(proto.Message):
250250
"""
251251

252252
class State(proto.Enum):
253-
r"""Represents the different states of a Redis instance."""
253+
r"""Represents the different states of a Redis instance.
254+
255+
Values:
256+
STATE_UNSPECIFIED (0):
257+
Not set.
258+
CREATING (1):
259+
Redis instance is being created.
260+
READY (2):
261+
Redis instance has been created and is fully
262+
usable.
263+
UPDATING (3):
264+
Redis instance configuration is being
265+
updated. Certain kinds of updates may cause the
266+
instance to become unusable while the update is
267+
in progress.
268+
DELETING (4):
269+
Redis instance is being deleted.
270+
REPAIRING (5):
271+
Redis instance is being repaired and may be
272+
unusable.
273+
MAINTENANCE (6):
274+
Maintenance is being performed on this Redis
275+
instance.
276+
IMPORTING (8):
277+
Redis instance is importing data
278+
(availability may be affected).
279+
FAILING_OVER (10):
280+
Redis instance is failing over (availability
281+
may be affected).
282+
"""
254283
STATE_UNSPECIFIED = 0
255284
CREATING = 1
256285
READY = 2
@@ -262,25 +291,71 @@ class State(proto.Enum):
262291
FAILING_OVER = 10
263292

264293
class Tier(proto.Enum):
265-
r"""Available service tiers to choose from"""
294+
r"""Available service tiers to choose from
295+
296+
Values:
297+
TIER_UNSPECIFIED (0):
298+
Not set.
299+
BASIC (1):
300+
BASIC tier: standalone instance
301+
STANDARD_HA (3):
302+
STANDARD_HA tier: highly available primary/replica instances
303+
"""
266304
TIER_UNSPECIFIED = 0
267305
BASIC = 1
268306
STANDARD_HA = 3
269307

270308
class ConnectMode(proto.Enum):
271-
r"""Available connection modes."""
309+
r"""Available connection modes.
310+
311+
Values:
312+
CONNECT_MODE_UNSPECIFIED (0):
313+
Not set.
314+
DIRECT_PEERING (1):
315+
Connect via direct peering to the Memorystore
316+
for Redis hosted service.
317+
PRIVATE_SERVICE_ACCESS (2):
318+
Connect your Memorystore for Redis instance
319+
using Private Service Access. Private services
320+
access provides an IP address range for multiple
321+
Google Cloud services, including Memorystore.
322+
"""
272323
CONNECT_MODE_UNSPECIFIED = 0
273324
DIRECT_PEERING = 1
274325
PRIVATE_SERVICE_ACCESS = 2
275326

276327
class TransitEncryptionMode(proto.Enum):
277-
r"""Available TLS modes."""
328+
r"""Available TLS modes.
329+
330+
Values:
331+
TRANSIT_ENCRYPTION_MODE_UNSPECIFIED (0):
332+
Not set.
333+
SERVER_AUTHENTICATION (1):
334+
Client to Server traffic encryption enabled
335+
with server authentication.
336+
DISABLED (2):
337+
TLS is disabled for the instance.
338+
"""
278339
TRANSIT_ENCRYPTION_MODE_UNSPECIFIED = 0
279340
SERVER_AUTHENTICATION = 1
280341
DISABLED = 2
281342

282343
class ReadReplicasMode(proto.Enum):
283-
r"""Read replicas mode."""
344+
r"""Read replicas mode.
345+
346+
Values:
347+
READ_REPLICAS_MODE_UNSPECIFIED (0):
348+
If not set, Memorystore Redis backend will default to
349+
READ_REPLICAS_DISABLED.
350+
READ_REPLICAS_DISABLED (1):
351+
If disabled, read endpoint will not be
352+
provided and the instance cannot scale up or
353+
down the number of replicas.
354+
READ_REPLICAS_ENABLED (2):
355+
If enabled, read endpoint will be provided
356+
and the instance can scale up and down the
357+
number of replicas. Not valid for basic tier.
358+
"""
284359
READ_REPLICAS_MODE_UNSPECIFIED = 0
285360
READ_REPLICAS_DISABLED = 1
286361
READ_REPLICAS_ENABLED = 2
@@ -451,13 +526,36 @@ class PersistenceConfig(proto.Message):
451526
"""
452527

453528
class PersistenceMode(proto.Enum):
454-
r"""Available Persistence modes."""
529+
r"""Available Persistence modes.
530+
531+
Values:
532+
PERSISTENCE_MODE_UNSPECIFIED (0):
533+
Not set.
534+
DISABLED (1):
535+
Persistence is disabled for the instance,
536+
and any existing snapshots are deleted.
537+
RDB (2):
538+
RDB based Persistence is enabled.
539+
"""
455540
PERSISTENCE_MODE_UNSPECIFIED = 0
456541
DISABLED = 1
457542
RDB = 2
458543

459544
class SnapshotPeriod(proto.Enum):
460-
r"""Available snapshot periods for scheduling."""
545+
r"""Available snapshot periods for scheduling.
546+
547+
Values:
548+
SNAPSHOT_PERIOD_UNSPECIFIED (0):
549+
Not set.
550+
ONE_HOUR (3):
551+
Snapshot every 1 hour.
552+
SIX_HOURS (4):
553+
Snapshot every 6 hours.
554+
TWELVE_HOURS (5):
555+
Snapshot every 12 hours.
556+
TWENTY_FOUR_HOURS (6):
557+
Snapshot every 24 hours.
558+
"""
461559
SNAPSHOT_PERIOD_UNSPECIFIED = 0
462560
ONE_HOUR = 3
463561
SIX_HOURS = 4
@@ -505,7 +603,22 @@ class RescheduleMaintenanceRequest(proto.Message):
505603
"""
506604

507605
class RescheduleType(proto.Enum):
508-
r"""Reschedule options."""
606+
r"""Reschedule options.
607+
608+
Values:
609+
RESCHEDULE_TYPE_UNSPECIFIED (0):
610+
Not set.
611+
IMMEDIATE (1):
612+
If the user wants to schedule the maintenance
613+
to happen now.
614+
NEXT_AVAILABLE_WINDOW (2):
615+
If the user wants to use the existing
616+
maintenance policy to find the next available
617+
window.
618+
SPECIFIC_TIME (3):
619+
If the user wants to reschedule the
620+
maintenance to a specific time.
621+
"""
509622
RESCHEDULE_TYPE_UNSPECIFIED = 0
510623
IMMEDIATE = 1
511624
NEXT_AVAILABLE_WINDOW = 2
@@ -1026,6 +1139,20 @@ class FailoverInstanceRequest(proto.Message):
10261139
class DataProtectionMode(proto.Enum):
10271140
r"""Specifies different modes of operation in relation to the
10281141
data retention.
1142+
1143+
Values:
1144+
DATA_PROTECTION_MODE_UNSPECIFIED (0):
1145+
Defaults to LIMITED_DATA_LOSS if a data protection mode is
1146+
not specified.
1147+
LIMITED_DATA_LOSS (1):
1148+
Instance failover will be protected with data
1149+
loss control. More specifically, the failover
1150+
will only be performed if the current
1151+
replication offset diff between primary and
1152+
replica is under a certain threshold.
1153+
FORCE_DATA_LOSS (2):
1154+
Instance failover will be performed without
1155+
data loss control.
10291156
"""
10301157
DATA_PROTECTION_MODE_UNSPECIFIED = 0
10311158
LIMITED_DATA_LOSS = 1

samples/generated_samples/snippet_metadata_google.cloud.redis.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-redis",
11-
"version": "2.11.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.cloud.redis.v1beta1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-redis",
11-
"version": "2.11.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)