Skip to content
This repository was archived by the owner on Mar 15, 2025. It is now read-only.

Commit 78d90a3

Browse files
fix: use retry_async instead of retry in async client (#247)
* chore: Update gapic-generator-python to v1.12.0 PiperOrigin-RevId: 586356061 Source-Link: googleapis/googleapis@72a1f55 Source-Link: googleapis/googleapis-gen@558a04b 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 #22 * remove pb2 file generated via bazel --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 967fe69 commit 78d90a3

File tree

4 files changed

+23
-19
lines changed

4 files changed

+23
-19
lines changed

.github/.OwlBot.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
docker:
1616
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
1717

18+
# See https://github.com/googleapis/python-org-policy/issues/22
19+
deep-preserve-regex:
20+
- /owl-bot-staging/v1
21+
1822
deep-remove-regex:
1923
- /owl-bot-staging
2024

google/cloud/orgpolicy_v2/services/org_policy/async_client.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@
3333
from google.api_core.client_options import ClientOptions
3434
from google.api_core import exceptions as core_exceptions
3535
from google.api_core import gapic_v1
36-
from google.api_core import retry as retries
36+
from google.api_core import retry_async as retries
3737
from google.auth import credentials as ga_credentials # type: ignore
3838
from google.oauth2 import service_account # type: ignore
3939

4040
try:
41-
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
41+
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
4242
except AttributeError: # pragma: NO COVER
43-
OptionalRetry = Union[retries.Retry, object] # type: ignore
43+
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore
4444

4545
from google.cloud.orgpolicy_v2.services.org_policy import pagers
4646
from google.cloud.orgpolicy_v2.types import constraint
@@ -288,7 +288,7 @@ async def sample_list_constraints():
288288
This corresponds to the ``parent`` field
289289
on the ``request`` instance; if ``request`` is provided, this
290290
should not be set.
291-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
291+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
292292
should be retried.
293293
timeout (float): The timeout for this request.
294294
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -325,7 +325,7 @@ async def sample_list_constraints():
325325
# and friendly error handling.
326326
rpc = gapic_v1.method_async.wrap_method(
327327
self._client._transport.list_constraints,
328-
default_retry=retries.Retry(
328+
default_retry=retries.AsyncRetry(
329329
initial=1.0,
330330
maximum=10.0,
331331
multiplier=1.3,
@@ -422,7 +422,7 @@ async def sample_list_policies():
422422
This corresponds to the ``parent`` field
423423
on the ``request`` instance; if ``request`` is provided, this
424424
should not be set.
425-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
425+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
426426
should be retried.
427427
timeout (float): The timeout for this request.
428428
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -460,7 +460,7 @@ async def sample_list_policies():
460460
# and friendly error handling.
461461
rpc = gapic_v1.method_async.wrap_method(
462462
self._client._transport.list_policies,
463-
default_retry=retries.Retry(
463+
default_retry=retries.AsyncRetry(
464464
initial=1.0,
465465
maximum=10.0,
466466
multiplier=1.3,
@@ -552,7 +552,7 @@ async def sample_get_policy():
552552
This corresponds to the ``name`` field
553553
on the ``request`` instance; if ``request`` is provided, this
554554
should not be set.
555-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
555+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
556556
should be retried.
557557
timeout (float): The timeout for this request.
558558
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -585,7 +585,7 @@ async def sample_get_policy():
585585
# and friendly error handling.
586586
rpc = gapic_v1.method_async.wrap_method(
587587
self._client._transport.get_policy,
588-
default_retry=retries.Retry(
588+
default_retry=retries.AsyncRetry(
589589
initial=1.0,
590590
maximum=10.0,
591591
multiplier=1.3,
@@ -670,7 +670,7 @@ async def sample_get_effective_policy():
670670
This corresponds to the ``name`` field
671671
on the ``request`` instance; if ``request`` is provided, this
672672
should not be set.
673-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
673+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
674674
should be retried.
675675
timeout (float): The timeout for this request.
676676
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -703,7 +703,7 @@ async def sample_get_effective_policy():
703703
# and friendly error handling.
704704
rpc = gapic_v1.method_async.wrap_method(
705705
self._client._transport.get_effective_policy,
706-
default_retry=retries.Retry(
706+
default_retry=retries.AsyncRetry(
707707
initial=1.0,
708708
maximum=10.0,
709709
multiplier=1.3,
@@ -800,7 +800,7 @@ async def sample_create_policy():
800800
This corresponds to the ``policy`` field
801801
on the ``request`` instance; if ``request`` is provided, this
802802
should not be set.
803-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
803+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
804804
should be retried.
805805
timeout (float): The timeout for this request.
806806
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -835,7 +835,7 @@ async def sample_create_policy():
835835
# and friendly error handling.
836836
rpc = gapic_v1.method_async.wrap_method(
837837
self._client._transport.create_policy,
838-
default_retry=retries.Retry(
838+
default_retry=retries.AsyncRetry(
839839
initial=1.0,
840840
maximum=10.0,
841841
multiplier=1.3,
@@ -921,7 +921,7 @@ async def sample_update_policy():
921921
This corresponds to the ``policy`` field
922922
on the ``request`` instance; if ``request`` is provided, this
923923
should not be set.
924-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
924+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
925925
should be retried.
926926
timeout (float): The timeout for this request.
927927
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -954,7 +954,7 @@ async def sample_update_policy():
954954
# and friendly error handling.
955955
rpc = gapic_v1.method_async.wrap_method(
956956
self._client._transport.update_policy,
957-
default_retry=retries.Retry(
957+
default_retry=retries.AsyncRetry(
958958
initial=1.0,
959959
maximum=10.0,
960960
multiplier=1.3,
@@ -1037,7 +1037,7 @@ async def sample_delete_policy():
10371037
This corresponds to the ``name`` field
10381038
on the ``request`` instance; if ``request`` is provided, this
10391039
should not be set.
1040-
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1040+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
10411041
should be retried.
10421042
timeout (float): The timeout for this request.
10431043
metadata (Sequence[Tuple[str, str]]): Strings which should be
@@ -1064,7 +1064,7 @@ async def sample_delete_policy():
10641064
# and friendly error handling.
10651065
rpc = gapic_v1.method_async.wrap_method(
10661066
self._client._transport.delete_policy,
1067-
default_retry=retries.Retry(
1067+
default_retry=retries.AsyncRetry(
10681068
initial=1.0,
10691069
maximum=10.0,
10701070
multiplier=1.3,

owlbot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
if clean_up_generated_samples:
4242
shutil.rmtree("samples/generated_samples", ignore_errors=True)
4343
clean_up_generated_samples = False
44-
s.move([library], excludes=["**/gapic_version.py", "noxfile.py"])
44+
s.move([library], excludes=["**/gapic_version.py", "noxfile.py", "tests/__init__.py"])
4545
s.remove_staging_dirs()
4646

4747
# Clean up googleapis

samples/generated_samples/snippet_metadata_google.cloud.orgpolicy.v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-org-policy",
11-
"version": "1.8.3"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)