Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 58f5d58

Browse files
fix: update default retry configs (#51)
* fix: migrate asset/v1 to grpc_service_config PiperOrigin-RevId: 317872667 Source-Author: Google APIs <noreply@google.com> Source-Date: Tue Jun 23 08:43:32 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: e8385a4863e19248b71dd1cbe0df5ff51c7a3c3e Source-Link: googleapis/googleapis@e8385a4 * chore: update grpc to v1.30.0 PiperOrigin-RevId: 317949519 Source-Author: Google APIs <noreply@google.com> Source-Date: Tue Jun 23 15:22:22 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: 7157f9552747421572cf1ab3aec1105c05ebd4f9 Source-Link: googleapis/googleapis@7157f95
1 parent e089e86 commit 58f5d58

26 files changed

+860
-251
lines changed

google/cloud/asset_v1/gapic/asset_service_client.py

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -205,76 +205,6 @@ def __init__(
205205
self._inner_api_calls = {}
206206

207207
# Service calls
208-
def delete_feed(
209-
self,
210-
name,
211-
retry=google.api_core.gapic_v1.method.DEFAULT,
212-
timeout=google.api_core.gapic_v1.method.DEFAULT,
213-
metadata=None,
214-
):
215-
"""
216-
Deletes an asset feed.
217-
218-
Example:
219-
>>> from google.cloud import asset_v1
220-
>>>
221-
>>> client = asset_v1.AssetServiceClient()
222-
>>>
223-
>>> # TODO: Initialize `name`:
224-
>>> name = ''
225-
>>>
226-
>>> client.delete_feed(name)
227-
228-
Args:
229-
name (str): Required. The name of the feed and it must be in the format of:
230-
projects/project_number/feeds/feed_id
231-
folders/folder_number/feeds/feed_id
232-
organizations/organization_number/feeds/feed_id
233-
retry (Optional[google.api_core.retry.Retry]): A retry object used
234-
to retry requests. If ``None`` is specified, requests will
235-
be retried using a default configuration.
236-
timeout (Optional[float]): The amount of time, in seconds, to wait
237-
for the request to complete. Note that if ``retry`` is
238-
specified, the timeout applies to each individual attempt.
239-
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
240-
that is provided to the method.
241-
242-
Raises:
243-
google.api_core.exceptions.GoogleAPICallError: If the request
244-
failed for any reason.
245-
google.api_core.exceptions.RetryError: If the request failed due
246-
to a retryable error and retry attempts failed.
247-
ValueError: If the parameters are invalid.
248-
"""
249-
# Wrap the transport method to add retry and timeout logic.
250-
if "delete_feed" not in self._inner_api_calls:
251-
self._inner_api_calls[
252-
"delete_feed"
253-
] = google.api_core.gapic_v1.method.wrap_method(
254-
self.transport.delete_feed,
255-
default_retry=self._method_configs["DeleteFeed"].retry,
256-
default_timeout=self._method_configs["DeleteFeed"].timeout,
257-
client_info=self._client_info,
258-
)
259-
260-
request = asset_service_pb2.DeleteFeedRequest(name=name,)
261-
if metadata is None:
262-
metadata = []
263-
metadata = list(metadata)
264-
try:
265-
routing_header = [("name", name)]
266-
except AttributeError:
267-
pass
268-
else:
269-
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
270-
routing_header
271-
)
272-
metadata.append(routing_metadata)
273-
274-
self._inner_api_calls["delete_feed"](
275-
request, retry=retry, timeout=timeout, metadata=metadata
276-
)
277-
278208
def export_assets(
279209
self,
280210
parent,
@@ -837,6 +767,76 @@ def update_feed(
837767
request, retry=retry, timeout=timeout, metadata=metadata
838768
)
839769

770+
def delete_feed(
771+
self,
772+
name,
773+
retry=google.api_core.gapic_v1.method.DEFAULT,
774+
timeout=google.api_core.gapic_v1.method.DEFAULT,
775+
metadata=None,
776+
):
777+
"""
778+
Deletes an asset feed.
779+
780+
Example:
781+
>>> from google.cloud import asset_v1
782+
>>>
783+
>>> client = asset_v1.AssetServiceClient()
784+
>>>
785+
>>> # TODO: Initialize `name`:
786+
>>> name = ''
787+
>>>
788+
>>> client.delete_feed(name)
789+
790+
Args:
791+
name (str): Required. The name of the feed and it must be in the format of:
792+
projects/project_number/feeds/feed_id
793+
folders/folder_number/feeds/feed_id
794+
organizations/organization_number/feeds/feed_id
795+
retry (Optional[google.api_core.retry.Retry]): A retry object used
796+
to retry requests. If ``None`` is specified, requests will
797+
be retried using a default configuration.
798+
timeout (Optional[float]): The amount of time, in seconds, to wait
799+
for the request to complete. Note that if ``retry`` is
800+
specified, the timeout applies to each individual attempt.
801+
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
802+
that is provided to the method.
803+
804+
Raises:
805+
google.api_core.exceptions.GoogleAPICallError: If the request
806+
failed for any reason.
807+
google.api_core.exceptions.RetryError: If the request failed due
808+
to a retryable error and retry attempts failed.
809+
ValueError: If the parameters are invalid.
810+
"""
811+
# Wrap the transport method to add retry and timeout logic.
812+
if "delete_feed" not in self._inner_api_calls:
813+
self._inner_api_calls[
814+
"delete_feed"
815+
] = google.api_core.gapic_v1.method.wrap_method(
816+
self.transport.delete_feed,
817+
default_retry=self._method_configs["DeleteFeed"].retry,
818+
default_timeout=self._method_configs["DeleteFeed"].timeout,
819+
client_info=self._client_info,
820+
)
821+
822+
request = asset_service_pb2.DeleteFeedRequest(name=name,)
823+
if metadata is None:
824+
metadata = []
825+
metadata = list(metadata)
826+
try:
827+
routing_header = [("name", name)]
828+
except AttributeError:
829+
pass
830+
else:
831+
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
832+
routing_header
833+
)
834+
metadata.append(routing_metadata)
835+
836+
self._inner_api_calls["delete_feed"](
837+
request, retry=retry, timeout=timeout, metadata=metadata
838+
)
839+
840840
def search_all_resources(
841841
self,
842842
scope,

google/cloud/asset_v1/gapic/asset_service_client_config.py

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,65 +2,94 @@
22
"interfaces": {
33
"google.cloud.asset.v1.AssetService": {
44
"retry_codes": {
5-
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
6-
"non_idempotent": [],
5+
"retry_policy_1_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
6+
"no_retry_codes": [],
7+
"retry_policy_2_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
8+
"no_retry_1_codes": [],
79
},
810
"retry_params": {
9-
"default": {
11+
"retry_policy_1_params": {
1012
"initial_retry_delay_millis": 100,
1113
"retry_delay_multiplier": 1.3,
1214
"max_retry_delay_millis": 60000,
13-
"initial_rpc_timeout_millis": 20000,
15+
"initial_rpc_timeout_millis": 60000,
1416
"rpc_timeout_multiplier": 1.0,
15-
"max_rpc_timeout_millis": 20000,
16-
"total_timeout_millis": 600000,
17-
}
17+
"max_rpc_timeout_millis": 60000,
18+
"total_timeout_millis": 60000,
19+
},
20+
"retry_policy_2_params": {
21+
"initial_retry_delay_millis": 100,
22+
"retry_delay_multiplier": 1.3,
23+
"max_retry_delay_millis": 60000,
24+
"initial_rpc_timeout_millis": 15000,
25+
"rpc_timeout_multiplier": 1.0,
26+
"max_rpc_timeout_millis": 15000,
27+
"total_timeout_millis": 15000,
28+
},
29+
"no_retry_params": {
30+
"initial_retry_delay_millis": 0,
31+
"retry_delay_multiplier": 0.0,
32+
"max_retry_delay_millis": 0,
33+
"initial_rpc_timeout_millis": 0,
34+
"rpc_timeout_multiplier": 1.0,
35+
"max_rpc_timeout_millis": 0,
36+
"total_timeout_millis": 0,
37+
},
38+
"no_retry_1_params": {
39+
"initial_retry_delay_millis": 0,
40+
"retry_delay_multiplier": 0.0,
41+
"max_retry_delay_millis": 0,
42+
"initial_rpc_timeout_millis": 60000,
43+
"rpc_timeout_multiplier": 1.0,
44+
"max_rpc_timeout_millis": 60000,
45+
"total_timeout_millis": 60000,
46+
},
1847
},
1948
"methods": {
20-
"DeleteFeed": {
21-
"timeout_millis": 60000,
22-
"retry_codes_name": "idempotent",
23-
"retry_params_name": "default",
24-
},
2549
"ExportAssets": {
2650
"timeout_millis": 60000,
27-
"retry_codes_name": "non_idempotent",
28-
"retry_params_name": "default",
51+
"retry_codes_name": "no_retry_1_codes",
52+
"retry_params_name": "no_retry_1_params",
2953
},
3054
"BatchGetAssetsHistory": {
3155
"timeout_millis": 60000,
32-
"retry_codes_name": "idempotent",
33-
"retry_params_name": "default",
56+
"retry_codes_name": "retry_policy_1_codes",
57+
"retry_params_name": "retry_policy_1_params",
3458
},
3559
"CreateFeed": {
3660
"timeout_millis": 60000,
37-
"retry_codes_name": "non_idempotent",
38-
"retry_params_name": "default",
61+
"retry_codes_name": "no_retry_1_codes",
62+
"retry_params_name": "no_retry_1_params",
3963
},
4064
"GetFeed": {
4165
"timeout_millis": 60000,
42-
"retry_codes_name": "idempotent",
43-
"retry_params_name": "default",
66+
"retry_codes_name": "retry_policy_1_codes",
67+
"retry_params_name": "retry_policy_1_params",
4468
},
4569
"ListFeeds": {
4670
"timeout_millis": 60000,
47-
"retry_codes_name": "idempotent",
48-
"retry_params_name": "default",
71+
"retry_codes_name": "retry_policy_1_codes",
72+
"retry_params_name": "retry_policy_1_params",
4973
},
5074
"UpdateFeed": {
5175
"timeout_millis": 60000,
52-
"retry_codes_name": "non_idempotent",
53-
"retry_params_name": "default",
76+
"retry_codes_name": "no_retry_1_codes",
77+
"retry_params_name": "no_retry_1_params",
5478
},
55-
"SearchAllResources": {
79+
"DeleteFeed": {
5680
"timeout_millis": 60000,
57-
"retry_codes_name": "idempotent",
58-
"retry_params_name": "default",
81+
"retry_codes_name": "retry_policy_1_codes",
82+
"retry_params_name": "retry_policy_1_params",
83+
},
84+
"SearchAllResources": {
85+
"timeout_millis": 15000,
86+
"retry_codes_name": "retry_policy_2_codes",
87+
"retry_params_name": "retry_policy_2_params",
5988
},
6089
"SearchAllIamPolicies": {
61-
"timeout_millis": 60000,
62-
"retry_codes_name": "idempotent",
63-
"retry_params_name": "default",
90+
"timeout_millis": 15000,
91+
"retry_codes_name": "retry_policy_2_codes",
92+
"retry_params_name": "retry_policy_2_params",
6493
},
6594
},
6695
}

google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,6 @@ def channel(self):
115115
"""
116116
return self._channel
117117

118-
@property
119-
def delete_feed(self):
120-
"""Return the gRPC stub for :meth:`AssetServiceClient.delete_feed`.
121-
122-
Deletes an asset feed.
123-
124-
Returns:
125-
Callable: A callable which accepts the appropriate
126-
deserialized request object and returns a
127-
deserialized response object.
128-
"""
129-
return self._stubs["asset_service_stub"].DeleteFeed
130-
131118
@property
132119
def export_assets(self):
133120
"""Return the gRPC stub for :meth:`AssetServiceClient.export_assets`.
@@ -221,6 +208,19 @@ def update_feed(self):
221208
"""
222209
return self._stubs["asset_service_stub"].UpdateFeed
223210

211+
@property
212+
def delete_feed(self):
213+
"""Return the gRPC stub for :meth:`AssetServiceClient.delete_feed`.
214+
215+
Deletes an asset feed.
216+
217+
Returns:
218+
Callable: A callable which accepts the appropriate
219+
deserialized request object and returns a
220+
deserialized response object.
221+
"""
222+
return self._stubs["asset_service_stub"].DeleteFeed
223+
224224
@property
225225
def search_all_resources(self):
226226
"""Return the gRPC stub for :meth:`AssetServiceClient.search_all_resources`.

google/cloud/asset_v1/proto/asset_service_pb2.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)