diff --git a/gapic/generator/generator.py b/gapic/generator/generator.py index dff8e0ebed..0aec65cc57 100644 --- a/gapic/generator/generator.py +++ b/gapic/generator/generator.py @@ -294,9 +294,13 @@ def _render_template( ('transport' in template_name and not self._is_desired_transport(template_name, opts)) or - # TODO(yon-mg) - remove when rest async implementation resolved - # temporarily stop async client gen while rest async is unkown - ('async' in template_name and 'grpc' not in opts.transport) + # TODO: Remove the following conditions once support for async rest transport is GA: + # See related issue: https://github.com/googleapis/gapic-generator-python/issues/2121. + ('async_client' in template_name and ('grpc' not in opts.transport or + not api_schema.all_library_settings[api_schema.naming.proto_package].python_settings.experimental_features.rest_async_io_enabled)) + or + ('rest_asyncio' in template_name and + not api_schema.all_library_settings[api_schema.naming.proto_package].python_settings.experimental_features.rest_async_io_enabled) or ('rest_base' in template_name and 'rest' not in opts.transport) ): diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest_asyncio.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest_asyncio.py.j2 new file mode 100644 index 0000000000..d73591c472 --- /dev/null +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest_asyncio.py.j2 @@ -0,0 +1,5 @@ +{# TODO: Remove the following condition for async rest transport once support for it is GA: + # {% if rest_async_io_enabled %} + # See related issue: https://github.com/googleapis/gapic-generator-python/issues/2121. +#} +{% set rest_async_io_enabled = api.all_library_settings[api.naming.proto_package].python_settings.experimental_features.rest_async_io_enabled %}