From 365e620fdd4b466986cebc76892933683de56e74 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 14:38:31 -0500 Subject: [PATCH] fix: use retry_async instead of retry in async client (#247) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.12.0 PiperOrigin-RevId: 586356061 Source-Link: https://github.com/googleapis/googleapis/commit/72a1f55abaedbb62decd8ae8a44a4de223799c76 Source-Link: https://github.com/googleapis/googleapis-gen/commit/558a04bcd1cc0576e8fac1089e48e48b27ac161b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU4YTA0YmNkMWNjMDU3NmU4ZmFjMTA4OWU0OGU0OGIyN2FjMTYxYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert changes to setup.py * See https://github.com/googleapis/python-org-policy/issues/22 * remove pb2 file generated via bazel --------- Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../.github/.OwlBot.yaml | 4 +++ .../services/org_policy/async_client.py | 34 +++++++++---------- packages/google-cloud-org-policy/owlbot.py | 2 +- ...et_metadata_google.cloud.orgpolicy.v2.json | 2 +- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/packages/google-cloud-org-policy/.github/.OwlBot.yaml b/packages/google-cloud-org-policy/.github/.OwlBot.yaml index 648390116083..807197493a21 100644 --- a/packages/google-cloud-org-policy/.github/.OwlBot.yaml +++ b/packages/google-cloud-org-policy/.github/.OwlBot.yaml @@ -15,6 +15,10 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest +# See https://github.com/googleapis/python-org-policy/issues/22 +deep-preserve-regex: + - /owl-bot-staging/v1 + deep-remove-regex: - /owl-bot-staging diff --git a/packages/google-cloud-org-policy/google/cloud/orgpolicy_v2/services/org_policy/async_client.py b/packages/google-cloud-org-policy/google/cloud/orgpolicy_v2/services/org_policy/async_client.py index e495d1f2b355..1f28749e02d4 100644 --- a/packages/google-cloud-org-policy/google/cloud/orgpolicy_v2/services/org_policy/async_client.py +++ b/packages/google-cloud-org-policy/google/cloud/orgpolicy_v2/services/org_policy/async_client.py @@ -33,14 +33,14 @@ from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 -from google.api_core import retry as retries +from google.api_core import retry_async as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore try: - OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] + OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER - OptionalRetry = Union[retries.Retry, object] # type: ignore + OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore from google.cloud.orgpolicy_v2.services.org_policy import pagers from google.cloud.orgpolicy_v2.types import constraint @@ -288,7 +288,7 @@ async def sample_list_constraints(): This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be @@ -325,7 +325,7 @@ async def sample_list_constraints(): # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.list_constraints, - default_retry=retries.Retry( + default_retry=retries.AsyncRetry( initial=1.0, maximum=10.0, multiplier=1.3, @@ -422,7 +422,7 @@ async def sample_list_policies(): This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be @@ -460,7 +460,7 @@ async def sample_list_policies(): # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.list_policies, - default_retry=retries.Retry( + default_retry=retries.AsyncRetry( initial=1.0, maximum=10.0, multiplier=1.3, @@ -552,7 +552,7 @@ async def sample_get_policy(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be @@ -585,7 +585,7 @@ async def sample_get_policy(): # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.get_policy, - default_retry=retries.Retry( + default_retry=retries.AsyncRetry( initial=1.0, maximum=10.0, multiplier=1.3, @@ -670,7 +670,7 @@ async def sample_get_effective_policy(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be @@ -703,7 +703,7 @@ async def sample_get_effective_policy(): # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.get_effective_policy, - default_retry=retries.Retry( + default_retry=retries.AsyncRetry( initial=1.0, maximum=10.0, multiplier=1.3, @@ -800,7 +800,7 @@ async def sample_create_policy(): This corresponds to the ``policy`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be @@ -835,7 +835,7 @@ async def sample_create_policy(): # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.create_policy, - default_retry=retries.Retry( + default_retry=retries.AsyncRetry( initial=1.0, maximum=10.0, multiplier=1.3, @@ -921,7 +921,7 @@ async def sample_update_policy(): This corresponds to the ``policy`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be @@ -954,7 +954,7 @@ async def sample_update_policy(): # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.update_policy, - default_retry=retries.Retry( + default_retry=retries.AsyncRetry( initial=1.0, maximum=10.0, multiplier=1.3, @@ -1037,7 +1037,7 @@ async def sample_delete_policy(): This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. metadata (Sequence[Tuple[str, str]]): Strings which should be @@ -1064,7 +1064,7 @@ async def sample_delete_policy(): # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( self._client._transport.delete_policy, - default_retry=retries.Retry( + default_retry=retries.AsyncRetry( initial=1.0, maximum=10.0, multiplier=1.3, diff --git a/packages/google-cloud-org-policy/owlbot.py b/packages/google-cloud-org-policy/owlbot.py index 3df098419248..0a940148fff7 100644 --- a/packages/google-cloud-org-policy/owlbot.py +++ b/packages/google-cloud-org-policy/owlbot.py @@ -41,7 +41,7 @@ if clean_up_generated_samples: shutil.rmtree("samples/generated_samples", ignore_errors=True) clean_up_generated_samples = False - s.move([library], excludes=["**/gapic_version.py", "noxfile.py"]) + s.move([library], excludes=["**/gapic_version.py", "noxfile.py", "tests/__init__.py"]) s.remove_staging_dirs() # Clean up googleapis diff --git a/packages/google-cloud-org-policy/samples/generated_samples/snippet_metadata_google.cloud.orgpolicy.v2.json b/packages/google-cloud-org-policy/samples/generated_samples/snippet_metadata_google.cloud.orgpolicy.v2.json index 36ab0ad1a64e..89b8f4ede818 100644 --- a/packages/google-cloud-org-policy/samples/generated_samples/snippet_metadata_google.cloud.orgpolicy.v2.json +++ b/packages/google-cloud-org-policy/samples/generated_samples/snippet_metadata_google.cloud.orgpolicy.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-org-policy", - "version": "1.8.3" + "version": "0.1.0" }, "snippets": [ {