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

fix: update default retry configs #51

Merged
merged 5 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 70 additions & 70 deletions google/cloud/asset_v1/gapic/asset_service_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,76 +205,6 @@ def __init__(
self._inner_api_calls = {}

# Service calls
def delete_feed(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes an asset feed.

Example:
>>> from google.cloud import asset_v1
>>>
>>> client = asset_v1.AssetServiceClient()
>>>
>>> # TODO: Initialize `name`:
>>> name = ''
>>>
>>> client.delete_feed(name)

Args:
name (str): Required. The name of the feed and it must be in the format of:
projects/project_number/feeds/feed_id
folders/folder_number/feeds/feed_id
organizations/organization_number/feeds/feed_id
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.

Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "delete_feed" not in self._inner_api_calls:
self._inner_api_calls[
"delete_feed"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.delete_feed,
default_retry=self._method_configs["DeleteFeed"].retry,
default_timeout=self._method_configs["DeleteFeed"].timeout,
client_info=self._client_info,
)

request = asset_service_pb2.DeleteFeedRequest(name=name,)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("name", name)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)

self._inner_api_calls["delete_feed"](
request, retry=retry, timeout=timeout, metadata=metadata
)

def export_assets(
self,
parent,
Expand Down Expand Up @@ -837,6 +767,76 @@ def update_feed(
request, retry=retry, timeout=timeout, metadata=metadata
)

def delete_feed(
self,
name,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Deletes an asset feed.

Example:
>>> from google.cloud import asset_v1
>>>
>>> client = asset_v1.AssetServiceClient()
>>>
>>> # TODO: Initialize `name`:
>>> name = ''
>>>
>>> client.delete_feed(name)

Args:
name (str): Required. The name of the feed and it must be in the format of:
projects/project_number/feeds/feed_id
folders/folder_number/feeds/feed_id
organizations/organization_number/feeds/feed_id
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.

Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "delete_feed" not in self._inner_api_calls:
self._inner_api_calls[
"delete_feed"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.delete_feed,
default_retry=self._method_configs["DeleteFeed"].retry,
default_timeout=self._method_configs["DeleteFeed"].timeout,
client_info=self._client_info,
)

request = asset_service_pb2.DeleteFeedRequest(name=name,)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("name", name)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)

self._inner_api_calls["delete_feed"](
request, retry=retry, timeout=timeout, metadata=metadata
)

def search_all_resources(
self,
scope,
Expand Down
89 changes: 59 additions & 30 deletions google/cloud/asset_v1/gapic/asset_service_client_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,94 @@
"interfaces": {
"google.cloud.asset.v1.AssetService": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": [],
"retry_policy_1_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"no_retry_codes": [],
"retry_policy_2_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"no_retry_1_codes": [],
},
"retry_params": {
"default": {
"retry_policy_1_params": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 20000,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 20000,
"total_timeout_millis": 600000,
}
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 60000,
},
"retry_policy_2_params": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 15000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 15000,
"total_timeout_millis": 15000,
},
"no_retry_params": {
"initial_retry_delay_millis": 0,
"retry_delay_multiplier": 0.0,
"max_retry_delay_millis": 0,
"initial_rpc_timeout_millis": 0,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 0,
"total_timeout_millis": 0,
},
"no_retry_1_params": {
"initial_retry_delay_millis": 0,
"retry_delay_multiplier": 0.0,
"max_retry_delay_millis": 0,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 60000,
},
},
"methods": {
"DeleteFeed": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
},
"ExportAssets": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params",
},
"BatchGetAssetsHistory": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params",
},
"CreateFeed": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params",
},
"GetFeed": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params",
},
"ListFeeds": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params",
},
"UpdateFeed": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params",
},
"SearchAllResources": {
"DeleteFeed": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params",
},
"SearchAllResources": {
"timeout_millis": 15000,
"retry_codes_name": "retry_policy_2_codes",
"retry_params_name": "retry_policy_2_params",
},
"SearchAllIamPolicies": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
"timeout_millis": 15000,
"retry_codes_name": "retry_policy_2_codes",
"retry_params_name": "retry_policy_2_params",
},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,6 @@ def channel(self):
"""
return self._channel

@property
def delete_feed(self):
"""Return the gRPC stub for :meth:`AssetServiceClient.delete_feed`.

Deletes an asset feed.

Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs["asset_service_stub"].DeleteFeed

@property
def export_assets(self):
"""Return the gRPC stub for :meth:`AssetServiceClient.export_assets`.
Expand Down Expand Up @@ -221,6 +208,19 @@ def update_feed(self):
"""
return self._stubs["asset_service_stub"].UpdateFeed

@property
def delete_feed(self):
"""Return the gRPC stub for :meth:`AssetServiceClient.delete_feed`.

Deletes an asset feed.

Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs["asset_service_stub"].DeleteFeed

@property
def search_all_resources(self):
"""Return the gRPC stub for :meth:`AssetServiceClient.search_all_resources`.
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/asset_v1/proto/asset_service_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading