Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions autorest/codegen/templates/lro_operation.py.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -20,11 +20,10 @@ 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 #}
# 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 %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-
Expand All @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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]
Expand Down Expand Up @@ -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.
Expand All @@ -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]
Expand Down Expand Up @@ -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-
Expand All @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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’.
Expand All @@ -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]
Expand Down Expand Up @@ -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.
Expand All @@ -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]
Expand Down Expand Up @@ -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’.
Expand All @@ -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]
Expand Down Expand Up @@ -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’.

Expand All @@ -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]
Expand Down Expand Up @@ -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.

Expand All @@ -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]
Expand Down Expand Up @@ -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.

Expand All @@ -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]
Expand Down Expand Up @@ -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.
Expand All @@ -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]
Expand Down
Loading