Skip to content

Commit

Permalink
fix: update default retry configs (#51)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
yoshi-automation authored Jun 25, 2020
1 parent 775f162 commit b337e07
Show file tree
Hide file tree
Showing 26 changed files with 860 additions and 251 deletions.
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
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

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

Loading

0 comments on commit b337e07

Please sign in to comment.