From 74ef61229ad72843f4ed90c78847682e28c895f4 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 26 May 2020 11:30:23 -0400 Subject: [PATCH 1/4] fixed async docs and typing --- .../codegen/templates/lro_operation.py.jinja2 | 6 +- .../_lr_os_custom_header_operations_async.py | 24 +- .../_lro_retrys_operations_async.py | 42 +-- .../_lros_operations_async.py | 246 +++++++++--------- .../_lrosads_operations_async.py | 156 +++++------ .../_paging_operations_async.py | 6 +- .../_storage_accounts_operations_async.py | 6 +- ...ultiapi_service_client_operations_async.py | 6 +- ...ultiapi_service_client_operations_async.py | 6 +- 9 files changed, 249 insertions(+), 249 deletions(-) diff --git a/autorest/codegen/templates/lro_operation.py.jinja2 b/autorest/codegen/templates/lro_operation.py.jinja2 index 4b69dbee961..7727e4fa676 100644 --- a/autorest/codegen/templates/lro_operation.py.jinja2 +++ b/autorest/codegen/templates/lro_operation.py.jinja2 @@ -5,8 +5,8 @@ {% set poller = "AsyncLROPoller" if async_mode else "LROPoller" %} {% set operation_name = "begin_"+operation.python_name %} {% macro return_docstring() %} -:return: {{ "" if async_mode else "An instance of LROPoller that returns either " }}{{ operation.responses[0].schema.docstring_text if operation.responses[0].has_body else "None"}}{{ "," if async_mode }} or the result of cls(response) -:rtype: {{"" if async_mode else "~azure.core.polling.LROPoller["}}{{ operation.responses[0].schema.docstring_type if operation.responses[0].has_body else "None" }}{{ "" if async_mode else "]" }}{% endmacro %} +:return: An instance of {{ "Async" if async_mode }}LROPoller that returns either {{ operation.responses[0].schema.docstring_text if operation.responses[0].has_body else "None"}} or the result of cls(response) +:rtype: ~azure.core.polling.{{ "Async" if async_mode }}LROPoller[{{ operation.responses[0].schema.docstring_type if operation.responses[0].has_body else "None" }}]{% endmacro %} {% macro param_documentation_string(parameter) %}:param {{ parameter.serialized_name }}: {{ parameter.description }}{% endmacro %} {% macro response_headers(response) %} response_headers = { @@ -20,7 +20,7 @@ response_headers = { {% if code_model.options['tracing'] %} {{ trace_decorator }} {% endif %} -{% set return_type_wrapper = "" if async_mode else "LROPoller" %} +{% set return_type_wrapper = "AsyncLROPoller" if async_mode else "LROPoller" %} {{ op_tools.method_signature(operation, operation_name, async_mode=async_mode, coroutine=async_mode, return_type_wrapper=return_type_wrapper) }} {%- if not async_mode %} {# overriding sync_return_type_annotation because we know if it's sync, it's return type is just LROPoller #} diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lr_os_custom_header_operations_async.py b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lr_os_custom_header_operations_async.py index f733757f00e..36a2c87ed9a 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lr_os_custom_header_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lr_os_custom_header_operations_async.py @@ -97,7 +97,7 @@ async def begin_put_async_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure- @@ -111,8 +111,8 @@ async def begin_put_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -213,7 +213,7 @@ async def begin_put201_creating_succeeded200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -227,8 +227,8 @@ async def begin_put201_creating_succeeded200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -319,7 +319,7 @@ async def begin_post202_retry200( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -332,8 +332,8 @@ async def begin_post202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -422,7 +422,7 @@ async def begin_post_async_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure- @@ -436,8 +436,8 @@ async def begin_post_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lro_retrys_operations_async.py b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lro_retrys_operations_async.py index 880f701ff66..02f33682797 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lro_retrys_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lro_retrys_operations_async.py @@ -98,7 +98,7 @@ async def begin_put201_creating_succeeded200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -111,8 +111,8 @@ async def begin_put201_creating_succeeded200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -207,7 +207,7 @@ async def begin_put_async_relative_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure- AsyncOperation header for operation status. @@ -220,8 +220,8 @@ async def begin_put_async_relative_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -314,7 +314,7 @@ async def _delete_provisioning202_accepted200_succeeded_initial( async def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -325,8 +325,8 @@ async def begin_delete_provisioning202_accepted200_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -409,7 +409,7 @@ async def _delete202_retry200_initial( async def begin_delete202_retry200( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -419,8 +419,8 @@ async def begin_delete202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -497,7 +497,7 @@ async def _delete_async_relative_retry_succeeded_initial( async def begin_delete_async_relative_retry_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -507,8 +507,8 @@ async def begin_delete_async_relative_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -595,7 +595,7 @@ async def begin_post202_retry200( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -607,8 +607,8 @@ async def begin_post202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -697,7 +697,7 @@ async def begin_post_async_relative_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure- AsyncOperation header for operation status. @@ -710,8 +710,8 @@ async def begin_post_async_relative_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lros_operations_async.py b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lros_operations_async.py index 37ca98390ab..2186491c006 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lros_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lros_operations_async.py @@ -95,7 +95,7 @@ async def begin_put200_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -107,8 +107,8 @@ async def begin_put200_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -199,7 +199,7 @@ async def begin_put201_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -211,8 +211,8 @@ async def begin_put201_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -299,7 +299,7 @@ async def _post202_list_initial( async def begin_post202_list( self, **kwargs - ) -> List["models.Product"]: + ) -> AsyncLROPoller[List["models.Product"]]: """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -309,8 +309,8 @@ async def begin_post202_list( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: list of Product, or the result of cls(response) - :rtype: list[~lro.models.Product] + :return: An instance of AsyncLROPoller that returns either list of Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[list[~lro.models.Product]] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -400,7 +400,7 @@ async def begin_put200_succeeded_no_state( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -412,8 +412,8 @@ async def begin_put200_succeeded_no_state( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -504,7 +504,7 @@ async def begin_put202_retry200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. @@ -517,8 +517,8 @@ async def begin_put202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -614,7 +614,7 @@ async def begin_put201_creating_succeeded200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -627,8 +627,8 @@ async def begin_put201_creating_succeeded200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -719,7 +719,7 @@ async def begin_put200_updating_succeeded204( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -732,8 +732,8 @@ async def begin_put200_updating_succeeded204( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -829,7 +829,7 @@ async def begin_put201_creating_failed200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -842,8 +842,8 @@ async def begin_put201_creating_failed200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -934,7 +934,7 @@ async def begin_put200_acceptedcanceled200( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -947,8 +947,8 @@ async def begin_put200_acceptedcanceled200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1041,7 +1041,7 @@ async def begin_put_no_header_in_retry( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -1053,8 +1053,8 @@ async def begin_put_no_header_in_retry( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1152,7 +1152,7 @@ async def begin_put_async_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1165,8 +1165,8 @@ async def begin_put_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1265,7 +1265,7 @@ async def begin_put_async_no_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1278,8 +1278,8 @@ async def begin_put_async_no_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1378,7 +1378,7 @@ async def begin_put_async_retry_failed( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1391,8 +1391,8 @@ async def begin_put_async_retry_failed( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1491,7 +1491,7 @@ async def begin_put_async_no_retrycanceled( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1504,8 +1504,8 @@ async def begin_put_async_no_retrycanceled( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1602,7 +1602,7 @@ async def begin_put_async_no_header_in_retry( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 202 to the initial request with Azure- AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -1615,8 +1615,8 @@ async def begin_put_async_no_header_in_retry( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1710,7 +1710,7 @@ async def begin_put_non_resource( self, sku: Optional["models.Sku"] = None, **kwargs - ) -> "models.Sku": + ) -> AsyncLROPoller["models.Sku"]: """Long running put request with non resource. :param sku: sku to put. @@ -1721,8 +1721,8 @@ async def begin_put_non_resource( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Sku, or the result of cls(response) - :rtype: ~lro.models.Sku + :return: An instance of AsyncLROPoller that returns either Sku or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Sku] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1813,7 +1813,7 @@ async def begin_put_async_non_resource( self, sku: Optional["models.Sku"] = None, **kwargs - ) -> "models.Sku": + ) -> AsyncLROPoller["models.Sku"]: """Long running put request with non resource. :param sku: Sku to put. @@ -1824,8 +1824,8 @@ async def begin_put_async_non_resource( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Sku, or the result of cls(response) - :rtype: ~lro.models.Sku + :return: An instance of AsyncLROPoller that returns either Sku or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Sku] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1918,7 +1918,7 @@ async def begin_put_sub_resource( self, provisioning_state: Optional[str] = None, **kwargs - ) -> "models.SubProduct": + ) -> AsyncLROPoller["models.SubProduct"]: """Long running put request with sub resource. :param provisioning_state: @@ -1929,8 +1929,8 @@ async def begin_put_sub_resource( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: SubProduct, or the result of cls(response) - :rtype: ~lro.models.SubProduct + :return: An instance of AsyncLROPoller that returns either SubProduct or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.SubProduct] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2023,7 +2023,7 @@ async def begin_put_async_sub_resource( self, provisioning_state: Optional[str] = None, **kwargs - ) -> "models.SubProduct": + ) -> AsyncLROPoller["models.SubProduct"]: """Long running put request with sub resource. :param provisioning_state: @@ -2034,8 +2034,8 @@ async def begin_put_async_sub_resource( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: SubProduct, or the result of cls(response) - :rtype: ~lro.models.SubProduct + :return: An instance of AsyncLROPoller that returns either SubProduct or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.SubProduct] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2123,7 +2123,7 @@ async def _delete_provisioning202_accepted200_succeeded_initial( async def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2134,8 +2134,8 @@ async def begin_delete_provisioning202_accepted200_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2226,7 +2226,7 @@ async def _delete_provisioning202_deleting_failed200_initial( async def begin_delete_provisioning202_deleting_failed200( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -2237,8 +2237,8 @@ async def begin_delete_provisioning202_deleting_failed200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2329,7 +2329,7 @@ async def _delete_provisioning202_deletingcanceled200_initial( async def begin_delete_provisioning202_deletingcanceled200( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -2340,8 +2340,8 @@ async def begin_delete_provisioning202_deletingcanceled200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2420,7 +2420,7 @@ async def _delete204_succeeded_initial( async def begin_delete204_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete succeeds and returns right away. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2429,8 +2429,8 @@ async def begin_delete204_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2513,7 +2513,7 @@ async def _delete202_retry200_initial( async def begin_delete202_retry200( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2523,8 +2523,8 @@ async def begin_delete202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2610,7 +2610,7 @@ async def _delete202_no_retry204_initial( async def begin_delete202_no_retry204( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2620,8 +2620,8 @@ async def begin_delete202_no_retry204( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2700,7 +2700,7 @@ async def _delete_no_header_in_retry_initial( async def begin_delete_no_header_in_retry( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. @@ -2710,8 +2710,8 @@ async def begin_delete_no_header_in_retry( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2787,7 +2787,7 @@ async def _delete_async_no_header_in_retry_initial( async def begin_delete_async_no_header_in_retry( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -2797,8 +2797,8 @@ async def begin_delete_async_no_header_in_retry( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2875,7 +2875,7 @@ async def _delete_async_retry_succeeded_initial( async def begin_delete_async_retry_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2885,8 +2885,8 @@ async def begin_delete_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2963,7 +2963,7 @@ async def _delete_async_no_retry_succeeded_initial( async def begin_delete_async_no_retry_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2973,8 +2973,8 @@ async def begin_delete_async_no_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3051,7 +3051,7 @@ async def _delete_async_retry_failed_initial( async def begin_delete_async_retry_failed( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3061,8 +3061,8 @@ async def begin_delete_async_retry_failed( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3139,7 +3139,7 @@ async def _delete_async_retrycanceled_initial( async def begin_delete_async_retrycanceled( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3149,8 +3149,8 @@ async def begin_delete_async_retrycanceled( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3231,7 +3231,7 @@ async def _post200_with_payload_initial( async def begin_post200_with_payload( self, **kwargs - ) -> "models.Sku": + ) -> AsyncLROPoller["models.Sku"]: """Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. @@ -3241,8 +3241,8 @@ async def begin_post200_with_payload( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Sku, or the result of cls(response) - :rtype: ~lro.models.Sku + :return: An instance of AsyncLROPoller that returns either Sku or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Sku] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3332,7 +3332,7 @@ async def begin_post202_retry200( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -3344,8 +3344,8 @@ async def begin_post202_retry200( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3436,7 +3436,7 @@ async def begin_post202_no_retry204( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -3448,8 +3448,8 @@ async def begin_post202_no_retry204( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3533,7 +3533,7 @@ async def _post_double_headers_final_location_get_initial( async def begin_post_double_headers_final_location_get( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final object. @@ -3544,8 +3544,8 @@ async def begin_post_double_headers_final_location_get( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3624,7 +3624,7 @@ async def _post_double_headers_final_azure_header_get_initial( async def begin_post_double_headers_final_azure_header_get( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object. @@ -3635,8 +3635,8 @@ async def begin_post_double_headers_final_azure_header_get( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3715,7 +3715,7 @@ async def _post_double_headers_final_azure_header_get_default_initial( async def begin_post_double_headers_final_azure_header_get_default( self, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object if you support initial Autorest behavior. @@ -3726,8 +3726,8 @@ async def begin_post_double_headers_final_azure_header_get_default( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3825,7 +3825,7 @@ async def begin_post_async_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3838,8 +3838,8 @@ async def begin_post_async_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -3938,7 +3938,7 @@ async def begin_post_async_no_retry_succeeded( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3951,8 +3951,8 @@ async def begin_post_async_no_retry_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -4044,7 +4044,7 @@ async def begin_post_async_retry_failed( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -4057,8 +4057,8 @@ async def begin_post_async_retry_failed( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -4147,7 +4147,7 @@ async def begin_post_async_retrycanceled( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -4160,8 +4160,8 @@ async def begin_post_async_retrycanceled( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lrosads_operations_async.py b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lrosads_operations_async.py index 3533a151ed1..364e800e44b 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lrosads_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/aio/operations_async/_lrosads_operations_async.py @@ -98,7 +98,7 @@ async def begin_put_non_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 400 to the initial request. :param product: Product to put. @@ -109,8 +109,8 @@ async def begin_put_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -206,7 +206,7 @@ async def begin_put_non_retry201_creating400( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -218,8 +218,8 @@ async def begin_put_non_retry201_creating400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -315,7 +315,7 @@ async def begin_put_non_retry201_creating400_invalid_json( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -327,8 +327,8 @@ async def begin_put_non_retry201_creating400_invalid_json( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -423,7 +423,7 @@ async def begin_put_async_relative_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -435,8 +435,8 @@ async def begin_put_async_relative_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -521,7 +521,7 @@ async def _delete_non_retry400_initial( async def begin_delete_non_retry400( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 400 with an error body. :keyword callable cls: A custom type or function that will be passed the direct response @@ -530,8 +530,8 @@ async def begin_delete_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -607,7 +607,7 @@ async def _delete202_non_retry400_initial( async def begin_delete202_non_retry400( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 with a location header. :keyword callable cls: A custom type or function that will be passed the direct response @@ -616,8 +616,8 @@ async def begin_delete202_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -694,7 +694,7 @@ async def _delete_async_relative_retry400_initial( async def begin_delete_async_relative_retry400( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -704,8 +704,8 @@ async def begin_delete_async_relative_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -792,7 +792,7 @@ async def begin_post_non_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 400 with no error body. :param product: Product to put. @@ -803,8 +803,8 @@ async def begin_post_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -892,7 +892,7 @@ async def begin_post202_non_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 with a location header. :param product: Product to put. @@ -903,8 +903,8 @@ async def begin_post202_non_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -993,7 +993,7 @@ async def begin_post_async_relative_retry400( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1005,8 +1005,8 @@ async def begin_post_async_relative_retry400( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1099,7 +1099,7 @@ async def begin_put_error201_no_provisioning_state_payload( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 201 to the initial request with no payload. :param product: Product to put. @@ -1110,8 +1110,8 @@ async def begin_put_error201_no_provisioning_state_payload( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1206,7 +1206,7 @@ async def begin_put_async_relative_retry_no_status( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1219,8 +1219,8 @@ async def begin_put_async_relative_retry_no_status( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1320,7 +1320,7 @@ async def begin_put_async_relative_retry_no_status_payload( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1333,8 +1333,8 @@ async def begin_put_async_relative_retry_no_status_payload( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1415,7 +1415,7 @@ async def _delete204_succeeded_initial( async def begin_delete204_succeeded( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 204 to the initial request, indicating success. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1424,8 +1424,8 @@ async def begin_delete204_succeeded( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1502,7 +1502,7 @@ async def _delete_async_relative_retry_no_status_initial( async def begin_delete_async_relative_retry_no_status( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1512,8 +1512,8 @@ async def begin_delete_async_relative_retry_no_status( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1600,7 +1600,7 @@ async def begin_post202_no_location( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, without a location header. @@ -1612,8 +1612,8 @@ async def begin_post202_no_location( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1702,7 +1702,7 @@ async def begin_post_async_relative_retry_no_payload( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1715,8 +1715,8 @@ async def begin_post_async_relative_retry_no_payload( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1806,7 +1806,7 @@ async def begin_put200_invalid_json( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -1818,8 +1818,8 @@ async def begin_put200_invalid_json( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -1914,7 +1914,7 @@ async def begin_put_async_relative_retry_invalid_header( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -1927,8 +1927,8 @@ async def begin_put_async_relative_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2028,7 +2028,7 @@ async def begin_put_async_relative_retry_invalid_json_polling( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2041,8 +2041,8 @@ async def begin_put_async_relative_retry_invalid_json_polling( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~lro.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~lro.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2127,7 +2127,7 @@ async def _delete202_retry_invalid_header_initial( async def begin_delete202_retry_invalid_header( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. @@ -2137,8 +2137,8 @@ async def begin_delete202_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2215,7 +2215,7 @@ async def _delete_async_relative_retry_invalid_header_initial( async def begin_delete_async_relative_retry_invalid_header( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2225,8 +2225,8 @@ async def begin_delete_async_relative_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2303,7 +2303,7 @@ async def _delete_async_relative_retry_invalid_json_polling_initial( async def begin_delete_async_relative_retry_invalid_json_polling( self, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2313,8 +2313,8 @@ async def begin_delete_async_relative_retry_invalid_json_polling( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2401,7 +2401,7 @@ async def begin_post202_retry_invalid_header( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -2413,8 +2413,8 @@ async def begin_post202_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2503,7 +2503,7 @@ async def begin_post_async_relative_retry_invalid_header( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2516,8 +2516,8 @@ async def begin_post_async_relative_retry_invalid_header( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] @@ -2606,7 +2606,7 @@ async def begin_post_async_relative_retry_invalid_json_polling( self, product: Optional["models.Product"] = None, **kwargs - ) -> None: + ) -> AsyncLROPoller[None]: """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2619,8 +2619,8 @@ async def begin_post_async_relative_retry_invalid_json_polling( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: None, or the result of cls(response) - :rtype: None + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/Paging/paging/aio/operations_async/_paging_operations_async.py b/test/azure/Expected/AcceptanceTests/Paging/paging/aio/operations_async/_paging_operations_async.py index f47473c0fa0..b1810244c5d 100644 --- a/test/azure/Expected/AcceptanceTests/Paging/paging/aio/operations_async/_paging_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Paging/paging/aio/operations_async/_paging_operations_async.py @@ -1026,7 +1026,7 @@ async def begin_get_multiple_pages_lro( client_request_id: Optional[str] = None, paging_get_multiple_pages_lro_options: Optional["models.PagingGetMultiplePagesLroOptions"] = None, **kwargs - ) -> "models.ProductResult": + ) -> AsyncLROPoller["models.ProductResult"]: """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: @@ -1039,8 +1039,8 @@ async def begin_get_multiple_pages_lro( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: ProductResult, or the result of cls(response) - :rtype: ~paging.models.ProductResult + :return: An instance of AsyncLROPoller that returns either ProductResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~paging.models.ProductResult] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_storage_accounts_operations_async.py b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_storage_accounts_operations_async.py index 96f2c036621..5fa3b106a73 100644 --- a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_storage_accounts_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_storage_accounts_operations_async.py @@ -166,7 +166,7 @@ async def begin_create( account_name: str, parameters: "models.StorageAccountCreateParameters", **kwargs - ) -> "models.StorageAccount": + ) -> AsyncLROPoller["models.StorageAccount"]: """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of @@ -186,8 +186,8 @@ async def begin_create( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: StorageAccount, or the result of cls(response) - :rtype: ~storage.models.StorageAccount + :return: An instance of AsyncLROPoller that returns either StorageAccount or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~storage.models.StorageAccount] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_multiapi_service_client_operations_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_multiapi_service_client_operations_async.py index 8f44bc04f80..cf974a74994 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_multiapi_service_client_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_multiapi_service_client_operations_async.py @@ -123,7 +123,7 @@ async def begin_test_lro( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. @@ -134,8 +134,8 @@ async def begin_test_lro( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~multiapi.v1.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~multiapi.v1.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_multiapi_service_client_operations_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_multiapi_service_client_operations_async.py index b729f2581f9..a0e22fc7e70 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_multiapi_service_client_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_multiapi_service_client_operations_async.py @@ -123,7 +123,7 @@ async def begin_test_lro( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. @@ -134,8 +134,8 @@ async def begin_test_lro( polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: Product, or the result of cls(response) - :rtype: ~multiapiwithsubmodule.submodule.v1.models.Product + :return: An instance of AsyncLROPoller that returns either Product or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~multiapiwithsubmodule.submodule.v1.models.Product] :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', False) # type: Union[bool, AsyncPollingMethod] From 08d3953fec218c6019ee12221b30e8ad1f251436 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 26 May 2020 11:36:20 -0400 Subject: [PATCH 2/4] added return type to LROPoller sync typing --- .../codegen/templates/lro_operation.py.jinja2 | 3 +- .../_lr_os_custom_header_operations.py | 8 +- .../lro/operations/_lro_retrys_operations.py | 14 ++-- .../Lro/lro/operations/_lros_operations.py | 82 +++++++++---------- .../Lro/lro/operations/_lrosads_operations.py | 52 ++++++------ .../paging/operations/_paging_operations.py | 2 +- .../_storage_accounts_operations.py | 2 +- .../_multiapi_service_client_operations.py | 2 +- .../_multiapi_service_client_operations.py | 2 +- .../_multiapi_service_client_operations.py | 2 +- 10 files changed, 84 insertions(+), 85 deletions(-) diff --git a/autorest/codegen/templates/lro_operation.py.jinja2 b/autorest/codegen/templates/lro_operation.py.jinja2 index 7727e4fa676..7a5c98b6849 100644 --- a/autorest/codegen/templates/lro_operation.py.jinja2 +++ b/autorest/codegen/templates/lro_operation.py.jinja2 @@ -23,8 +23,7 @@ response_headers = { {% set return_type_wrapper = "AsyncLROPoller" if async_mode else "LROPoller" %} {{ op_tools.method_signature(operation, operation_name, async_mode=async_mode, coroutine=async_mode, return_type_wrapper=return_type_wrapper) }} {%- if not async_mode %} -{# overriding sync_return_type_annotation because we know if it's sync, it's return type is just LROPoller #} - # type: (...) -> LROPoller + {{ op_tools.sync_return_type_annotation(operation, return_type_wrapper) }} {% endif %} """{{ operation.summary if operation.summary else operation.description | wordwrap(width=95, break_long_words=False, wrapstring='\n') }} {% if operation.summary and operation.description %} diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py index 4fbd3ed5f9b..3b42c68efde 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lr_os_custom_header_operations.py @@ -103,7 +103,7 @@ def begin_put_async_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure- @@ -221,7 +221,7 @@ def begin_put201_creating_succeeded200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll @@ -329,7 +329,7 @@ def begin_post202_retry200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -434,7 +434,7 @@ def begin_post_async_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """x-ms-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 is required message header for all requests. Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure- diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py index 005103e8602..c574ba82e58 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lro_retrys_operations.py @@ -104,7 +104,7 @@ def begin_put201_creating_succeeded200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 500, then a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -215,7 +215,7 @@ def begin_put_async_relative_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 500, then a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure- AsyncOperation header for operation status. @@ -324,7 +324,7 @@ def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running delete request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -421,7 +421,7 @@ def begin_delete202_retry200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 500, then a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -511,7 +511,7 @@ def begin_delete_async_relative_retry_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -611,7 +611,7 @@ def begin_post202_retry200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 500, then a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -715,7 +715,7 @@ def begin_post_async_relative_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 500, then a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure- AsyncOperation header for operation status. diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py index 431fbba40b6..a9e3f60120d 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py @@ -101,7 +101,7 @@ def begin_put200_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -207,7 +207,7 @@ def begin_put201_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Succeeded’. @@ -309,7 +309,7 @@ def begin_post202_list( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[List["models.Product"]] """Long running put request, service returns a 202 with empty body to first request, returns a 200 with body [{ 'id': '100', 'name': 'foo' }]. @@ -412,7 +412,7 @@ def begin_put200_succeeded_no_state( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that does not contain ProvisioningState=’Succeeded’. @@ -518,7 +518,7 @@ def begin_put202_retry200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 202 to the initial request, with a location header that points to a polling URL that returns a 200 and an entity that doesn't contains ProvisioningState. @@ -630,7 +630,7 @@ def begin_put201_creating_succeeded200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -737,7 +737,7 @@ def begin_put200_updating_succeeded204( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Updating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -849,7 +849,7 @@ def begin_put201_creating_failed200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Created’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -956,7 +956,7 @@ def begin_put200_acceptedcanceled200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 201 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -1065,7 +1065,7 @@ def begin_put_no_header_in_retry( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 202 to the initial request with location header. Subsequent calls to operation status do not contain location header. @@ -1178,7 +1178,7 @@ def begin_put_async_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1293,7 +1293,7 @@ def begin_put_async_no_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1408,7 +1408,7 @@ def begin_put_async_retry_failed( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1523,7 +1523,7 @@ def begin_put_async_no_retrycanceled( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1636,7 +1636,7 @@ def begin_put_async_no_header_in_retry( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 202 to the initial request with Azure- AsyncOperation header. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -1746,7 +1746,7 @@ def begin_put_non_resource( sku=None, # type: Optional["models.Sku"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Sku"] """Long running put request with non resource. :param sku: sku to put. @@ -1851,7 +1851,7 @@ def begin_put_async_non_resource( sku=None, # type: Optional["models.Sku"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Sku"] """Long running put request with non resource. :param sku: Sku to put. @@ -1958,7 +1958,7 @@ def begin_put_sub_resource( provisioning_state=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.SubProduct"] """Long running put request with sub resource. :param provisioning_state: @@ -2065,7 +2065,7 @@ def begin_put_async_sub_resource( provisioning_state=None, # type: Optional[str] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.SubProduct"] """Long running put request with sub resource. :param provisioning_state: @@ -2167,7 +2167,7 @@ def begin_delete_provisioning202_accepted200_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Accepted’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2272,7 +2272,7 @@ def begin_delete_provisioning202_deleting_failed200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Failed’. @@ -2377,7 +2377,7 @@ def begin_delete_provisioning202_deletingcanceled200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running delete request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Canceled’. @@ -2470,7 +2470,7 @@ def begin_delete204_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete succeeds and returns right away. :keyword callable cls: A custom type or function that will be passed the direct response @@ -2565,7 +2565,7 @@ def begin_delete202_retry200( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2664,7 +2664,7 @@ def begin_delete202_no_retry204( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running delete request, service returns a 202 to the initial request. Polls return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. @@ -2756,7 +2756,7 @@ def begin_delete_no_header_in_retry( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a location header in the initial request. Subsequent calls to operation status do not contain location header. @@ -2845,7 +2845,7 @@ def begin_delete_async_no_header_in_retry( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns an Azure-AsyncOperation header in the initial request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. @@ -2935,7 +2935,7 @@ def begin_delete_async_retry_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3025,7 +3025,7 @@ def begin_delete_async_no_retry_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3115,7 +3115,7 @@ def begin_delete_async_retry_failed( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3205,7 +3205,7 @@ def begin_delete_async_retrycanceled( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -3299,7 +3299,7 @@ def begin_post200_with_payload( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Sku"] """Long running post request, service returns a 202 to the initial request, with 'Location' header. Poll returns a 200 with a response body after success. @@ -3402,7 +3402,7 @@ def begin_post202_retry200( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, with 'Location' and 'Retry-After' headers, Polls return a 200 with a response body after success. @@ -3508,7 +3508,7 @@ def begin_post202_no_retry204( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running post request, service returns a 202 to the initial request, with 'Location' header, 204 with noresponse body after success. @@ -3607,7 +3607,7 @@ def begin_post_double_headers_final_location_get( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should poll Location to get the final object. @@ -3700,7 +3700,7 @@ def begin_post_double_headers_final_azure_header_get( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object. @@ -3793,7 +3793,7 @@ def begin_post_double_headers_final_azure_header_get_default( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running post request, service returns a 202 to the initial request with both Location and Azure-Async header. Poll Azure-Async and it's success. Should NOT poll Location to get the final object if you support initial Autorest behavior. @@ -3905,7 +3905,7 @@ def begin_post_async_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -4020,7 +4020,7 @@ def begin_post_async_no_retry_succeeded( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -4128,7 +4128,7 @@ def begin_post_async_retry_failed( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -4233,7 +4233,7 @@ def begin_post_async_retrycanceled( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. diff --git a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py index 6018f3a552d..022da243859 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py @@ -104,7 +104,7 @@ def begin_put_non_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 400 to the initial request. :param product: Product to put. @@ -214,7 +214,7 @@ def begin_put_non_retry201_creating400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -325,7 +325,7 @@ def begin_put_non_retry201_creating400_invalid_json( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a Product with 'ProvisioningState' = 'Creating' and 201 response code. @@ -435,7 +435,7 @@ def begin_put_async_relative_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 with ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -535,7 +535,7 @@ def begin_delete_non_retry400( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 400 with an error body. :keyword callable cls: A custom type or function that will be passed the direct response @@ -623,7 +623,7 @@ def begin_delete202_non_retry400( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 with a location header. :keyword callable cls: A custom type or function that will be passed the direct response @@ -712,7 +712,7 @@ def begin_delete_async_relative_retry400( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -812,7 +812,7 @@ def begin_post_non_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 400 with no error body. :param product: Product to put. @@ -914,7 +914,7 @@ def begin_post202_non_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 with a location header. :param product: Product to put. @@ -1017,7 +1017,7 @@ def begin_post_async_relative_retry400( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1125,7 +1125,7 @@ def begin_put_error201_no_provisioning_state_payload( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 201 to the initial request with no payload. :param product: Product to put. @@ -1234,7 +1234,7 @@ def begin_put_async_relative_retry_no_status( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1350,7 +1350,7 @@ def begin_put_async_relative_retry_no_status_payload( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1447,7 +1447,7 @@ def begin_delete204_succeeded( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 204 to the initial request, indicating success. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1536,7 +1536,7 @@ def begin_delete_async_relative_retry_no_status( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1636,7 +1636,7 @@ def begin_post202_no_location( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, without a location header. @@ -1740,7 +1740,7 @@ def begin_post_async_relative_retry_no_payload( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -1846,7 +1846,7 @@ def begin_put200_invalid_json( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that is not a valid json. @@ -1956,7 +1956,7 @@ def begin_put_async_relative_retry_invalid_header( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2072,7 +2072,7 @@ def begin_put_async_relative_retry_invalid_json_polling( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Long running put request, service returns a 200 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2173,7 +2173,7 @@ def begin_delete202_retry_invalid_header( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. @@ -2263,7 +2263,7 @@ def begin_delete_async_relative_retry_invalid_header( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2353,7 +2353,7 @@ def begin_delete_async_relative_retry_invalid_json_polling( self, **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. @@ -2453,7 +2453,7 @@ def begin_post202_retry_invalid_header( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers. @@ -2557,7 +2557,7 @@ def begin_post_async_relative_retry_invalid_header( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. The endpoint indicated in the Azure-AsyncOperation header is invalid. @@ -2662,7 +2662,7 @@ def begin_post_async_relative_retry_invalid_json_polling( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller[None] """Long running post request, service returns a 202 to the initial request, with an entity that contains ProvisioningState=’Creating’. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. diff --git a/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py b/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py index 86638a4ff27..dd9e42f1111 100644 --- a/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py +++ b/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py @@ -1045,7 +1045,7 @@ def begin_get_multiple_pages_lro( paging_get_multiple_pages_lro_options=None, # type: Optional["models.PagingGetMultiplePagesLroOptions"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.ProductResult"] """A long-running paging operation that includes a nextLink that has 10 pages. :param client_request_id: diff --git a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py index 1b90aa5b9ef..a858f306771 100644 --- a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py +++ b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_storage_accounts_operations.py @@ -172,7 +172,7 @@ def begin_create( parameters, # type: "models.StorageAccountCreateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.StorageAccount"] """Asynchronously creates a new storage account with the specified parameters. Existing accounts cannot be updated with this API and should instead use the Update Storage Account API. If an account is already created and subsequent PUT request is issued with exact same set of diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py index 4485e7eadb0..d2b493f502b 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_multiapi_service_client_operations.py @@ -130,7 +130,7 @@ def begin_test_lro( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py index a78c42fb10d..b14ec738268 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_multiapi_service_client_operations.py @@ -130,7 +130,7 @@ def begin_test_lro( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py index b6573ec26f5..b474c944d01 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_multiapi_service_client_operations.py @@ -130,7 +130,7 @@ def begin_test_lro( product=None, # type: Optional["models.Product"] **kwargs # type: Any ): - # type: (...) -> LROPoller + # type: (...) -> LROPoller["models.Product"] """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. From 5d878bd7409043fe732e40f1736c8a3be9ff54ab Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 26 May 2020 17:24:04 -0400 Subject: [PATCH 3/4] fixed handling of LRO in multiapi --- autorest/codegen/templates/metadata.json.jinja2 | 12 +++++------- autorest/multiapi/__init__.py | 6 ++---- .../templates/multiapi_operations_mixin.py.jinja2 | 6 +++--- .../AcceptanceTests/asynctests/multiapi_base.py | 3 ++- .../multiapi/aio/_multiapi_service_client_async.py | 2 +- .../Multiapi/multiapi/aio/_operations_mixin_async.py | 8 ++++---- .../Multiapi/multiapi/v1/_metadata.json | 10 ++-------- .../Multiapi/multiapi/v2/_metadata.json | 2 -- .../Multiapi/multiapi/v3/_metadata.json | 4 +--- .../multiapinoasync/v1/_metadata.json | 10 ++-------- .../multiapinoasync/v2/_metadata.json | 2 -- .../multiapinoasync/v3/_metadata.json | 4 +--- .../submodule/aio/_multiapi_service_client_async.py | 2 +- .../submodule/aio/_operations_mixin_async.py | 8 ++++---- .../submodule/v1/_metadata.json | 10 ++-------- .../submodule/v2/_metadata.json | 2 -- .../submodule/v3/_metadata.json | 4 +--- 17 files changed, 31 insertions(+), 64 deletions(-) diff --git a/autorest/codegen/templates/metadata.json.jinja2 b/autorest/codegen/templates/metadata.json.jinja2 index f682bc60268..d94752b7b3d 100644 --- a/autorest/codegen/templates/metadata.json.jinja2 +++ b/autorest/codegen/templates/metadata.json.jinja2 @@ -50,18 +50,16 @@ }, "operation_mixins": { {% for operation in mixin_operations %} - {{ operation.name | tojson }} : { + {% set operation_name = "begin_" + operation.name if is_lro(operation) else operation.name %} + {{ operation_name | tojson }} : { "sync": { - {% set sync_operation_name = "begin_" + operation.name if is_lro(operation) else operation.name %} {% set sync_return_type_wrapper = "LROPoller" if is_lro(operation) else ("ItemPaged" if is_paging(operation) else "") %} - "operation_name": {{ sync_operation_name | tojson }}, - "signature": {{ op_tools.method_signature(operation, sync_operation_name, False, False, sync_return_type_wrapper) | tojson }} + "signature": {{ op_tools.method_signature(operation, operation_name, False, False, sync_return_type_wrapper) | tojson }} }, "async": { {% set coroutine = False if is_paging(operation) else True %} - {% set async_return_type_wrapper = "AsyncItemPaged" if is_paging(operation) else "" %} - "operation_name": {{ operation.name | tojson }}, - "signature": {{ op_tools.method_signature(operation, operation.name, True, coroutine, async_return_type_wrapper) | tojson }}, + {% set sync_return_type_wrapper = "AsyncLROPoller" if is_lro(operation) else ("ItemPaged" if is_paging(operation) else "") %} + "signature": {{ op_tools.method_signature(operation, operation_name, True, coroutine, async_return_type_wrapper) | tojson }}, "coroutine": {{ coroutine | tojson }} }, "doc": {{ op_tools.operation_docstring(operation) | tojson }}, diff --git a/autorest/multiapi/__init__.py b/autorest/multiapi/__init__.py index 3b0e5fe2014..07a7ae64b18 100644 --- a/autorest/multiapi/__init__.py +++ b/autorest/multiapi/__init__.py @@ -103,8 +103,8 @@ def there_is_a_rt_that_contains_api_version(rt_dict, api_version): # Operations at client level versioned_dict.update( { - operation_metadata[sync_or_async]["operation_name"]: operation_metadata[sync_or_async]["available_apis"] - for operation_metadata in mixin_operations.values() + operation_name: operation_metadata[sync_or_async]["available_apis"] + for operation_name, operation_metadata in mixin_operations.items() } ) for operation, api_versions_list in versioned_dict.items(): @@ -181,13 +181,11 @@ def _build_operation_mixin_meta(self, paths_to_versions: List[Path]) -> Dict[str mixin_operations.setdefault(func_name, {}).setdefault('async', {}) mixin_operations[func_name]['sync'].update({ "signature": func['sync']['signature'], - "operation_name": func['sync']['operation_name'], "doc": func['doc'], "call": func['call'] }) mixin_operations[func_name]['async'].update({ "signature": func['async']['signature'], - "operation_name": func['async']['operation_name'], "coroutine": func['async']['coroutine'], "doc": func['doc'], "call": func['call'] diff --git a/autorest/multiapi/templates/multiapi_operations_mixin.py.jinja2 b/autorest/multiapi/templates/multiapi_operations_mixin.py.jinja2 index cf50ce67016..2c7e500697c 100644 --- a/autorest/multiapi/templates/multiapi_operations_mixin.py.jinja2 +++ b/autorest/multiapi/templates/multiapi_operations_mixin.py.jinja2 @@ -16,11 +16,11 @@ from msrest import Serializer, Deserializer class {{ client_name }}OperationsMixin(object): -{% for _, metadata_sync_and_async in mixin_operations|dictsort %} +{% for operation_name, metadata_sync_and_async in mixin_operations|dictsort %} {% set metadata = metadata_sync_and_async['async'] if async_mode else metadata_sync_and_async['sync'] %} {{ metadata['signature'] | indent }} {{ metadata['doc'] | indent(8) }} - api_version = self._get_api_version('{{ metadata['operation_name'] }}') + api_version = self._get_api_version('{{ operation_name }}') {% for api in metadata['available_apis']|sort %} {% set if_statement = "if" if loop.first else "elif" %} {{ if_statement }} api_version == '{{ mod_to_api_version[api] }}': @@ -33,5 +33,5 @@ class {{ client_name }}OperationsMixin(object): mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - return {{ "await " if async_mode and metadata['coroutine'] else "" }}mixin_instance.{{ metadata['operation_name'] }}({{ metadata['call'] }}{{ ", **kwargs" if metadata['call'] else "**kwargs" }}) + return {{ "await " if async_mode and metadata['coroutine'] else "" }}mixin_instance.{{ operation_name }}({{ metadata['call'] }}{{ ", **kwargs" if metadata['call'] else "**kwargs" }}) {% endfor %} \ No newline at end of file diff --git a/test/multiapi/AcceptanceTests/asynctests/multiapi_base.py b/test/multiapi/AcceptanceTests/asynctests/multiapi_base.py index 249ca0ae36b..23fec594ef0 100644 --- a/test/multiapi/AcceptanceTests/asynctests/multiapi_base.py +++ b/test/multiapi/AcceptanceTests/asynctests/multiapi_base.py @@ -181,7 +181,8 @@ async def test_version_two_operation_group_two(self, client): @pytest.mark.parametrize('api_version', ["1.0.0"]) @pytest.mark.asyncio async def test_lro(self, client, namespace_models): - product = await client.test_lro(namespace_models.Product()) + poller = await client.begin_test_lro(namespace_models.Product()) + product = await poller.result() assert product.id == 100 @pytest.mark.asyncio diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_multiapi_service_client_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_multiapi_service_client_async.py index fec9d8babb4..dfa13e5b3c0 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_multiapi_service_client_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_multiapi_service_client_async.py @@ -49,7 +49,7 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin, MultiApiClient LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'test_lro': '1.0.0', + 'begin_test_lro': '1.0.0', 'test_one': '2.0.0', }}, _PROFILE_TAG + " latest" diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py index 2643b77915a..dbe977ae334 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py @@ -20,7 +20,7 @@ class MultiapiServiceClientOperationsMixin(object): - async def test_lro( + async def begin_test_lro( self, product: Optional["models.Product"] = None, **kwargs @@ -34,7 +34,7 @@ async def test_lro( :rtype: ~multiapi.v1.models.Product or None :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = self._get_api_version('test_lro') + api_version = self._get_api_version('begin_test_lro') if api_version == '1.0.0': from ..v1.aio.operations_async import MultiapiServiceClientOperationsMixin as OperationClass else: @@ -44,7 +44,7 @@ async def test_lro( mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - return await mixin_instance.test_lro(product, **kwargs) + return await mixin_instance.begin_test_lro(product, **kwargs) async def test_one( self, @@ -80,7 +80,7 @@ async def test_one( def test_paging( self, **kwargs - ) -> AsyncItemPaged["models.PagingResult"]: + ) -> "models.PagingResult": """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json index 5ae7064e457..f10e995a557 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json @@ -37,11 +37,9 @@ "operation_mixins": { "test_one" : { "sync": { - "operation_name": "test_one", "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_one", "signature": "async def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", "coroutine": true }, @@ -50,25 +48,21 @@ }, "_test_lro_initial" : { "sync": { - "operation_name": "_test_lro_initial", "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[\"models.Product\"]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "_test_lro_initial", "signature": "async def _test_lro_initial(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", "coroutine": true }, "doc": " \"\"\"\n\n:param product: Product to put.\n:type product: ~multiapi.v1.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product, or the result of cls(response)\n:rtype: ~multiapi.v1.models.Product or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", "call": "product" }, - "test_lro" : { + "begin_test_lro" : { "sync": { - "operation_name": "begin_test_lro", "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[\"models.Product\"]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_lro", - "signature": "async def test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", + "signature": "async def begin_test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", "coroutine": true }, "doc": " \"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~multiapi.v1.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product, or the result of cls(response)\n:rtype: ~multiapi.v1.models.Product or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json index 7f4d71d3487..bcfd8aaf876 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json @@ -38,11 +38,9 @@ "operation_mixins": { "test_one" : { "sync": { - "operation_name": "test_one", "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_one", "signature": "async def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs\n) -\u003e \"models.ModelTwo\":\n", "coroutine": true }, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json index ce561fbf18f..8d8a15af06f 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json @@ -38,12 +38,10 @@ "operation_mixins": { "test_paging" : { "sync": { - "operation_name": "test_paging", "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_paging", - "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.PagingResult\"]:\n", + "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e \"models.PagingResult\":\n", "coroutine": false }, "doc": " \"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult, or the result of cls(response)\n:rtype: ~multiapi.v3.models.PagingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json index 4af2a4e2659..07bddc0802b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json @@ -37,11 +37,9 @@ "operation_mixins": { "test_one" : { "sync": { - "operation_name": "test_one", "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_one", "signature": "async def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", "coroutine": true }, @@ -50,25 +48,21 @@ }, "_test_lro_initial" : { "sync": { - "operation_name": "_test_lro_initial", "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[\"models.Product\"]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "_test_lro_initial", "signature": "async def _test_lro_initial(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", "coroutine": true }, "doc": " \"\"\"\n\n:param product: Product to put.\n:type product: ~multiapinoasync.v1.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product, or the result of cls(response)\n:rtype: ~multiapinoasync.v1.models.Product or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", "call": "product" }, - "test_lro" : { + "begin_test_lro" : { "sync": { - "operation_name": "begin_test_lro", "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[\"models.Product\"]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_lro", - "signature": "async def test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", + "signature": "async def begin_test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", "coroutine": true }, "doc": " \"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~multiapinoasync.v1.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product, or the result of cls(response)\n:rtype: ~multiapinoasync.v1.models.Product or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json index b981a3ced91..0323f54a015 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json @@ -38,11 +38,9 @@ "operation_mixins": { "test_one" : { "sync": { - "operation_name": "test_one", "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_one", "signature": "async def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs\n) -\u003e \"models.ModelTwo\":\n", "coroutine": true }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json index e0b2353be92..04b76abc74e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json @@ -38,12 +38,10 @@ "operation_mixins": { "test_paging" : { "sync": { - "operation_name": "test_paging", "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_paging", - "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.PagingResult\"]:\n", + "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e \"models.PagingResult\":\n", "coroutine": false }, "doc": " \"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult, or the result of cls(response)\n:rtype: ~multiapinoasync.v3.models.PagingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_multiapi_service_client_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_multiapi_service_client_async.py index c8d71d4fcfe..ce5870e503a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_multiapi_service_client_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_multiapi_service_client_async.py @@ -49,7 +49,7 @@ class MultiapiServiceClient(MultiapiServiceClientOperationsMixin, MultiApiClient LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'test_lro': '1.0.0', + 'begin_test_lro': '1.0.0', 'test_one': '2.0.0', }}, _PROFILE_TAG + " latest" diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py index 11552e376da..f6b54a23a48 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py @@ -20,7 +20,7 @@ class MultiapiServiceClientOperationsMixin(object): - async def test_lro( + async def begin_test_lro( self, product: Optional["models.Product"] = None, **kwargs @@ -34,7 +34,7 @@ async def test_lro( :rtype: ~multiapiwithsubmodule.submodule.v1.models.Product or None :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = self._get_api_version('test_lro') + api_version = self._get_api_version('begin_test_lro') if api_version == '1.0.0': from ..v1.aio.operations_async import MultiapiServiceClientOperationsMixin as OperationClass else: @@ -44,7 +44,7 @@ async def test_lro( mixin_instance._config = self._config mixin_instance._serialize = Serializer(self._models_dict(api_version)) mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) - return await mixin_instance.test_lro(product, **kwargs) + return await mixin_instance.begin_test_lro(product, **kwargs) async def test_one( self, @@ -80,7 +80,7 @@ async def test_one( def test_paging( self, **kwargs - ) -> AsyncItemPaged["models.PagingResult"]: + ) -> "models.PagingResult": """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json index 4df1f0d992d..e5a8c6086e6 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json @@ -37,11 +37,9 @@ "operation_mixins": { "test_one" : { "sync": { - "operation_name": "test_one", "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_one", "signature": "async def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs\n) -\u003e None:\n", "coroutine": true }, @@ -50,25 +48,21 @@ }, "_test_lro_initial" : { "sync": { - "operation_name": "_test_lro_initial", "signature": "def _test_lro_initial(\n self,\n product=None, # type: Optional[\"models.Product\"]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "_test_lro_initial", "signature": "async def _test_lro_initial(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", "coroutine": true }, "doc": " \"\"\"\n\n:param product: Product to put.\n:type product: ~multiapiwithsubmodule.submodule.v1.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product, or the result of cls(response)\n:rtype: ~multiapiwithsubmodule.submodule.v1.models.Product or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", "call": "product" }, - "test_lro" : { + "begin_test_lro" : { "sync": { - "operation_name": "begin_test_lro", "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[\"models.Product\"]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_lro", - "signature": "async def test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", + "signature": "async def begin_test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", "coroutine": true }, "doc": " \"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~multiapiwithsubmodule.submodule.v1.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product, or the result of cls(response)\n:rtype: ~multiapiwithsubmodule.submodule.v1.models.Product or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json index b2a215b7d33..0450cf993d7 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/_metadata.json @@ -38,11 +38,9 @@ "operation_mixins": { "test_one" : { "sync": { - "operation_name": "test_one", "signature": "def test_one(\n self,\n id, # type: int\n message=None, # type: Optional[str]\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_one", "signature": "async def test_one(\n self,\n id: int,\n message: Optional[str] = None,\n **kwargs\n) -\u003e \"models.ModelTwo\":\n", "coroutine": true }, diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json index e21e9254f01..abac9c9b7b3 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json @@ -38,12 +38,10 @@ "operation_mixins": { "test_paging" : { "sync": { - "operation_name": "test_paging", "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n" }, "async": { - "operation_name": "test_paging", - "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.PagingResult\"]:\n", + "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e \"models.PagingResult\":\n", "coroutine": false }, "doc": " \"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult, or the result of cls(response)\n:rtype: ~multiapiwithsubmodule.submodule.v3.models.PagingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", From bc52ff283b4523a7db4549a61dd03cb28332b719 Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Tue, 26 May 2020 18:38:45 -0400 Subject: [PATCH 4/4] fixed return type for async functions --- autorest/codegen/templates/metadata.json.jinja2 | 2 +- .../Multiapi/multiapi/aio/_operations_mixin_async.py | 4 ++-- .../AcceptanceTests/Multiapi/multiapi/v1/_metadata.json | 2 +- .../AcceptanceTests/Multiapi/multiapi/v3/_metadata.json | 2 +- .../MultiapiNoAsync/multiapinoasync/v1/_metadata.json | 2 +- .../MultiapiNoAsync/multiapinoasync/v3/_metadata.json | 2 +- .../submodule/aio/_operations_mixin_async.py | 4 ++-- .../multiapiwithsubmodule/submodule/v1/_metadata.json | 2 +- .../multiapiwithsubmodule/submodule/v3/_metadata.json | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/autorest/codegen/templates/metadata.json.jinja2 b/autorest/codegen/templates/metadata.json.jinja2 index d94752b7b3d..11f8da77585 100644 --- a/autorest/codegen/templates/metadata.json.jinja2 +++ b/autorest/codegen/templates/metadata.json.jinja2 @@ -58,7 +58,7 @@ }, "async": { {% set coroutine = False if is_paging(operation) else True %} - {% set sync_return_type_wrapper = "AsyncLROPoller" if is_lro(operation) else ("ItemPaged" if is_paging(operation) else "") %} + {% set async_return_type_wrapper = "AsyncLROPoller" if is_lro(operation) else ("AsyncItemPaged" if is_paging(operation) else "") %} "signature": {{ op_tools.method_signature(operation, operation_name, True, coroutine, async_return_type_wrapper) | tojson }}, "coroutine": {{ coroutine | tojson }} }, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py index dbe977ae334..a4af9a328a8 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/aio/_operations_mixin_async.py @@ -24,7 +24,7 @@ async def begin_test_lro( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. @@ -80,7 +80,7 @@ async def test_one( def test_paging( self, **kwargs - ) -> "models.PagingResult": + ) -> AsyncItemPaged["models.PagingResult"]: """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json index f10e995a557..0082bc1ecd8 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json @@ -62,7 +62,7 @@ "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[\"models.Product\"]\n **kwargs # type: Any\n):\n" }, "async": { - "signature": "async def begin_test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", + "signature": "async def begin_test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e AsyncLROPoller[\"models.Product\"]:\n", "coroutine": true }, "doc": " \"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~multiapi.v1.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product, or the result of cls(response)\n:rtype: ~multiapi.v1.models.Product or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json index 8d8a15af06f..5953fe8f741 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json @@ -41,7 +41,7 @@ "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n" }, "async": { - "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e \"models.PagingResult\":\n", + "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.PagingResult\"]:\n", "coroutine": false }, "doc": " \"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult, or the result of cls(response)\n:rtype: ~multiapi.v3.models.PagingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json index 07bddc0802b..b47ebb898b9 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json @@ -62,7 +62,7 @@ "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[\"models.Product\"]\n **kwargs # type: Any\n):\n" }, "async": { - "signature": "async def begin_test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", + "signature": "async def begin_test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e AsyncLROPoller[\"models.Product\"]:\n", "coroutine": true }, "doc": " \"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~multiapinoasync.v1.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product, or the result of cls(response)\n:rtype: ~multiapinoasync.v1.models.Product or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json index 04b76abc74e..40e1a20d0fa 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json @@ -41,7 +41,7 @@ "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n" }, "async": { - "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e \"models.PagingResult\":\n", + "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.PagingResult\"]:\n", "coroutine": false }, "doc": " \"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult, or the result of cls(response)\n:rtype: ~multiapinoasync.v3.models.PagingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py index f6b54a23a48..b8844971c34 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/aio/_operations_mixin_async.py @@ -24,7 +24,7 @@ async def begin_test_lro( self, product: Optional["models.Product"] = None, **kwargs - ) -> "models.Product": + ) -> AsyncLROPoller["models.Product"]: """Put in whatever shape of Product you want, will return a Product with id equal to 100. :param product: Product to put. @@ -80,7 +80,7 @@ async def test_one( def test_paging( self, **kwargs - ) -> "models.PagingResult": + ) -> AsyncItemPaged["models.PagingResult"]: """Returns ModelThree with optionalProperty 'paged'. :keyword callable cls: A custom type or function that will be passed the direct response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json index e5a8c6086e6..bb1d74396e0 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/_metadata.json @@ -62,7 +62,7 @@ "signature": "def begin_test_lro(\n self,\n product=None, # type: Optional[\"models.Product\"]\n **kwargs # type: Any\n):\n" }, "async": { - "signature": "async def begin_test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e \"models.Product\":\n", + "signature": "async def begin_test_lro(\n self,\n product: Optional[\"models.Product\"] = None,\n **kwargs\n) -\u003e AsyncLROPoller[\"models.Product\"]:\n", "coroutine": true }, "doc": " \"\"\"Put in whatever shape of Product you want, will return a Product with id equal to 100.\n\n:param product: Product to put.\n:type product: ~multiapiwithsubmodule.submodule.v1.models.Product\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Product, or the result of cls(response)\n:rtype: ~multiapiwithsubmodule.submodule.v1.models.Product or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json index abac9c9b7b3..bee6b022a45 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json @@ -41,7 +41,7 @@ "signature": "def test_paging(\n self,\n **kwargs # type: Any\n):\n" }, "async": { - "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e \"models.PagingResult\":\n", + "signature": "def test_paging(\n self,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.PagingResult\"]:\n", "coroutine": false }, "doc": " \"\"\"Returns ModelThree with optionalProperty \u0027paged\u0027.\n\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: PagingResult, or the result of cls(response)\n:rtype: ~multiapiwithsubmodule.submodule.v3.models.PagingResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"",