8000 fix: correct protobuf type for diagnose_cluster, update retry configs… · googleapis/google-cloud-python@ac662e2 · GitHub
[go: up one dir, main page]

Skip to content

Commit ac662e2

Browse files
fix: correct protobuf type for diagnose_cluster, update retry configs (#55)
1 parent 24c4825 commit ac662e2

File tree

43 files changed

+2027
-1572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2027
-1572
lines changed

packages/google-cloud-dataproc/google/cloud/dataproc_v1/gapic/autoscaling_policy_service_client.py

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -218,31 +218,41 @@ def __init__(
218218
self._inner_api_calls = {}
219219

220220
# Service calls
221-
def update_autoscaling_policy(
221+
def create_autoscaling_policy(
222222
self,
223+
parent,
223224
policy,
224225
retry=google.api_core.gapic_v1.method.DEFAULT,
225226
timeout=google.api_core.gapic_v1.method.DEFAULT,
226227
metadata=None,
227228
):
228229
"""
229-
Updates (replaces) autoscaling policy.
230-
231-
Disabled check for update_mask, because all updates will be full
232-
replacements.
230+
Creates new autoscaling policy.
233231
234232
Example:
235233
>>> from google.cloud import dataproc_v1
236234
>>>
237235
>>> client = dataproc_v1.AutoscalingPolicyServiceClient()
238236
>>>
237+
>>> parent = client.region_path('[PROJECT]', '[REGION]')
238+
>>>
239239
>>> # TODO: Initialize `policy`:
240240
>>> policy = {}
241241
>>>
242-
>>> response = client.update_autoscaling_policy(policy)
242+
>>> response = client.create_autoscaling_policy(parent, policy)
243243
244244
Args:
245-
policy (Union[dict, ~google.cloud.dataproc_v1.types.AutoscalingPolicy]): Required. The updated autoscaling policy.
245+
parent (str): Required. The "resource name" of the region or location, as
246+
described in https://cloud.google.com/apis/design/resource_names.
247+
248+
- For ``projects.regions.autoscalingPolicies.create``, the resource
249+
name of the region has the following format:
250+
``projects/{project_id}/regions/{region}``
251+
252+
- For ``projects.locations.autoscalingPolicies.create``, the resource
253+
name of the location has the following format:
254+
``projects/{project_id}/locations/{location}``
255+
policy (Union[dict, ~google.cloud.dataproc_v1.types.AutoscalingPolicy]): Required. The autoscaling policy to create.
246256
247257
If a dict is provided, it must be of the same form as the protobuf
248258
message :class:`~google.cloud.dataproc_v1.types.AutoscalingPolicy`
@@ -266,24 +276,24 @@ def update_autoscaling_policy(
266276
ValueError: If the parameters are invalid.
267277
"""
268278
# Wrap the transport method to add retry and timeout logic.
269-
if "update_autoscaling_policy" not in self._inner_api_calls:
279+
if "create_autoscaling_policy" not in self._inner_api_calls:
270280
self._inner_api_calls[
271-
"update_autoscaling_policy"
281+
"create_autoscaling_policy"
272282
] = google.api_core.gapic_v1.method.wrap_method(
273-
self.transport.update_autoscaling_policy,
274-
default_retry=self._method_configs["UpdateAutoscalingPolicy"].retry,
275-
default_timeout=self._method_configs["UpdateAutoscalingPolicy"].timeout,
283+
self.transport.create_autoscaling_policy,
284+
default_retry=self._method_configs["CreateAutoscalingPolicy"].retry,
285+
default_timeout=self._method_configs["CreateAutoscalingPolicy"].timeout,
276286
client_info=self._client_info,
277287
)
278288

279-
request = autoscaling_policies_pb2.UpdateAutoscalingPolicyRequest(
280-
policy=policy,
289+
request = autoscaling_policies_pb2.CreateAutoscalingPolicyRequest(
290+
parent=parent, policy=policy,
281291
)
282292
if metadata is None:
283293
metadata = []
284294
metadata = list(metadata)
285295
try:
286-
routing_header = [("policy.name", policy.name)]
296+
routing_header = [("parent", parent)]
287297
except AttributeError:
288298
pass
289299
else:
@@ -292,45 +302,35 @@ def update_autoscaling_policy(
292302
)
293303
metadata.append(routing_metadata)
294304

295-
return self._inner_api_calls["update_autoscaling_policy"](
305+
return self._inner_api_calls["create_autoscaling_policy"](
296306
request, retry=retry, timeout=timeout, metadata=metadata
297307
)
298308

299-
def create_autoscaling_policy(
309+
def update_autoscaling_policy(
300310
self,
301-
parent,
302311
policy,
303312
retry=google.api_core.gapic_v1.method.DEFAULT,
304313
timeout=google.api_core.gapic_v1.method.DEFAULT,
305314
metadata=None,
306315
):
307316
"""
308-
Creates new autoscaling policy.
317+
Updates (replaces) autoscaling policy.
318+
319+
Disabled check for update_mask, because all updates will be full
320+
replacements.
309321
310322
Example:
311323
>>> from google.cloud import dataproc_v1
312324
>>>
313325
>>> client = dataproc_v1.AutoscalingPolicyServiceClient()
314326
>>>
315-
>>> parent = client.region_path('[PROJECT]', '[REGION]')
316-
>>>
317327
>>> # TODO: Initialize `policy`:
318328
>>> policy = {}
319329
>>>
320-
>>> response = client.create_autoscaling_policy(parent, policy)
330+
>>> response = client.update_autoscaling_policy(policy)
321331
322332
Args:
323-
parent (str): Required. The "resource name" of the region or location, as
324-
described in https://cloud.google.com/apis/design/resource_names.
325-
326-
- For ``projects.regions.autoscalingPolicies.create``, the resource
327-
name of the region has the following format:
328-
``projects/{project_id}/regions/{region}``
329-
330-
- For ``projects.locations.autoscalingPolicies.create``, the resource
331-
name of the location has the following format:
332-
``projects/{project_id}/locations/{location}``
333-
policy (Union[dict, ~google.cloud.dataproc_v1.types.AutoscalingPolicy]): Required. The autoscaling policy to create.
333+
policy (Union[dict, ~google.cloud.dataproc_v1.types.AutoscalingPolicy]): Required. The updated autoscaling policy.
334334
335335
If a dict is provided, it must be of the same form as the protobuf
336336
message :class:`~google.cloud.dataproc_v1.types.AutoscalingPolicy`
@@ -354,24 +354,24 @@ def create_autoscaling_policy(
354354
ValueError: If the parameters are invalid.
355355
"""
356356
# Wrap the transport method to add retry and timeout logic.
357-
if "create_autoscaling_policy" not in self._inner_api_calls:
357+
if "update_autoscaling_policy" not in self._inner_api_calls:
358358
self._inner_api_calls[
359-
"create_autoscaling_policy"
359+
"update_autoscaling_policy"
360360
] = google.api_core.gapic_v1.method.wrap_method(
361-
self.transport.create_autoscaling_policy,
362-
default_retry=self._method_configs["CreateAutoscalingPolicy"].retry,
363-
default_timeout=self._method_configs["CreateAutoscalingPolicy"].timeout,
361+
self.transport.update_autoscaling_policy,
362+
default_retry=self._method_configs["UpdateAutoscalingPolicy"].retry,
363+
default_timeout=self._method_configs["UpdateAutoscalingPolicy"].timeout,
364364
client_info=self._client_info,
365365
)
366366

367-
request = autoscaling_policies_pb2.CreateAutoscalingPolicyRequest(
368-
parent=parent, policy=policy,
367+
request = autoscaling_policies_pb2.UpdateAutoscalingPolicyRequest(
368+
policy=policy,
369369
)
370370
if metadata is None:
371371
metadata = []
372372
metadata = list(metadata)
373373
try:
374-
routing_header = [("parent", parent)]
374+
routing_header = [("policy.name", policy.name)]
375375
except AttributeError:
376376
pass
377377
else:
@@ -380,7 +380,7 @@ def create_autoscaling_policy(
380380
)
381381
metadata.append(routing_metadata)
382382

383-
return self._inner_api_calls["create_autoscaling_policy"](
383+
return self._inner_api_calls["update_autoscaling_policy"](
384384
request, retry=retry, timeout=timeout, metadata=metadata
385385
)
386386

packages/google-cloud-dataproc/google/cloud/dataproc_v1/gapic/autoscaling_policy_service_client_config.py

Lines changed: 114 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,136 @@
22
"interfaces": {
33
"google.cloud.dataproc.v1.AutoscalingPolicyService": {
44
"retry_codes": {
5-
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
6-
"non_idempotent": [],
5+
"retry_policy_4_codes": [
6+
"DEADLINE_EXCEEDED",
7+
"INTERNAL",
8+
"UNAVAILABLE",
9+
],
10+
"retry_policy_1_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
11+
"retry_policy_6_codes": [
12+
"INTERNAL",
13+
"DEADLINE_EXCEEDED",
14+
"UNAVAILABLE",
15+
],
16+
"no_retry_codes": [],
17+
"retry_policy_3_codes": ["UNAVAILABLE"],
18+
"retry_policy_2_codes": [
19+
"DEADLINE_EXCEEDED",
20+
"INTERNAL",
21+
"UNAVAILABLE",
22+
],
23+
"no_retry_1_codes": [],
24+
"retry_policy_5_codes": ["UNAVAILABLE"],
25+
"retry_policy_7_codes": ["UNAVAILABLE"],
726
},
827
"retry_params": {
9-
"default": {
28+
"retry_policy_1_params": {
1029
"initial_retry_delay_millis": 100,
1130
"retry_delay_multiplier": 1.3,
1231
"max_retry_delay_millis": 60000,
13-
"initial_rpc_timeout_millis": 20000,
32+
"initial_rpc_timeout_millis": 600000,
1433
"rpc_timeout_multiplier": 1.0,
15-
"max_rpc_timeout_millis": 20000,
34+
"max_rpc_timeout_millis": 600000,
1635
"total_timeout_millis": 600000,
17-
}
36+
},
37+
"retry_policy_3_params": {
38+
"initial_retry_delay_millis": 100,
39+
"retry_delay_multiplier": 1.3,
40+
"max_retry_delay_millis": 60000,
41+
"initial_rpc_timeout_millis": 600000,
42+
"rpc_timeout_multiplier": 1.0,
43+
"max_rpc_timeout_millis": 600000,
44+
"total_timeout_millis": 600000,
45+
},
46+
"retry_policy_2_params": {
47+
"initial_retry_delay_millis": 100,
48+
"retry_delay_multiplier": 1.3,
49+
"max_retry_delay_millis": 60000,
50+
"initial_rpc_timeout_millis": 900000,
51+
"rpc_timeout_multiplier": 1.0,
52+
"max_rpc_timeout_millis": 900000,
53+
"total_timeout_millis": 900000,
54+
},
55+
"retry_policy_6_params": {
56+
"initial_retry_delay_millis": 100,
57+
"retry_delay_multiplier": 1.3,
58+
"max_retry_delay_millis": 60000,
59+
"initial_rpc_timeout_millis": 300000,
60+
"rpc_timeout_multiplier": 1.0,
61+
"max_rpc_timeout_millis": 300000,
62+
"total_timeout_millis": 300000,
63+
},
64+
"retry_policy_7_params": {
65+
"initial_retry_delay_millis": 100,
66+
"retry_delay_multiplier": 1.3,
67+
"max_retry_delay_millis": 60000,
68+
"initial_rpc_timeout_millis": 900000,
69+
"rpc_timeout_multiplier": 1.0,
70+
"max_rpc_timeout_millis": 900000,
71+
"total_timeout_millis": 900000,
72+
},
73+
"retry_policy_5_params": {
74+
"initial_retry_delay_millis": 100,
75+
"retry_delay_multiplier": 1.3,
76+
"max_retry_delay_millis": 60000,
77+
"initial_rpc_timeout_millis": 300000,
78+
"rpc_timeout_multiplier": 1.0,
79+
"max_rpc_timeout_millis": 300000,
80+
"total_timeout_millis": 300000,
81+
},
82+
"retry_policy_4_params": {
83+
"initial_retry_delay_millis": 100,
84+
"retry_delay_multiplier": 1.3,
85+
"max_retry_delay_millis": 60000,
86+
"initial_rpc_timeout_millis": 600000,
87+
"rpc_timeout_multiplier": 1.0,
88+
"max_rpc_timeout_millis": 600000,
89+
"total_timeout_millis": 600000,
90+
},
91+
"no_retry_params": {
92+
"initial_retry_delay_millis": 0,
93+
"retry_delay_multiplier": 0.0,
94+
"max_retry_delay_millis": 0,
95+
"initial_rpc_timeout_millis": 0,
96+
"rpc_timeout_multiplier": 1.0,
97+
"max_rpc_timeout_millis": 0,
98+
"total_timeout_millis": 0,
99+
},
100+
"no_retry_1_params": {
101+
"initial_retry_delay_millis": 0,
102+
"retry_delay_multiplier": 0.0,
103+
"max_retry_delay_millis": 0,
104+
"initial_rpc_timeout_millis": 600000,
105+
"rpc_timeout_multiplier": 1.0,
106+
"max_rpc_timeout_millis": 600000,
107+
"total_timeout_millis": 600000,
108+
},
18109
},
19110
"methods": {
20-
"UpdateAutoscalingPolicy": {
21-
"timeout_millis": 60000,
22-
"retry_codes_name": "idempotent",
23-
"retry_params_name": "default",
24-
},
25111
"CreateAutoscalingPolicy": {
26-
"timeout_millis": 60000,
27-
"retry_codes_name": "non_idempotent",
28-
"retry_params_name": "default",
112+
"timeout_millis": 600000,
113+
"retry_codes_name": "no_retry_1_codes",
114+
"retry_params_name": "no_retry_1_params",
115+
},
116+
"UpdateAutoscalingPolicy": {
117+
"timeout_millis": 600000,
118+
"retry_codes_name": "retry_policy_1_codes",
119+
"retry_params_name": "retry_policy_1_params",
29120
},
30121
"GetAutoscalingPolicy": {
31-
"timeout_millis": 60000,
32-
"retry_codes_name": "idempotent",
33-
"retry_params_name": "default",
122+
"timeout_millis": 600000,
123+
"retry_codes_name": "retry_policy_1_codes",
124+
"retry_params_name": "retry_policy_1_params",
34125
},
35126
"ListAutoscalingPolicies": {
36-
"timeout_millis": 60000,
37-
"retry_codes_name": "idempotent",
38-
"retry_params_name": "default",
127+
"timeout_millis": 600000,
128+
"retry_codes_name": "retry_policy_1_codes",
129+
"retry_params_name": "retry_policy_1_params",
39130
},
40131
"DeleteAutoscalingPolicy": {
41-
"timeout_millis": 60000,
42-
"retry_codes_name": "non_idempotent",
43-
"retry_params_name": "default",
132+
"timeout_millis": 600000,
133+
"retry_codes_name": "no_retry_1_codes",
134+
"retry_params_name": "no_retry_1_params",
44135
},
45136
},
46137
}

0 commit comments

Comments
 (0)
0