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

Commit f04a02e

Browse files
fix: Add missing fields for TLS and Maintenance Window features (#147)
* fix: [Cloud Memorystore for Redis] Add missing fields for TLS and Maintenance Window features PiperOrigin-RevId: 421360191 Source-Link: googleapis/googleapis@3e958c3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/f6580f02343d8adb49c170f8e9160113bfbbd2b3 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjY1ODBmMDIzNDNkOGFkYjQ5YzE3MGY4ZTkxNjAxMTNiZmJiZDJiMyJ9 * 🦉 Updates from OwlBot 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 1551159 commit f04a02e

File tree

11 files changed

+1244
-6
lines changed

11 files changed

+1244
-6
lines changed

google/cloud/redis_v1beta1/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,24 @@
2323
from .types.cloud_redis import FailoverInstanceRequest
2424
from .types.cloud_redis import GcsDestination
2525
from .types.cloud_redis import GcsSource
26+
from .types.cloud_redis import GetInstanceAuthStringRequest
2627
from .types.cloud_redis import GetInstanceRequest
2728
from .types.cloud_redis import ImportInstanceRequest
2829
from .types.cloud_redis import InputConfig
2930
from .types.cloud_redis import Instance
31+
from .types.cloud_redis import InstanceAuthString
3032
from .types.cloud_redis import ListInstancesRequest
3133
from .types.cloud_redis import ListInstancesResponse
3234
from .types.cloud_redis import LocationMetadata
35+
from .types.cloud_redis import MaintenancePolicy
36+
from .types.cloud_redis import MaintenanceSchedule
3337
from .types.cloud_redis import NodeInfo
3438
from .types.cloud_redis import OutputConfig
39+
from .types.cloud_redis import RescheduleMaintenanceRequest
40+
from .types.cloud_redis import TlsCertificate
3541
from .types.cloud_redis import UpdateInstanceRequest
3642
from .types.cloud_redis import UpgradeInstanceRequest
43+
from .types.cloud_redis import WeeklyMaintenanceWindow
3744
from .types.cloud_redis import ZoneMetadata
3845

3946
__all__ = (
@@ -45,16 +52,23 @@
4552
"FailoverInstanceRequest",
4653
"GcsDestination",
4754
"GcsSource",
55+
"GetInstanceAuthStringRequest",
4856
"GetInstanceRequest",
4957
"ImportInstanceRequest",
5058
"InputConfig",
5159
"Instance",
60+
"InstanceAuthString",
5261
"ListInstancesRequest",
5362
"ListInstancesResponse",
5463
"LocationMetadata",
64+
"MaintenancePolicy",
65+
"MaintenanceSchedule",
5566
"NodeInfo",
5667
"OutputConfig",
68+
"RescheduleMaintenanceRequest",
69+
"TlsCertificate",
5770
"UpdateInstanceRequest",
5871
"UpgradeInstanceRequest",
72+
"WeeklyMaintenanceWindow",
5973
"ZoneMetadata",
6074
)

google/cloud/redis_v1beta1/gapic_metadata.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
"get_instance"
3636
]
3737
},
38+
"GetInstanceAuthString": {
39+
"methods": [
40+
"get_instance_auth_string"
41+
]
42+
},
3843
"ImportInstance": {
3944
"methods": [
4045
"import_instance"
@@ -45,6 +50,11 @@
4550
"list_instances"
4651
]
4752
},
53+
"RescheduleMaintenance": {
54+
"methods": [
55+
"reschedule_maintenance"
56+
]
57+
},
4858
"UpdateInstance": {
4959
"methods": [
5060
"update_instance"
@@ -85,6 +95,11 @@
8595
"get_instance"
8696
]
8797
},
98+
"GetInstanceAuthString": {
99+
"methods": [
100+
"get_instance_auth_string"
101+
]
102+
},
88103
"ImportInstance": {
89104
"methods": [
90105
"import_instance"
@@ -95,6 +110,11 @@
95110
"list_instances"
96111
]
97112
},
113+
"RescheduleMaintenance": {
114+
"methods": [
115+
"reschedule_maintenance"
116+
]
117+
},
98118
"UpdateInstance": {
99119
"methods": [
100120
"update_instance"

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

Lines changed: 179 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ async def list_instances(
229229
Returns:
230230
google.cloud.redis_v1beta1.services.cloud_redis.pagers.ListInstancesAsyncPager:
231231
Response for
232-
[ListInstances][google.cloud.redis.v1beta1.CloudRedis.ListInstances].
232+
[ListInstances][google.cloud.redis.v1beta1.CloudRedis.ListInstances].
233233
234234
Iterating over this object will yield results and
235235
resolve additional pages automatically.
@@ -348,6 +348,79 @@ async def get_instance(
348348
# Done; return the response.
349349
return response
350350

351+
async def get_instance_auth_string(
352+
self,
353+
request: Union[cloud_redis.GetInstanceAuthStringRequest, dict] = None,
354+
*,
355+
name: str = None,
356+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
357+
timeout: float = None,
358+
metadata: Sequence[Tuple[str, str]] = (),
359+
) -> cloud_redis.InstanceAuthString:
360+
r"""Gets the AUTH string for a Redis instance. If AUTH is
361+
not enabled for the instance the response will be empty.
362+
This information is not included in the details returned
363+
to GetInstance.
364+
365+
Args:
366+
request (Union[google.cloud.redis_v1beta1.types.GetInstanceAuthStringRequest, dict]):
367+
The request object. Request for
368+
[GetInstanceAuthString][google.cloud.redis.v1beta1.CloudRedis.GetInstanceAuthString].
369+
name (:class:`str`):
370+
Required. Redis instance resource name using the form:
371+
``projects/{project_id}/locations/{location_id}/instances/{instance_id}``
372+
where ``location_id`` refers to a GCP region.
373+
374+
This corresponds to the ``name`` field
375+
on the ``request`` instance; if ``request`` is provided, this
376+
should not be set.
377+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
378+
should be retried.
379+
timeout (float): The timeout for this request.
380+
metadata (Sequence[Tuple[str, str]]): Strings which should be
381+
sent along with the request as metadata.
382+
383+
Returns:
384+
google.cloud.redis_v1beta1.types.InstanceAuthString:
385+
Instance AUTH string details.
386+
"""
387+
# Create or coerce a protobuf request object.
388+
# Sanity check: If we got a request object, we should *not* have
389+
# gotten any keyword arguments that map to the request.
390+
has_flattened_params = any([name])
391+
if request is not None and has_flattened_params:
392+
raise ValueError(
393+
"If the `request` argument is set, then none of "
394+
"the individual field arguments should be set."
395+
)
396+
397+
request = cloud_redis.GetInstanceAuthStringRequest(request)
398+
399+
# If we have keyword arguments corresponding to fields on the
400+
# request, apply these.
401+
if name is not None:
402+
request.name = name
403+
404+
# Wrap the RPC method; this adds retry and timeout information,
405+
# and friendly error handling.
406+
rpc = gapic_v1.method_async.wrap_method(
407+
self._client._transport.get_instance_auth_string,
408+
default_timeout=600.0,
409+
client_info=DEFAULT_CLIENT_INFO,
410+
)
411+
412+
# Certain fields should be provided within the metadata header;
413+
# add these here.
414+
metadata = tuple(metadata) + (
415+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
416+
)
417+
418+
# Send the request.
419+
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
420+
421+
# Done; return the response.
422+
return response
423+
351424
async def create_instance(
352425
self,
353426
request: Union[cloud_redis.CreateInstanceRequest, dict] = None,
@@ -1059,6 +1132,111 @@ async def delete_instance(
10591132
# Done; return the response.
10601133
return response
10611134

1135+
async def reschedule_maintenance(
1136+
self,
1137+
request: Union[cloud_redis.RescheduleMaintenanceRequest, dict] = None,
1138+
*,
1139+
name: str = None,
1140+
reschedule_type: cloud_redis.RescheduleMaintenanceRequest.RescheduleType = None,
1141+
schedule_time: timestamp_pb2.Timestamp = None,
1142+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1143+
timeout: float = None,
1144+
metadata: Sequence[Tuple[str, str]] = (),
1145+
) -> operation_async.AsyncOperation:
1146+
r"""Reschedule maintenance for a given instance in a
1147+
given project and location.
1148+
1149+
Args:
1150+
request (Union[google.cloud.redis_v1beta1.types.RescheduleMaintenanceRequest, dict]):
1151+
The request object. Request for
1152+
[RescheduleMaintenance][google.cloud.redis.v1beta1.CloudRedis.RescheduleMaintenance].
1153+
name (:class:`str`):
1154+
Required. Redis instance resource name using the form:
1155+
``projects/{project_id}/locations/{location_id}/instances/{instance_id}``
1156+
where ``location_id`` refers to a GCP region.
1157+
1158+
This corresponds to the ``name`` field
1159+
on the ``request`` instance; if ``request`` is provided, this
1160+
should not be set.
1161+
reschedule_type (:class:`google.cloud.redis_v1beta1.types.RescheduleMaintenanceRequest.RescheduleType`):
1162+
Required. If reschedule type is SPECIFIC_TIME, must set
1163+
up schedule_time as well.
1164+
1165+
This corresponds to the ``reschedule_type`` field
1166+
on the ``request`` instance; if ``request`` is provided, this
1167+
should not be set.
1168+
schedule_time (:class:`google.protobuf.timestamp_pb2.Timestamp`):
1169+
Optional. Timestamp when the maintenance shall be
1170+
rescheduled to if reschedule_type=SPECIFIC_TIME, in RFC
1171+
3339 format, for example ``2012-11-15T16:19:00.094Z``.
1172+
1173+
This corresponds to the ``schedule_time`` field
1174+
on the ``request`` instance; if ``request`` is provided, this
1175+
should not be set.
1176+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1177+
should be retried.
1178+
timeout (float): The timeout for this request.
1179+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1180+
sent along with the request as metadata.
1181+
1182+
Returns:
1183+
google.api_core.operation_async.AsyncOperation:
1184+
An object representing a long-running operation.
1185+
1186+
The result type for the operation will be
1187+
:class:`google.cloud.redis_v1beta1.types.Instance` A
1188+
Google Cloud Redis instance.
1189+
1190+
"""
1191+
# Create or coerce a protobuf request object.
1192+
# Sanity check: If we got a request object, we should *not* have
1193+
# gotten any keyword arguments that map to the request.
1194+
has_flattened_params = any([name, reschedule_type, schedule_time])
1195+
if request is not None and has_flattened_params:
1196+
raise ValueError(
1197+
"If the `request` argument is set, then none of "
1198+
"the individual field arguments should be set."
1199+
)
1200+
1201+
request = cloud_redis.RescheduleMaintenanceRequest(request)
1202+
1203+
# If we have keyword arguments corresponding to fields on the
1204+
# request, apply these.
1205+
if name is not None:
1206+
request.name = name
1207+
if reschedule_type is not None:
1208+
request.reschedule_type = reschedule_type
1209+
if schedule_time is not None:
1210+
request.schedule_time = schedule_time
1211+
1212+
# Wrap the RPC method; this adds retry and timeout information,
1213+
# and friendly error handling.
1214+
rpc = gapic_v1.method_async.wrap_method(
1215+
self._client._transport.reschedule_maintenance,
1216+
default_timeout=None,
1217+
client_info=DEFAULT_CLIENT_INFO,
1218+
)
1219+
1220+
# Certain fields should be provided within the metadata header;
1221+
# add these here.
1222+
metadata = tuple(metadata) + (
1223+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
1224+
)
1225+
1226+
# Send the request.
1227+
response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,)
1228+
1229+
# Wrap the response in an operation future.
1230+
response = operation_async.from_gapic(
1231+
response,
1232+
self._client._transport.operations_client,
1233+
cloud_redis.Instance,
1234+
metadata_type=any_pb2.Any,
1235+
)
1236+
1237+
# Done; return the response.
1238+
return response
1239+
10621240
async def __aenter__(self):
10631241
return self
10641242

0 commit comments

Comments
 (0)