Skip to content

Commit a42469e

Browse files
ohmayrparthea
andauthored
feat: add async rest transport support in gapics (#2164)
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 4b2e890 commit a42469e

82 files changed

Lines changed: 15410 additions & 10001 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/gapic-generator/.github/workflows/tests.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ jobs:
5555
strategy:
5656
# Run showcase tests on the lowest and highest supported runtimes
5757
matrix:
58+
# TODO(https://github.com/googleapis/gapic-generator-python/issues/2121) Remove `showcase_w_rest_async` target when async rest is GA.
5859
python: ["3.7", "3.12"]
59-
target: [showcase, showcase_alternative_templates]
60+
target: [showcase, showcase_alternative_templates, showcase_w_rest_async]
6061
runs-on: ubuntu-latest
6162
steps:
6263
- uses: actions/checkout@v4

packages/gapic-generator/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/_mixins.py.j2

Lines changed: 10 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@
3232

3333
# Wrap the RPC method; this adds retry and timeout information,
3434
# and friendly error handling.
35-
rpc = gapic_v1.method.wrap_method(
36-
self._transport.list_operations,
37-
default_timeout=None,
38-
client_info=DEFAULT_CLIENT_INFO,
39-
)
35+
rpc = self._transport._wrapped_methods[self._transport.list_operations]
4036

4137
# Certain fields should be provided within the metadata header;
4238
# add these here.
@@ -86,11 +82,7 @@
8682

8783
# Wrap the RPC method; this adds retry and timeout information,
8884
# and friendly error handling.
89-
rpc = gapic_v1.method.wrap_method(
90-
self._transport.get_operation,
91-
default_timeout=None,
92-
client_info=DEFAULT_CLIENT_INFO,
93-
)
85+
rpc = self._transport._wrapped_methods[self._transport.get_operation]
9486

9587
# Certain fields should be provided within the metadata header;
9688
# add these here.
@@ -143,11 +135,7 @@
143135

144136
# Wrap the RPC method; this adds retry and timeout information,
145137
# and friendly error handling.
146-
rpc = gapic_v1.method.wrap_method(
147-
self._transport.delete_operation,
148-
default_timeout=None,
149-
client_info=DEFAULT_CLIENT_INFO,
150-
)
138+
rpc = self._transport._wrapped_methods[self._transport.delete_operation]
151139

152140
# Certain fields should be provided within the metadata header;
153141
# add these here.
@@ -195,11 +183,7 @@
195183

196184
# Wrap the RPC method; this adds retry and timeout information,
197185
# and friendly error handling.
198-
rpc = gapic_v1.method.wrap_method(
199-
self._transport.cancel_operation,
200-
default_timeout=None,
201-
client_info=DEFAULT_CLIENT_INFO,
202-
)
186+
rpc = self._transport._wrapped_methods[self._transport.cancel_operation]
203187

204188
# Certain fields should be provided within the metadata header;
205189
# add these here.
@@ -250,11 +234,7 @@
250234

251235
# Wrap the RPC method; this adds retry and timeout information,
252236
# and friendly error handling.
253-
rpc = gapic_v1.method.wrap_method(
254-
self._transport.wait_operation,
255-
default_timeout=None,
256-
client_info=DEFAULT_CLIENT_INFO,
257-
)
237+
rpc = self._transport._wrapped_methods[self._transport.wait_operation]
258238

259239
metadata = tuple(metadata)
260240

@@ -369,11 +349,7 @@
369349

370350
# Wrap the RPC method; this adds retry and timeout information,
371351
# and friendly error handling.
372-
rpc = gapic_v1.method.wrap_method(
373-
self._transport.set_iam_policy,
374-
default_timeout=None,
375-
client_info=DEFAULT_CLIENT_INFO,
376-
)
352+
rpc = self._transport._wrapped_methods[self._transport.set_iam_policy]
377353

378354
# Certain fields should be provided within the metadata header;
379355
# add these here.
@@ -489,11 +465,7 @@
489465

490466
# Wrap the RPC method; this adds retry and timeout information,
491467
# and friendly error handling.
492-
rpc = gapic_v1.method.wrap_method(
493-
self._transport.get_iam_policy,
494-
default_timeout=None,
495-
client_info=DEFAULT_CLIENT_INFO,
496-
)
468+
rpc = self._transport._wrapped_methods[self._transport.get_iam_policy]
497469

498470
# Certain fields should be provided within the metadata header;
499471
# add these here.
@@ -547,11 +519,7 @@
547519

548520
# Wrap the RPC method; this adds retry and timeout information,
549521
# and friendly error handling.
550-
rpc = gapic_v1.method.wrap_method(
551-
self._transport.test_iam_permissions,
552-
default_timeout=None,
553-
client_info=DEFAULT_CLIENT_INFO,
554-
)
522+
rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions]
555523

556524
# Certain fields should be provided within the metadata header;
557525
# add these here.
@@ -604,11 +572,7 @@
604572

605573
# Wrap the RPC method; this adds retry and timeout information,
606574
# and friendly error handling.
607-
rpc = gapic_v1.method.wrap_method(
608-
self._transport.get_location,
609-
default_timeout=None,
610-
client_info=DEFAULT_CLIENT_INFO,
611-
)
575+
rpc = self._transport._wrapped_methods[self._transport.get_location]
612576

613577
# Certain fields should be provided within the metadata header;
614578
# add these here.
@@ -657,11 +621,7 @@
657621

658622
# Wrap the RPC method; this adds retry and timeout information,
659623
# and friendly error handling.
660-
rpc = gapic_v1.method.wrap_method(
661-
self._transport.list_locations,
662-
default_timeout=None,
663-
client_info=DEFAULT_CLIENT_INFO,
664-
)
624+
rpc = self._transport._wrapped_methods[self._transport.list_locations]
665625

666626
# Certain fields should be provided within the metadata header;
667627
# add these here.

0 commit comments

Comments
 (0)