diff --git a/ChangeLog.md b/ChangeLog.md index b88c3341a45..2dfc663f2c8 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,8 +1,17 @@ # Change Log -### Unreleased +### 2020-06-03 - 5.1.0-preview.1 Modelerfour version: 4.13.351 +**Disclaimer** + +This version requires azure-core 1.6.0 and contains features and bugfixes 5.0.0-preview.8 + +**Features** + +- Refactor async LRO poller with a AsyncLROPoller class + "begin_" prefix +- Add continuation_token kwargs to LRO methods + **Bug Fixes** - Corrected generation of the item name of paging response when extracting data #648 - Corrected return type typing annotation for operations that return an optional body #656 diff --git a/autorest/codegen/models/__init__.py b/autorest/codegen/models/__init__.py index 8b68c5654c2..c52dd8f40b4 100644 --- a/autorest/codegen/models/__init__.py +++ b/autorest/codegen/models/__init__.py @@ -13,7 +13,7 @@ from .enum_schema import EnumSchema from .base_schema import BaseSchema from .constant_schema import ConstantSchema -from .imports import FileImport, ImportType +from .imports import FileImport, ImportType, TypingSection from .lro_operation import LROOperation from .paging_operation import PagingOperation from .parameter import Parameter @@ -36,6 +36,7 @@ "EnumSchema", "FileImport", "ImportType", + "TypingSection", "PrimitiveSchema", "LROOperation", "Operation", diff --git a/autorest/codegen/models/imports.py b/autorest/codegen/models/imports.py index 72a89047566..f855e053018 100644 --- a/autorest/codegen/models/imports.py +++ b/autorest/codegen/models/imports.py @@ -3,20 +3,20 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from enum import Enum, auto +from enum import Enum from typing import Dict, Optional, Set -class ImportType(Enum): - STDLIB = auto() - THIRDPARTY = auto() - AZURECORE = auto() - LOCAL = auto() +class ImportType(str, Enum): + STDLIB = "stdlib" + THIRDPARTY = "thirdparty" + AZURECORE = "azurecore" + LOCAL = "local" -class TypingSection(Enum): - REGULAR = auto() # this import is always a typing import - CONDITIONAL = auto() # is a typing import when we're dealing with files that py2 will use, else regular - TYPING = auto() # never a typing import +class TypingSection(str, Enum): + REGULAR = "regular" # this import is always a typing import + CONDITIONAL = "conditional" # is a typing import when we're dealing with files that py2 will use, else regular + TYPING = "typing" # never a typing import class FileImport: diff --git a/autorest/codegen/models/lro_operation.py b/autorest/codegen/models/lro_operation.py index 8983dd40cff..e09a7f3ee30 100644 --- a/autorest/codegen/models/lro_operation.py +++ b/autorest/codegen/models/lro_operation.py @@ -89,7 +89,7 @@ def imports(self, code_model, async_mode: bool) -> FileImport: file_import.add_from_import("typing", "Union", ImportType.STDLIB, TypingSection.CONDITIONAL) if async_mode: file_import.add_from_import("typing", "Optional", ImportType.STDLIB, TypingSection.CONDITIONAL) - file_import.add_from_import("azure.core.polling", "async_poller", ImportType.AZURECORE) + file_import.add_from_import("azure.core.polling", "AsyncLROPoller", ImportType.AZURECORE) file_import.add_from_import("azure.core.polling", "AsyncNoPolling", ImportType.AZURECORE) file_import.add_from_import("azure.core.polling", "AsyncPollingMethod", ImportType.AZURECORE) if code_model.options['azure_arm']: diff --git a/autorest/codegen/serializers/metadata_serializer.py b/autorest/codegen/serializers/metadata_serializer.py index 64e97aba10d..2ec39660c03 100644 --- a/autorest/codegen/serializers/metadata_serializer.py +++ b/autorest/codegen/serializers/metadata_serializer.py @@ -4,7 +4,8 @@ # license information. # -------------------------------------------------------------------------- import copy -from typing import List, Optional, Set, Tuple +import json +from typing import List, Optional, Set, Tuple, Dict from jinja2 import Environment from ..models import ( CodeModel, @@ -13,9 +14,10 @@ LROOperation, PagingOperation, CredentialSchema, - ParameterList + ParameterList, + TypingSection, + ImportType ) -from .import_serializer import FileImportSerializer def _correct_credential_parameter(global_parameters: ParameterList, async_mode: bool) -> None: credential_param = [ @@ -23,6 +25,31 @@ def _correct_credential_parameter(global_parameters: ParameterList, async_mode: ][0] credential_param.schema = CredentialSchema(async_mode=async_mode) +def _json_serialize_imports( + imports: Dict[TypingSection, Dict[ImportType, Dict[str, Set[Optional[str]]]]] +): + if not imports: + return None + + json_serialize_imports = {} + # need to make name_import set -> list to make the dictionary json serializable + # not using an OrderedDict since we're iterating through a set and the order there varies + # going to sort the list instead + + for typing_section_key, typing_section_value in imports.items(): + json_import_type_dictionary = {} + for import_type_key, import_type_value in typing_section_value.items(): + json_package_name_dictionary = {} + for package_name, name_imports in import_type_value.items(): + name_import_ordered_list = [] + if name_imports: + name_import_ordered_list = list(name_imports) + name_import_ordered_list.sort() + json_package_name_dictionary[package_name] = name_import_ordered_list + json_import_type_dictionary[import_type_key] = json_package_name_dictionary + json_serialize_imports[typing_section_key] = json_import_type_dictionary + return json.dumps(json_serialize_imports) + class MetadataSerializer: def __init__(self, code_model: CodeModel, env: Environment) -> None: @@ -99,11 +126,11 @@ def _is_paging(operation): is_paging=_is_paging, str=str, sync_mixin_imports=( - FileImportSerializer(sync_mixin_imports, is_python_3_file=False) + _json_serialize_imports(sync_mixin_imports.imports) if sync_mixin_imports else None ), async_mixin_imports=( - FileImportSerializer(async_mixin_imports, is_python_3_file=True) + _json_serialize_imports(async_mixin_imports.imports) if async_mixin_imports else None ) ) diff --git a/autorest/codegen/templates/lro_operation.py.jinja2 b/autorest/codegen/templates/lro_operation.py.jinja2 index 80959e331e1..7a5c98b6849 100644 --- a/autorest/codegen/templates/lro_operation.py.jinja2 +++ b/autorest/codegen/templates/lro_operation.py.jinja2 @@ -2,11 +2,11 @@ {% import 'operation_tools.jinja2' as op_tools %} {% set trace_decorator = "@distributed_trace_async" if async_mode else "@distributed_trace" %} {% set async_prefix = "Async" if async_mode else "" %} -{% set poller = "async_poller" if async_mode else "LROPoller" %} -{% set operation_name = operation.python_name if async_mode else "begin_"+operation.python_name %} +{% 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 %} {{ op_tools.sync_return_type_annotation(operation, return_type_wrapper) }} @@ -43,6 +43,7 @@ response_headers = { :type {{ parameter.serialized_name }}: {{ parameter.schema.docstring_type }} {% endfor %} :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.{{ "Async" if async_mode else "" }}PollingMethod @@ -56,13 +57,15 @@ response_headers = { 'polling_interval', self._config.polling_interval ) - raw_result = {{ keywords.await }}self._{{ operation.name }}_initial( - {% for parameter in operation.parameters.method %} - {{ parameter.serialized_name }}={{ parameter.serialized_name }}, - {% endfor %} - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = {{ keywords.await }}self._{{ operation.name }}_initial( + {% for parameter in operation.parameters.method %} + {{ parameter.serialized_name }}={{ parameter.serialized_name }}, + {% endfor %} + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -88,5 +91,13 @@ response_headers = { {% endif %} elif polling is False: polling_method = {{ async_prefix }}NoPolling() else: polling_method = polling - return {{ keywords.await }}{{ poller }}(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return {{ poller }}.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return {{ poller }}(self._client, raw_result, get_long_running_output, polling_method) {{ operation_name }}.metadata = {'url': '{{ operation.url }}'} # type: ignore \ No newline at end of file diff --git a/autorest/codegen/templates/metadata.json.jinja2 b/autorest/codegen/templates/metadata.json.jinja2 index f682bc60268..11f8da77585 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 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 }} }, "doc": {{ op_tools.operation_docstring(operation) | tojson }}, diff --git a/autorest/multiapi/__init__.py b/autorest/multiapi/__init__.py index 3b0e5fe2014..4eb279f1a79 100644 --- a/autorest/multiapi/__init__.py +++ b/autorest/multiapi/__init__.py @@ -11,7 +11,8 @@ from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple, Optional, cast, Any -from .multiapi_serializer import MultiAPISerializer +from .serializers import MultiAPISerializer, FileImportSerializer +from .models import FileImport from ..jsonrpc import AutorestAPI from .. import Plugin @@ -103,8 +104,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 +182,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'] @@ -249,6 +248,20 @@ def _parse_package_name_input(self) -> str: self.output_package_name = self.input_package_name return module_name + def _merge_mixin_imports_across_versions( + self, paths_to_versions: List[Path], async_mode: bool + ) -> FileImport: + imports = FileImport() + imports_to_load = "async_imports" if async_mode else "sync_imports" + for version_path in paths_to_versions: + metadata_json = json.loads(self._autorestapi.read_file(version_path / "_metadata.json")) + if not metadata_json.get('operation_mixins'): + continue + current_version_imports = FileImport(json.loads(metadata_json[imports_to_load])) + imports.merge(current_version_imports) + + return imports + def process(self) -> bool: _LOGGER.info("Generating multiapi client") # If True, means the auto-profile will consider preview versions. @@ -326,6 +339,14 @@ def process(self) -> bool: versioned_operations_dict, mixin_operations, last_api_version, preview_mode, async_mode=True ) + sync_imports = self._merge_mixin_imports_across_versions( + paths_to_versions, async_mode=False + ) + + async_imports = self._merge_mixin_imports_across_versions( + paths_to_versions, async_mode=True + ) + conf = { "client_name": metadata_json["client"]["name"], "package_name": self.output_package_name, @@ -342,8 +363,8 @@ def process(self) -> bool: ), "config": metadata_json["config"], "global_parameters": metadata_json["global_parameters"], - "sync_imports": metadata_json["sync_imports"], - "async_imports": metadata_json["async_imports"] + "sync_imports": str(FileImportSerializer(sync_imports, is_python_3_file=False)), + "async_imports": str(FileImportSerializer(async_imports, is_python_3_file=True)) } multiapi_serializer = MultiAPISerializer( diff --git a/autorest/multiapi/models/__init__.py b/autorest/multiapi/models/__init__.py new file mode 100644 index 00000000000..5ac7539c8bc --- /dev/null +++ b/autorest/multiapi/models/__init__.py @@ -0,0 +1,13 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from .imports import ImportType, FileImport, TypingSection + +__all__ = [ + "ImportType", + "FileImport", + "TypingSection" +] diff --git a/autorest/multiapi/models/imports.py b/autorest/multiapi/models/imports.py new file mode 100644 index 00000000000..f855e053018 --- /dev/null +++ b/autorest/multiapi/models/imports.py @@ -0,0 +1,78 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from enum import Enum +from typing import Dict, Optional, Set + + +class ImportType(str, Enum): + STDLIB = "stdlib" + THIRDPARTY = "thirdparty" + AZURECORE = "azurecore" + LOCAL = "local" + +class TypingSection(str, Enum): + REGULAR = "regular" # this import is always a typing import + CONDITIONAL = "conditional" # is a typing import when we're dealing with files that py2 will use, else regular + TYPING = "typing" # never a typing import + + +class FileImport: + def __init__( + self, imports: Dict[TypingSection, Dict[ImportType, Dict[str, Set[Optional[str]]]]] = None + ) -> None: + # Basic implementation + # First level dict: TypingSection + # Second level dict: ImportType + # Third level dict: the package name. + # Fourth level set: None if this import is a "import", the name to import if it's a "from" + self._imports: Dict[TypingSection, Dict[ImportType, Dict[str, Set[Optional[str]]]]] = imports or dict() + + def _add_import( + self, + from_section: str, + import_type: ImportType, + name_import: Optional[str] = None, + typing_section: TypingSection = TypingSection.REGULAR + ) -> None: + self._imports.setdefault( + typing_section, dict() + ).setdefault( + import_type, dict() + ).setdefault( + from_section, set() + ).add(name_import) + + def add_from_import( + self, + from_section: str, + name_import: str, + import_type: ImportType, + typing_section: TypingSection = TypingSection.REGULAR + ) -> None: + """Add an import to this import block. + """ + self._add_import(from_section, import_type, name_import, typing_section) + + def add_import( + self, + name_import: str, + import_type: ImportType, + typing_section: TypingSection = TypingSection.REGULAR + ) -> None: + # Implementation detail: a regular import is just a "from" with no from + self._add_import(name_import, import_type, None, typing_section) + + @property + def imports(self) -> Dict[TypingSection, Dict[ImportType, Dict[str, Set[Optional[str]]]]]: + return self._imports + + def merge(self, file_import: "FileImport") -> None: + """Merge the given file import format.""" + for typing_section, import_type_dict in file_import.imports.items(): + for import_type, package_list in import_type_dict.items(): + for package_name, module_list in package_list.items(): + for module_name in module_list: + self._add_import(package_name, import_type, module_name, typing_section) diff --git a/autorest/multiapi/serializers/__init__.py b/autorest/multiapi/serializers/__init__.py new file mode 100644 index 00000000000..92bfc4a46f0 --- /dev/null +++ b/autorest/multiapi/serializers/__init__.py @@ -0,0 +1,13 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from .import_serializer import FileImportSerializer +from .multiapi_serializer import MultiAPISerializer + +__all__ = [ + "FileImportSerializer", + "MultiAPISerializer" +] diff --git a/autorest/multiapi/serializers/import_serializer.py b/autorest/multiapi/serializers/import_serializer.py new file mode 100644 index 00000000000..e597a3b9116 --- /dev/null +++ b/autorest/multiapi/serializers/import_serializer.py @@ -0,0 +1,87 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +from copy import deepcopy +from typing import Dict, Set, Optional, List +from ..models import ImportType, FileImport, TypingSection + +def _serialize_package(package_name: str, module_list: Set[Optional[str]], delimiter: str) -> str: + buffer = [] + if None in module_list: + buffer.append(f"import {package_name}") + if module_list != {None}: + buffer.append( + "from {} import {}".format( + package_name, ", ".join(sorted([mod for mod in module_list if mod is not None])) + ) + ) + return delimiter.join(buffer) + +def _serialize_type(import_type_dict: Dict[str, Set[Optional[str]]], delimiter: str) -> str: + """Serialize a given import type.""" + import_list = [] + for package_name in sorted(list(import_type_dict.keys())): + module_list = import_type_dict[package_name] + import_list.append(_serialize_package(package_name, module_list, delimiter)) + return delimiter.join(import_list) + +def _get_import_clauses(imports: Dict[ImportType, Dict[str, Set[Optional[str]]]], delimiter: str) -> List[str]: + import_clause = [] + for import_type in ImportType: + if import_type in imports: + import_clause.append(_serialize_type(imports[import_type], delimiter)) + return import_clause + + +class FileImportSerializer: + def __init__(self, file_import: FileImport, is_python_3_file: bool) -> None: + self._file_import = file_import + self.is_python_3_file = is_python_3_file + + def _switch_typing_section_key(self, new_key: TypingSection): + switched_dictionary = {} + switched_dictionary[new_key] = self._file_import.imports[TypingSection.CONDITIONAL] + return switched_dictionary + + def _get_imports_dict(self, baseline_typing_section: TypingSection, add_conditional_typing: bool): + # If this is a python 3 file, our regular imports include the CONDITIONAL category + # If this is not a python 3 file, our typing imports include the CONDITIONAL category + file_import_copy = deepcopy(self._file_import) + if add_conditional_typing and self._file_import.imports.get(TypingSection.CONDITIONAL): + # we switch the TypingSection key for the CONDITIONAL typing imports so we can merge + # the imports together + switched_imports_dictionary = self._switch_typing_section_key(baseline_typing_section) + switched_imports = FileImport(switched_imports_dictionary) + file_import_copy.merge(switched_imports) + return file_import_copy.imports.get(baseline_typing_section, {}) + + def _add_type_checking_import(self): + if ( + self._file_import.imports.get(TypingSection.TYPING) or + (not self.is_python_3_file and self._file_import.imports.get(TypingSection.CONDITIONAL)) + ): + self._file_import.add_from_import("typing", "TYPE_CHECKING", ImportType.STDLIB) + + def __str__(self) -> str: + self._add_type_checking_import() + regular_imports = "" + regular_imports_dict = self._get_imports_dict( + baseline_typing_section=TypingSection.REGULAR, add_conditional_typing=self.is_python_3_file + ) + + if regular_imports_dict: + regular_imports = "\n\n".join( + _get_import_clauses(regular_imports_dict, "\n") + ) + + typing_imports = "" + typing_imports_dict = self._get_imports_dict( + baseline_typing_section=TypingSection.TYPING, add_conditional_typing=not self.is_python_3_file + ) + if typing_imports_dict: + typing_imports += "\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n " + typing_imports += "\n\n ".join(_get_import_clauses(typing_imports_dict, "\n ")) + + return regular_imports + typing_imports diff --git a/autorest/multiapi/multiapi_serializer.py b/autorest/multiapi/serializers/multiapi_serializer.py similarity index 99% rename from autorest/multiapi/multiapi_serializer.py rename to autorest/multiapi/serializers/multiapi_serializer.py index 869677ad7cd..27c53ebfca2 100644 --- a/autorest/multiapi/multiapi_serializer.py +++ b/autorest/multiapi/serializers/multiapi_serializer.py @@ -7,7 +7,7 @@ from pathlib import Path from jinja2 import Environment, PackageLoader -from ..jsonrpc import AutorestAPI +from ...jsonrpc import AutorestAPI class MultiAPISerializer: 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/autorest/namer/python_mappings.py b/autorest/namer/python_mappings.py index 3e84cd2d9c3..28c5e49a73e 100644 --- a/autorest/namer/python_mappings.py +++ b/autorest/namer/python_mappings.py @@ -102,6 +102,7 @@ class PadType(Enum): "content_type", "cls", "polling", + "continuation_token", # for LRO calls # these are transport kwargs # https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#transport "connection_timeout", diff --git a/package.json b/package.json index 62ca7a27e00..c0b4c4ef907 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@autorest/python", - "version": "5.0.0-preview.8", + "version": "5.1.0-preview.1", "description": "The Python extension for generators in AutoRest.", "scripts": { "prepare": "python prepare.py", @@ -37,4 +37,4 @@ "venvtools.py", "run-python3.js" ] -} \ No newline at end of file +} diff --git a/test/azure/AcceptanceTests/asynctests/test_lro.py b/test/azure/AcceptanceTests/asynctests/test_lro.py index 0bb4a38a967..89dd23404d5 100644 --- a/test/azure/AcceptanceTests/asynctests/test_lro.py +++ b/test/azure/AcceptanceTests/asynctests/test_lro.py @@ -30,10 +30,10 @@ import isodate import tempfile import json -import time from uuid import uuid4 from datetime import date, datetime, timedelta import os +import time from os.path import dirname, pardir, join, realpath from azure.core.exceptions import DecodeError, HttpResponseError @@ -129,92 +129,94 @@ async def assert_raises_with_message(self, msg, func, *args, **kwargs): async def lro_result(self, func, *args, **kwargs): if "polling" not in kwargs: kwargs["polling"] = AutorestTestARMPolling(0) - return await func(*args, **kwargs) + return await (await func(*args, **kwargs)).result() @pytest.mark.asyncio async def test_post_double_headers_final(self, client): - product = await client.lros.post_double_headers_final_location_get() - assert product.id == "100" + poller = await client.lros.begin_post_double_headers_final_location_get() + continuation_token = poller.continuation_token() - product = await client.lros.post_double_headers_final_azure_header_get() + poller = await client.lros.begin_post_double_headers_final_location_get(continuation_token=continuation_token) + product = await poller.result() assert product.id == "100" @pytest.mark.asyncio async def test_post_double_headers_default(self, client): # This test will work as long as the default is Location - product = await client.lros.post_double_headers_final_azure_header_get_default() + poller = await client.lros.begin_post_double_headers_final_azure_header_get_default() + product = await poller.result() assert product.id == "100" @pytest.mark.asyncio async def test_happy_put201_creating_succeeded200(self, client, product): - process = await self.lro_result(client.lros.put201_creating_succeeded200, product) + process = await self.lro_result(client.lros.begin_put201_creating_succeeded200, product) assert "Succeeded" == process.provisioning_state # Testing nopolling - process = await self.lro_result(client.lros.put201_creating_succeeded200, product, polling=False) + process = await self.lro_result(client.lros.begin_put201_creating_succeeded200, product, polling=False) assert "Creating" == process.provisioning_state @pytest.mark.asyncio async def test_happy_put201_creating_failed200(self, client, product): await self.assert_raises_with_message( ("Operation returned an invalid status 'OK'", "failed"), - client.lros.put201_creating_failed200, product) + client.lros.begin_put201_creating_failed200, product) - process = await self.lro_result(client.lros.put201_creating_failed200, product, polling=False) + process = await self.lro_result(client.lros.begin_put201_creating_failed200, product, polling=False) assert "Created" == process.provisioning_state @pytest.mark.asyncio async def test_happy_put200_updating_succeeded204(self, client, product): - process = await self.lro_result(client.lros.put200_updating_succeeded204, product) + process = await self.lro_result(client.lros.begin_put200_updating_succeeded204, product) assert "Succeeded" == process.provisioning_state - process = await self.lro_result(client.lros.put200_updating_succeeded204, product, polling=False) + process = await self.lro_result(client.lros.begin_put200_updating_succeeded204, product, polling=False) assert "Updating" == process.provisioning_state @pytest.mark.asyncio async def test_happy_put200_acceptedcanceled200(self, client, product): await self.assert_raises_with_message( ("Operation returned an invalid status 'OK'", "canceled"), - client.lros.put200_acceptedcanceled200, product) + client.lros.begin_put200_acceptedcanceled200, product) - process = await self.lro_result(client.lros.put200_acceptedcanceled200, product, polling=False) + process = await self.lro_result(client.lros.begin_put200_acceptedcanceled200, product, polling=False) assert "Accepted" == process.provisioning_state @pytest.mark.asyncio async def test_happy_put_no_header_in_retry(self, client, product): - process = await self.lro_result(client.lros.put_no_header_in_retry, product) + process = await self.lro_result(client.lros.begin_put_no_header_in_retry, product) assert "Succeeded" == process.provisioning_state - process = await self.lro_result(client.lros.put_async_no_header_in_retry, product) + process = await self.lro_result(client.lros.begin_put_async_no_header_in_retry, product) assert "Succeeded" == process.provisioning_state @pytest.mark.asyncio async def test_happy_put_sub_resource(self, client): - process = await self.lro_result(client.lros.put_sub_resource, SubProduct()) + process = await self.lro_result(client.lros.begin_put_sub_resource, SubProduct()) assert "Succeeded" == process.provisioning_state - process = await self.lro_result(client.lros.put_async_sub_resource, SubProduct()) + process = await self.lro_result(client.lros.begin_put_async_sub_resource, SubProduct()) assert "Succeeded" == process.provisioning_state @pytest.mark.asyncio async def test_happy_put_non_resource(self, client): - process = await self.lro_result(client.lros.put_non_resource, Sku()) + process = await self.lro_result(client.lros.begin_put_non_resource, Sku()) assert "100" == process.id - process = await self.lro_result(client.lros.put_async_non_resource, Sku()) + process = await self.lro_result(client.lros.begin_put_async_non_resource, Sku()) assert "100" == process.id @pytest.mark.asyncio async def test_happy_put200_succeeded(self, client, product): - process = await self.lro_result(client.lros.put200_succeeded, product) + process = await self.lro_result(client.lros.begin_put200_succeeded, product) assert "Succeeded" == process.provisioning_state - process = await self.lro_result(client.lros.put200_succeeded_no_state, product) + process = await self.lro_result(client.lros.begin_put200_succeeded_no_state, product) assert "100" == process.id @pytest.mark.asyncio async def test_put201_succeeded(self, client, product): - process = await self.lro_result(client.lros.put201_succeeded, product) + process = await self.lro_result(client.lros.begin_put201_succeeded, product) assert "Succeeded" == process.provisioning_state assert "100" == process.id @@ -222,256 +224,258 @@ async def test_put201_succeeded(self, client, product): @pytest.mark.asyncio async def test_happy_put202_retry200(self, client, product): - process = await self.lro_result(client.lros.put202_retry200, product) + process = await self.lro_result(client.lros.begin_put202_retry200, product) assert "100" == process.id @pytest.mark.asyncio async def test_happy_put_retry_succeeded(self, client, product): - process = await self.lro_result(client.lros.put_async_retry_succeeded, product) + process = await self.lro_result(client.lros.begin_put_async_retry_succeeded, product) assert "Succeeded" == process.provisioning_state - process = await self.lro_result(client.lros.put_async_no_retry_succeeded, product) + process = await self.lro_result(client.lros.begin_put_async_no_retry_succeeded, product) assert "Succeeded" == process.provisioning_state @pytest.mark.asyncio async def test_happy_put_retry_failed_canceled(self, client, product): await self.assert_raises_with_message( ("Operation returned an invalid status 'OK'", "failed"), - client.lros.put_async_retry_failed, product) + client.lros.begin_put_async_retry_failed, product) await self.assert_raises_with_message( ("Operation returned an invalid status 'OK'", "canceled"), - client.lros.put_async_no_retrycanceled, product) + client.lros.begin_put_async_no_retrycanceled, product) @pytest.mark.asyncio async def test_post202_retry200(self, client, product): - process = await self.lro_result(client.lros.post202_retry200, product) + process = await self.lro_result(client.lros.begin_post202_retry200, product) assert process is None @pytest.mark.asyncio async def test_happy_delete(self, client): - assert await self.lro_result(client.lros.delete204_succeeded) is None - assert await self.lro_result(client.lros.delete202_retry200) is None - assert await self.lro_result(client.lros.delete202_no_retry204) is None + assert await self.lro_result(client.lros.begin_delete204_succeeded) is None + assert await self.lro_result(client.lros.begin_delete202_retry200) is None + assert await self.lro_result(client.lros.begin_delete202_no_retry204) is None @pytest.mark.asyncio async def test_happy_delete_no_header_in_retry(self, client): - assert await self.lro_result(client.lros.delete_no_header_in_retry) is None - assert await self.lro_result(client.lros.delete_async_no_header_in_retry) is None + assert await self.lro_result(client.lros.begin_delete_no_header_in_retry) is None + assert await self.lro_result(client.lros.begin_delete_async_no_header_in_retry) is None @pytest.mark.asyncio async def test_happy_delete_async_retry_failed_canceled(self, client): await self.assert_raises_with_message( ("Operation returned an invalid status 'OK'", "canceled"), - client.lros.delete_async_retrycanceled) + client.lros.begin_delete_async_retrycanceled) await self.assert_raises_with_message( ("Operation returned an invalid status 'OK'", "failed"), - client.lros.delete_async_retry_failed) + client.lros.begin_delete_async_retry_failed) @pytest.mark.asyncio async def test_happy_delete_async_succeeded(self, client): - assert await self.lro_result(client.lros.delete_async_no_retry_succeeded) is None - assert await self.lro_result(client.lros.delete_async_retry_succeeded) is None + assert await self.lro_result(client.lros.begin_delete_async_no_retry_succeeded) is None + assert await self.lro_result(client.lros.begin_delete_async_retry_succeeded) is None @pytest.mark.asyncio async def test_happy_delete_provisioning(self, client): - process = await self.lro_result(client.lros.delete_provisioning202_accepted200_succeeded) + process = await self.lro_result(client.lros.begin_delete_provisioning202_accepted200_succeeded) assert "Succeeded" == process.provisioning_state - result = await self.lro_result(client.lros.delete_provisioning202_deletingcanceled200) + result = await self.lro_result(client.lros.begin_delete_provisioning202_deletingcanceled200) assert result.provisioning_state == 'Canceled' - result = await self.lro_result(client.lros.delete_provisioning202_deleting_failed200) + result = await self.lro_result(client.lros.begin_delete_provisioning202_deleting_failed200) assert result.provisioning_state == 'Failed' @pytest.mark.asyncio async def test_happy_post(self, client, product): - assert await self.lro_result(client.lros.post202_no_retry204, product) is None + assert await self.lro_result(client.lros.begin_post202_no_retry204, product) is None - sku = await self.lro_result(client.lros.post200_with_payload) + sku = await self.lro_result(client.lros.begin_post200_with_payload) assert sku.id == '1' @pytest.mark.asyncio async def test_happy_post_async_retry_failed_canceled(self, client, product): await self.assert_raises_with_message("Internal Server Error", - client.lros.post_async_retry_failed) + client.lros.begin_post_async_retry_failed) await self.assert_raises_with_message( ("Operation returned an invalid status 'OK'", "canceled"), - client.lros.post_async_retrycanceled) + client.lros.begin_post_async_retrycanceled) @pytest.mark.asyncio async def test_happy_post_async_succeeded(self, client, product): - prod = await self.lro_result(client.lros.post_async_retry_succeeded) + prod = await self.lro_result(client.lros.begin_post_async_retry_succeeded) assert prod.id == "100" - prod = await self.lro_result(client.lros.post_async_no_retry_succeeded) + prod = await self.lro_result(client.lros.begin_post_async_no_retry_succeeded) assert prod.id == "100" @pytest.mark.asyncio async def test_retrys_put(self, client, product): - process = await self.lro_result(client.lro_retrys.put201_creating_succeeded200, product) + process = await self.lro_result(client.lro_retrys.begin_put201_creating_succeeded200, product) assert 'Succeeded' == process.provisioning_state - process = await self.lro_result(client.lro_retrys.put_async_relative_retry_succeeded, product) + process = await self.lro_result(client.lro_retrys.begin_put_async_relative_retry_succeeded, product) assert 'Succeeded' == process.provisioning_state @pytest.mark.asyncio async def test_retrys_delete(self, client, product): - process = await self.lro_result(client.lro_retrys.delete_provisioning202_accepted200_succeeded) + process = await self.lro_result(client.lro_retrys.begin_delete_provisioning202_accepted200_succeeded) assert 'Succeeded' == process.provisioning_state - assert await self.lro_result(client.lro_retrys.delete202_retry200) is None - assert await self.lro_result(client.lro_retrys.delete_async_relative_retry_succeeded) is None + assert await self.lro_result(client.lro_retrys.begin_delete202_retry200) is None + assert await self.lro_result(client.lro_retrys.begin_delete_async_relative_retry_succeeded) is None @pytest.mark.asyncio async def test_retrys_post(self, client, product): - assert await self.lro_result(client.lro_retrys.post202_retry200, product) is None - assert await self.lro_result(client.lro_retrys.post_async_relative_retry_succeeded, product) is None + assert await self.lro_result(client.lro_retrys.begin_post202_retry200, product) is None + assert await self.lro_result(client.lro_retrys.begin_post_async_relative_retry_succeeded, product) is None @pytest.mark.asyncio async def test_custom_headers_put_async_retry_succeeded(self, client, product, custom_headers): - process = await self.lro_result(client.lr_os_custom_header.put_async_retry_succeeded, product, headers=custom_headers) + process = await self.lro_result(client.lr_os_custom_header.begin_put_async_retry_succeeded, product, headers=custom_headers) assert process is not None @pytest.mark.asyncio async def test_custom_headers_post_async_retry_succeeded(self, client, product, custom_headers): - process = await self.lro_result(client.lr_os_custom_header.post_async_retry_succeeded, product, headers=custom_headers) + process = await self.lro_result(client.lr_os_custom_header.begin_post_async_retry_succeeded, product, headers=custom_headers) assert process is None @pytest.mark.asyncio async def test_custom_headers_put201_creating_succeeded200(self, client, product, custom_headers): - process = await self.lro_result(client.lr_os_custom_header.put201_creating_succeeded200, product, headers=custom_headers) + process = await self.lro_result(client.lr_os_custom_header.begin_put201_creating_succeeded200, product, headers=custom_headers) assert process is not None @pytest.mark.asyncio async def test_custom_headers_post202_retry200(self, client, product, custom_headers): - process = await self.lro_result(client.lr_os_custom_header.post202_retry200, product, headers=custom_headers) + process = await self.lro_result(client.lr_os_custom_header.begin_post202_retry200, product, headers=custom_headers) assert process is None @pytest.mark.asyncio async def test_sads_put_non_retry(self, client, product): await self.assert_raises_with_message("Bad Request", - client.lrosads.put_non_retry400, product) + client.lrosads.begin_put_non_retry400, product) await self.assert_raises_with_message("Error from the server", - client.lrosads.put_non_retry201_creating400, product) + client.lrosads.begin_put_non_retry201_creating400, product) @pytest.mark.asyncio async def test_sads_put_async_relative(self, client, product): await self.assert_raises_with_message("Operation returned an invalid status 'Bad Request'", - client.lrosads.put_async_relative_retry400, product) + client.lrosads.begin_put_async_relative_retry400, product) await self.assert_raises_with_message("no status found in body", - client.lrosads.put_async_relative_retry_no_status, product) + client.lrosads.begin_put_async_relative_retry_no_status, product) await self.assert_raises_with_message("The response from long running operation does not contain a body.", - client.lrosads.put_async_relative_retry_no_status_payload, product) + client.lrosads.begin_put_async_relative_retry_no_status_payload, product) @pytest.mark.asyncio async def test_sads_put_error201_no_provisioning_state_payload(self, client, product): await self.assert_raises_with_message("The response from long running operation does not contain a body.", - client.lrosads.put_error201_no_provisioning_state_payload, product) + client.lrosads.begin_put_error201_no_provisioning_state_payload, product) @pytest.mark.asyncio async def test_sads_put200_invalid_json_with_exception(self, client, product): with pytest.raises(DecodeError): - await self.lro_result(client.lrosads.put200_invalid_json, product) + await self.lro_result(client.lrosads.begin_put200_invalid_json, product) @pytest.mark.asyncio async def test_sads_put_async_relative_with_exception(self, client, product): with pytest.raises(DecodeError): - await self.lro_result(client.lrosads.put_async_relative_retry_invalid_json_polling, product) + await self.lro_result(client.lrosads.begin_put_async_relative_retry_invalid_json_polling, product) with pytest.raises(Exception): - await self.lro_result(client.lrosads.put_async_relative_retry_invalid_header, product) + await self.lro_result(client.lrosads.begin_put_async_relative_retry_invalid_header, product) @pytest.mark.asyncio async def test_sads_put_non_retry201_creating400_invalid_json_with_exception(self, client, product): with pytest.raises(DecodeError): - await self.lro_result(client.lrosads.put_non_retry201_creating400_invalid_json, product) + await self.lro_result(client.lrosads.begin_put_non_retry201_creating400_invalid_json, product) @pytest.mark.asyncio async def tests_lro_sads_delete_non_retry(self, client, product): await self.assert_raises_with_message("Bad Request", - client.lrosads.delete_non_retry400) + client.lrosads.begin_delete_non_retry400) await self.assert_raises_with_message("Bad Request", - client.lrosads.delete202_non_retry400) + client.lrosads.begin_delete202_non_retry400) @pytest.mark.asyncio async def test_sads_delete_async_relative(self, client, product): await self.assert_raises_with_message("Bad Request", - client.lrosads.delete_async_relative_retry400) + client.lrosads.begin_delete_async_relative_retry400) await self.assert_raises_with_message("no status found in body", - client.lrosads.delete_async_relative_retry_no_status) + client.lrosads.begin_delete_async_relative_retry_no_status) @pytest.mark.asyncio async def test_sads_delete204_succeeded(self, client): - await self.lro_result(client.lrosads.delete204_succeeded) + await self.lro_result(client.lrosads.begin_delete204_succeeded) @pytest.mark.asyncio async def test_sads_delete_async_relative_with_exception(self, client): with pytest.raises(Exception): - await self.lro_result(client.lrosads.delete_async_relative_retry_invalid_header) + await self.lro_result(client.lrosads.begin_delete_async_relative_retry_invalid_header) with pytest.raises(DecodeError): - await self.lro_result(client.lrosads.delete_async_relative_retry_invalid_json_polling) + await self.lro_result(client.lrosads.begin_delete_async_relative_retry_invalid_json_polling) @pytest.mark.asyncio async def test_sads_delete202_retry_invalid_header_with_exception(self, client): with pytest.raises(Exception): - await self.lro_result(client.lrosads.delete202_retry_invalid_header) + await self.lro_result(client.lrosads.begin_delete202_retry_invalid_header) @pytest.mark.asyncio async def test_sads_post_non_retry(self, client, product): await self.assert_raises_with_message("Bad Request", - client.lrosads.post_non_retry400, product) + client.lrosads.begin_post_non_retry400, product) await self.assert_raises_with_message("Bad Request", - client.lrosads.post202_non_retry400, product) + client.lrosads.begin_post202_non_retry400, product) @pytest.mark.asyncio async def test_sads_post_async_relative(self, client, product): await self.assert_raises_with_message("Bad Request", - client.lrosads.post_async_relative_retry400, product) + client.lrosads.begin_post_async_relative_retry400, product) await self.assert_raises_with_message("The response from long running operation does not contain a body.", - client.lrosads.post_async_relative_retry_no_payload) + client.lrosads.begin_post_async_relative_retry_no_payload) @pytest.mark.asyncio async def test_sads_post202_no_location(self, client): # Testserver wants us to fail (coverage name is LROErrorPostNoLocation) # Actually, Python will NOT, and consider any kind of success 2xx on the initial call # is an actual success - process = await self.lro_result(client.lrosads.post202_no_location) + process = await self.lro_result(client.lrosads.begin_post202_no_location) assert process is None @pytest.mark.asyncio async def test_sads_post_async_relative_with_exception(self, client): with pytest.raises(Exception): - await self.lro_result(client.lrosads.post_async_relative_retry_invalid_header) + await self.lro_result(client.lrosads.begin_post_async_relative_retry_invalid_header) with pytest.raises(DecodeError): - await self.lro_result(client.lrosads.post_async_relative_retry_invalid_json_polling) + await self.lro_result(client.lrosads.begin_post_async_relative_retry_invalid_json_polling) @pytest.mark.asyncio async def test_post202_retry_invalid_header_with_exception(self, client): with pytest.raises(Exception): - await self.lro_result(client.lrosads.post202_retry_invalid_header) + await self.lro_result(client.lrosads.begin_post202_retry_invalid_header) @pytest.mark.asyncio async def test_polling_interval_operation(self, client): default_polling_interval_start_time = time.time() - product1 = await client.lros.post_double_headers_final_azure_header_get_default() + poller = await client.lros.begin_post_double_headers_final_azure_header_get_default() + product1 = await poller.result() default_polling_interval_duration = time.time() - default_polling_interval_start_time assert abs(default_polling_interval_duration - 0) < 0.1 one_second_polling_interval_start_time = time.time() - product2 = await client.lros.post_double_headers_final_azure_header_get_default(polling_interval=1) + poller = await client.lros.begin_post_double_headers_final_azure_header_get_default(polling_interval=1) + product2 = await poller.result() one_second_polling_interval_duration = time.time() - one_second_polling_interval_start_time assert abs(one_second_polling_interval_duration - 1) < 0.1 @@ -480,7 +484,8 @@ async def test_polling_interval_operation(self, client): @pytest.mark.asyncio async def test_polling_interval_config(self, cookie_policy, credential, client): default_polling_interval_start_time = time.time() - product1 = await client.lros.post_double_headers_final_azure_header_get_default() + poller = await client.lros.begin_post_double_headers_final_azure_header_get_default() + product1 = await poller.result() default_polling_interval_duration = time.time() - default_polling_interval_start_time assert abs(default_polling_interval_duration - 0) < 0.1 @@ -494,19 +499,20 @@ async def test_polling_interval_config(self, cookie_policy, credential, client): ] client_one_second = AutoRestLongRunningOperationTestService(credential, base_url="http://localhost:3000", policies=policies, polling_interval=1) one_second_polling_interval_start_time = time.time() - product2 = await client_one_second.lros.post_double_headers_final_azure_header_get_default() + poller = await client_one_second.lros.begin_post_double_headers_final_azure_header_get_default() + product2 = await poller.result() one_second_polling_interval_duration = time.time() - one_second_polling_interval_start_time assert abs(one_second_polling_interval_duration - 1) < 0.1 assert product1 == product2 @pytest.mark.asyncio async def test_passing_kwargs(self, client, product): - process = await self.lro_result(client.lros.put200_succeeded, product, content_type="application/json") + process = await self.lro_result(client.lros.begin_put200_succeeded, product, content_type="application/json") assert "Succeeded" == process.provisioning_state @pytest.mark.asyncio async def test_lro_list(self, client, product): - products = await self.lro_result(client.lros.post202_list) + products = await self.lro_result(client.lros.begin_post202_list) assert len(products) == 1 product = products[0] assert product.id == "100" diff --git a/test/azure/AcceptanceTests/asynctests/test_paging.py b/test/azure/AcceptanceTests/asynctests/test_paging.py index a2282186e12..d7433e65b8a 100644 --- a/test/azure/AcceptanceTests/asynctests/test_paging.py +++ b/test/azure/AcceptanceTests/asynctests/test_paging.py @@ -219,7 +219,8 @@ async def test_get_multiple_pages_lro(client): polling = AsyncARMPolling(0, lro_options={'final-state-via': 'location'}) # FIXME Location should be the default once 1.0.0b2 is out - page1 = await client.paging.get_multiple_pages_lro(polling=polling) + poller = await client.paging.begin_get_multiple_pages_lro(polling=polling) + page1 = await poller.result() assert len(page1.values) == 1 assert page1.values[0].properties.id == 1 assert page1.next_link.endswith("paging/multiple/page/2") diff --git a/test/azure/AcceptanceTests/asynctests/test_tracing.py b/test/azure/AcceptanceTests/asynctests/test_tracing.py index e4335261dec..d6ae7daad31 100644 --- a/test/azure/AcceptanceTests/asynctests/test_tracing.py +++ b/test/azure/AcceptanceTests/asynctests/test_tracing.py @@ -53,8 +53,7 @@ async def test_paging(): async def test_lro(): async with AutoRestLongRunningOperationTestService("cred", base_url="dummy url") as client: assert not has_tracing_decorator(client.lros._put201_creating_succeeded200_initial) - assert has_tracing_decorator(client.lros.put201_creating_succeeded200) - assert not has_tracing_decorator(client.lros._put201_creating_succeeded200_initial) + assert has_tracing_decorator(client.lros.begin_put201_creating_succeeded200) def test_azure_url(): diff --git a/test/azure/AcceptanceTests/test_lro.py b/test/azure/AcceptanceTests/test_lro.py index 8a2a7fedc5e..d6c84beadd9 100644 --- a/test/azure/AcceptanceTests/test_lro.py +++ b/test/azure/AcceptanceTests/test_lro.py @@ -130,6 +130,14 @@ def lro_result(self, func, *args, **kwargs): kwargs["polling"] = AutorestTestARMPolling(0) return func(*args, **kwargs).result() + def test_post_double_headers_final_continuation_token(self, client): + poller = client.lros.begin_post_double_headers_final_location_get() + continuation_token = poller.continuation_token() + + poller = client.lros.begin_post_double_headers_final_location_get(continuation_token=continuation_token) + product = poller.result() + assert product.id == "100" + def test_post_double_headers_final(self, client): product = client.lros.begin_post_double_headers_final_location_get().result() assert product.id == "100" diff --git a/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py index 86fde5090a8..7336aca4623 100644 --- a/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py @@ -67,7 +67,6 @@ async def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,7 +114,6 @@ async def put_positive_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(duration_body, 'duration') body_content_kwargs['content'] = body_content @@ -160,7 +158,6 @@ async def get_positive_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -204,7 +201,6 @@ async def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py b/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py index 905da870b63..6d39dd5be2a 100644 --- a/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureBodyDuration/bodyduration/operations/_duration_operations.py @@ -72,7 +72,6 @@ def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -121,7 +120,6 @@ def put_positive_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(duration_body, 'duration') body_content_kwargs['content'] = body_content @@ -167,7 +165,6 @@ def get_positive_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,7 +209,6 @@ def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations_async/_parameter_grouping_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations_async/_parameter_grouping_operations_async.py index dca06edd13f..7acacf7415e 100644 --- a/test/azure/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations_async/_parameter_grouping_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/aio/operations_async/_parameter_grouping_operations_async.py @@ -88,7 +88,6 @@ async def post_required( header_parameters['customHeader'] = self._serialize.header("custom_header", _custom_header, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_body, 'int') body_content_kwargs['content'] = body_content @@ -145,7 +144,6 @@ async def post_optional( if _custom_header is not None: header_parameters['customHeader'] = self._serialize.header("custom_header", _custom_header, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -210,7 +208,6 @@ async def post_multi_param_groups( if _header_two is not None: header_parameters['header-two'] = self._serialize.header("header_two", _header_two, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -263,7 +260,6 @@ async def post_shared_parameter_group_object( if _header_one is not None: header_parameters['header-one'] = self._serialize.header("header_one", _header_one, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py b/test/azure/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py index ba063d2a3b1..19686360de7 100644 --- a/test/azure/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureParameterGrouping/azureparametergrouping/operations/_parameter_grouping_operations.py @@ -93,7 +93,6 @@ def post_required( header_parameters['customHeader'] = self._serialize.header("custom_header", _custom_header, 'str') header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_body, 'int') body_content_kwargs['content'] = body_content @@ -151,7 +150,6 @@ def post_optional( if _custom_header is not None: header_parameters['customHeader'] = self._serialize.header("custom_header", _custom_header, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -217,7 +215,6 @@ def post_multi_param_groups( if _header_two is not None: header_parameters['header-two'] = self._serialize.header("header_two", _header_two, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -271,7 +268,6 @@ def post_shared_parameter_group_object( if _header_one is not None: header_parameters['header-one'] = self._serialize.header("header_one", _header_one, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations_async/_auto_rest_report_service_for_azure_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations_async/_auto_rest_report_service_for_azure_operations_async.py index 4290c6d4374..3e4cecb62e4 100644 --- a/test/azure/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations_async/_auto_rest_report_service_for_azure_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureReport/azurereport/aio/operations_async/_auto_rest_report_service_for_azure_operations_async.py @@ -53,7 +53,6 @@ async def get_report( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py b/test/azure/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py index 44cf81d638d..2df9ce0b787 100644 --- a/test/azure/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureReport/azurereport/operations/_auto_rest_report_service_for_azure_operations.py @@ -58,7 +58,6 @@ def get_report( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_api_version_default_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_api_version_default_operations_async.py index d2450a56947..2bf0e356dbb 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_api_version_default_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_api_version_default_operations_async.py @@ -68,7 +68,6 @@ async def get_method_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -110,7 +109,6 @@ async def get_method_global_not_provided_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -152,7 +150,6 @@ async def get_path_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -194,7 +191,6 @@ async def get_swagger_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_api_version_local_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_api_version_local_operations_async.py index e98965f9426..7dbe1611fcb 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_api_version_local_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_api_version_local_operations_async.py @@ -68,7 +68,6 @@ async def get_method_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,7 +113,6 @@ async def get_method_local_null( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -156,7 +154,6 @@ async def get_path_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -198,7 +195,6 @@ async def get_swagger_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_header_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_header_operations_async.py index 3d864d93ab4..a77495f80b1 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_header_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_header_operations_async.py @@ -70,7 +70,6 @@ async def custom_named_request_id( header_parameters = {} # type: Dict[str, Any] header_parameters['foo-client-request-id'] = self._serialize.header("foo_client_request_id", foo_client_request_id, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -122,7 +121,6 @@ async def custom_named_request_id_param_grouping( header_parameters = {} # type: Dict[str, Any] header_parameters['foo-client-request-id'] = self._serialize.header("foo_client_request_id", _foo_client_request_id, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -169,7 +167,6 @@ async def custom_named_request_id_head( header_parameters = {} # type: Dict[str, Any] header_parameters['foo-client-request-id'] = self._serialize.header("foo_client_request_id", foo_client_request_id, 'str') - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_odata_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_odata_operations_async.py index 53bd03d74a1..f5e51029d6d 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_odata_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_odata_operations_async.py @@ -81,7 +81,6 @@ async def get_with_filter( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_skip_url_encoding_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_skip_url_encoding_operations_async.py index e4ec1465210..6f7fc49d6c7 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_skip_url_encoding_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_skip_url_encoding_operations_async.py @@ -73,7 +73,6 @@ async def get_method_path_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,7 +119,6 @@ async def get_path_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -165,7 +163,6 @@ async def get_swagger_path_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -209,7 +206,6 @@ async def get_method_query_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -254,7 +250,6 @@ async def get_method_query_null( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -298,7 +293,6 @@ async def get_path_query_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -340,7 +334,6 @@ async def get_swagger_query_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_subscription_in_credentials_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_subscription_in_credentials_operations_async.py index 45d0d24d74e..7da97309b4e 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_subscription_in_credentials_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_subscription_in_credentials_operations_async.py @@ -71,7 +71,6 @@ async def post_method_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,7 +115,6 @@ async def post_method_global_null( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,7 +161,6 @@ async def post_method_global_not_provided_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -208,7 +205,6 @@ async def post_path_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -253,7 +249,6 @@ async def post_swagger_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_subscription_in_method_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_subscription_in_method_operations_async.py index 86b9c0c3061..8eb91c55043 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_subscription_in_method_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_subscription_in_method_operations_async.py @@ -75,7 +75,6 @@ async def post_method_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -124,7 +123,6 @@ async def post_method_local_null( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,7 +170,6 @@ async def post_path_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -221,7 +218,6 @@ async def post_swagger_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_xms_client_request_id_operations_async.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_xms_client_request_id_operations_async.py index 8eeb7e214b4..275730deda0 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_xms_client_request_id_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/aio/operations_async/_xms_client_request_id_operations_async.py @@ -67,7 +67,6 @@ async def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,7 +111,6 @@ async def param_get( header_parameters = {} # type: Dict[str, Any] header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", x_ms_client_request_id, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py index cf1c2159842..42f84d7e329 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_default_operations.py @@ -73,7 +73,6 @@ def get_method_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,7 +115,6 @@ def get_method_global_not_provided_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -159,7 +157,6 @@ def get_path_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -202,7 +199,6 @@ def get_swagger_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py index 370a1b2d936..fd5c858feaa 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_api_version_local_operations.py @@ -73,7 +73,6 @@ def get_method_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,7 +119,6 @@ def get_method_local_null( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -163,7 +161,6 @@ def get_path_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -206,7 +203,6 @@ def get_swagger_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py index 7753b315108..50826a0fd57 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_header_operations.py @@ -75,7 +75,6 @@ def custom_named_request_id( header_parameters = {} # type: Dict[str, Any] header_parameters['foo-client-request-id'] = self._serialize.header("foo_client_request_id", foo_client_request_id, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -128,7 +127,6 @@ def custom_named_request_id_param_grouping( header_parameters = {} # type: Dict[str, Any] header_parameters['foo-client-request-id'] = self._serialize.header("foo_client_request_id", _foo_client_request_id, 'str') - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -176,7 +174,6 @@ def custom_named_request_id_head( header_parameters = {} # type: Dict[str, Any] header_parameters['foo-client-request-id'] = self._serialize.header("foo_client_request_id", foo_client_request_id, 'str') - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py index 223f3e54950..f57a3df02cb 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_odata_operations.py @@ -86,7 +86,6 @@ def get_with_filter( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py index 68b64b15f97..59bcf17e584 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_skip_url_encoding_operations.py @@ -78,7 +78,6 @@ def get_method_path_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -126,7 +125,6 @@ def get_path_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,7 +170,6 @@ def get_swagger_path_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -217,7 +214,6 @@ def get_method_query_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -263,7 +259,6 @@ def get_method_query_null( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -308,7 +303,6 @@ def get_path_query_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -351,7 +345,6 @@ def get_swagger_query_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py index 25f64503587..7a0280ee876 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_credentials_operations.py @@ -76,7 +76,6 @@ def post_method_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -122,7 +121,6 @@ def post_method_global_null( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -170,7 +168,6 @@ def post_method_global_not_provided_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -216,7 +213,6 @@ def post_path_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -262,7 +258,6 @@ def post_swagger_global_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py index d1c0e449e8a..5b8c30cdd54 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_subscription_in_method_operations.py @@ -80,7 +80,6 @@ def post_method_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -130,7 +129,6 @@ def post_method_local_null( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,7 +177,6 @@ def post_path_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -229,7 +226,6 @@ def post_swagger_local_valid( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py index 3ba0fc1a412..dd9c8a7410a 100644 --- a/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py +++ b/test/azure/Expected/AcceptanceTests/AzureSpecials/azurespecialproperties/operations/_xms_client_request_id_operations.py @@ -72,7 +72,6 @@ def get( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -118,7 +117,6 @@ def param_get( header_parameters = {} # type: Dict[str, Any] header_parameters['x-ms-client-request-id'] = self._serialize.header("x_ms_client_request_id", x_ms_client_request_id, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations_async/_paths_operations_async.py b/test/azure/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations_async/_paths_operations_async.py index 1cb9b4fdbaf..4f6777c1e57 100644 --- a/test/azure/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations_async/_paths_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/aio/operations_async/_paths_operations_async.py @@ -73,7 +73,6 @@ async def get_empty( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py b/test/azure/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py index 2307332906c..9757136e19f 100644 --- a/test/azure/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py +++ b/test/azure/Expected/AcceptanceTests/CustomBaseUri/custombaseurl/operations/_paths_operations.py @@ -78,7 +78,6 @@ def get_empty( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations_async/_paging_operations_async.py b/test/azure/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations_async/_paging_operations_async.py index 6f35f0cd49c..1b196cf5f3a 100644 --- a/test/azure/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations_async/_paging_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/aio/operations_async/_paging_operations_async.py @@ -79,7 +79,6 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link @@ -89,7 +88,6 @@ def prepare_request(next_link=None): 'host': self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -152,7 +150,6 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = '/paging/customurl/{nextLink}' @@ -165,7 +162,6 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request diff --git a/test/azure/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py b/test/azure/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py index c4ec4dc9baa..c2cd8617c5e 100644 --- a/test/azure/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py +++ b/test/azure/Expected/AcceptanceTests/CustomUrlPaging/custombaseurlpaging/operations/_paging_operations.py @@ -83,7 +83,6 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link @@ -93,7 +92,6 @@ def prepare_request(next_link=None): 'host': self._serialize.url("self._config.host", self._config.host, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -157,7 +155,6 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = '/paging/customurl/{nextLink}' @@ -170,7 +167,6 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request diff --git a/test/azure/Expected/AcceptanceTests/Head/head/aio/operations_async/_http_success_operations_async.py b/test/azure/Expected/AcceptanceTests/Head/head/aio/operations_async/_http_success_operations_async.py index 187e073d258..c16ac735254 100644 --- a/test/azure/Expected/AcceptanceTests/Head/head/aio/operations_async/_http_success_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/Head/head/aio/operations_async/_http_success_operations_async.py @@ -60,7 +60,6 @@ async def head200( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,7 +99,6 @@ async def head204( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -140,7 +138,6 @@ async def head404( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py b/test/azure/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py index 0e455284317..51ecdb61341 100644 --- a/test/azure/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py +++ b/test/azure/Expected/AcceptanceTests/Head/head/operations/_http_success_operations.py @@ -65,7 +65,6 @@ def head200( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,7 +105,6 @@ def head204( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def head404( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations_async/_head_exception_operations_async.py b/test/azure/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations_async/_head_exception_operations_async.py index 100f799a86a..abb246bfd1d 100644 --- a/test/azure/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations_async/_head_exception_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/HeadExceptions/headexceptions/aio/operations_async/_head_exception_operations_async.py @@ -60,7 +60,6 @@ async def head200( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -100,7 +99,6 @@ async def head204( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -140,7 +138,6 @@ async def head404( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py b/test/azure/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py index 7de8c913665..237985df8fe 100644 --- a/test/azure/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py +++ b/test/azure/Expected/AcceptanceTests/HeadExceptions/headexceptions/operations/_head_exception_operations.py @@ -65,7 +65,6 @@ def head200( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,7 +105,6 @@ def head204( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -147,7 +145,6 @@ def head404( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.head(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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 e68b39490c7..7457f976e02 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -64,7 +64,6 @@ async def _put_async_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -93,11 +92,11 @@ async def _put_async_retry_succeeded_initial( _put_async_retry_succeeded_initial.metadata = {'url': '/lro/customheader/putasync/retry/succeeded'} # type: ignore @distributed_trace_async - async def put_async_retry_succeeded( + 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- @@ -106,12 +105,13 @@ async def put_async_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -120,11 +120,13 @@ async def put_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -144,8 +146,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_retry_succeeded.metadata = {'url': '/lro/customheader/putasync/retry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_retry_succeeded.metadata = {'url': '/lro/customheader/putasync/retry/succeeded'} # type: ignore async def _put201_creating_succeeded200_initial( self, @@ -168,7 +178,6 @@ async def _put201_creating_succeeded200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -197,11 +206,11 @@ async def _put201_creating_succeeded200_initial( _put201_creating_succeeded200_initial.metadata = {'url': '/lro/customheader/put/201/creating/succeeded/200'} # type: ignore @distributed_trace_async - async def put201_creating_succeeded200( + 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 @@ -210,12 +219,13 @@ async def put201_creating_succeeded200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -224,11 +234,13 @@ async def put201_creating_succeeded200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put201_creating_succeeded200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put201_creating_succeeded200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -243,8 +255,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put201_creating_succeeded200.metadata = {'url': '/lro/customheader/put/201/creating/succeeded/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put201_creating_succeeded200.metadata = {'url': '/lro/customheader/put/201/creating/succeeded/200'} # type: ignore async def _post202_retry200_initial( self, @@ -266,7 +286,6 @@ async def _post202_retry200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -292,11 +311,11 @@ async def _post202_retry200_initial( _post202_retry200_initial.metadata = {'url': '/lro/customheader/post/202/retry/200'} # type: ignore @distributed_trace_async - async def post202_retry200( + 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. @@ -304,12 +323,13 @@ async def post202_retry200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -318,11 +338,13 @@ async def post202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post202_retry200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post202_retry200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -334,8 +356,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post202_retry200.metadata = {'url': '/lro/customheader/post/202/retry/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post202_retry200.metadata = {'url': '/lro/customheader/post/202/retry/200'} # type: ignore async def _post_async_retry_succeeded_initial( self, @@ -357,7 +387,6 @@ async def _post_async_retry_succeeded_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -384,11 +413,11 @@ async def _post_async_retry_succeeded_initial( _post_async_retry_succeeded_initial.metadata = {'url': '/lro/customheader/postasync/retry/succeeded'} # type: ignore @distributed_trace_async - async def post_async_retry_succeeded( + 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- @@ -397,12 +426,13 @@ async def post_async_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -411,11 +441,13 @@ async def post_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -427,5 +459,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_retry_succeeded.metadata = {'url': '/lro/customheader/postasync/retry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_retry_succeeded.metadata = {'url': '/lro/customheader/postasync/retry/succeeded'} # type: ignore 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 d65a0fd9120..6f70aa15ccf 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -64,7 +64,6 @@ async def _put201_creating_succeeded200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -93,11 +92,11 @@ async def _put201_creating_succeeded200_initial( _put201_creating_succeeded200_initial.metadata = {'url': '/lro/retryerror/put/201/creating/succeeded/200'} # type: ignore @distributed_trace_async - async def put201_creating_succeeded200( + 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’. @@ -105,12 +104,13 @@ async def put201_creating_succeeded200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -119,11 +119,13 @@ async def put201_creating_succeeded200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put201_creating_succeeded200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put201_creating_succeeded200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -138,8 +140,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put201_creating_succeeded200.metadata = {'url': '/lro/retryerror/put/201/creating/succeeded/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put201_creating_succeeded200.metadata = {'url': '/lro/retryerror/put/201/creating/succeeded/200'} # type: ignore async def _put_async_relative_retry_succeeded_initial( self, @@ -162,7 +172,6 @@ async def _put_async_relative_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -191,11 +200,11 @@ async def _put_async_relative_retry_succeeded_initial( _put_async_relative_retry_succeeded_initial.metadata = {'url': '/lro/retryerror/putasync/retry/succeeded'} # type: ignore @distributed_trace_async - async def put_async_relative_retry_succeeded( + 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. @@ -203,12 +212,13 @@ async def put_async_relative_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -217,11 +227,13 @@ async def put_async_relative_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_relative_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_relative_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -241,8 +253,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/putasync/retry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/putasync/retry/succeeded'} # type: ignore async def _delete_provisioning202_accepted200_succeeded_initial( self, @@ -262,7 +282,6 @@ async def _delete_provisioning202_accepted200_succeeded_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -287,21 +306,22 @@ async def _delete_provisioning202_accepted200_succeeded_initial( _delete_provisioning202_accepted200_succeeded_initial.metadata = {'url': '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded'} # type: ignore @distributed_trace_async - async def delete_provisioning202_accepted200_succeeded( + 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’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -310,10 +330,12 @@ async def delete_provisioning202_accepted200_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_provisioning202_accepted200_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_provisioning202_accepted200_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -332,8 +354,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded'} # type: ignore async def _delete202_retry200_initial( self, @@ -352,7 +382,6 @@ async def _delete202_retry200_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -371,20 +400,21 @@ async def _delete202_retry200_initial( _delete202_retry200_initial.metadata = {'url': '/lro/retryerror/delete/202/retry/200'} # type: ignore @distributed_trace_async - async def delete202_retry200( + 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’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -393,10 +423,12 @@ async def delete202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete202_retry200_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -408,8 +440,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete202_retry200.metadata = {'url': '/lro/retryerror/delete/202/retry/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete202_retry200.metadata = {'url': '/lro/retryerror/delete/202/retry/200'} # type: ignore async def _delete_async_relative_retry_succeeded_initial( self, @@ -428,7 +468,6 @@ async def _delete_async_relative_retry_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -448,20 +487,21 @@ async def _delete_async_relative_retry_succeeded_initial( _delete_async_relative_retry_succeeded_initial.metadata = {'url': '/lro/retryerror/deleteasync/retry/succeeded'} # type: ignore @distributed_trace_async - async def delete_async_relative_retry_succeeded( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -470,10 +510,12 @@ async def delete_async_relative_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_relative_retry_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_relative_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -485,8 +527,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/deleteasync/retry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/deleteasync/retry/succeeded'} # type: ignore async def _post202_retry200_initial( self, @@ -508,7 +558,6 @@ async def _post202_retry200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -534,23 +583,24 @@ async def _post202_retry200_initial( _post202_retry200_initial.metadata = {'url': '/lro/retryerror/post/202/retry/200'} # type: ignore @distributed_trace_async - async def post202_retry200( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -559,11 +609,13 @@ async def post202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post202_retry200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post202_retry200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -575,8 +627,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post202_retry200.metadata = {'url': '/lro/retryerror/post/202/retry/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post202_retry200.metadata = {'url': '/lro/retryerror/post/202/retry/200'} # type: ignore async def _post_async_relative_retry_succeeded_initial( self, @@ -598,7 +658,6 @@ async def _post_async_relative_retry_succeeded_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -625,11 +684,11 @@ async def _post_async_relative_retry_succeeded_initial( _post_async_relative_retry_succeeded_initial.metadata = {'url': '/lro/retryerror/postasync/retry/succeeded'} # type: ignore @distributed_trace_async - async def post_async_relative_retry_succeeded( + 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. @@ -637,12 +696,13 @@ async def post_async_relative_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -651,11 +711,13 @@ async def post_async_relative_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_relative_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_relative_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -667,5 +729,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/postasync/retry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/postasync/retry/succeeded'} # type: ignore 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 74e28e567b4..5581a955a25 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -64,7 +64,6 @@ async def _put200_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -91,23 +90,24 @@ async def _put200_succeeded_initial( _put200_succeeded_initial.metadata = {'url': '/lro/put/200/succeeded'} # type: ignore @distributed_trace_async - async def put200_succeeded( + 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’. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -116,11 +116,13 @@ async def put200_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put200_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put200_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -135,8 +137,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put200_succeeded.metadata = {'url': '/lro/put/200/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put200_succeeded.metadata = {'url': '/lro/put/200/succeeded'} # type: ignore async def _put201_succeeded_initial( self, @@ -159,7 +169,6 @@ async def _put201_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -184,23 +193,24 @@ async def _put201_succeeded_initial( _put201_succeeded_initial.metadata = {'url': '/lro/put/201/succeeded'} # type: ignore @distributed_trace_async - async def put201_succeeded( + 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’. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -209,11 +219,13 @@ async def put201_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put201_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put201_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -228,8 +240,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put201_succeeded.metadata = {'url': '/lro/put/201/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put201_succeeded.metadata = {'url': '/lro/put/201/succeeded'} # type: ignore async def _post202_list_initial( self, @@ -249,7 +269,6 @@ async def _post202_list_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -274,20 +293,21 @@ async def _post202_list_initial( _post202_list_initial.metadata = {'url': '/lro/list'} # type: ignore @distributed_trace_async - async def post202_list( + 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' }]. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -296,10 +316,12 @@ async def post202_list( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post202_list_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post202_list_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -314,8 +336,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post202_list.metadata = {'url': '/lro/list'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post202_list.metadata = {'url': '/lro/list'} # type: ignore async def _put200_succeeded_no_state_initial( self, @@ -338,7 +368,6 @@ async def _put200_succeeded_no_state_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -363,23 +392,24 @@ async def _put200_succeeded_no_state_initial( _put200_succeeded_no_state_initial.metadata = {'url': '/lro/put/200/succeeded/nostate'} # type: ignore @distributed_trace_async - async def put200_succeeded_no_state( + 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’. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -388,11 +418,13 @@ async def put200_succeeded_no_state( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put200_succeeded_no_state_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put200_succeeded_no_state_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -407,8 +439,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put200_succeeded_no_state.metadata = {'url': '/lro/put/200/succeeded/nostate'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put200_succeeded_no_state.metadata = {'url': '/lro/put/200/succeeded/nostate'} # type: ignore async def _put202_retry200_initial( self, @@ -431,7 +471,6 @@ async def _put202_retry200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -456,11 +495,11 @@ async def _put202_retry200_initial( _put202_retry200_initial.metadata = {'url': '/lro/put/202/retry/200'} # type: ignore @distributed_trace_async - async def put202_retry200( + 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. @@ -468,12 +507,13 @@ async def put202_retry200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -482,11 +522,13 @@ async def put202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put202_retry200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put202_retry200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -501,8 +543,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put202_retry200.metadata = {'url': '/lro/put/202/retry/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put202_retry200.metadata = {'url': '/lro/put/202/retry/200'} # type: ignore async def _put201_creating_succeeded200_initial( self, @@ -525,7 +575,6 @@ async def _put201_creating_succeeded200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -554,11 +603,11 @@ async def _put201_creating_succeeded200_initial( _put201_creating_succeeded200_initial.metadata = {'url': '/lro/put/201/creating/succeeded/200'} # type: ignore @distributed_trace_async - async def put201_creating_succeeded200( + 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’. @@ -566,12 +615,13 @@ async def put201_creating_succeeded200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -580,11 +630,13 @@ async def put201_creating_succeeded200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put201_creating_succeeded200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put201_creating_succeeded200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -599,8 +651,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put201_creating_succeeded200.metadata = {'url': '/lro/put/201/creating/succeeded/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put201_creating_succeeded200.metadata = {'url': '/lro/put/201/creating/succeeded/200'} # type: ignore async def _put200_updating_succeeded204_initial( self, @@ -623,7 +683,6 @@ async def _put200_updating_succeeded204_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -648,11 +707,11 @@ async def _put200_updating_succeeded204_initial( _put200_updating_succeeded204_initial.metadata = {'url': '/lro/put/200/updating/succeeded/200'} # type: ignore @distributed_trace_async - async def put200_updating_succeeded204( + 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’. @@ -660,12 +719,13 @@ async def put200_updating_succeeded204( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -674,11 +734,13 @@ async def put200_updating_succeeded204( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put200_updating_succeeded204_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put200_updating_succeeded204_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -693,8 +755,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put200_updating_succeeded204.metadata = {'url': '/lro/put/200/updating/succeeded/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put200_updating_succeeded204.metadata = {'url': '/lro/put/200/updating/succeeded/200'} # type: ignore async def _put201_creating_failed200_initial( self, @@ -717,7 +787,6 @@ async def _put201_creating_failed200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -746,11 +815,11 @@ async def _put201_creating_failed200_initial( _put201_creating_failed200_initial.metadata = {'url': '/lro/put/201/created/failed/200'} # type: ignore @distributed_trace_async - async def put201_creating_failed200( + 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’. @@ -758,12 +827,13 @@ async def put201_creating_failed200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -772,11 +842,13 @@ async def put201_creating_failed200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put201_creating_failed200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put201_creating_failed200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -791,8 +863,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put201_creating_failed200.metadata = {'url': '/lro/put/201/created/failed/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put201_creating_failed200.metadata = {'url': '/lro/put/201/created/failed/200'} # type: ignore async def _put200_acceptedcanceled200_initial( self, @@ -815,7 +895,6 @@ async def _put200_acceptedcanceled200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -840,11 +919,11 @@ async def _put200_acceptedcanceled200_initial( _put200_acceptedcanceled200_initial.metadata = {'url': '/lro/put/200/accepted/canceled/200'} # type: ignore @distributed_trace_async - async def put200_acceptedcanceled200( + 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’. @@ -852,12 +931,13 @@ async def put200_acceptedcanceled200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -866,11 +946,13 @@ async def put200_acceptedcanceled200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put200_acceptedcanceled200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put200_acceptedcanceled200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -885,8 +967,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put200_acceptedcanceled200.metadata = {'url': '/lro/put/200/accepted/canceled/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put200_acceptedcanceled200.metadata = {'url': '/lro/put/200/accepted/canceled/200'} # type: ignore async def _put_no_header_in_retry_initial( self, @@ -909,7 +999,6 @@ async def _put_no_header_in_retry_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -936,23 +1025,24 @@ async def _put_no_header_in_retry_initial( _put_no_header_in_retry_initial.metadata = {'url': '/lro/put/noheader/202/200'} # type: ignore @distributed_trace_async - async def put_no_header_in_retry( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -961,11 +1051,13 @@ async def put_no_header_in_retry( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_no_header_in_retry_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_no_header_in_retry_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -983,8 +1075,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_no_header_in_retry.metadata = {'url': '/lro/put/noheader/202/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_no_header_in_retry.metadata = {'url': '/lro/put/noheader/202/200'} # type: ignore async def _put_async_retry_succeeded_initial( self, @@ -1007,7 +1107,6 @@ async def _put_async_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1036,11 +1135,11 @@ async def _put_async_retry_succeeded_initial( _put_async_retry_succeeded_initial.metadata = {'url': '/lro/putasync/retry/succeeded'} # type: ignore @distributed_trace_async - async def put_async_retry_succeeded( + 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. @@ -1048,12 +1147,13 @@ async def put_async_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1062,11 +1162,13 @@ async def put_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1086,8 +1188,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_retry_succeeded.metadata = {'url': '/lro/putasync/retry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_retry_succeeded.metadata = {'url': '/lro/putasync/retry/succeeded'} # type: ignore async def _put_async_no_retry_succeeded_initial( self, @@ -1110,7 +1220,6 @@ async def _put_async_no_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1138,11 +1247,11 @@ async def _put_async_no_retry_succeeded_initial( _put_async_no_retry_succeeded_initial.metadata = {'url': '/lro/putasync/noretry/succeeded'} # type: ignore @distributed_trace_async - async def put_async_no_retry_succeeded( + 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. @@ -1150,12 +1259,13 @@ async def put_async_no_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1164,11 +1274,13 @@ async def put_async_no_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_no_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_no_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1187,8 +1299,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_no_retry_succeeded.metadata = {'url': '/lro/putasync/noretry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_no_retry_succeeded.metadata = {'url': '/lro/putasync/noretry/succeeded'} # type: ignore async def _put_async_retry_failed_initial( self, @@ -1211,7 +1331,6 @@ async def _put_async_retry_failed_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1240,11 +1359,11 @@ async def _put_async_retry_failed_initial( _put_async_retry_failed_initial.metadata = {'url': '/lro/putasync/retry/failed'} # type: ignore @distributed_trace_async - async def put_async_retry_failed( + 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. @@ -1252,12 +1371,13 @@ async def put_async_retry_failed( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1266,11 +1386,13 @@ async def put_async_retry_failed( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_retry_failed_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_retry_failed_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1290,8 +1412,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_retry_failed.metadata = {'url': '/lro/putasync/retry/failed'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_retry_failed.metadata = {'url': '/lro/putasync/retry/failed'} # type: ignore async def _put_async_no_retrycanceled_initial( self, @@ -1314,7 +1444,6 @@ async def _put_async_no_retrycanceled_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1342,11 +1471,11 @@ async def _put_async_no_retrycanceled_initial( _put_async_no_retrycanceled_initial.metadata = {'url': '/lro/putasync/noretry/canceled'} # type: ignore @distributed_trace_async - async def put_async_no_retrycanceled( + 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. @@ -1354,12 +1483,13 @@ async def put_async_no_retrycanceled( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1368,11 +1498,13 @@ async def put_async_no_retrycanceled( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_no_retrycanceled_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_no_retrycanceled_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1391,8 +1523,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_no_retrycanceled.metadata = {'url': '/lro/putasync/noretry/canceled'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_no_retrycanceled.metadata = {'url': '/lro/putasync/noretry/canceled'} # type: ignore async def _put_async_no_header_in_retry_initial( self, @@ -1415,7 +1555,6 @@ async def _put_async_no_header_in_retry_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1442,11 +1581,11 @@ async def _put_async_no_header_in_retry_initial( _put_async_no_header_in_retry_initial.metadata = {'url': '/lro/putasync/noheader/201/200'} # type: ignore @distributed_trace_async - async def put_async_no_header_in_retry( + 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. @@ -1454,12 +1593,13 @@ async def put_async_no_header_in_retry( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1468,11 +1608,13 @@ async def put_async_no_header_in_retry( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_no_header_in_retry_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_no_header_in_retry_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1490,8 +1632,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_no_header_in_retry.metadata = {'url': '/lro/putasync/noheader/201/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_no_header_in_retry.metadata = {'url': '/lro/putasync/noheader/201/200'} # type: ignore async def _put_non_resource_initial( self, @@ -1514,7 +1664,6 @@ async def _put_non_resource_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if sku is not None: body_content = self._serialize.body(sku, 'Sku') @@ -1539,22 +1688,23 @@ async def _put_non_resource_initial( _put_non_resource_initial.metadata = {'url': '/lro/putnonresource/202/200'} # type: ignore @distributed_trace_async - async def put_non_resource( + 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. :type sku: ~lro.models.Sku :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1563,11 +1713,13 @@ async def put_non_resource( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_non_resource_initial( - sku=sku, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_non_resource_initial( + sku=sku, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1582,8 +1734,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_non_resource.metadata = {'url': '/lro/putnonresource/202/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_non_resource.metadata = {'url': '/lro/putnonresource/202/200'} # type: ignore async def _put_async_non_resource_initial( self, @@ -1606,7 +1766,6 @@ async def _put_async_non_resource_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if sku is not None: body_content = self._serialize.body(sku, 'Sku') @@ -1631,22 +1790,23 @@ async def _put_async_non_resource_initial( _put_async_non_resource_initial.metadata = {'url': '/lro/putnonresourceasync/202/200'} # type: ignore @distributed_trace_async - async def put_async_non_resource( + 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. :type sku: ~lro.models.Sku :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1655,11 +1815,13 @@ async def put_async_non_resource( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_non_resource_initial( - sku=sku, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_non_resource_initial( + sku=sku, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1674,8 +1836,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_non_resource.metadata = {'url': '/lro/putnonresourceasync/202/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_non_resource.metadata = {'url': '/lro/putnonresourceasync/202/200'} # type: ignore async def _put_sub_resource_initial( self, @@ -1700,7 +1870,6 @@ async def _put_sub_resource_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if _product is not None: body_content = self._serialize.body(_product, 'SubProduct') @@ -1725,22 +1894,23 @@ async def _put_sub_resource_initial( _put_sub_resource_initial.metadata = {'url': '/lro/putsubresource/202/200'} # type: ignore @distributed_trace_async - async def put_sub_resource( + 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: :type provisioning_state: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1749,11 +1919,13 @@ async def put_sub_resource( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_sub_resource_initial( - provisioning_state=provisioning_state, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_sub_resource_initial( + provisioning_state=provisioning_state, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1768,8 +1940,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_sub_resource.metadata = {'url': '/lro/putsubresource/202/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_sub_resource.metadata = {'url': '/lro/putsubresource/202/200'} # type: ignore async def _put_async_sub_resource_initial( self, @@ -1794,7 +1974,6 @@ async def _put_async_sub_resource_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if _product is not None: body_content = self._serialize.body(_product, 'SubProduct') @@ -1819,22 +1998,23 @@ async def _put_async_sub_resource_initial( _put_async_sub_resource_initial.metadata = {'url': '/lro/putsubresourceasync/202/200'} # type: ignore @distributed_trace_async - async def put_async_sub_resource( + 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: :type provisioning_state: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1843,11 +2023,13 @@ async def put_async_sub_resource( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_sub_resource_initial( - provisioning_state=provisioning_state, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_sub_resource_initial( + provisioning_state=provisioning_state, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1862,8 +2044,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_sub_resource.metadata = {'url': '/lro/putsubresourceasync/202/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_sub_resource.metadata = {'url': '/lro/putsubresourceasync/202/200'} # type: ignore async def _delete_provisioning202_accepted200_succeeded_initial( self, @@ -1883,7 +2073,6 @@ async def _delete_provisioning202_accepted200_succeeded_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1908,21 +2097,22 @@ async def _delete_provisioning202_accepted200_succeeded_initial( _delete_provisioning202_accepted200_succeeded_initial.metadata = {'url': '/lro/delete/provisioning/202/accepted/200/succeeded'} # type: ignore @distributed_trace_async - async def delete_provisioning202_accepted200_succeeded( + 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’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1931,10 +2121,12 @@ async def delete_provisioning202_accepted200_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_provisioning202_accepted200_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_provisioning202_accepted200_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1953,8 +2145,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/delete/provisioning/202/accepted/200/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/delete/provisioning/202/accepted/200/succeeded'} # type: ignore async def _delete_provisioning202_deleting_failed200_initial( self, @@ -1974,7 +2174,6 @@ async def _delete_provisioning202_deleting_failed200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1999,21 +2198,22 @@ async def _delete_provisioning202_deleting_failed200_initial( _delete_provisioning202_deleting_failed200_initial.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/failed'} # type: ignore @distributed_trace_async - async def delete_provisioning202_deleting_failed200( + 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’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2022,10 +2222,12 @@ async def delete_provisioning202_deleting_failed200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_provisioning202_deleting_failed200_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_provisioning202_deleting_failed200_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2044,8 +2246,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_provisioning202_deleting_failed200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/failed'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_provisioning202_deleting_failed200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/failed'} # type: ignore async def _delete_provisioning202_deletingcanceled200_initial( self, @@ -2065,7 +2275,6 @@ async def _delete_provisioning202_deletingcanceled200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2090,21 +2299,22 @@ async def _delete_provisioning202_deletingcanceled200_initial( _delete_provisioning202_deletingcanceled200_initial.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/canceled'} # type: ignore @distributed_trace_async - async def delete_provisioning202_deletingcanceled200( + 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’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2113,10 +2323,12 @@ async def delete_provisioning202_deletingcanceled200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_provisioning202_deletingcanceled200_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_provisioning202_deletingcanceled200_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2135,8 +2347,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_provisioning202_deletingcanceled200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/canceled'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_provisioning202_deletingcanceled200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/canceled'} # type: ignore async def _delete204_succeeded_initial( self, @@ -2155,7 +2375,6 @@ async def _delete204_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2170,19 +2389,20 @@ async def _delete204_succeeded_initial( _delete204_succeeded_initial.metadata = {'url': '/lro/delete/204/succeeded'} # type: ignore @distributed_trace_async - async def delete204_succeeded( + 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2191,10 +2411,12 @@ async def delete204_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete204_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2206,8 +2428,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete204_succeeded.metadata = {'url': '/lro/delete/204/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete204_succeeded.metadata = {'url': '/lro/delete/204/succeeded'} # type: ignore async def _delete202_retry200_initial( self, @@ -2227,7 +2457,6 @@ async def _delete202_retry200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2252,20 +2481,21 @@ async def _delete202_retry200_initial( _delete202_retry200_initial.metadata = {'url': '/lro/delete/202/retry/200'} # type: ignore @distributed_trace_async - async def delete202_retry200( + 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’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2274,10 +2504,12 @@ async def delete202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete202_retry200_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2292,8 +2524,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete202_retry200.metadata = {'url': '/lro/delete/202/retry/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete202_retry200.metadata = {'url': '/lro/delete/202/retry/200'} # type: ignore async def _delete202_no_retry204_initial( self, @@ -2313,7 +2553,6 @@ async def _delete202_no_retry204_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2338,20 +2577,21 @@ async def _delete202_no_retry204_initial( _delete202_no_retry204_initial.metadata = {'url': '/lro/delete/202/noretry/204'} # type: ignore @distributed_trace_async - async def delete202_no_retry204( + 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’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2360,10 +2600,12 @@ async def delete202_no_retry204( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete202_no_retry204_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete202_no_retry204_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2378,8 +2620,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete202_no_retry204.metadata = {'url': '/lro/delete/202/noretry/204'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete202_no_retry204.metadata = {'url': '/lro/delete/202/noretry/204'} # type: ignore async def _delete_no_header_in_retry_initial( self, @@ -2398,7 +2648,6 @@ async def _delete_no_header_in_retry_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2417,20 +2666,21 @@ async def _delete_no_header_in_retry_initial( _delete_no_header_in_retry_initial.metadata = {'url': '/lro/delete/noheader'} # type: ignore @distributed_trace_async - async def delete_no_header_in_retry( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2439,10 +2689,12 @@ async def delete_no_header_in_retry( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_no_header_in_retry_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2454,8 +2706,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_no_header_in_retry.metadata = {'url': '/lro/delete/noheader'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_no_header_in_retry.metadata = {'url': '/lro/delete/noheader'} # type: ignore async def _delete_async_no_header_in_retry_initial( self, @@ -2474,7 +2734,6 @@ async def _delete_async_no_header_in_retry_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2493,20 +2752,21 @@ async def _delete_async_no_header_in_retry_initial( _delete_async_no_header_in_retry_initial.metadata = {'url': '/lro/deleteasync/noheader/202/204'} # type: ignore @distributed_trace_async - async def delete_async_no_header_in_retry( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2515,10 +2775,12 @@ async def delete_async_no_header_in_retry( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_no_header_in_retry_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2530,8 +2792,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_no_header_in_retry.metadata = {'url': '/lro/deleteasync/noheader/202/204'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_no_header_in_retry.metadata = {'url': '/lro/deleteasync/noheader/202/204'} # type: ignore async def _delete_async_retry_succeeded_initial( self, @@ -2550,7 +2820,6 @@ async def _delete_async_retry_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2570,20 +2839,21 @@ async def _delete_async_retry_succeeded_initial( _delete_async_retry_succeeded_initial.metadata = {'url': '/lro/deleteasync/retry/succeeded'} # type: ignore @distributed_trace_async - async def delete_async_retry_succeeded( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2592,10 +2862,12 @@ async def delete_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_retry_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2607,8 +2879,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_retry_succeeded.metadata = {'url': '/lro/deleteasync/retry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_retry_succeeded.metadata = {'url': '/lro/deleteasync/retry/succeeded'} # type: ignore async def _delete_async_no_retry_succeeded_initial( self, @@ -2627,7 +2907,6 @@ async def _delete_async_no_retry_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2647,20 +2926,21 @@ async def _delete_async_no_retry_succeeded_initial( _delete_async_no_retry_succeeded_initial.metadata = {'url': '/lro/deleteasync/noretry/succeeded'} # type: ignore @distributed_trace_async - async def delete_async_no_retry_succeeded( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2669,10 +2949,12 @@ async def delete_async_no_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_no_retry_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_no_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2684,8 +2966,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_no_retry_succeeded.metadata = {'url': '/lro/deleteasync/noretry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_no_retry_succeeded.metadata = {'url': '/lro/deleteasync/noretry/succeeded'} # type: ignore async def _delete_async_retry_failed_initial( self, @@ -2704,7 +2994,6 @@ async def _delete_async_retry_failed_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2724,20 +3013,21 @@ async def _delete_async_retry_failed_initial( _delete_async_retry_failed_initial.metadata = {'url': '/lro/deleteasync/retry/failed'} # type: ignore @distributed_trace_async - async def delete_async_retry_failed( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2746,10 +3036,12 @@ async def delete_async_retry_failed( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_retry_failed_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_retry_failed_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2761,8 +3053,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_retry_failed.metadata = {'url': '/lro/deleteasync/retry/failed'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_retry_failed.metadata = {'url': '/lro/deleteasync/retry/failed'} # type: ignore async def _delete_async_retrycanceled_initial( self, @@ -2781,7 +3081,6 @@ async def _delete_async_retrycanceled_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2801,20 +3100,21 @@ async def _delete_async_retrycanceled_initial( _delete_async_retrycanceled_initial.metadata = {'url': '/lro/deleteasync/retry/canceled'} # type: ignore @distributed_trace_async - async def delete_async_retrycanceled( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2823,10 +3123,12 @@ async def delete_async_retrycanceled( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_retrycanceled_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_retrycanceled_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2838,8 +3140,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_retrycanceled.metadata = {'url': '/lro/deleteasync/retry/canceled'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_retrycanceled.metadata = {'url': '/lro/deleteasync/retry/canceled'} # type: ignore async def _post200_with_payload_initial( self, @@ -2859,7 +3169,6 @@ async def _post200_with_payload_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2881,20 +3190,21 @@ async def _post200_with_payload_initial( _post200_with_payload_initial.metadata = {'url': '/lro/post/payload/200'} # type: ignore @distributed_trace_async - async def post200_with_payload( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2903,10 +3213,12 @@ async def post200_with_payload( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post200_with_payload_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post200_with_payload_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2921,8 +3233,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post200_with_payload.metadata = {'url': '/lro/post/payload/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post200_with_payload.metadata = {'url': '/lro/post/payload/200'} # type: ignore async def _post202_retry200_initial( self, @@ -2944,7 +3264,6 @@ async def _post202_retry200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -2970,23 +3289,24 @@ async def _post202_retry200_initial( _post202_retry200_initial.metadata = {'url': '/lro/post/202/retry/200'} # type: ignore @distributed_trace_async - async def post202_retry200( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2995,11 +3315,13 @@ async def post202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post202_retry200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post202_retry200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3011,8 +3333,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post202_retry200.metadata = {'url': '/lro/post/202/retry/200'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post202_retry200.metadata = {'url': '/lro/post/202/retry/200'} # type: ignore async def _post202_no_retry204_initial( self, @@ -3035,7 +3365,6 @@ async def _post202_no_retry204_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3063,23 +3392,24 @@ async def _post202_no_retry204_initial( _post202_no_retry204_initial.metadata = {'url': '/lro/post/202/noretry/204'} # type: ignore @distributed_trace_async - async def post202_no_retry204( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -3088,11 +3418,13 @@ async def post202_no_retry204( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post202_no_retry204_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post202_no_retry204_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3111,8 +3443,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post202_no_retry204.metadata = {'url': '/lro/post/202/noretry/204'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post202_no_retry204.metadata = {'url': '/lro/post/202/noretry/204'} # type: ignore async def _post_double_headers_final_location_get_initial( self, @@ -3132,7 +3472,6 @@ async def _post_double_headers_final_location_get_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3150,21 +3489,22 @@ async def _post_double_headers_final_location_get_initial( _post_double_headers_final_location_get_initial.metadata = {'url': '/lro/LROPostDoubleHeadersFinalLocationGet'} # type: ignore @distributed_trace_async - async def post_double_headers_final_location_get( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -3173,10 +3513,12 @@ async def post_double_headers_final_location_get( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_double_headers_final_location_get_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_double_headers_final_location_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3191,8 +3533,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_double_headers_final_location_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalLocationGet'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_double_headers_final_location_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalLocationGet'} # type: ignore async def _post_double_headers_final_azure_header_get_initial( self, @@ -3212,7 +3562,6 @@ async def _post_double_headers_final_azure_header_get_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3230,21 +3579,22 @@ async def _post_double_headers_final_azure_header_get_initial( _post_double_headers_final_azure_header_get_initial.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGet'} # type: ignore @distributed_trace_async - async def post_double_headers_final_azure_header_get( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -3253,10 +3603,12 @@ async def post_double_headers_final_azure_header_get( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_double_headers_final_azure_header_get_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_double_headers_final_azure_header_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3271,8 +3623,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_double_headers_final_azure_header_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGet'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_double_headers_final_azure_header_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGet'} # type: ignore async def _post_double_headers_final_azure_header_get_default_initial( self, @@ -3292,7 +3652,6 @@ async def _post_double_headers_final_azure_header_get_default_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3310,21 +3669,22 @@ async def _post_double_headers_final_azure_header_get_default_initial( _post_double_headers_final_azure_header_get_default_initial.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault'} # type: ignore @distributed_trace_async - async def post_double_headers_final_azure_header_get_default( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -3333,10 +3693,12 @@ async def post_double_headers_final_azure_header_get_default( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_double_headers_final_azure_header_get_default_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_double_headers_final_azure_header_get_default_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3351,8 +3713,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_double_headers_final_azure_header_get_default.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_double_headers_final_azure_header_get_default.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault'} # type: ignore async def _post_async_retry_succeeded_initial( self, @@ -3375,7 +3745,6 @@ async def _post_async_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3408,11 +3777,11 @@ async def _post_async_retry_succeeded_initial( _post_async_retry_succeeded_initial.metadata = {'url': '/lro/postasync/retry/succeeded'} # type: ignore @distributed_trace_async - async def post_async_retry_succeeded( + 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. @@ -3420,12 +3789,13 @@ async def post_async_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -3434,11 +3804,13 @@ async def post_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3453,8 +3825,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_retry_succeeded.metadata = {'url': '/lro/postasync/retry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_retry_succeeded.metadata = {'url': '/lro/postasync/retry/succeeded'} # type: ignore async def _post_async_no_retry_succeeded_initial( self, @@ -3477,7 +3857,6 @@ async def _post_async_no_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3510,11 +3889,11 @@ async def _post_async_no_retry_succeeded_initial( _post_async_no_retry_succeeded_initial.metadata = {'url': '/lro/postasync/noretry/succeeded'} # type: ignore @distributed_trace_async - async def post_async_no_retry_succeeded( + 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. @@ -3522,12 +3901,13 @@ async def post_async_no_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -3536,11 +3916,13 @@ async def post_async_no_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_no_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_no_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3555,8 +3937,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_no_retry_succeeded.metadata = {'url': '/lro/postasync/noretry/succeeded'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_no_retry_succeeded.metadata = {'url': '/lro/postasync/noretry/succeeded'} # type: ignore async def _post_async_retry_failed_initial( self, @@ -3578,7 +3968,6 @@ async def _post_async_retry_failed_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3605,11 +3994,11 @@ async def _post_async_retry_failed_initial( _post_async_retry_failed_initial.metadata = {'url': '/lro/postasync/retry/failed'} # type: ignore @distributed_trace_async - async def post_async_retry_failed( + 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. @@ -3617,12 +4006,13 @@ async def post_async_retry_failed( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -3631,11 +4021,13 @@ async def post_async_retry_failed( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_retry_failed_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_retry_failed_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3647,8 +4039,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_retry_failed.metadata = {'url': '/lro/postasync/retry/failed'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_retry_failed.metadata = {'url': '/lro/postasync/retry/failed'} # type: ignore async def _post_async_retrycanceled_initial( self, @@ -3670,7 +4070,6 @@ async def _post_async_retrycanceled_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3697,11 +4096,11 @@ async def _post_async_retrycanceled_initial( _post_async_retrycanceled_initial.metadata = {'url': '/lro/postasync/retry/canceled'} # type: ignore @distributed_trace_async - async def post_async_retrycanceled( + 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. @@ -3709,12 +4108,13 @@ async def post_async_retrycanceled( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -3723,11 +4123,13 @@ async def post_async_retrycanceled( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_retrycanceled_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_retrycanceled_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3739,5 +4141,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_retrycanceled.metadata = {'url': '/lro/postasync/retry/canceled'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_retrycanceled.metadata = {'url': '/lro/postasync/retry/canceled'} # type: ignore 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 0c4291750a7..9000cd0dcbc 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -64,7 +64,6 @@ async def _put_non_retry400_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -93,22 +92,23 @@ async def _put_non_retry400_initial( _put_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/put/400'} # type: ignore @distributed_trace_async - async def put_non_retry400( + 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. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -117,11 +117,13 @@ async def put_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_non_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_non_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -136,8 +138,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_non_retry400.metadata = {'url': '/lro/nonretryerror/put/400'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_non_retry400.metadata = {'url': '/lro/nonretryerror/put/400'} # type: ignore async def _put_non_retry201_creating400_initial( self, @@ -160,7 +170,6 @@ async def _put_non_retry201_creating400_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -189,23 +198,24 @@ async def _put_non_retry201_creating400_initial( _put_non_retry201_creating400_initial.metadata = {'url': '/lro/nonretryerror/put/201/creating/400'} # type: ignore @distributed_trace_async - async def put_non_retry201_creating400( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -214,11 +224,13 @@ async def put_non_retry201_creating400( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_non_retry201_creating400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_non_retry201_creating400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -233,8 +245,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_non_retry201_creating400.metadata = {'url': '/lro/nonretryerror/put/201/creating/400'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_non_retry201_creating400.metadata = {'url': '/lro/nonretryerror/put/201/creating/400'} # type: ignore async def _put_non_retry201_creating400_invalid_json_initial( self, @@ -257,7 +277,6 @@ async def _put_non_retry201_creating400_invalid_json_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -286,23 +305,24 @@ async def _put_non_retry201_creating400_invalid_json_initial( _put_non_retry201_creating400_invalid_json_initial.metadata = {'url': '/lro/nonretryerror/put/201/creating/400/invalidjson'} # type: ignore @distributed_trace_async - async def put_non_retry201_creating400_invalid_json( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -311,11 +331,13 @@ async def put_non_retry201_creating400_invalid_json( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_non_retry201_creating400_invalid_json_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_non_retry201_creating400_invalid_json_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -330,8 +352,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_non_retry201_creating400_invalid_json.metadata = {'url': '/lro/nonretryerror/put/201/creating/400/invalidjson'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_non_retry201_creating400_invalid_json.metadata = {'url': '/lro/nonretryerror/put/201/creating/400/invalidjson'} # type: ignore async def _put_async_relative_retry400_initial( self, @@ -354,7 +384,6 @@ async def _put_async_relative_retry400_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -383,23 +412,24 @@ async def _put_async_relative_retry400_initial( _put_async_relative_retry400_initial.metadata = {'url': '/lro/nonretryerror/putasync/retry/400'} # type: ignore @distributed_trace_async - async def put_async_relative_retry400( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -408,11 +438,13 @@ async def put_async_relative_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_relative_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_relative_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -432,8 +464,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/putasync/retry/400'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/putasync/retry/400'} # type: ignore async def _delete_non_retry400_initial( self, @@ -452,7 +492,6 @@ async def _delete_non_retry400_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -471,19 +510,20 @@ async def _delete_non_retry400_initial( _delete_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/delete/400'} # type: ignore @distributed_trace_async - async def delete_non_retry400( + 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -492,10 +532,12 @@ async def delete_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_non_retry400_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -507,8 +549,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/400'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/400'} # type: ignore async def _delete202_non_retry400_initial( self, @@ -527,7 +577,6 @@ async def _delete202_non_retry400_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -546,19 +595,20 @@ async def _delete202_non_retry400_initial( _delete202_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/delete/202/retry/400'} # type: ignore @distributed_trace_async - async def delete202_non_retry400( + 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -567,10 +617,12 @@ async def delete202_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete202_non_retry400_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete202_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -582,8 +634,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete202_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/202/retry/400'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete202_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/202/retry/400'} # type: ignore async def _delete_async_relative_retry400_initial( self, @@ -602,7 +662,6 @@ async def _delete_async_relative_retry400_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -622,20 +681,21 @@ async def _delete_async_relative_retry400_initial( _delete_async_relative_retry400_initial.metadata = {'url': '/lro/nonretryerror/deleteasync/retry/400'} # type: ignore @distributed_trace_async - async def delete_async_relative_retry400( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -644,10 +704,12 @@ async def delete_async_relative_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_relative_retry400_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_relative_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -659,8 +721,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/deleteasync/retry/400'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/deleteasync/retry/400'} # type: ignore async def _post_non_retry400_initial( self, @@ -682,7 +752,6 @@ async def _post_non_retry400_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -708,22 +777,23 @@ async def _post_non_retry400_initial( _post_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/post/400'} # type: ignore @distributed_trace_async - async def post_non_retry400( + 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. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -732,11 +802,13 @@ async def post_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_non_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_non_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -748,8 +820,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_non_retry400.metadata = {'url': '/lro/nonretryerror/post/400'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_non_retry400.metadata = {'url': '/lro/nonretryerror/post/400'} # type: ignore async def _post202_non_retry400_initial( self, @@ -771,7 +851,6 @@ async def _post202_non_retry400_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -797,22 +876,23 @@ async def _post202_non_retry400_initial( _post202_non_retry400_initial.metadata = {'url': '/lro/nonretryerror/post/202/retry/400'} # type: ignore @distributed_trace_async - async def post202_non_retry400( + 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. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -821,11 +901,13 @@ async def post202_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post202_non_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post202_non_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -837,8 +919,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post202_non_retry400.metadata = {'url': '/lro/nonretryerror/post/202/retry/400'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post202_non_retry400.metadata = {'url': '/lro/nonretryerror/post/202/retry/400'} # type: ignore async def _post_async_relative_retry400_initial( self, @@ -860,7 +950,6 @@ async def _post_async_relative_retry400_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -887,23 +976,24 @@ async def _post_async_relative_retry400_initial( _post_async_relative_retry400_initial.metadata = {'url': '/lro/nonretryerror/postasync/retry/400'} # type: ignore @distributed_trace_async - async def post_async_relative_retry400( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -912,11 +1002,13 @@ async def post_async_relative_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_relative_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_relative_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -928,8 +1020,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/postasync/retry/400'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/postasync/retry/400'} # type: ignore async def _put_error201_no_provisioning_state_payload_initial( self, @@ -952,7 +1052,6 @@ async def _put_error201_no_provisioning_state_payload_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -981,22 +1080,23 @@ async def _put_error201_no_provisioning_state_payload_initial( _put_error201_no_provisioning_state_payload_initial.metadata = {'url': '/lro/error/put/201/noprovisioningstatepayload'} # type: ignore @distributed_trace_async - async def put_error201_no_provisioning_state_payload( + 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. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1005,11 +1105,13 @@ async def put_error201_no_provisioning_state_payload( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_error201_no_provisioning_state_payload_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_error201_no_provisioning_state_payload_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1024,8 +1126,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_error201_no_provisioning_state_payload.metadata = {'url': '/lro/error/put/201/noprovisioningstatepayload'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_error201_no_provisioning_state_payload.metadata = {'url': '/lro/error/put/201/noprovisioningstatepayload'} # type: ignore async def _put_async_relative_retry_no_status_initial( self, @@ -1048,7 +1158,6 @@ async def _put_async_relative_retry_no_status_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1077,11 +1186,11 @@ async def _put_async_relative_retry_no_status_initial( _put_async_relative_retry_no_status_initial.metadata = {'url': '/lro/error/putasync/retry/nostatus'} # type: ignore @distributed_trace_async - async def put_async_relative_retry_no_status( + 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. @@ -1089,12 +1198,13 @@ async def put_async_relative_retry_no_status( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1103,11 +1213,13 @@ async def put_async_relative_retry_no_status( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_relative_retry_no_status_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_relative_retry_no_status_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1127,8 +1239,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_relative_retry_no_status.metadata = {'url': '/lro/error/putasync/retry/nostatus'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_relative_retry_no_status.metadata = {'url': '/lro/error/putasync/retry/nostatus'} # type: ignore async def _put_async_relative_retry_no_status_payload_initial( self, @@ -1151,7 +1271,6 @@ async def _put_async_relative_retry_no_status_payload_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1180,11 +1299,11 @@ async def _put_async_relative_retry_no_status_payload_initial( _put_async_relative_retry_no_status_payload_initial.metadata = {'url': '/lro/error/putasync/retry/nostatuspayload'} # type: ignore @distributed_trace_async - async def put_async_relative_retry_no_status_payload( + 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. @@ -1192,12 +1311,13 @@ async def put_async_relative_retry_no_status_payload( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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,11 +1326,13 @@ async def put_async_relative_retry_no_status_payload( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_relative_retry_no_status_payload_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_relative_retry_no_status_payload_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1230,8 +1352,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_relative_retry_no_status_payload.metadata = {'url': '/lro/error/putasync/retry/nostatuspayload'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_relative_retry_no_status_payload.metadata = {'url': '/lro/error/putasync/retry/nostatuspayload'} # type: ignore async def _delete204_succeeded_initial( self, @@ -1250,7 +1380,6 @@ async def _delete204_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1265,19 +1394,20 @@ async def _delete204_succeeded_initial( _delete204_succeeded_initial.metadata = {'url': '/lro/error/delete/204/nolocation'} # type: ignore @distributed_trace_async - async def delete204_succeeded( + 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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1286,10 +1416,12 @@ async def delete204_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete204_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1301,8 +1433,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete204_succeeded.metadata = {'url': '/lro/error/delete/204/nolocation'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete204_succeeded.metadata = {'url': '/lro/error/delete/204/nolocation'} # type: ignore async def _delete_async_relative_retry_no_status_initial( self, @@ -1321,7 +1461,6 @@ async def _delete_async_relative_retry_no_status_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1341,20 +1480,21 @@ async def _delete_async_relative_retry_no_status_initial( _delete_async_relative_retry_no_status_initial.metadata = {'url': '/lro/error/deleteasync/retry/nostatus'} # type: ignore @distributed_trace_async - async def delete_async_relative_retry_no_status( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1363,10 +1503,12 @@ async def delete_async_relative_retry_no_status( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_relative_retry_no_status_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_relative_retry_no_status_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1378,8 +1520,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_relative_retry_no_status.metadata = {'url': '/lro/error/deleteasync/retry/nostatus'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_relative_retry_no_status.metadata = {'url': '/lro/error/deleteasync/retry/nostatus'} # type: ignore async def _post202_no_location_initial( self, @@ -1401,7 +1551,6 @@ async def _post202_no_location_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1427,23 +1576,24 @@ async def _post202_no_location_initial( _post202_no_location_initial.metadata = {'url': '/lro/error/post/202/nolocation'} # type: ignore @distributed_trace_async - async def post202_no_location( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1452,11 +1602,13 @@ async def post202_no_location( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post202_no_location_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post202_no_location_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1468,8 +1620,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post202_no_location.metadata = {'url': '/lro/error/post/202/nolocation'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post202_no_location.metadata = {'url': '/lro/error/post/202/nolocation'} # type: ignore async def _post_async_relative_retry_no_payload_initial( self, @@ -1491,7 +1651,6 @@ async def _post_async_relative_retry_no_payload_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1518,11 +1677,11 @@ async def _post_async_relative_retry_no_payload_initial( _post_async_relative_retry_no_payload_initial.metadata = {'url': '/lro/error/postasync/retry/nopayload'} # type: ignore @distributed_trace_async - async def post_async_relative_retry_no_payload( + 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. @@ -1530,12 +1689,13 @@ async def post_async_relative_retry_no_payload( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1544,11 +1704,13 @@ async def post_async_relative_retry_no_payload( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_relative_retry_no_payload_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_relative_retry_no_payload_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1560,8 +1722,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_relative_retry_no_payload.metadata = {'url': '/lro/error/postasync/retry/nopayload'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_relative_retry_no_payload.metadata = {'url': '/lro/error/postasync/retry/nopayload'} # type: ignore async def _put200_invalid_json_initial( self, @@ -1584,7 +1754,6 @@ async def _put200_invalid_json_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1611,23 +1780,24 @@ async def _put200_invalid_json_initial( _put200_invalid_json_initial.metadata = {'url': '/lro/error/put/200/invalidjson'} # type: ignore @distributed_trace_async - async def put200_invalid_json( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1636,11 +1806,13 @@ async def put200_invalid_json( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put200_invalid_json_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put200_invalid_json_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1655,8 +1827,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put200_invalid_json.metadata = {'url': '/lro/error/put/200/invalidjson'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put200_invalid_json.metadata = {'url': '/lro/error/put/200/invalidjson'} # type: ignore async def _put_async_relative_retry_invalid_header_initial( self, @@ -1679,7 +1859,6 @@ async def _put_async_relative_retry_invalid_header_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1708,11 +1887,11 @@ async def _put_async_relative_retry_invalid_header_initial( _put_async_relative_retry_invalid_header_initial.metadata = {'url': '/lro/error/putasync/retry/invalidheader'} # type: ignore @distributed_trace_async - async def put_async_relative_retry_invalid_header( + 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. @@ -1720,12 +1899,13 @@ async def put_async_relative_retry_invalid_header( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1734,11 +1914,13 @@ async def put_async_relative_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_relative_retry_invalid_header_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_relative_retry_invalid_header_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1758,8 +1940,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/putasync/retry/invalidheader'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/putasync/retry/invalidheader'} # type: ignore async def _put_async_relative_retry_invalid_json_polling_initial( self, @@ -1782,7 +1972,6 @@ async def _put_async_relative_retry_invalid_json_polling_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1811,11 +2000,11 @@ async def _put_async_relative_retry_invalid_json_polling_initial( _put_async_relative_retry_invalid_json_polling_initial.metadata = {'url': '/lro/error/putasync/retry/invalidjsonpolling'} # type: ignore @distributed_trace_async - async def put_async_relative_retry_invalid_json_polling( + 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. @@ -1823,12 +2012,13 @@ async def put_async_relative_retry_invalid_json_polling( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1837,11 +2027,13 @@ async def put_async_relative_retry_invalid_json_polling( 'polling_interval', self._config.polling_interval ) - raw_result = await self._put_async_relative_retry_invalid_json_polling_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._put_async_relative_retry_invalid_json_polling_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1861,8 +2053,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - put_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/putasync/retry/invalidjsonpolling'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/putasync/retry/invalidjsonpolling'} # type: ignore async def _delete202_retry_invalid_header_initial( self, @@ -1881,7 +2081,6 @@ async def _delete202_retry_invalid_header_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1900,20 +2099,21 @@ async def _delete202_retry_invalid_header_initial( _delete202_retry_invalid_header_initial.metadata = {'url': '/lro/error/delete/202/retry/invalidheader'} # type: ignore @distributed_trace_async - async def delete202_retry_invalid_header( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1922,10 +2122,12 @@ async def delete202_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete202_retry_invalid_header_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete202_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1937,8 +2139,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete202_retry_invalid_header.metadata = {'url': '/lro/error/delete/202/retry/invalidheader'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete202_retry_invalid_header.metadata = {'url': '/lro/error/delete/202/retry/invalidheader'} # type: ignore async def _delete_async_relative_retry_invalid_header_initial( self, @@ -1957,7 +2167,6 @@ async def _delete_async_relative_retry_invalid_header_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1977,20 +2186,21 @@ async def _delete_async_relative_retry_invalid_header_initial( _delete_async_relative_retry_invalid_header_initial.metadata = {'url': '/lro/error/deleteasync/retry/invalidheader'} # type: ignore @distributed_trace_async - async def delete_async_relative_retry_invalid_header( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1999,10 +2209,12 @@ async def delete_async_relative_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_relative_retry_invalid_header_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_relative_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2014,8 +2226,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/deleteasync/retry/invalidheader'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/deleteasync/retry/invalidheader'} # type: ignore async def _delete_async_relative_retry_invalid_json_polling_initial( self, @@ -2034,7 +2254,6 @@ async def _delete_async_relative_retry_invalid_json_polling_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2054,20 +2273,21 @@ async def _delete_async_relative_retry_invalid_json_polling_initial( _delete_async_relative_retry_invalid_json_polling_initial.metadata = {'url': '/lro/error/deleteasync/retry/invalidjsonpolling'} # type: ignore @distributed_trace_async - async def delete_async_relative_retry_invalid_json_polling( + 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. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2076,10 +2296,12 @@ async def delete_async_relative_retry_invalid_json_polling( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_async_relative_retry_invalid_json_polling_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_async_relative_retry_invalid_json_polling_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2091,8 +2313,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/deleteasync/retry/invalidjsonpolling'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/deleteasync/retry/invalidjsonpolling'} # type: ignore async def _post202_retry_invalid_header_initial( self, @@ -2114,7 +2344,6 @@ async def _post202_retry_invalid_header_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -2140,23 +2369,24 @@ async def _post202_retry_invalid_header_initial( _post202_retry_invalid_header_initial.metadata = {'url': '/lro/error/post/202/retry/invalidheader'} # type: ignore @distributed_trace_async - async def post202_retry_invalid_header( + 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. :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2165,11 +2395,13 @@ async def post202_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post202_retry_invalid_header_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post202_retry_invalid_header_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2181,8 +2413,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post202_retry_invalid_header.metadata = {'url': '/lro/error/post/202/retry/invalidheader'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post202_retry_invalid_header.metadata = {'url': '/lro/error/post/202/retry/invalidheader'} # type: ignore async def _post_async_relative_retry_invalid_header_initial( self, @@ -2204,7 +2444,6 @@ async def _post_async_relative_retry_invalid_header_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -2231,11 +2470,11 @@ async def _post_async_relative_retry_invalid_header_initial( _post_async_relative_retry_invalid_header_initial.metadata = {'url': '/lro/error/postasync/retry/invalidheader'} # type: ignore @distributed_trace_async - async def post_async_relative_retry_invalid_header( + 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. @@ -2243,12 +2482,13 @@ async def post_async_relative_retry_invalid_header( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2257,11 +2497,13 @@ async def post_async_relative_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_relative_retry_invalid_header_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_relative_retry_invalid_header_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2273,8 +2515,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/postasync/retry/invalidheader'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/postasync/retry/invalidheader'} # type: ignore async def _post_async_relative_retry_invalid_json_polling_initial( self, @@ -2296,7 +2546,6 @@ async def _post_async_relative_retry_invalid_json_polling_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -2323,11 +2572,11 @@ async def _post_async_relative_retry_invalid_json_polling_initial( _post_async_relative_retry_invalid_json_polling_initial.metadata = {'url': '/lro/error/postasync/retry/invalidjsonpolling'} # type: ignore @distributed_trace_async - async def post_async_relative_retry_invalid_json_polling( + 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. @@ -2335,12 +2584,13 @@ async def post_async_relative_retry_invalid_json_polling( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -2349,11 +2599,13 @@ async def post_async_relative_retry_invalid_json_polling( 'polling_interval', self._config.polling_interval ) - raw_result = await self._post_async_relative_retry_invalid_json_polling_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._post_async_relative_retry_invalid_json_polling_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2365,5 +2617,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - post_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/postasync/retry/invalidjsonpolling'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_post_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/postasync/retry/invalidjsonpolling'} # type: ignore 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 cc607e6c58e..2ecf075215d 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 @@ -69,7 +69,6 @@ def _put_async_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -112,6 +111,7 @@ def begin_put_async_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -126,11 +126,13 @@ def begin_put_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -150,7 +152,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_retry_succeeded.metadata = {'url': '/lro/customheader/putasync/retry/succeeded'} # type: ignore def _put201_creating_succeeded200_initial( @@ -175,7 +185,6 @@ def _put201_creating_succeeded200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -218,6 +227,7 @@ def begin_put201_creating_succeeded200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -232,11 +242,13 @@ def begin_put201_creating_succeeded200( 'polling_interval', self._config.polling_interval ) - raw_result = self._put201_creating_succeeded200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put201_creating_succeeded200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -251,7 +263,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put201_creating_succeeded200.metadata = {'url': '/lro/customheader/put/201/creating/succeeded/200'} # type: ignore def _post202_retry200_initial( @@ -275,7 +295,6 @@ def _post202_retry200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -314,6 +333,7 @@ def begin_post202_retry200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -328,11 +348,13 @@ def begin_post202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = self._post202_retry200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post202_retry200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -344,7 +366,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post202_retry200.metadata = {'url': '/lro/customheader/post/202/retry/200'} # type: ignore def _post_async_retry_succeeded_initial( @@ -368,7 +398,6 @@ def _post_async_retry_succeeded_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -409,6 +438,7 @@ def begin_post_async_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -423,11 +453,13 @@ def begin_post_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -439,5 +471,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_retry_succeeded.metadata = {'url': '/lro/customheader/postasync/retry/succeeded'} # type: ignore 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 3cda372f659..cc6fbdcfcbb 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 @@ -69,7 +69,6 @@ def _put201_creating_succeeded200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -111,6 +110,7 @@ def begin_put201_creating_succeeded200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -125,11 +125,13 @@ def begin_put201_creating_succeeded200( 'polling_interval', self._config.polling_interval ) - raw_result = self._put201_creating_succeeded200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put201_creating_succeeded200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -144,7 +146,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put201_creating_succeeded200.metadata = {'url': '/lro/retryerror/put/201/creating/succeeded/200'} # type: ignore def _put_async_relative_retry_succeeded_initial( @@ -169,7 +179,6 @@ def _put_async_relative_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -211,6 +220,7 @@ def begin_put_async_relative_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -225,11 +235,13 @@ def begin_put_async_relative_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_relative_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_relative_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -249,7 +261,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/putasync/retry/succeeded'} # type: ignore def _delete_provisioning202_accepted200_succeeded_initial( @@ -271,7 +291,6 @@ def _delete_provisioning202_accepted200_succeeded_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,6 +325,7 @@ def begin_delete_provisioning202_accepted200_succeeded( returns a ‘200’ with ProvisioningState=’Succeeded’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -320,10 +340,12 @@ def begin_delete_provisioning202_accepted200_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_provisioning202_accepted200_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_provisioning202_accepted200_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -342,7 +364,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/retryerror/delete/provisioning/202/accepted/200/succeeded'} # type: ignore def _delete202_retry200_initial( @@ -363,7 +393,6 @@ def _delete202_retry200_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -391,6 +420,7 @@ def begin_delete202_retry200( return this value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -405,10 +435,12 @@ def begin_delete202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete202_retry200_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -420,7 +452,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete202_retry200.metadata = {'url': '/lro/retryerror/delete/202/retry/200'} # type: ignore def _delete_async_relative_retry_succeeded_initial( @@ -441,7 +481,6 @@ def _delete_async_relative_retry_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -470,6 +509,7 @@ def begin_delete_async_relative_retry_succeeded( endpoint indicated in the Azure-AsyncOperation header for operation status. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -484,10 +524,12 @@ def begin_delete_async_relative_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_relative_retry_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_relative_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -499,7 +541,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/deleteasync/retry/succeeded'} # type: ignore def _post202_retry200_initial( @@ -523,7 +573,6 @@ def _post202_retry200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -561,6 +610,7 @@ def begin_post202_retry200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -575,11 +625,13 @@ def begin_post202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = self._post202_retry200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post202_retry200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -591,7 +643,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post202_retry200.metadata = {'url': '/lro/retryerror/post/202/retry/200'} # type: ignore def _post_async_relative_retry_succeeded_initial( @@ -615,7 +675,6 @@ def _post_async_relative_retry_succeeded_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -655,6 +714,7 @@ def begin_post_async_relative_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -669,11 +729,13 @@ def begin_post_async_relative_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_relative_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_relative_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -685,5 +747,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_relative_retry_succeeded.metadata = {'url': '/lro/retryerror/postasync/retry/succeeded'} # type: ignore 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 147162e61d8..18ba846ff38 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lros_operations.py @@ -69,7 +69,6 @@ def _put200_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -108,6 +107,7 @@ def begin_put200_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -122,11 +122,13 @@ def begin_put200_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._put200_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put200_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -141,7 +143,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put200_succeeded.metadata = {'url': '/lro/put/200/succeeded'} # type: ignore def _put201_succeeded_initial( @@ -166,7 +176,6 @@ def _put201_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -203,6 +212,7 @@ def begin_put201_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -217,11 +227,13 @@ def begin_put201_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._put201_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put201_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -236,7 +248,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put201_succeeded.metadata = {'url': '/lro/put/201/succeeded'} # type: ignore def _post202_list_initial( @@ -258,7 +278,6 @@ def _post202_list_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -292,6 +311,7 @@ def begin_post202_list( with body [{ 'id': '100', 'name': 'foo' }]. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -306,10 +326,12 @@ def begin_post202_list( 'polling_interval', self._config.polling_interval ) - raw_result = self._post202_list_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post202_list_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -324,7 +346,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post202_list.metadata = {'url': '/lro/list'} # type: ignore def _put200_succeeded_no_state_initial( @@ -349,7 +379,6 @@ def _put200_succeeded_no_state_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -386,6 +415,7 @@ def begin_put200_succeeded_no_state( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -400,11 +430,13 @@ def begin_put200_succeeded_no_state( 'polling_interval', self._config.polling_interval ) - raw_result = self._put200_succeeded_no_state_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put200_succeeded_no_state_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -419,7 +451,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put200_succeeded_no_state.metadata = {'url': '/lro/put/200/succeeded/nostate'} # type: ignore def _put202_retry200_initial( @@ -444,7 +484,6 @@ def _put202_retry200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -482,6 +521,7 @@ def begin_put202_retry200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -496,11 +536,13 @@ def begin_put202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = self._put202_retry200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put202_retry200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -515,7 +557,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put202_retry200.metadata = {'url': '/lro/put/202/retry/200'} # type: ignore def _put201_creating_succeeded200_initial( @@ -540,7 +590,6 @@ def _put201_creating_succeeded200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -582,6 +631,7 @@ def begin_put201_creating_succeeded200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -596,11 +646,13 @@ def begin_put201_creating_succeeded200( 'polling_interval', self._config.polling_interval ) - raw_result = self._put201_creating_succeeded200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put201_creating_succeeded200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -615,7 +667,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put201_creating_succeeded200.metadata = {'url': '/lro/put/201/creating/succeeded/200'} # type: ignore def _put200_updating_succeeded204_initial( @@ -640,7 +700,6 @@ def _put200_updating_succeeded204_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -678,6 +737,7 @@ def begin_put200_updating_succeeded204( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -692,11 +752,13 @@ def begin_put200_updating_succeeded204( 'polling_interval', self._config.polling_interval ) - raw_result = self._put200_updating_succeeded204_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put200_updating_succeeded204_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -711,7 +773,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put200_updating_succeeded204.metadata = {'url': '/lro/put/200/updating/succeeded/200'} # type: ignore def _put201_creating_failed200_initial( @@ -736,7 +806,6 @@ def _put201_creating_failed200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -778,6 +847,7 @@ def begin_put201_creating_failed200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -792,11 +862,13 @@ def begin_put201_creating_failed200( 'polling_interval', self._config.polling_interval ) - raw_result = self._put201_creating_failed200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put201_creating_failed200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -811,7 +883,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put201_creating_failed200.metadata = {'url': '/lro/put/201/created/failed/200'} # type: ignore def _put200_acceptedcanceled200_initial( @@ -836,7 +916,6 @@ def _put200_acceptedcanceled200_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -874,6 +953,7 @@ def begin_put200_acceptedcanceled200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -888,11 +968,13 @@ def begin_put200_acceptedcanceled200( 'polling_interval', self._config.polling_interval ) - raw_result = self._put200_acceptedcanceled200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put200_acceptedcanceled200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -907,7 +989,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put200_acceptedcanceled200.metadata = {'url': '/lro/put/200/accepted/canceled/200'} # type: ignore def _put_no_header_in_retry_initial( @@ -932,7 +1022,6 @@ def _put_no_header_in_retry_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -971,6 +1060,7 @@ def begin_put_no_header_in_retry( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -985,11 +1075,13 @@ def begin_put_no_header_in_retry( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_no_header_in_retry_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_no_header_in_retry_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1007,7 +1099,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_no_header_in_retry.metadata = {'url': '/lro/put/noheader/202/200'} # type: ignore def _put_async_retry_succeeded_initial( @@ -1032,7 +1132,6 @@ def _put_async_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1074,6 +1173,7 @@ def begin_put_async_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1088,11 +1188,13 @@ def begin_put_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1112,7 +1214,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_retry_succeeded.metadata = {'url': '/lro/putasync/retry/succeeded'} # type: ignore def _put_async_no_retry_succeeded_initial( @@ -1137,7 +1247,6 @@ def _put_async_no_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1178,6 +1287,7 @@ def begin_put_async_no_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1192,11 +1302,13 @@ def begin_put_async_no_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_no_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_no_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1215,7 +1327,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_no_retry_succeeded.metadata = {'url': '/lro/putasync/noretry/succeeded'} # type: ignore def _put_async_retry_failed_initial( @@ -1240,7 +1360,6 @@ def _put_async_retry_failed_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1282,6 +1401,7 @@ def begin_put_async_retry_failed( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1296,11 +1416,13 @@ def begin_put_async_retry_failed( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_retry_failed_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_retry_failed_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1320,7 +1442,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_retry_failed.metadata = {'url': '/lro/putasync/retry/failed'} # type: ignore def _put_async_no_retrycanceled_initial( @@ -1345,7 +1475,6 @@ def _put_async_no_retrycanceled_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1386,6 +1515,7 @@ def begin_put_async_no_retrycanceled( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1400,11 +1530,13 @@ def begin_put_async_no_retrycanceled( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_no_retrycanceled_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_no_retrycanceled_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1423,7 +1555,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_no_retrycanceled.metadata = {'url': '/lro/putasync/noretry/canceled'} # type: ignore def _put_async_no_header_in_retry_initial( @@ -1448,7 +1588,6 @@ def _put_async_no_header_in_retry_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1488,6 +1627,7 @@ def begin_put_async_no_header_in_retry( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1502,11 +1642,13 @@ def begin_put_async_no_header_in_retry( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_no_header_in_retry_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_no_header_in_retry_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1524,7 +1666,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_no_header_in_retry.metadata = {'url': '/lro/putasync/noheader/201/200'} # type: ignore def _put_non_resource_initial( @@ -1549,7 +1699,6 @@ def _put_non_resource_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if sku is not None: body_content = self._serialize.body(sku, 'Sku') @@ -1585,6 +1734,7 @@ def begin_put_non_resource( :param sku: sku to put. :type sku: ~lro.models.Sku :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1599,11 +1749,13 @@ def begin_put_non_resource( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_non_resource_initial( - sku=sku, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_non_resource_initial( + sku=sku, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1618,7 +1770,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_non_resource.metadata = {'url': '/lro/putnonresource/202/200'} # type: ignore def _put_async_non_resource_initial( @@ -1643,7 +1803,6 @@ def _put_async_non_resource_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if sku is not None: body_content = self._serialize.body(sku, 'Sku') @@ -1679,6 +1838,7 @@ def begin_put_async_non_resource( :param sku: Sku to put. :type sku: ~lro.models.Sku :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1693,11 +1853,13 @@ def begin_put_async_non_resource( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_non_resource_initial( - sku=sku, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_non_resource_initial( + sku=sku, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1712,7 +1874,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_non_resource.metadata = {'url': '/lro/putnonresourceasync/202/200'} # type: ignore def _put_sub_resource_initial( @@ -1739,7 +1909,6 @@ def _put_sub_resource_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if _product is not None: body_content = self._serialize.body(_product, 'SubProduct') @@ -1775,6 +1944,7 @@ def begin_put_sub_resource( :param provisioning_state: :type provisioning_state: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1789,11 +1959,13 @@ def begin_put_sub_resource( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_sub_resource_initial( - provisioning_state=provisioning_state, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_sub_resource_initial( + provisioning_state=provisioning_state, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1808,7 +1980,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_sub_resource.metadata = {'url': '/lro/putsubresource/202/200'} # type: ignore def _put_async_sub_resource_initial( @@ -1835,7 +2015,6 @@ def _put_async_sub_resource_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if _product is not None: body_content = self._serialize.body(_product, 'SubProduct') @@ -1871,6 +2050,7 @@ def begin_put_async_sub_resource( :param provisioning_state: :type provisioning_state: str :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1885,11 +2065,13 @@ def begin_put_async_sub_resource( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_sub_resource_initial( - provisioning_state=provisioning_state, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_sub_resource_initial( + provisioning_state=provisioning_state, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1904,7 +2086,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_sub_resource.metadata = {'url': '/lro/putsubresourceasync/202/200'} # type: ignore def _delete_provisioning202_accepted200_succeeded_initial( @@ -1926,7 +2116,6 @@ def _delete_provisioning202_accepted200_succeeded_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1961,6 +2150,7 @@ def begin_delete_provisioning202_accepted200_succeeded( ‘200’ with ProvisioningState=’Succeeded’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1975,10 +2165,12 @@ def begin_delete_provisioning202_accepted200_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_provisioning202_accepted200_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_provisioning202_accepted200_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1997,7 +2189,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_provisioning202_accepted200_succeeded.metadata = {'url': '/lro/delete/provisioning/202/accepted/200/succeeded'} # type: ignore def _delete_provisioning202_deleting_failed200_initial( @@ -2019,7 +2219,6 @@ def _delete_provisioning202_deleting_failed200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2054,6 +2253,7 @@ def begin_delete_provisioning202_deleting_failed200( ‘200’ with ProvisioningState=’Failed’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2068,10 +2268,12 @@ def begin_delete_provisioning202_deleting_failed200( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_provisioning202_deleting_failed200_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_provisioning202_deleting_failed200_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2090,7 +2292,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_provisioning202_deleting_failed200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/failed'} # type: ignore def _delete_provisioning202_deletingcanceled200_initial( @@ -2112,7 +2322,6 @@ def _delete_provisioning202_deletingcanceled200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2147,6 +2356,7 @@ def begin_delete_provisioning202_deletingcanceled200( ‘200’ with ProvisioningState=’Canceled’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2161,10 +2371,12 @@ def begin_delete_provisioning202_deletingcanceled200( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_provisioning202_deletingcanceled200_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_provisioning202_deletingcanceled200_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2183,7 +2395,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_provisioning202_deletingcanceled200.metadata = {'url': '/lro/delete/provisioning/202/deleting/200/canceled'} # type: ignore def _delete204_succeeded_initial( @@ -2204,7 +2424,6 @@ def _delete204_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2227,6 +2446,7 @@ def begin_delete204_succeeded( """Long running delete succeeds and returns right away. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2241,10 +2461,12 @@ def begin_delete204_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete204_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2256,7 +2478,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete204_succeeded.metadata = {'url': '/lro/delete/204/succeeded'} # type: ignore def _delete202_retry200_initial( @@ -2278,7 +2508,6 @@ def _delete202_retry200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2312,6 +2541,7 @@ def begin_delete202_retry200( value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2326,10 +2556,12 @@ def begin_delete202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete202_retry200_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete202_retry200_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2344,7 +2576,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete202_retry200.metadata = {'url': '/lro/delete/202/retry/200'} # type: ignore def _delete202_no_retry204_initial( @@ -2366,7 +2606,6 @@ def _delete202_no_retry204_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2400,6 +2639,7 @@ def begin_delete202_no_retry204( value until the last poll returns a ‘200’ with ProvisioningState=’Succeeded’. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2414,10 +2654,12 @@ def begin_delete202_no_retry204( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete202_no_retry204_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete202_no_retry204_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2432,7 +2674,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete202_no_retry204.metadata = {'url': '/lro/delete/202/noretry/204'} # type: ignore def _delete_no_header_in_retry_initial( @@ -2453,7 +2703,6 @@ def _delete_no_header_in_retry_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2481,6 +2730,7 @@ def begin_delete_no_header_in_retry( Subsequent calls to operation status do not contain location header. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2495,10 +2745,12 @@ def begin_delete_no_header_in_retry( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_no_header_in_retry_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2510,7 +2762,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_no_header_in_retry.metadata = {'url': '/lro/delete/noheader'} # type: ignore def _delete_async_no_header_in_retry_initial( @@ -2531,7 +2791,6 @@ def _delete_async_no_header_in_retry_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2559,6 +2818,7 @@ def begin_delete_async_no_header_in_retry( request. Subsequent calls to operation status do not contain Azure-AsyncOperation header. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2573,10 +2833,12 @@ def begin_delete_async_no_header_in_retry( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_no_header_in_retry_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_no_header_in_retry_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2588,7 +2850,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_no_header_in_retry.metadata = {'url': '/lro/deleteasync/noheader/202/204'} # type: ignore def _delete_async_retry_succeeded_initial( @@ -2609,7 +2879,6 @@ def _delete_async_retry_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2638,6 +2907,7 @@ def begin_delete_async_retry_succeeded( indicated in the Azure-AsyncOperation header for operation status. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2652,10 +2922,12 @@ def begin_delete_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_retry_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2667,7 +2939,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_retry_succeeded.metadata = {'url': '/lro/deleteasync/retry/succeeded'} # type: ignore def _delete_async_no_retry_succeeded_initial( @@ -2688,7 +2968,6 @@ def _delete_async_no_retry_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2717,6 +2996,7 @@ def begin_delete_async_no_retry_succeeded( indicated in the Azure-AsyncOperation header for operation status. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2731,10 +3011,12 @@ def begin_delete_async_no_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_no_retry_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_no_retry_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2746,7 +3028,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_no_retry_succeeded.metadata = {'url': '/lro/deleteasync/noretry/succeeded'} # type: ignore def _delete_async_retry_failed_initial( @@ -2767,7 +3057,6 @@ def _delete_async_retry_failed_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2796,6 +3085,7 @@ def begin_delete_async_retry_failed( indicated in the Azure-AsyncOperation header for operation status. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2810,10 +3100,12 @@ def begin_delete_async_retry_failed( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_retry_failed_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_retry_failed_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2825,7 +3117,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_retry_failed.metadata = {'url': '/lro/deleteasync/retry/failed'} # type: ignore def _delete_async_retrycanceled_initial( @@ -2846,7 +3146,6 @@ def _delete_async_retrycanceled_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2875,6 +3174,7 @@ def begin_delete_async_retrycanceled( indicated in the Azure-AsyncOperation header for operation status. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2889,10 +3189,12 @@ def begin_delete_async_retrycanceled( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_retrycanceled_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_retrycanceled_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2904,7 +3206,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_retrycanceled.metadata = {'url': '/lro/deleteasync/retry/canceled'} # type: ignore def _post200_with_payload_initial( @@ -2926,7 +3236,6 @@ def _post200_with_payload_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2957,6 +3266,7 @@ def begin_post200_with_payload( header. Poll returns a 200 with a response body after success. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2971,10 +3281,12 @@ def begin_post200_with_payload( 'polling_interval', self._config.polling_interval ) - raw_result = self._post200_with_payload_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post200_with_payload_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2989,7 +3301,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post200_with_payload.metadata = {'url': '/lro/post/payload/200'} # type: ignore def _post202_retry200_initial( @@ -3013,7 +3333,6 @@ def _post202_retry200_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3051,6 +3370,7 @@ def begin_post202_retry200( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -3065,11 +3385,13 @@ def begin_post202_retry200( 'polling_interval', self._config.polling_interval ) - raw_result = self._post202_retry200_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post202_retry200_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3081,7 +3403,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post202_retry200.metadata = {'url': '/lro/post/202/retry/200'} # type: ignore def _post202_no_retry204_initial( @@ -3106,7 +3436,6 @@ def _post202_no_retry204_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3146,6 +3475,7 @@ def begin_post202_no_retry204( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -3160,11 +3490,13 @@ def begin_post202_no_retry204( 'polling_interval', self._config.polling_interval ) - raw_result = self._post202_no_retry204_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post202_no_retry204_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3183,7 +3515,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post202_no_retry204.metadata = {'url': '/lro/post/202/noretry/204'} # type: ignore def _post_double_headers_final_location_get_initial( @@ -3205,7 +3545,6 @@ def _post_double_headers_final_location_get_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3233,6 +3572,7 @@ def begin_post_double_headers_final_location_get( object. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -3247,10 +3587,12 @@ def begin_post_double_headers_final_location_get( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_double_headers_final_location_get_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_double_headers_final_location_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3265,7 +3607,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_double_headers_final_location_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalLocationGet'} # type: ignore def _post_double_headers_final_azure_header_get_initial( @@ -3287,7 +3637,6 @@ def _post_double_headers_final_azure_header_get_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3315,6 +3664,7 @@ def begin_post_double_headers_final_azure_header_get( final object. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -3329,10 +3679,12 @@ def begin_post_double_headers_final_azure_header_get( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_double_headers_final_azure_header_get_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_double_headers_final_azure_header_get_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3347,7 +3699,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_double_headers_final_azure_header_get.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGet'} # type: ignore def _post_double_headers_final_azure_header_get_default_initial( @@ -3369,7 +3729,6 @@ def _post_double_headers_final_azure_header_get_default_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3397,6 +3756,7 @@ def begin_post_double_headers_final_azure_header_get_default( final object if you support initial Autorest behavior. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -3411,10 +3771,12 @@ def begin_post_double_headers_final_azure_header_get_default( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_double_headers_final_azure_header_get_default_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_double_headers_final_azure_header_get_default_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3429,7 +3791,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_double_headers_final_azure_header_get_default.metadata = {'url': '/lro/LROPostDoubleHeadersFinalAzureHeaderGetDefault'} # type: ignore def _post_async_retry_succeeded_initial( @@ -3454,7 +3824,6 @@ def _post_async_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3500,6 +3869,7 @@ def begin_post_async_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -3514,11 +3884,13 @@ def begin_post_async_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3533,7 +3905,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_retry_succeeded.metadata = {'url': '/lro/postasync/retry/succeeded'} # type: ignore def _post_async_no_retry_succeeded_initial( @@ -3558,7 +3938,6 @@ def _post_async_no_retry_succeeded_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3604,6 +3983,7 @@ def begin_post_async_no_retry_succeeded( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -3618,11 +3998,13 @@ def begin_post_async_no_retry_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_no_retry_succeeded_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_no_retry_succeeded_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3637,7 +4019,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_no_retry_succeeded.metadata = {'url': '/lro/postasync/noretry/succeeded'} # type: ignore def _post_async_retry_failed_initial( @@ -3661,7 +4051,6 @@ def _post_async_retry_failed_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3701,6 +4090,7 @@ def begin_post_async_retry_failed( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -3715,11 +4105,13 @@ def begin_post_async_retry_failed( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_retry_failed_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_retry_failed_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3731,7 +4123,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_retry_failed.metadata = {'url': '/lro/postasync/retry/failed'} # type: ignore def _post_async_retrycanceled_initial( @@ -3755,7 +4155,6 @@ def _post_async_retrycanceled_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -3795,6 +4194,7 @@ def begin_post_async_retrycanceled( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -3809,11 +4209,13 @@ def begin_post_async_retrycanceled( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_retrycanceled_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_retrycanceled_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -3825,5 +4227,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_retrycanceled.metadata = {'url': '/lro/postasync/retry/canceled'} # type: ignore 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 b36ffa50e9c..1542c12066b 100644 --- a/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py +++ b/test/azure/Expected/AcceptanceTests/Lro/lro/operations/_lrosads_operations.py @@ -69,7 +69,6 @@ def _put_non_retry400_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -109,6 +108,7 @@ def begin_put_non_retry400( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -123,11 +123,13 @@ def begin_put_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_non_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_non_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -142,7 +144,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_non_retry400.metadata = {'url': '/lro/nonretryerror/put/400'} # type: ignore def _put_non_retry201_creating400_initial( @@ -167,7 +177,6 @@ def _put_non_retry201_creating400_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -208,6 +217,7 @@ def begin_put_non_retry201_creating400( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -222,11 +232,13 @@ def begin_put_non_retry201_creating400( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_non_retry201_creating400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_non_retry201_creating400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -241,7 +253,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_non_retry201_creating400.metadata = {'url': '/lro/nonretryerror/put/201/creating/400'} # type: ignore def _put_non_retry201_creating400_invalid_json_initial( @@ -266,7 +286,6 @@ def _put_non_retry201_creating400_invalid_json_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -307,6 +326,7 @@ def begin_put_non_retry201_creating400_invalid_json( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -321,11 +341,13 @@ def begin_put_non_retry201_creating400_invalid_json( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_non_retry201_creating400_invalid_json_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_non_retry201_creating400_invalid_json_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -340,7 +362,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_non_retry201_creating400_invalid_json.metadata = {'url': '/lro/nonretryerror/put/201/creating/400/invalidjson'} # type: ignore def _put_async_relative_retry400_initial( @@ -365,7 +395,6 @@ def _put_async_relative_retry400_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -406,6 +435,7 @@ def begin_put_async_relative_retry400( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -420,11 +450,13 @@ def begin_put_async_relative_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_relative_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_relative_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -444,7 +476,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/putasync/retry/400'} # type: ignore def _delete_non_retry400_initial( @@ -465,7 +505,6 @@ def _delete_non_retry400_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -492,6 +531,7 @@ def begin_delete_non_retry400( """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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -506,10 +546,12 @@ def begin_delete_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_non_retry400_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -521,7 +563,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/400'} # type: ignore def _delete202_non_retry400_initial( @@ -542,7 +592,6 @@ def _delete202_non_retry400_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -569,6 +618,7 @@ def begin_delete202_non_retry400( """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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -583,10 +633,12 @@ def begin_delete202_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete202_non_retry400_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete202_non_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -598,7 +650,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete202_non_retry400.metadata = {'url': '/lro/nonretryerror/delete/202/retry/400'} # type: ignore def _delete_async_relative_retry400_initial( @@ -619,7 +679,6 @@ def _delete_async_relative_retry400_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -648,6 +707,7 @@ def begin_delete_async_relative_retry400( indicated in the Azure-AsyncOperation header for operation status. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -662,10 +722,12 @@ def begin_delete_async_relative_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_relative_retry400_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_relative_retry400_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -677,7 +739,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/deleteasync/retry/400'} # type: ignore def _post_non_retry400_initial( @@ -701,7 +771,6 @@ def _post_non_retry400_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -738,6 +807,7 @@ def begin_post_non_retry400( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -752,11 +822,13 @@ def begin_post_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_non_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_non_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -768,7 +840,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_non_retry400.metadata = {'url': '/lro/nonretryerror/post/400'} # type: ignore def _post202_non_retry400_initial( @@ -792,7 +872,6 @@ def _post202_non_retry400_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -829,6 +908,7 @@ def begin_post202_non_retry400( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -843,11 +923,13 @@ def begin_post202_non_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = self._post202_non_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post202_non_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -859,7 +941,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post202_non_retry400.metadata = {'url': '/lro/nonretryerror/post/202/retry/400'} # type: ignore def _post_async_relative_retry400_initial( @@ -883,7 +973,6 @@ def _post_async_relative_retry400_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -922,6 +1011,7 @@ def begin_post_async_relative_retry400( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -936,11 +1026,13 @@ def begin_post_async_relative_retry400( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_relative_retry400_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_relative_retry400_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -952,7 +1044,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_relative_retry400.metadata = {'url': '/lro/nonretryerror/postasync/retry/400'} # type: ignore def _put_error201_no_provisioning_state_payload_initial( @@ -977,7 +1077,6 @@ def _put_error201_no_provisioning_state_payload_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1017,6 +1116,7 @@ def begin_put_error201_no_provisioning_state_payload( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1031,11 +1131,13 @@ def begin_put_error201_no_provisioning_state_payload( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_error201_no_provisioning_state_payload_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_error201_no_provisioning_state_payload_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1050,7 +1152,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_error201_no_provisioning_state_payload.metadata = {'url': '/lro/error/put/201/noprovisioningstatepayload'} # type: ignore def _put_async_relative_retry_no_status_initial( @@ -1075,7 +1185,6 @@ def _put_async_relative_retry_no_status_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1117,6 +1226,7 @@ def begin_put_async_relative_retry_no_status( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1131,11 +1241,13 @@ def begin_put_async_relative_retry_no_status( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_relative_retry_no_status_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_relative_retry_no_status_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1155,7 +1267,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_relative_retry_no_status.metadata = {'url': '/lro/error/putasync/retry/nostatus'} # type: ignore def _put_async_relative_retry_no_status_payload_initial( @@ -1180,7 +1300,6 @@ def _put_async_relative_retry_no_status_payload_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1222,6 +1341,7 @@ def begin_put_async_relative_retry_no_status_payload( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1236,11 +1356,13 @@ def begin_put_async_relative_retry_no_status_payload( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_relative_retry_no_status_payload_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_relative_retry_no_status_payload_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1260,7 +1382,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_relative_retry_no_status_payload.metadata = {'url': '/lro/error/putasync/retry/nostatuspayload'} # type: ignore def _delete204_succeeded_initial( @@ -1281,7 +1411,6 @@ def _delete204_succeeded_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1304,6 +1433,7 @@ def begin_delete204_succeeded( """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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1318,10 +1448,12 @@ def begin_delete204_succeeded( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete204_succeeded_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete204_succeeded_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1333,7 +1465,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete204_succeeded.metadata = {'url': '/lro/error/delete/204/nolocation'} # type: ignore def _delete_async_relative_retry_no_status_initial( @@ -1354,7 +1494,6 @@ def _delete_async_relative_retry_no_status_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1383,6 +1522,7 @@ def begin_delete_async_relative_retry_no_status( indicated in the Azure-AsyncOperation header for operation status. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1397,10 +1537,12 @@ def begin_delete_async_relative_retry_no_status( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_relative_retry_no_status_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_relative_retry_no_status_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1412,7 +1554,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_relative_retry_no_status.metadata = {'url': '/lro/error/deleteasync/retry/nostatus'} # type: ignore def _post202_no_location_initial( @@ -1436,7 +1586,6 @@ def _post202_no_location_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1474,6 +1623,7 @@ def begin_post202_no_location( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1488,11 +1638,13 @@ def begin_post202_no_location( 'polling_interval', self._config.polling_interval ) - raw_result = self._post202_no_location_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post202_no_location_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1504,7 +1656,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post202_no_location.metadata = {'url': '/lro/error/post/202/nolocation'} # type: ignore def _post_async_relative_retry_no_payload_initial( @@ -1528,7 +1688,6 @@ def _post_async_relative_retry_no_payload_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1568,6 +1727,7 @@ def begin_post_async_relative_retry_no_payload( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1582,11 +1742,13 @@ def begin_post_async_relative_retry_no_payload( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_relative_retry_no_payload_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_relative_retry_no_payload_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1598,7 +1760,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_relative_retry_no_payload.metadata = {'url': '/lro/error/postasync/retry/nopayload'} # type: ignore def _put200_invalid_json_initial( @@ -1623,7 +1793,6 @@ def _put200_invalid_json_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1662,6 +1831,7 @@ def begin_put200_invalid_json( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1676,11 +1846,13 @@ def begin_put200_invalid_json( 'polling_interval', self._config.polling_interval ) - raw_result = self._put200_invalid_json_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put200_invalid_json_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1695,7 +1867,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put200_invalid_json.metadata = {'url': '/lro/error/put/200/invalidjson'} # type: ignore def _put_async_relative_retry_invalid_header_initial( @@ -1720,7 +1900,6 @@ def _put_async_relative_retry_invalid_header_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1762,6 +1941,7 @@ def begin_put_async_relative_retry_invalid_header( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1776,11 +1956,13 @@ def begin_put_async_relative_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_relative_retry_invalid_header_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_relative_retry_invalid_header_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1800,7 +1982,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/putasync/retry/invalidheader'} # type: ignore def _put_async_relative_retry_invalid_json_polling_initial( @@ -1825,7 +2015,6 @@ def _put_async_relative_retry_invalid_json_polling_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -1867,6 +2056,7 @@ def begin_put_async_relative_retry_invalid_json_polling( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1881,11 +2071,13 @@ def begin_put_async_relative_retry_invalid_json_polling( 'polling_interval', self._config.polling_interval ) - raw_result = self._put_async_relative_retry_invalid_json_polling_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._put_async_relative_retry_invalid_json_polling_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1905,7 +2097,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_put_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/putasync/retry/invalidjsonpolling'} # type: ignore def _delete202_retry_invalid_header_initial( @@ -1926,7 +2126,6 @@ def _delete202_retry_invalid_header_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1954,6 +2153,7 @@ def begin_delete202_retry_invalid_header( with an invalid 'Location' and 'Retry-After' headers. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1968,10 +2168,12 @@ def begin_delete202_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete202_retry_invalid_header_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete202_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1983,7 +2185,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete202_retry_invalid_header.metadata = {'url': '/lro/error/delete/202/retry/invalidheader'} # type: ignore def _delete_async_relative_retry_invalid_header_initial( @@ -2004,7 +2214,6 @@ def _delete_async_relative_retry_invalid_header_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2033,6 +2242,7 @@ def begin_delete_async_relative_retry_invalid_header( indicated in the Azure-AsyncOperation header is invalid. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2047,10 +2257,12 @@ def begin_delete_async_relative_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_relative_retry_invalid_header_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_relative_retry_invalid_header_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2062,7 +2274,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/deleteasync/retry/invalidheader'} # type: ignore def _delete_async_relative_retry_invalid_json_polling_initial( @@ -2083,7 +2303,6 @@ def _delete_async_relative_retry_invalid_json_polling_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2112,6 +2331,7 @@ def begin_delete_async_relative_retry_invalid_json_polling( indicated in the Azure-AsyncOperation header for operation status. :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2126,10 +2346,12 @@ def begin_delete_async_relative_retry_invalid_json_polling( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_async_relative_retry_invalid_json_polling_initial( - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_async_relative_retry_invalid_json_polling_initial( + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2141,7 +2363,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/deleteasync/retry/invalidjsonpolling'} # type: ignore def _post202_retry_invalid_header_initial( @@ -2165,7 +2395,6 @@ def _post202_retry_invalid_header_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -2203,6 +2432,7 @@ def begin_post202_retry_invalid_header( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2217,11 +2447,13 @@ def begin_post202_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = self._post202_retry_invalid_header_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post202_retry_invalid_header_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2233,7 +2465,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post202_retry_invalid_header.metadata = {'url': '/lro/error/post/202/retry/invalidheader'} # type: ignore def _post_async_relative_retry_invalid_header_initial( @@ -2257,7 +2497,6 @@ def _post_async_relative_retry_invalid_header_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -2297,6 +2536,7 @@ def begin_post_async_relative_retry_invalid_header( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2311,11 +2551,13 @@ def begin_post_async_relative_retry_invalid_header( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_relative_retry_invalid_header_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_relative_retry_invalid_header_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2327,7 +2569,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_relative_retry_invalid_header.metadata = {'url': '/lro/error/postasync/retry/invalidheader'} # type: ignore def _post_async_relative_retry_invalid_json_polling_initial( @@ -2351,7 +2601,6 @@ def _post_async_relative_retry_invalid_json_polling_initial( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -2391,6 +2640,7 @@ def begin_post_async_relative_retry_invalid_json_polling( :param product: Product to put. :type product: ~lro.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -2405,11 +2655,13 @@ def begin_post_async_relative_retry_invalid_json_polling( 'polling_interval', self._config.polling_interval ) - raw_result = self._post_async_relative_retry_invalid_json_polling_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._post_async_relative_retry_invalid_json_polling_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -2421,5 +2673,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_post_async_relative_retry_invalid_json_polling.metadata = {'url': '/lro/error/postasync/retry/invalidjsonpolling'} # type: ignore 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 24dae9cab5e..2a8062cbbbe 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat @@ -72,12 +72,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -132,12 +130,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -192,12 +188,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -270,12 +264,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -338,7 +330,6 @@ def prepare_request(next_link=None): query_parameters['requiredQueryParameter'] = self._serialize.query("required_query_parameter", required_query_parameter, 'int') query_parameters['queryConstant'] = self._serialize.query("query_constant", query_constant, 'bool') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = '/paging/multiple/nextOperationWithQueryParams' @@ -346,7 +337,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['queryConstant'] = self._serialize.query("query_constant", query_constant, 'bool') - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -419,12 +409,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -503,12 +491,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -564,12 +550,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -625,12 +609,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -685,12 +667,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -745,12 +725,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -805,12 +783,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -876,7 +852,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api_version'] = self._serialize.query("api_version", api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = '/paging/multiple/fragment/{tenant}/{nextLink}' @@ -889,7 +864,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api_version'] = self._serialize.query("api_version", api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -958,7 +932,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api_version'] = self._serialize.query("api_version", _api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = '/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}' @@ -971,7 +944,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api_version'] = self._serialize.query("api_version", _api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -1031,7 +1003,6 @@ async def _get_multiple_pages_lro_initial( header_parameters['timeout'] = self._serialize.header("timeout", _timeout, 'int') header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1049,12 +1020,12 @@ async def _get_multiple_pages_lro_initial( _get_multiple_pages_lro_initial.metadata = {'url': '/paging/multiple/lro'} # type: ignore @distributed_trace_async - async def get_multiple_pages_lro( + async def begin_get_multiple_pages_lro( self, 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: @@ -1062,12 +1033,13 @@ async def get_multiple_pages_lro( :param paging_get_multiple_pages_lro_options: Parameter group. :type paging_get_multiple_pages_lro_options: ~paging.models.PagingGetMultiplePagesLroOptions :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -1076,12 +1048,14 @@ async def get_multiple_pages_lro( 'polling_interval', self._config.polling_interval ) - raw_result = await self._get_multiple_pages_lro_initial( - client_request_id=client_request_id, - paging_get_multiple_pages_lro_options=paging_get_multiple_pages_lro_options, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._get_multiple_pages_lro_initial( + client_request_id=client_request_id, + paging_get_multiple_pages_lro_options=paging_get_multiple_pages_lro_options, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1096,8 +1070,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - get_multiple_pages_lro.metadata = {'url': '/paging/multiple/lro'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_get_multiple_pages_lro.metadata = {'url': '/paging/multiple/lro'} # type: ignore @distributed_trace def get_paging_model_with_item_name_with_xms_client_name( @@ -1127,12 +1109,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request 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 94b7dd1b455..9043a40b4d9 100644 --- a/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py +++ b/test/azure/Expected/AcceptanceTests/Paging/paging/operations/_paging_operations.py @@ -76,12 +76,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -137,12 +135,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -198,12 +194,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -277,12 +271,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -346,7 +338,6 @@ def prepare_request(next_link=None): query_parameters['requiredQueryParameter'] = self._serialize.query("required_query_parameter", required_query_parameter, 'int') query_parameters['queryConstant'] = self._serialize.query("query_constant", query_constant, 'bool') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = '/paging/multiple/nextOperationWithQueryParams' @@ -354,7 +345,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['queryConstant'] = self._serialize.query("query_constant", query_constant, 'bool') - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -428,12 +418,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -513,12 +501,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -575,12 +561,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -637,12 +621,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -698,12 +680,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -759,12 +739,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -820,12 +798,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -892,7 +868,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api_version'] = self._serialize.query("api_version", api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = '/paging/multiple/fragment/{tenant}/{nextLink}' @@ -905,7 +880,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api_version'] = self._serialize.query("api_version", api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -975,7 +949,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api_version'] = self._serialize.query("api_version", _api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = '/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}' @@ -988,7 +961,6 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api_version'] = self._serialize.query("api_version", _api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -1049,7 +1021,6 @@ def _get_multiple_pages_lro_initial( header_parameters['timeout'] = self._serialize.header("timeout", _timeout, 'int') header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1081,6 +1052,7 @@ def begin_get_multiple_pages_lro( :param paging_get_multiple_pages_lro_options: Parameter group. :type paging_get_multiple_pages_lro_options: ~paging.models.PagingGetMultiplePagesLroOptions :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -1095,12 +1067,14 @@ def begin_get_multiple_pages_lro( 'polling_interval', self._config.polling_interval ) - raw_result = self._get_multiple_pages_lro_initial( - client_request_id=client_request_id, - paging_get_multiple_pages_lro_options=paging_get_multiple_pages_lro_options, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._get_multiple_pages_lro_initial( + client_request_id=client_request_id, + paging_get_multiple_pages_lro_options=paging_get_multiple_pages_lro_options, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -1115,7 +1089,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_get_multiple_pages_lro.metadata = {'url': '/paging/multiple/lro'} # type: ignore @distributed_trace @@ -1147,12 +1129,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request 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 244646216ed..570f17086b5 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 @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat @@ -84,7 +84,6 @@ async def check_name_availability( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') body_content_kwargs['content'] = body_content @@ -136,7 +135,6 @@ async def _create_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') body_content_kwargs['content'] = body_content @@ -160,13 +158,13 @@ async def _create_initial( _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore @distributed_trace_async - async def create( + async def begin_create( self, resource_group_name: str, 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 @@ -181,12 +179,13 @@ async def create( :param parameters: The parameters to provide for the created account. :type parameters: ~storage.models.StorageAccountCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -195,13 +194,15 @@ async def create( 'polling_interval', self._config.polling_interval ) - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - account_name=account_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -216,8 +217,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore @distributed_trace_async async def delete( @@ -260,7 +269,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -318,7 +326,6 @@ async def get_properties( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -389,7 +396,6 @@ async def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') body_content_kwargs['content'] = body_content @@ -450,7 +456,6 @@ async def list_keys( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -501,12 +506,10 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -572,12 +575,10 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -654,7 +655,6 @@ async def regenerate_key( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_regenerate_key, 'StorageAccountRegenerateKeyParameters') body_content_kwargs['content'] = body_content diff --git a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_usage_operations_async.py b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_usage_operations_async.py index 45e5f995e45..9957b9beed2 100644 --- a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_usage_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/aio/operations_async/_usage_operations_async.py @@ -73,7 +73,6 @@ async def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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 a531fedc0a1..945346caf0c 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 @@ -88,7 +88,6 @@ def check_name_availability( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(account_name, 'StorageAccountCheckNameAvailabilityParameters') body_content_kwargs['content'] = body_content @@ -141,7 +140,6 @@ def _create_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') body_content_kwargs['content'] = body_content @@ -187,6 +185,7 @@ def begin_create( :param parameters: The parameters to provide for the created account. :type parameters: ~storage.models.StorageAccountCreateParameters :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -201,13 +200,15 @@ def begin_create( 'polling_interval', self._config.polling_interval ) - raw_result = self._create_initial( - resource_group_name=resource_group_name, - account_name=account_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -222,7 +223,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'} # type: ignore @distributed_trace @@ -267,7 +276,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -326,7 +334,6 @@ def get_properties( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -398,7 +405,6 @@ def update( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') body_content_kwargs['content'] = body_content @@ -460,7 +466,6 @@ def list_keys( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -512,12 +517,10 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -584,12 +587,10 @@ def prepare_request(next_link=None): query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request @@ -667,7 +668,6 @@ def regenerate_key( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_regenerate_key, 'StorageAccountRegenerateKeyParameters') body_content_kwargs['content'] = body_content diff --git a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py index baaa7f29d3b..fc79291efe5 100644 --- a/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py +++ b/test/azure/Expected/AcceptanceTests/StorageManagementClient/storage/operations/_usage_operations.py @@ -78,7 +78,6 @@ def list( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations_async/_group_operations_async.py b/test/azure/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations_async/_group_operations_async.py index 2cf11917759..4155f54950d 100644 --- a/test/azure/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations_async/_group_operations_async.py +++ b/test/azure/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/aio/operations_async/_group_operations_async.py @@ -77,7 +77,6 @@ async def get_sample_resource_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py b/test/azure/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py index 35faaf5abf4..dc5f66e6165 100644 --- a/test/azure/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py +++ b/test/azure/Expected/AcceptanceTests/SubscriptionIdApiVersion/subscriptionidapiversion/operations/_group_operations.py @@ -82,7 +82,6 @@ def get_sample_resource_group( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/azure/requirements.txt b/test/azure/requirements.txt index 6072414626b..3c72c29496a 100644 --- a/test/azure/requirements.txt +++ b/test/azure/requirements.txt @@ -3,8 +3,8 @@ pytest pytest-cov pytest-asyncio==0.10.0;python_full_version>="3.5.2" async_generator;python_full_version>="3.5.2" -azure-core>=1.4.0 -azure-mgmt-core>=1.0.0 +azure-core>=1.6.0 +azure-mgmt-core>=1.1.0 msrest>=0.6.10 aiohttp;python_full_version>="3.5.2" -e ./Expected/AcceptanceTests/AzureBodyDuration 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/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py index 6b1c68b498a..766930bf6d3 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/_operations_mixin.py @@ -16,10 +16,12 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union class MultiapiServiceClientOperationsMixin(object): 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 ff9806f0565..4d8badb71fa 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 @@ -9,22 +9,24 @@ # regenerated. # -------------------------------------------------------------------------- from msrest import Serializer, Deserializer -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling class MultiapiServiceClientOperationsMixin(object): - async def test_lro( + 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. @@ -34,7 +36,7 @@ async def test_lro( :rtype: ~multiapi.v1.models.Product :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 +46,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, diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/_metadata.json index 09e2553a708..21c04479272 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,31 +48,27 @@ }, "_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 Optional[\"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 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\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", "call": "product" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\nfrom azure.core.polling import LROPoller, NoPolling, PollingMethod\nfrom azure.core.polling.base_polling import LROBasePolling\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest\nfrom azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller\nfrom azure.core.polling.async_base_polling import AsyncLROBasePolling" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.polling\": [\"LROPoller\", \"NoPolling\", \"PollingMethod\"], \"azure.core.polling.base_polling\": [\"LROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.polling\": [\"AsyncLROPoller\", \"AsyncNoPolling\", \"AsyncPollingMethod\"], \"azure.core.polling.async_base_polling\": [\"AsyncLROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" } \ No newline at end of file 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 c18f930ad21..eb0e6ff06c0 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.polling.async_base_polling import AsyncLROBasePolling from ... import models @@ -56,7 +56,6 @@ async def test_one( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -92,7 +91,6 @@ async def _test_lro_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -119,22 +117,23 @@ async def _test_lro_initial( return deserialized _test_lro_initial.metadata = {'url': '/multiapi/lro'} # type: ignore - async def test_lro( + 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. :type product: ~multiapi.v1.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -143,11 +142,13 @@ async def test_lro( 'polling_interval', self._config.polling_interval ) - raw_result = await self._test_lro_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._test_lro_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -162,5 +163,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncLROBasePolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_operation_group_one_operations_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_operation_group_one_operations_async.py index fcc2e93d3a9..cd2e70a6451 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_operation_group_one_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/aio/operations_async/_operation_group_one_operations_async.py @@ -65,7 +65,6 @@ async def test_two( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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 640321e7efb..312744edd76 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 @@ -61,7 +61,6 @@ def test_one( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -98,7 +97,6 @@ def _test_lro_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -136,6 +134,7 @@ def begin_test_lro( :param product: Product to put. :type product: ~multiapi.v1.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -150,11 +149,13 @@ def begin_test_lro( 'polling_interval', self._config.polling_interval ) - raw_result = self._test_lro_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._test_lro_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -169,5 +170,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = LROBasePolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py index 74e0329f911..716d2ea00d6 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v1/operations/_operation_group_one_operations.py @@ -70,7 +70,6 @@ def test_two( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/_metadata.json index 7f4d71d3487..7cdd0320de7 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 }, @@ -50,6 +48,6 @@ "call": "id, message" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_multiapi_service_client_operations_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_multiapi_service_client_operations_async.py index deb56f74718..b71c567936b 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_multiapi_service_client_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_multiapi_service_client_operations_async.py @@ -55,7 +55,6 @@ async def test_one( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_operation_group_one_operations_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_operation_group_one_operations_async.py index 69bb0d9926d..fd0ab2b7601 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_operation_group_one_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_operation_group_one_operations_async.py @@ -71,7 +71,6 @@ async def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelTwo') @@ -122,7 +121,6 @@ async def test_three( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_operation_group_two_operations_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_operation_group_two_operations_async.py index c60d89e734b..6327f36969f 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_operation_group_two_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/aio/operations_async/_operation_group_two_operations_async.py @@ -69,7 +69,6 @@ async def test_four( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py index 37730c56be7..154a40b3e24 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_multiapi_service_client_operations.py @@ -60,7 +60,6 @@ def test_one( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py index 9053e6428a0..8670aa3e174 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_one_operations.py @@ -76,7 +76,6 @@ def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelTwo') @@ -128,7 +127,6 @@ def test_three( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py index c8071fbbfc3..9d416b902bb 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v2/operations/_operation_group_two_operations.py @@ -74,7 +74,6 @@ def test_four( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json index ce561fbf18f..11d13eaf335 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/_metadata.json @@ -38,11 +38,9 @@ "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", "coroutine": false }, @@ -50,6 +48,6 @@ "call": "" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.paging import ItemPaged\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar", - "async_imports": "from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.async_paging import AsyncItemPaged, AsyncList\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_multiapi_service_client_operations_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_multiapi_service_client_operations_async.py index c7ef1aa956f..0e0fe1d0bfc 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_multiapi_service_client_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_multiapi_service_client_operations_async.py @@ -46,12 +46,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_operation_group_one_operations_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_operation_group_one_operations_async.py index e04b01847c7..8da6f99ae95 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_operation_group_one_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_operation_group_one_operations_async.py @@ -71,7 +71,6 @@ async def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelThree') diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_operation_group_two_operations_async.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_operation_group_two_operations_async.py index 79e9b2e93ae..a71542cab38 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_operation_group_two_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/aio/operations_async/_operation_group_two_operations_async.py @@ -72,7 +72,6 @@ async def test_four( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: body_content_kwargs['stream_content'] = input @@ -128,7 +127,6 @@ async def test_five( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py index 61796e5754b..c14bd40a65d 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_multiapi_service_client_operations.py @@ -51,12 +51,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py index 3cfc4398e30..b9dd21c3fd1 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_one_operations.py @@ -76,7 +76,6 @@ def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelThree') diff --git a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py index 77128296daf..af209411a7a 100644 --- a/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/Multiapi/multiapi/v3/operations/_operation_group_two_operations.py @@ -77,7 +77,6 @@ def test_four( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: body_content_kwargs['stream_content'] = input @@ -134,7 +133,6 @@ def test_five( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py index 2e42114fc77..c31096b36c1 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/_operations_mixin.py @@ -16,10 +16,12 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union class MultiapiServiceClientOperationsMixin(object): diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/_metadata.json index f62586bc099..a16c7d35887 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,31 +48,27 @@ }, "_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 Optional[\"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 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\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", "call": "product" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\nfrom azure.core.polling import LROPoller, NoPolling, PollingMethod\nfrom azure.core.polling.base_polling import LROBasePolling\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest\nfrom azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller\nfrom azure.core.polling.async_base_polling import AsyncLROBasePolling" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.polling\": [\"LROPoller\", \"NoPolling\", \"PollingMethod\"], \"azure.core.polling.base_polling\": [\"LROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.polling\": [\"AsyncLROPoller\", \"AsyncNoPolling\", \"AsyncPollingMethod\"], \"azure.core.polling.async_base_polling\": [\"AsyncLROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" } \ No newline at end of file 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 6a2925dc81f..f68b937190b 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 @@ -61,7 +61,6 @@ def test_one( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -98,7 +97,6 @@ def _test_lro_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -136,6 +134,7 @@ def begin_test_lro( :param product: Product to put. :type product: ~multiapinoasync.v1.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -150,11 +149,13 @@ def begin_test_lro( 'polling_interval', self._config.polling_interval ) - raw_result = self._test_lro_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._test_lro_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -169,5 +170,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = LROBasePolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py index 5361116c154..d00121adb1f 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v1/operations/_operation_group_one_operations.py @@ -70,7 +70,6 @@ def test_two( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/_metadata.json index b981a3ced91..91a96cac25e 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 }, @@ -50,6 +48,6 @@ "call": "id, message" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py index 8ee1c1a8d58..3a3a4af59ba 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_multiapi_service_client_operations.py @@ -60,7 +60,6 @@ def test_one( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py index 0ee0bcc0003..a0b8878ba70 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_one_operations.py @@ -76,7 +76,6 @@ def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelTwo') @@ -128,7 +127,6 @@ def test_three( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py index 1c487bd1fa9..ce5a2ff787d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v2/operations/_operation_group_two_operations.py @@ -74,7 +74,6 @@ def test_four( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json index e0b2353be92..5f89c882881 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/_metadata.json @@ -38,11 +38,9 @@ "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", "coroutine": false }, @@ -50,6 +48,6 @@ "call": "" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.paging import ItemPaged\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar", - "async_imports": "from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.async_paging import AsyncItemPaged, AsyncList\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py index 7ae9f388ebe..92ff9e40b8d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_multiapi_service_client_operations.py @@ -51,12 +51,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py index c7224250dd5..c9bba4b385c 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_one_operations.py @@ -76,7 +76,6 @@ def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelThree') diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py index d037a72b716..f5953febff7 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiNoAsync/multiapinoasync/v3/operations/_operation_group_two_operations.py @@ -77,7 +77,6 @@ def test_four( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: body_content_kwargs['stream_content'] = input @@ -134,7 +133,6 @@ def test_five( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py index 28242d4821e..17cc2333f6a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/_operations_mixin.py @@ -16,10 +16,12 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.polling.base_polling import LROBasePolling if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union class MultiapiServiceClientOperationsMixin(object): 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 861f39616b1..0be7e6b860b 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 @@ -9,22 +9,24 @@ # regenerated. # -------------------------------------------------------------------------- from msrest import Serializer, Deserializer -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.polling.async_base_polling import AsyncLROBasePolling class MultiapiServiceClientOperationsMixin(object): - async def test_lro( + 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. @@ -34,7 +36,7 @@ async def test_lro( :rtype: ~multiapiwithsubmodule.submodule.v1.models.Product :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 +46,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, 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 c9bc7978120..29aef534623 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,31 +48,27 @@ }, "_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 Optional[\"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 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\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"", "call": "product" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\nfrom azure.core.polling import LROPoller, NoPolling, PollingMethod\nfrom azure.core.polling.base_polling import LROBasePolling\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest\nfrom azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller\nfrom azure.core.polling.async_base_polling import AsyncLROBasePolling" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.polling\": [\"LROPoller\", \"NoPolling\", \"PollingMethod\"], \"azure.core.polling.base_polling\": [\"LROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.polling\": [\"AsyncLROPoller\", \"AsyncNoPolling\", \"AsyncPollingMethod\"], \"azure.core.polling.async_base_polling\": [\"AsyncLROBasePolling\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\", \"Union\"]}}}" } \ No newline at end of file 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 49fea717ed9..8bf3b6c04ab 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 @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.polling.async_base_polling import AsyncLROBasePolling from ... import models @@ -56,7 +56,6 @@ async def test_one( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -92,7 +91,6 @@ async def _test_lro_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -119,22 +117,23 @@ async def _test_lro_initial( return deserialized _test_lro_initial.metadata = {'url': '/multiapi/lro'} # type: ignore - async def test_lro( + 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. :type product: ~multiapiwithsubmodule.submodule.v1.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a 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] @@ -143,11 +142,13 @@ async def test_lro( 'polling_interval', self._config.polling_interval ) - raw_result = await self._test_lro_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._test_lro_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -162,5 +163,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncLROBasePolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_operation_group_one_operations_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_operation_group_one_operations_async.py index d95e6e3bbb5..b58ecf4961e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_operation_group_one_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/aio/operations_async/_operation_group_one_operations_async.py @@ -65,7 +65,6 @@ async def test_two( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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 85f78a1f89a..6db34d42c88 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 @@ -61,7 +61,6 @@ def test_one( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -98,7 +97,6 @@ def _test_lro_initial( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if product is not None: body_content = self._serialize.body(product, 'Product') @@ -136,6 +134,7 @@ def begin_test_lro( :param product: Product to put. :type product: ~multiapiwithsubmodule.submodule.v1.models.Product :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -150,11 +149,13 @@ def begin_test_lro( 'polling_interval', self._config.polling_interval ) - raw_result = self._test_lro_initial( - product=product, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._test_lro_initial( + product=product, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -169,5 +170,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = LROBasePolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_test_lro.metadata = {'url': '/multiapi/lro'} # type: ignore diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py index 19388d3a82e..76fad518ea9 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v1/operations/_operation_group_one_operations.py @@ -70,7 +70,6 @@ def test_two( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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..028534fcf94 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 }, @@ -50,6 +48,6 @@ "call": "id, message" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Optional, TypeVar", - "async_imports": "from typing import Any, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_multiapi_service_client_operations_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_multiapi_service_client_operations_async.py index 0ec8095b7ac..df73c8d6457 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_multiapi_service_client_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_multiapi_service_client_operations_async.py @@ -55,7 +55,6 @@ async def test_one( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_operation_group_one_operations_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_operation_group_one_operations_async.py index c8a816efd94..4d080febc89 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_operation_group_one_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_operation_group_one_operations_async.py @@ -71,7 +71,6 @@ async def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelTwo') @@ -122,7 +121,6 @@ async def test_three( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_operation_group_two_operations_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_operation_group_two_operations_async.py index 11b5138be95..19aaa21854a 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_operation_group_two_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/aio/operations_async/_operation_group_two_operations_async.py @@ -69,7 +69,6 @@ async def test_four( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py index 265f334f3d5..84d1af81138 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_multiapi_service_client_operations.py @@ -60,7 +60,6 @@ def test_one( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py index 050d20a5c5f..4e86be678b0 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_one_operations.py @@ -76,7 +76,6 @@ def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelTwo') @@ -128,7 +127,6 @@ def test_three( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py index f08b1e24702..710c62ce7f6 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v2/operations/_operation_group_two_operations.py @@ -74,7 +74,6 @@ def test_four( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response 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..dc8d442255d 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/_metadata.json @@ -38,11 +38,9 @@ "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", "coroutine": false }, @@ -50,6 +48,6 @@ "call": "" } }, - "sync_imports": "from typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.paging import ItemPaged\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar", - "async_imports": "from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar\nimport warnings\n\nfrom azure.core.async_paging import AsyncItemPaged, AsyncList\nfrom azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest" + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}" } \ No newline at end of file diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_multiapi_service_client_operations_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_multiapi_service_client_operations_async.py index a473dd1ed4f..e806a8b65da 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_multiapi_service_client_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_multiapi_service_client_operations_async.py @@ -46,12 +46,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_operation_group_one_operations_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_operation_group_one_operations_async.py index 319bb5afe05..8d0e716cd65 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_operation_group_one_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_operation_group_one_operations_async.py @@ -71,7 +71,6 @@ async def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelThree') diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_operation_group_two_operations_async.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_operation_group_two_operations_async.py index 3ce00e7540d..eafa3e69b3b 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_operation_group_two_operations_async.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/aio/operations_async/_operation_group_two_operations_async.py @@ -72,7 +72,6 @@ async def test_four( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: body_content_kwargs['stream_content'] = input @@ -128,7 +127,6 @@ async def test_five( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py index bbd43cfb48a..3b51ec6c70e 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_multiapi_service_client_operations.py @@ -51,12 +51,10 @@ def prepare_request(next_link=None): # Construct parameters query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) else: url = next_link query_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.get(url, query_parameters, header_parameters) return request diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py index 298101c36eb..0cd9cbe9b41 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_one_operations.py @@ -76,7 +76,6 @@ def test_two( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if parameter_one is not None: body_content = self._serialize.body(parameter_one, 'ModelThree') diff --git a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py index 763c542e710..fe3d3dbd3f4 100644 --- a/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py +++ b/test/multiapi/Expected/AcceptanceTests/MultiapiWithSubmodule/multiapiwithsubmodule/submodule/v3/operations/_operation_group_two_operations.py @@ -77,7 +77,6 @@ def test_four( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] if header_parameters['Content-Type'].split(";")[0] in ['application/pdf', 'image/jpeg', 'image/png', 'image/tiff']: body_content_kwargs['stream_content'] = input @@ -134,7 +133,6 @@ def test_five( # Construct headers header_parameters = {} # type: Dict[str, Any] - # Construct request request = self._client.put(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/multiapi/requirements.txt b/test/multiapi/requirements.txt index e5650cc785e..6bd0d2baece 100644 --- a/test/multiapi/requirements.txt +++ b/test/multiapi/requirements.txt @@ -1,6 +1,6 @@ msrest>=0.6.11 -azure-core>=1.3.0 -azure-mgmt-core +azure-core>=1.6.0 +azure-mgmt-core>=1.1.0 pytest pytest-asyncio==0.10.0;python_full_version>="3.5.2" async_generator;python_full_version>="3.5.2" diff --git a/test/unittests/test_name_converter.py b/test/unittests/test_name_converter.py index 0bd38e06f4b..0ac6b070638 100644 --- a/test/unittests/test_name_converter.py +++ b/test/unittests/test_name_converter.py @@ -22,14 +22,16 @@ def test_escaped_reserved_words(): "content_type": "content_type_parameter", "request_id": "request_id_parameter", "elif": "elif_parameter", - "self": "self_parameter" + "self": "self_parameter", + "continuation_token": "continuation_token_parameter" } for name in expected_conversion_parameter: assert NameConverter._to_valid_python_name(name, pad_string=PadType.Parameter) == expected_conversion_parameter[name] expected_conversion_enum = { "self": "self", - "mro": "mro_enum" + "mro": "mro_enum", + "continuation_token": "continuation_token" } for name in expected_conversion_enum: assert NameConverter._to_valid_python_name(name, pad_string=PadType.Enum) == expected_conversion_enum[name] \ No newline at end of file diff --git a/test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations_async/_array_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations_async/_array_operations_async.py index bdb43df47d9..370689affe7 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations_async/_array_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/aio/operations_async/_array_operations_async.py @@ -67,7 +67,6 @@ async def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,7 +110,6 @@ async def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -155,7 +153,6 @@ async def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -203,7 +200,6 @@ async def put_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -248,7 +244,6 @@ async def get_boolean_tfft( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -296,7 +291,6 @@ async def put_boolean_tfft( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[bool]') body_content_kwargs['content'] = body_content @@ -341,7 +335,6 @@ async def get_boolean_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -385,7 +378,6 @@ async def get_boolean_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -429,7 +421,6 @@ async def get_integer_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -477,7 +468,6 @@ async def put_integer_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[int]') body_content_kwargs['content'] = body_content @@ -522,7 +512,6 @@ async def get_int_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -566,7 +555,6 @@ async def get_int_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -610,7 +598,6 @@ async def get_long_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -658,7 +645,6 @@ async def put_long_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[long]') body_content_kwargs['content'] = body_content @@ -703,7 +689,6 @@ async def get_long_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -747,7 +732,6 @@ async def get_long_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -791,7 +775,6 @@ async def get_float_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -839,7 +822,6 @@ async def put_float_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[float]') body_content_kwargs['content'] = body_content @@ -884,7 +866,6 @@ async def get_float_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -928,7 +909,6 @@ async def get_float_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -972,7 +952,6 @@ async def get_double_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1020,7 +999,6 @@ async def put_double_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[float]') body_content_kwargs['content'] = body_content @@ -1065,7 +1043,6 @@ async def get_double_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1109,7 +1086,6 @@ async def get_double_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1153,7 +1129,6 @@ async def get_string_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1201,7 +1176,6 @@ async def put_string_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -1246,7 +1220,6 @@ async def get_enum_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1294,7 +1267,6 @@ async def put_enum_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -1339,7 +1311,6 @@ async def get_string_enum_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1387,7 +1358,6 @@ async def put_string_enum_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -1432,7 +1402,6 @@ async def get_string_with_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1476,7 +1445,6 @@ async def get_string_with_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1521,7 +1489,6 @@ async def get_uuid_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1570,7 +1537,6 @@ async def put_uuid_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -1615,7 +1581,6 @@ async def get_uuid_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1659,7 +1624,6 @@ async def get_date_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1707,7 +1671,6 @@ async def put_date_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[date]') body_content_kwargs['content'] = body_content @@ -1752,7 +1715,6 @@ async def get_date_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1796,7 +1758,6 @@ async def get_date_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1841,7 +1802,6 @@ async def get_date_time_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1890,7 +1850,6 @@ async def put_date_time_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[iso-8601]') body_content_kwargs['content'] = body_content @@ -1935,7 +1894,6 @@ async def get_date_time_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1979,7 +1937,6 @@ async def get_date_time_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2024,7 +1981,6 @@ async def get_date_time_rfc1123_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2073,7 +2029,6 @@ async def put_date_time_rfc1123_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[rfc-1123]') body_content_kwargs['content'] = body_content @@ -2118,7 +2073,6 @@ async def get_duration_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2166,7 +2120,6 @@ async def put_duration_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[duration]') body_content_kwargs['content'] = body_content @@ -2212,7 +2165,6 @@ async def get_byte_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2261,7 +2213,6 @@ async def put_byte_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[bytearray]') body_content_kwargs['content'] = body_content @@ -2306,7 +2257,6 @@ async def get_byte_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2351,7 +2301,6 @@ async def get_base64_url( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2395,7 +2344,6 @@ async def get_complex_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2439,7 +2387,6 @@ async def get_complex_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2484,7 +2431,6 @@ async def get_complex_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2529,7 +2475,6 @@ async def get_complex_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2574,7 +2519,6 @@ async def get_complex_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2623,7 +2567,6 @@ async def put_complex_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[Product]') body_content_kwargs['content'] = body_content @@ -2668,7 +2611,6 @@ async def get_array_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2712,7 +2654,6 @@ async def get_array_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2756,7 +2697,6 @@ async def get_array_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2800,7 +2740,6 @@ async def get_array_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2844,7 +2783,6 @@ async def get_array_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2892,7 +2830,6 @@ async def put_array_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[[str]]') body_content_kwargs['content'] = body_content @@ -2937,7 +2874,6 @@ async def get_dictionary_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2981,7 +2917,6 @@ async def get_dictionary_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3026,7 +2961,6 @@ async def get_dictionary_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3071,7 +3005,6 @@ async def get_dictionary_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3116,7 +3049,6 @@ async def get_dictionary_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3165,7 +3097,6 @@ async def put_dictionary_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[{str}]') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py index 7531a45ffc4..05ff379b7ac 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyArrayWithNamespaceFolders/vanilla/body/array/operations/_array_operations.py @@ -72,7 +72,6 @@ def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,7 +116,6 @@ def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,7 +160,6 @@ def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -211,7 +208,6 @@ def put_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -257,7 +253,6 @@ def get_boolean_tfft( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,7 +301,6 @@ def put_boolean_tfft( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[bool]') body_content_kwargs['content'] = body_content @@ -352,7 +346,6 @@ def get_boolean_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -397,7 +390,6 @@ def get_boolean_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -442,7 +434,6 @@ def get_integer_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -491,7 +482,6 @@ def put_integer_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[int]') body_content_kwargs['content'] = body_content @@ -537,7 +527,6 @@ def get_int_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -582,7 +571,6 @@ def get_int_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -627,7 +615,6 @@ def get_long_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -676,7 +663,6 @@ def put_long_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[long]') body_content_kwargs['content'] = body_content @@ -722,7 +708,6 @@ def get_long_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -767,7 +752,6 @@ def get_long_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -812,7 +796,6 @@ def get_float_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -861,7 +844,6 @@ def put_float_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[float]') body_content_kwargs['content'] = body_content @@ -907,7 +889,6 @@ def get_float_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -952,7 +933,6 @@ def get_float_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -997,7 +977,6 @@ def get_double_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1046,7 +1025,6 @@ def put_double_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[float]') body_content_kwargs['content'] = body_content @@ -1092,7 +1070,6 @@ def get_double_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1137,7 +1114,6 @@ def get_double_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1182,7 +1158,6 @@ def get_string_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1231,7 +1206,6 @@ def put_string_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -1277,7 +1251,6 @@ def get_enum_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1326,7 +1299,6 @@ def put_enum_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -1372,7 +1344,6 @@ def get_string_enum_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1421,7 +1392,6 @@ def put_string_enum_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -1467,7 +1437,6 @@ def get_string_with_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1512,7 +1481,6 @@ def get_string_with_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1558,7 +1526,6 @@ def get_uuid_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1608,7 +1575,6 @@ def put_uuid_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[str]') body_content_kwargs['content'] = body_content @@ -1654,7 +1620,6 @@ def get_uuid_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1699,7 +1664,6 @@ def get_date_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1748,7 +1712,6 @@ def put_date_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[date]') body_content_kwargs['content'] = body_content @@ -1794,7 +1757,6 @@ def get_date_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1839,7 +1801,6 @@ def get_date_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1885,7 +1846,6 @@ def get_date_time_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1935,7 +1895,6 @@ def put_date_time_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[iso-8601]') body_content_kwargs['content'] = body_content @@ -1981,7 +1940,6 @@ def get_date_time_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2026,7 +1984,6 @@ def get_date_time_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2072,7 +2029,6 @@ def get_date_time_rfc1123_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2122,7 +2078,6 @@ def put_date_time_rfc1123_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[rfc-1123]') body_content_kwargs['content'] = body_content @@ -2168,7 +2123,6 @@ def get_duration_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2217,7 +2171,6 @@ def put_duration_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[duration]') body_content_kwargs['content'] = body_content @@ -2264,7 +2217,6 @@ def get_byte_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2314,7 +2266,6 @@ def put_byte_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[bytearray]') body_content_kwargs['content'] = body_content @@ -2360,7 +2311,6 @@ def get_byte_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2406,7 +2356,6 @@ def get_base64_url( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2451,7 +2400,6 @@ def get_complex_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2496,7 +2444,6 @@ def get_complex_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2542,7 +2489,6 @@ def get_complex_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2588,7 +2534,6 @@ def get_complex_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2634,7 +2579,6 @@ def get_complex_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2684,7 +2628,6 @@ def put_complex_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[Product]') body_content_kwargs['content'] = body_content @@ -2730,7 +2673,6 @@ def get_array_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2775,7 +2717,6 @@ def get_array_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2820,7 +2761,6 @@ def get_array_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2865,7 +2805,6 @@ def get_array_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2910,7 +2849,6 @@ def get_array_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2959,7 +2897,6 @@ def put_array_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[[str]]') body_content_kwargs['content'] = body_content @@ -3005,7 +2942,6 @@ def get_dictionary_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3050,7 +2986,6 @@ def get_dictionary_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3096,7 +3031,6 @@ def get_dictionary_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3142,7 +3076,6 @@ def get_dictionary_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3188,7 +3121,6 @@ def get_dictionary_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3238,7 +3170,6 @@ def put_dictionary_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct and send request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '[{str}]') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_array_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_array_operations_async.py index 7ad9eceeea8..fc960a6c099 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_array_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_array_operations_async.py @@ -66,7 +66,6 @@ async def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,7 +115,6 @@ async def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'ArrayWrapper') body_content_kwargs['content'] = body_content @@ -161,7 +159,6 @@ async def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -211,7 +208,6 @@ async def put_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'ArrayWrapper') body_content_kwargs['content'] = body_content @@ -256,7 +252,6 @@ async def get_not_provided( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_basic_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_basic_operations_async.py index 855de06ddab..99ddfc3520a 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_basic_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_basic_operations_async.py @@ -66,7 +66,6 @@ async def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,7 +115,6 @@ async def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Basic') body_content_kwargs['content'] = body_content @@ -161,7 +159,6 @@ async def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -205,7 +202,6 @@ async def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,7 +245,6 @@ async def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -293,7 +288,6 @@ async def get_not_provided( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_dictionary_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_dictionary_operations_async.py index e90b9bc385e..15ed9fb64a7 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_dictionary_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_dictionary_operations_async.py @@ -66,7 +66,6 @@ async def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,7 +115,6 @@ async def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'DictionaryWrapper') body_content_kwargs['content'] = body_content @@ -161,7 +159,6 @@ async def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -211,7 +208,6 @@ async def put_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'DictionaryWrapper') body_content_kwargs['content'] = body_content @@ -256,7 +252,6 @@ async def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,7 +295,6 @@ async def get_not_provided( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_flattencomplex_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_flattencomplex_operations_async.py index 4293d16510e..57aa49c2d4f 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_flattencomplex_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_flattencomplex_operations_async.py @@ -66,7 +66,6 @@ async def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_inheritance_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_inheritance_operations_async.py index e08fc8a868a..ded81598dba 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_inheritance_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_inheritance_operations_async.py @@ -66,7 +66,6 @@ async def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,7 +115,6 @@ async def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Siamese') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_polymorphicrecursive_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_polymorphicrecursive_operations_async.py index 9c22b1dcc35..e19bd29b666 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_polymorphicrecursive_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_polymorphicrecursive_operations_async.py @@ -66,7 +66,6 @@ async def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -166,7 +165,6 @@ async def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Fish') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_polymorphism_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_polymorphism_operations_async.py index 319798cced3..49ea07684f7 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_polymorphism_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_polymorphism_operations_async.py @@ -66,7 +66,6 @@ async def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -146,7 +145,6 @@ async def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Fish') body_content_kwargs['content'] = body_content @@ -191,7 +189,6 @@ async def get_dot_syntax( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -237,7 +234,6 @@ async def get_composed_with_discriminator( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -283,7 +279,6 @@ async def get_composed_without_discriminator( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -328,7 +323,6 @@ async def get_complicated( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -377,7 +371,6 @@ async def put_complicated( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Salmon') body_content_kwargs['content'] = body_content @@ -427,7 +420,6 @@ async def put_missing_discriminator( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Salmon') body_content_kwargs['content'] = body_content @@ -506,7 +498,6 @@ async def put_valid_missing_required( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Fish') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_primitive_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_primitive_operations_async.py index 5666fa7fa0d..4bbc1b8bbbf 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_primitive_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_primitive_operations_async.py @@ -67,7 +67,6 @@ async def get_int( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,7 +114,6 @@ async def put_int( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'IntWrapper') body_content_kwargs['content'] = body_content @@ -160,7 +158,6 @@ async def get_long( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -208,7 +205,6 @@ async def put_long( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'LongWrapper') body_content_kwargs['content'] = body_content @@ -253,7 +249,6 @@ async def get_float( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -301,7 +296,6 @@ async def put_float( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'FloatWrapper') body_content_kwargs['content'] = body_content @@ -346,7 +340,6 @@ async def get_double( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -395,7 +388,6 @@ async def put_double( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'DoubleWrapper') body_content_kwargs['content'] = body_content @@ -440,7 +432,6 @@ async def get_bool( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -488,7 +479,6 @@ async def put_bool( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'BooleanWrapper') body_content_kwargs['content'] = body_content @@ -533,7 +523,6 @@ async def get_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -581,7 +570,6 @@ async def put_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'StringWrapper') body_content_kwargs['content'] = body_content @@ -626,7 +614,6 @@ async def get_date( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -674,7 +661,6 @@ async def put_date( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'DateWrapper') body_content_kwargs['content'] = body_content @@ -719,7 +705,6 @@ async def get_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -767,7 +752,6 @@ async def put_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'DatetimeWrapper') body_content_kwargs['content'] = body_content @@ -812,7 +796,6 @@ async def get_date_time_rfc1123( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -861,7 +844,6 @@ async def put_date_time_rfc1123( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Datetimerfc1123Wrapper') body_content_kwargs['content'] = body_content @@ -906,7 +888,6 @@ async def get_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -956,7 +937,6 @@ async def put_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'DurationWrapper') body_content_kwargs['content'] = body_content @@ -1001,7 +981,6 @@ async def get_byte( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1051,7 +1030,6 @@ async def put_byte( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'ByteWrapper') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_readonlyproperty_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_readonlyproperty_operations_async.py index d3a4289331b..3a9289f0d0e 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_readonlyproperty_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/aio/operations_async/_readonlyproperty_operations_async.py @@ -66,7 +66,6 @@ async def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,7 +115,6 @@ async def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'ReadonlyObj') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py index 38d1f58d983..e8960d848d4 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_array_operations.py @@ -71,7 +71,6 @@ def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -122,7 +121,6 @@ def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'ArrayWrapper') body_content_kwargs['content'] = body_content @@ -168,7 +166,6 @@ def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -219,7 +216,6 @@ def put_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'ArrayWrapper') body_content_kwargs['content'] = body_content @@ -265,7 +261,6 @@ def get_not_provided( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py index 2debab85efc..fe01856afdb 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_basic_operations.py @@ -71,7 +71,6 @@ def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -122,7 +121,6 @@ def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Basic') body_content_kwargs['content'] = body_content @@ -168,7 +166,6 @@ def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -213,7 +210,6 @@ def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -258,7 +254,6 @@ def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -303,7 +298,6 @@ def get_not_provided( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py index 0e4f112fbf4..dc19e1f3111 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_dictionary_operations.py @@ -71,7 +71,6 @@ def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -122,7 +121,6 @@ def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'DictionaryWrapper') body_content_kwargs['content'] = body_content @@ -168,7 +166,6 @@ def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -219,7 +216,6 @@ def put_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'DictionaryWrapper') body_content_kwargs['content'] = body_content @@ -265,7 +261,6 @@ def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,7 +305,6 @@ def get_not_provided( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py index eb927ae6645..82b1d804204 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_flattencomplex_operations.py @@ -71,7 +71,6 @@ def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py index a840ed1d6ee..a46a5978de1 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_inheritance_operations.py @@ -71,7 +71,6 @@ def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -122,7 +121,6 @@ def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Siamese') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py index c9e07b68abb..88e5478c6d4 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphicrecursive_operations.py @@ -71,7 +71,6 @@ def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -172,7 +171,6 @@ def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Fish') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py index 876a969a344..1e2f6176fc1 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_polymorphism_operations.py @@ -71,7 +71,6 @@ def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -152,7 +151,6 @@ def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Fish') body_content_kwargs['content'] = body_content @@ -198,7 +196,6 @@ def get_dot_syntax( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -245,7 +242,6 @@ def get_composed_with_discriminator( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -292,7 +288,6 @@ def get_composed_without_discriminator( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -338,7 +333,6 @@ def get_complicated( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -388,7 +382,6 @@ def put_complicated( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Salmon') body_content_kwargs['content'] = body_content @@ -439,7 +432,6 @@ def put_missing_discriminator( header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Salmon') body_content_kwargs['content'] = body_content @@ -519,7 +511,6 @@ def put_valid_missing_required( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Fish') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py index 4bed55eadbb..84c20a6a053 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_primitive_operations.py @@ -72,7 +72,6 @@ def get_int( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -121,7 +120,6 @@ def put_int( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'IntWrapper') body_content_kwargs['content'] = body_content @@ -167,7 +165,6 @@ def get_long( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -216,7 +213,6 @@ def put_long( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'LongWrapper') body_content_kwargs['content'] = body_content @@ -262,7 +258,6 @@ def get_float( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -311,7 +306,6 @@ def put_float( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'FloatWrapper') body_content_kwargs['content'] = body_content @@ -357,7 +351,6 @@ def get_double( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -407,7 +400,6 @@ def put_double( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'DoubleWrapper') body_content_kwargs['content'] = body_content @@ -453,7 +445,6 @@ def get_bool( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,7 +493,6 @@ def put_bool( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'BooleanWrapper') body_content_kwargs['content'] = body_content @@ -548,7 +538,6 @@ def get_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -597,7 +586,6 @@ def put_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'StringWrapper') body_content_kwargs['content'] = body_content @@ -643,7 +631,6 @@ def get_date( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -692,7 +679,6 @@ def put_date( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'DateWrapper') body_content_kwargs['content'] = body_content @@ -738,7 +724,6 @@ def get_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -787,7 +772,6 @@ def put_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'DatetimeWrapper') body_content_kwargs['content'] = body_content @@ -833,7 +817,6 @@ def get_date_time_rfc1123( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -883,7 +866,6 @@ def put_date_time_rfc1123( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(complex_body, 'Datetimerfc1123Wrapper') body_content_kwargs['content'] = body_content @@ -929,7 +911,6 @@ def get_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -980,7 +961,6 @@ def put_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'DurationWrapper') body_content_kwargs['content'] = body_content @@ -1026,7 +1006,6 @@ def get_byte( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1077,7 +1056,6 @@ def put_byte( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'ByteWrapper') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py index 5c9a30664b7..314e3490c9d 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyComplex/bodycomplex/operations/_readonlyproperty_operations.py @@ -71,7 +71,6 @@ def get_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -122,7 +121,6 @@ def put_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(_complex_body, 'ReadonlyObj') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations_async/_datetimerfc1123_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations_async/_datetimerfc1123_operations_async.py index 0c048cde878..7f0b6581ec8 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations_async/_datetimerfc1123_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/aio/operations_async/_datetimerfc1123_operations_async.py @@ -67,7 +67,6 @@ async def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,7 +110,6 @@ async def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -155,7 +153,6 @@ async def get_overflow( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,7 +196,6 @@ async def get_underflow( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,7 +243,6 @@ async def put_utc_max_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(datetime_body, 'rfc-1123') body_content_kwargs['content'] = body_content @@ -292,7 +287,6 @@ async def get_utc_lowercase_max_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,7 +330,6 @@ async def get_utc_uppercase_max_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -384,7 +377,6 @@ async def put_utc_min_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(datetime_body, 'rfc-1123') body_content_kwargs['content'] = body_content @@ -429,7 +421,6 @@ async def get_utc_min_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py index 9a8001911be..e40bb88dac8 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDateTimeRfc1123/bodydatetimerfc1123/operations/_datetimerfc1123_operations.py @@ -72,7 +72,6 @@ def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,7 +116,6 @@ def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,7 +160,6 @@ def get_overflow( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -207,7 +204,6 @@ def get_underflow( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -256,7 +252,6 @@ def put_utc_max_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(datetime_body, 'rfc-1123') body_content_kwargs['content'] = body_content @@ -302,7 +297,6 @@ def get_utc_lowercase_max_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -347,7 +341,6 @@ def get_utc_uppercase_max_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,7 +389,6 @@ def put_utc_min_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(datetime_body, 'rfc-1123') body_content_kwargs['content'] = body_content @@ -442,7 +434,6 @@ def get_utc_min_date_time( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations_async/_dictionary_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations_async/_dictionary_operations_async.py index 0ade40984d9..faf83198286 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations_async/_dictionary_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/aio/operations_async/_dictionary_operations_async.py @@ -67,7 +67,6 @@ async def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,7 +110,6 @@ async def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -159,7 +157,6 @@ async def put_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{str}') body_content_kwargs['content'] = body_content @@ -204,7 +201,6 @@ async def get_null_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,7 +244,6 @@ async def get_null_key( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -292,7 +287,6 @@ async def get_empty_string_key( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -336,7 +330,6 @@ async def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -380,7 +373,6 @@ async def get_boolean_tfft( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -428,7 +420,6 @@ async def put_boolean_tfft( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{bool}') body_content_kwargs['content'] = body_content @@ -473,7 +464,6 @@ async def get_boolean_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -517,7 +507,6 @@ async def get_boolean_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -561,7 +550,6 @@ async def get_integer_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -609,7 +597,6 @@ async def put_integer_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{int}') body_content_kwargs['content'] = body_content @@ -654,7 +641,6 @@ async def get_int_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -698,7 +684,6 @@ async def get_int_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -742,7 +727,6 @@ async def get_long_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -790,7 +774,6 @@ async def put_long_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{long}') body_content_kwargs['content'] = body_content @@ -835,7 +818,6 @@ async def get_long_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -879,7 +861,6 @@ async def get_long_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -923,7 +904,6 @@ async def get_float_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -971,7 +951,6 @@ async def put_float_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{float}') body_content_kwargs['content'] = body_content @@ -1016,7 +995,6 @@ async def get_float_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1060,7 +1038,6 @@ async def get_float_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1104,7 +1081,6 @@ async def get_double_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1152,7 +1128,6 @@ async def put_double_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{float}') body_content_kwargs['content'] = body_content @@ -1197,7 +1172,6 @@ async def get_double_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1241,7 +1215,6 @@ async def get_double_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1285,7 +1258,6 @@ async def get_string_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1333,7 +1305,6 @@ async def put_string_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{str}') body_content_kwargs['content'] = body_content @@ -1378,7 +1349,6 @@ async def get_string_with_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1422,7 +1392,6 @@ async def get_string_with_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1466,7 +1435,6 @@ async def get_date_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1514,7 +1482,6 @@ async def put_date_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{date}') body_content_kwargs['content'] = body_content @@ -1559,7 +1526,6 @@ async def get_date_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1603,7 +1569,6 @@ async def get_date_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1648,7 +1613,6 @@ async def get_date_time_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1697,7 +1661,6 @@ async def put_date_time_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{iso-8601}') body_content_kwargs['content'] = body_content @@ -1742,7 +1705,6 @@ async def get_date_time_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1786,7 +1748,6 @@ async def get_date_time_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1831,7 +1792,6 @@ async def get_date_time_rfc1123_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1880,7 +1840,6 @@ async def put_date_time_rfc1123_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{rfc-1123}') body_content_kwargs['content'] = body_content @@ -1925,7 +1884,6 @@ async def get_duration_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1973,7 +1931,6 @@ async def put_duration_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{duration}') body_content_kwargs['content'] = body_content @@ -2019,7 +1976,6 @@ async def get_byte_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2068,7 +2024,6 @@ async def put_byte_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{bytearray}') body_content_kwargs['content'] = body_content @@ -2114,7 +2069,6 @@ async def get_byte_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2159,7 +2113,6 @@ async def get_base64_url( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2203,7 +2156,6 @@ async def get_complex_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2247,7 +2199,6 @@ async def get_complex_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2292,7 +2243,6 @@ async def get_complex_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2337,7 +2287,6 @@ async def get_complex_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2382,7 +2331,6 @@ async def get_complex_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2431,7 +2379,6 @@ async def put_complex_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{Widget}') body_content_kwargs['content'] = body_content @@ -2476,7 +2423,6 @@ async def get_array_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2520,7 +2466,6 @@ async def get_array_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2564,7 +2509,6 @@ async def get_array_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2608,7 +2552,6 @@ async def get_array_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2653,7 +2596,6 @@ async def get_array_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2702,7 +2644,6 @@ async def put_array_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{[str]}') body_content_kwargs['content'] = body_content @@ -2747,7 +2688,6 @@ async def get_dictionary_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2791,7 +2731,6 @@ async def get_dictionary_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2836,7 +2775,6 @@ async def get_dictionary_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2881,7 +2819,6 @@ async def get_dictionary_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2927,7 +2864,6 @@ async def get_dictionary_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2977,7 +2913,6 @@ async def put_dictionary_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{object}') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py index 9480ff05f45..5d99b506c6f 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDictionary/bodydictionary/operations/_dictionary_operations.py @@ -72,7 +72,6 @@ def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,7 +116,6 @@ def get_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -166,7 +164,6 @@ def put_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{str}') body_content_kwargs['content'] = body_content @@ -212,7 +209,6 @@ def get_null_value( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -257,7 +253,6 @@ def get_null_key( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -302,7 +297,6 @@ def get_empty_string_key( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -347,7 +341,6 @@ def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -392,7 +385,6 @@ def get_boolean_tfft( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -441,7 +433,6 @@ def put_boolean_tfft( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{bool}') body_content_kwargs['content'] = body_content @@ -487,7 +478,6 @@ def get_boolean_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -532,7 +522,6 @@ def get_boolean_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -577,7 +566,6 @@ def get_integer_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -626,7 +614,6 @@ def put_integer_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{int}') body_content_kwargs['content'] = body_content @@ -672,7 +659,6 @@ def get_int_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -717,7 +703,6 @@ def get_int_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -762,7 +747,6 @@ def get_long_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -811,7 +795,6 @@ def put_long_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{long}') body_content_kwargs['content'] = body_content @@ -857,7 +840,6 @@ def get_long_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -902,7 +884,6 @@ def get_long_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -947,7 +928,6 @@ def get_float_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -996,7 +976,6 @@ def put_float_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{float}') body_content_kwargs['content'] = body_content @@ -1042,7 +1021,6 @@ def get_float_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1087,7 +1065,6 @@ def get_float_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1132,7 +1109,6 @@ def get_double_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1181,7 +1157,6 @@ def put_double_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{float}') body_content_kwargs['content'] = body_content @@ -1227,7 +1202,6 @@ def get_double_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1272,7 +1246,6 @@ def get_double_invalid_string( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1317,7 +1290,6 @@ def get_string_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1366,7 +1338,6 @@ def put_string_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{str}') body_content_kwargs['content'] = body_content @@ -1412,7 +1383,6 @@ def get_string_with_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1457,7 +1427,6 @@ def get_string_with_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1502,7 +1471,6 @@ def get_date_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1551,7 +1519,6 @@ def put_date_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{date}') body_content_kwargs['content'] = body_content @@ -1597,7 +1564,6 @@ def get_date_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1642,7 +1608,6 @@ def get_date_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1688,7 +1653,6 @@ def get_date_time_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1738,7 +1702,6 @@ def put_date_time_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{iso-8601}') body_content_kwargs['content'] = body_content @@ -1784,7 +1747,6 @@ def get_date_time_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1829,7 +1791,6 @@ def get_date_time_invalid_chars( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1875,7 +1836,6 @@ def get_date_time_rfc1123_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1925,7 +1885,6 @@ def put_date_time_rfc1123_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{rfc-1123}') body_content_kwargs['content'] = body_content @@ -1971,7 +1930,6 @@ def get_duration_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2020,7 +1978,6 @@ def put_duration_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{duration}') body_content_kwargs['content'] = body_content @@ -2067,7 +2024,6 @@ def get_byte_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2117,7 +2073,6 @@ def put_byte_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{bytearray}') body_content_kwargs['content'] = body_content @@ -2164,7 +2119,6 @@ def get_byte_invalid_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2210,7 +2164,6 @@ def get_base64_url( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2255,7 +2208,6 @@ def get_complex_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2300,7 +2252,6 @@ def get_complex_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2346,7 +2297,6 @@ def get_complex_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2392,7 +2342,6 @@ def get_complex_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2438,7 +2387,6 @@ def get_complex_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2488,7 +2436,6 @@ def put_complex_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{Widget}') body_content_kwargs['content'] = body_content @@ -2534,7 +2481,6 @@ def get_array_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2579,7 +2525,6 @@ def get_array_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2624,7 +2569,6 @@ def get_array_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2669,7 +2613,6 @@ def get_array_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2715,7 +2658,6 @@ def get_array_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2765,7 +2707,6 @@ def put_array_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{[str]}') body_content_kwargs['content'] = body_content @@ -2811,7 +2752,6 @@ def get_dictionary_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2856,7 +2796,6 @@ def get_dictionary_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2902,7 +2841,6 @@ def get_dictionary_item_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2948,7 +2886,6 @@ def get_dictionary_item_empty( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -2995,7 +2932,6 @@ def get_dictionary_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -3046,7 +2982,6 @@ def put_dictionary_valid( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(array_body, '{object}') body_content_kwargs['content'] = body_content diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py index 86fde5090a8..7336aca4623 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/aio/operations_async/_duration_operations_async.py @@ -67,7 +67,6 @@ async def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,7 +114,6 @@ async def put_positive_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(duration_body, 'duration') body_content_kwargs['content'] = body_content @@ -160,7 +158,6 @@ async def get_positive_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -204,7 +201,6 @@ async def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py index 905da870b63..6d39dd5be2a 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyDuration/bodyduration/operations/_duration_operations.py @@ -72,7 +72,6 @@ def get_null( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -121,7 +120,6 @@ def put_positive_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - # Construct request body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(duration_body, 'duration') body_content_kwargs['content'] = body_content @@ -167,7 +165,6 @@ def get_positive_duration( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -212,7 +209,6 @@ def get_invalid( header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - # Construct request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response diff --git a/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/aio/operations_async/_string_operations_async.py b/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/aio/operations_async/_string_operations_async.py index 4ac4736575b..c71130a62f3 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/aio/operations_async/_string_operations_async.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/aio/operations_async/_string_operations_async.py @@ -452,15 +452,15 @@ async def get_not_provided( async def get_base64_encoded( self, **kwargs - ) -> bytes: + ) -> bytearray: """Get value that is base64 encoded. :keyword callable cls: A custom type or function that will be passed the direct response - :return: bytes, or the result of cls(response) - :rtype: bytes + :return: bytearray, or the result of cls(response) + :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[bytes] + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) @@ -483,7 +483,7 @@ async def get_base64_encoded( error = self._deserialize(models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('base64', pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py b/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py index 486edc4ad09..c377ba629b9 100644 --- a/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py +++ b/test/vanilla/Expected/AcceptanceTests/BodyString/bodystring/operations/_string_operations.py @@ -466,15 +466,15 @@ def get_base64_encoded( self, **kwargs # type: Any ): - # type: (...) -> bytes + # type: (...) -> bytearray """Get value that is base64 encoded. :keyword callable cls: A custom type or function that will be passed the direct response - :return: bytes, or the result of cls(response) - :rtype: bytes + :return: bytearray, or the result of cls(response) + :rtype: bytearray :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[bytes] + cls = kwargs.pop('cls', None) # type: ClsType[bytearray] error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} error_map.update(kwargs.pop('error_map', {})) @@ -497,7 +497,7 @@ def get_base64_encoded( error = self._deserialize(models.Error, response) raise HttpResponseError(response=response, model=error) - deserialized = self._deserialize('base64', pipeline_response) + deserialized = self._deserialize('bytearray', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/__init__.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/__init__.py new file mode 100644 index 00000000000..ec4ce84d210 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._multiple_inheritance_service_client import MultipleInheritanceServiceClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['MultipleInheritanceServiceClient'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_configuration.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_configuration.py new file mode 100644 index 00000000000..9934d7190b2 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_configuration.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + +class MultipleInheritanceServiceClientConfiguration(Configuration): + """Configuration for MultipleInheritanceServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + """ + + def __init__( + self, + **kwargs # type: Any + ): + # type: (...) -> None + super(MultipleInheritanceServiceClientConfiguration, self).__init__(**kwargs) + + kwargs.setdefault('sdk_moniker', 'multipleinheritanceserviceclient/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py new file mode 100644 index 00000000000..35ee8dc223a --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_multiple_inheritance_service_client.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + +from ._configuration import MultipleInheritanceServiceClientConfiguration +from .operations import MultipleInheritanceServiceClientOperationsMixin +from . import models + + +class MultipleInheritanceServiceClient(MultipleInheritanceServiceClientOperationsMixin): + """Service client for multiinheritance client testing. + + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'http://localhost:3000' + self._config = MultipleInheritanceServiceClientConfiguration(**kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> MultipleInheritanceServiceClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_version.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_version.py new file mode 100644 index 00000000000..eae7c95b6fb --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "0.1.0" diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/__init__.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/__init__.py new file mode 100644 index 00000000000..e04768551ec --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._multiple_inheritance_service_client_async import MultipleInheritanceServiceClient +__all__ = ['MultipleInheritanceServiceClient'] diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration_async.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration_async.py new file mode 100644 index 00000000000..1a1c36c9fa6 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration_async.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + + +class MultipleInheritanceServiceClientConfiguration(Configuration): + """Configuration for MultipleInheritanceServiceClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + """ + + def __init__( + self, + **kwargs: Any + ) -> None: + super(MultipleInheritanceServiceClientConfiguration, self).__init__(**kwargs) + + kwargs.setdefault('sdk_moniker', 'multipleinheritanceserviceclient/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client_async.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client_async.py new file mode 100644 index 00000000000..a619abd7410 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_multiple_inheritance_service_client_async.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional + +from azure.core import AsyncPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import MultipleInheritanceServiceClientConfiguration +from .operations_async import MultipleInheritanceServiceClientOperationsMixin +from .. import models + + +class MultipleInheritanceServiceClient(MultipleInheritanceServiceClientOperationsMixin): + """Service client for multiinheritance client testing. + + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'http://localhost:3000' + self._config = MultipleInheritanceServiceClientConfiguration(**kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "MultipleInheritanceServiceClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations_async/__init__.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations_async/__init__.py new file mode 100644 index 00000000000..2411f4731dd --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations_async/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._multiple_inheritance_service_client_operations_async import MultipleInheritanceServiceClientOperationsMixin + +__all__ = [ + 'MultipleInheritanceServiceClientOperationsMixin', +] diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations_async/_multiple_inheritance_service_client_operations_async.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations_async/_multiple_inheritance_service_client_operations_async.py new file mode 100644 index 00000000000..2a213e04c2d --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/operations_async/_multiple_inheritance_service_client_operations_async.py @@ -0,0 +1,496 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MultipleInheritanceServiceClientOperationsMixin: + + @distributed_trace_async + async def get_horse( + self, + **kwargs + ) -> "models.Horse": + """Get a horse with name 'Fred' and isAShowHorse true. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Horse, or the result of cls(response) + :rtype: ~multipleinheritance.models.Horse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Horse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_horse.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Horse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_horse.metadata = {'url': '/multipleInheritance/horse'} # type: ignore + + @distributed_trace_async + async def put_horse( + self, + horse: "models.Horse", + **kwargs + ) -> str: + """Put a horse with name 'General' and isAShowHorse false. + + :param horse: Put a horse with name 'General' and isAShowHorse false. + :type horse: ~multipleinheritance.models.Horse + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_horse.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(horse, 'Horse') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_horse.metadata = {'url': '/multipleInheritance/horse'} # type: ignore + + @distributed_trace_async + async def get_pet( + self, + **kwargs + ) -> "models.Pet": + """Get a pet with name 'Peanut'. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Pet, or the result of cls(response) + :rtype: ~multipleinheritance.models.Pet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Pet"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_pet.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Pet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_pet.metadata = {'url': '/multipleInheritance/pet'} # type: ignore + + @distributed_trace_async + async def put_pet( + self, + name: str, + **kwargs + ) -> str: + """Put a pet with name 'Butter'. + + :param name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _pet = models.Pet(name=name) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_pet.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_pet, 'Pet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_pet.metadata = {'url': '/multipleInheritance/pet'} # type: ignore + + @distributed_trace_async + async def get_feline( + self, + **kwargs + ) -> "models.Feline": + """Get a feline where meows and hisses are true. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Feline, or the result of cls(response) + :rtype: ~multipleinheritance.models.Feline + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Feline"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_feline.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Feline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_feline.metadata = {'url': '/multipleInheritance/feline'} # type: ignore + + @distributed_trace_async + async def put_feline( + self, + feline: "models.Feline", + **kwargs + ) -> str: + """Put a feline who hisses and doesn't meow. + + :param feline: Put a feline who hisses and doesn't meow. + :type feline: ~multipleinheritance.models.Feline + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_feline.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(feline, 'Feline') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_feline.metadata = {'url': '/multipleInheritance/feline'} # type: ignore + + @distributed_trace_async + async def get_cat( + self, + **kwargs + ) -> "models.Cat": + """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Cat, or the result of cls(response) + :rtype: ~multipleinheritance.models.Cat + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Cat"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_cat.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Cat', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_cat.metadata = {'url': '/multipleInheritance/cat'} # type: ignore + + @distributed_trace_async + async def put_cat( + self, + cat: "models.Cat", + **kwargs + ) -> str: + """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. + + :param cat: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. + :type cat: ~multipleinheritance.models.Cat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_cat.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(cat, 'Cat') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_cat.metadata = {'url': '/multipleInheritance/cat'} # type: ignore + + @distributed_trace_async + async def get_kitten( + self, + **kwargs + ) -> "models.Kitten": + """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet + is false. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Kitten, or the result of cls(response) + :rtype: ~multipleinheritance.models.Kitten + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Kitten"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_kitten.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Kitten', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_kitten.metadata = {'url': '/multipleInheritance/kitten'} # type: ignore + + @distributed_trace_async + async def put_kitten( + self, + kitten: "models.Kitten", + **kwargs + ) -> str: + """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is + true. + + :param kitten: Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and + eatsMiceYet is true. + :type kitten: ~multipleinheritance.models.Kitten + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_kitten.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(kitten, 'Kitten') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_kitten.metadata = {'url': '/multipleInheritance/kitten'} # type: ignore diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py new file mode 100644 index 00000000000..8c9e96065f7 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/__init__.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Cat + from ._models_py3 import Error + from ._models_py3 import Feline + from ._models_py3 import Horse + from ._models_py3 import Kitten + from ._models_py3 import Pet +except (SyntaxError, ImportError): + from ._models import Cat # type: ignore + from ._models import Error # type: ignore + from ._models import Feline # type: ignore + from ._models import Horse # type: ignore + from ._models import Kitten # type: ignore + from ._models import Pet # type: ignore + +__all__ = [ + 'Cat', + 'Error', + 'Feline', + 'Horse', + 'Kitten', + 'Pet', +] diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models.py new file mode 100644 index 00000000000..cc3875bbef9 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models.py @@ -0,0 +1,184 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Feline(msrest.serialization.Model): + """Feline. + + :param meows: + :type meows: bool + :param hisses: + :type hisses: bool + """ + + _attribute_map = { + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Feline, self).__init__(**kwargs) + self.meows = kwargs.get('meows', None) + self.hisses = kwargs.get('hisses', None) + + +class Pet(msrest.serialization.Model): + """Pet. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Pet, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class Cat(Pet, Feline): + """Cat. + + All required parameters must be populated in order to send to Azure. + + :param meows: + :type meows: bool + :param hisses: + :type hisses: bool + :param name: Required. + :type name: str + :param likes_milk: + :type likes_milk: bool + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'likes_milk': {'key': 'likesMilk', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Cat, self).__init__(**kwargs) + self.meows = kwargs.get('meows', None) + self.hisses = kwargs.get('hisses', None) + self.likes_milk = kwargs.get('likes_milk', None) + self.name = kwargs['name'] + self.likes_milk = kwargs.get('likes_milk', None) + + +class Error(msrest.serialization.Model): + """Error. + + :param status: + :type status: int + :param message: + :type message: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.message = kwargs.get('message', None) + + +class Horse(Pet): + """Horse. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. + :type name: str + :param is_a_show_horse: + :type is_a_show_horse: bool + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_a_show_horse': {'key': 'isAShowHorse', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Horse, self).__init__(**kwargs) + self.is_a_show_horse = kwargs.get('is_a_show_horse', None) + + +class Kitten(Cat): + """Kitten. + + All required parameters must be populated in order to send to Azure. + + :param meows: + :type meows: bool + :param hisses: + :type hisses: bool + :param name: Required. + :type name: str + :param likes_milk: + :type likes_milk: bool + :param eats_mice_yet: + :type eats_mice_yet: bool + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'likes_milk': {'key': 'likesMilk', 'type': 'bool'}, + 'eats_mice_yet': {'key': 'eatsMiceYet', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(Kitten, self).__init__(**kwargs) + self.eats_mice_yet = kwargs.get('eats_mice_yet', None) diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models_py3.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models_py3.py new file mode 100644 index 00000000000..b40439c1a36 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/models/_models_py3.py @@ -0,0 +1,208 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class Feline(msrest.serialization.Model): + """Feline. + + :param meows: + :type meows: bool + :param hisses: + :type hisses: bool + """ + + _attribute_map = { + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + } + + def __init__( + self, + *, + meows: Optional[bool] = None, + hisses: Optional[bool] = None, + **kwargs + ): + super(Feline, self).__init__(**kwargs) + self.meows = meows + self.hisses = hisses + + +class Pet(msrest.serialization.Model): + """Pet. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. + :type name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(Pet, self).__init__(**kwargs) + self.name = name + + +class Cat(Pet, Feline): + """Cat. + + All required parameters must be populated in order to send to Azure. + + :param meows: + :type meows: bool + :param hisses: + :type hisses: bool + :param name: Required. + :type name: str + :param likes_milk: + :type likes_milk: bool + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'likes_milk': {'key': 'likesMilk', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + meows: Optional[bool] = None, + hisses: Optional[bool] = None, + likes_milk: Optional[bool] = None, + **kwargs + ): + super(Cat, self).__init__(name=name, meows=meows, hisses=hisses, **kwargs) + self.meows = meows + self.hisses = hisses + self.likes_milk = likes_milk + self.name = name + self.likes_milk = likes_milk + + +class Error(msrest.serialization.Model): + """Error. + + :param status: + :type status: int + :param message: + :type message: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'int'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[int] = None, + message: Optional[str] = None, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.status = status + self.message = message + + +class Horse(Pet): + """Horse. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. + :type name: str + :param is_a_show_horse: + :type is_a_show_horse: bool + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_a_show_horse': {'key': 'isAShowHorse', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + is_a_show_horse: Optional[bool] = None, + **kwargs + ): + super(Horse, self).__init__(name=name, **kwargs) + self.is_a_show_horse = is_a_show_horse + + +class Kitten(Cat): + """Kitten. + + All required parameters must be populated in order to send to Azure. + + :param meows: + :type meows: bool + :param hisses: + :type hisses: bool + :param name: Required. + :type name: str + :param likes_milk: + :type likes_milk: bool + :param eats_mice_yet: + :type eats_mice_yet: bool + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'meows': {'key': 'meows', 'type': 'bool'}, + 'hisses': {'key': 'hisses', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'likes_milk': {'key': 'likesMilk', 'type': 'bool'}, + 'eats_mice_yet': {'key': 'eatsMiceYet', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + meows: Optional[bool] = None, + hisses: Optional[bool] = None, + likes_milk: Optional[bool] = None, + eats_mice_yet: Optional[bool] = None, + **kwargs + ): + super(Kitten, self).__init__(meows=meows, hisses=hisses, name=name, likes_milk=likes_milk, **kwargs) + self.eats_mice_yet = eats_mice_yet diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/__init__.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/__init__.py new file mode 100644 index 00000000000..4afee8c7842 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._multiple_inheritance_service_client_operations import MultipleInheritanceServiceClientOperationsMixin + +__all__ = [ + 'MultipleInheritanceServiceClientOperationsMixin', +] diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py new file mode 100644 index 00000000000..b50a1ea2b49 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/operations/_multiple_inheritance_service_client_operations.py @@ -0,0 +1,510 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MultipleInheritanceServiceClientOperationsMixin(object): + + @distributed_trace + def get_horse( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.Horse" + """Get a horse with name 'Fred' and isAShowHorse true. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Horse, or the result of cls(response) + :rtype: ~multipleinheritance.models.Horse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Horse"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_horse.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Horse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_horse.metadata = {'url': '/multipleInheritance/horse'} # type: ignore + + @distributed_trace + def put_horse( + self, + horse, # type: "models.Horse" + **kwargs # type: Any + ): + # type: (...) -> str + """Put a horse with name 'General' and isAShowHorse false. + + :param horse: Put a horse with name 'General' and isAShowHorse false. + :type horse: ~multipleinheritance.models.Horse + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_horse.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(horse, 'Horse') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_horse.metadata = {'url': '/multipleInheritance/horse'} # type: ignore + + @distributed_trace + def get_pet( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.Pet" + """Get a pet with name 'Peanut'. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Pet, or the result of cls(response) + :rtype: ~multipleinheritance.models.Pet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Pet"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_pet.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Pet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_pet.metadata = {'url': '/multipleInheritance/pet'} # type: ignore + + @distributed_trace + def put_pet( + self, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> str + """Put a pet with name 'Butter'. + + :param name: + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _pet = models.Pet(name=name) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_pet.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_pet, 'Pet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_pet.metadata = {'url': '/multipleInheritance/pet'} # type: ignore + + @distributed_trace + def get_feline( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.Feline" + """Get a feline where meows and hisses are true. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Feline, or the result of cls(response) + :rtype: ~multipleinheritance.models.Feline + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Feline"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_feline.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Feline', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_feline.metadata = {'url': '/multipleInheritance/feline'} # type: ignore + + @distributed_trace + def put_feline( + self, + feline, # type: "models.Feline" + **kwargs # type: Any + ): + # type: (...) -> str + """Put a feline who hisses and doesn't meow. + + :param feline: Put a feline who hisses and doesn't meow. + :type feline: ~multipleinheritance.models.Feline + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_feline.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(feline, 'Feline') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_feline.metadata = {'url': '/multipleInheritance/feline'} # type: ignore + + @distributed_trace + def get_cat( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.Cat" + """Get a cat with name 'Whiskers' where likesMilk, meows, and hisses is true. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Cat, or the result of cls(response) + :rtype: ~multipleinheritance.models.Cat + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Cat"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_cat.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Cat', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_cat.metadata = {'url': '/multipleInheritance/cat'} # type: ignore + + @distributed_trace + def put_cat( + self, + cat, # type: "models.Cat" + **kwargs # type: Any + ): + # type: (...) -> str + """Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. + + :param cat: Put a cat with name 'Boots' where likesMilk and hisses is false, meows is true. + :type cat: ~multipleinheritance.models.Cat + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_cat.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(cat, 'Cat') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_cat.metadata = {'url': '/multipleInheritance/cat'} # type: ignore + + @distributed_trace + def get_kitten( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.Kitten" + """Get a kitten with name 'Gatito' where likesMilk and meows is true, and hisses and eatsMiceYet + is false. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Kitten, or the result of cls(response) + :rtype: ~multipleinheritance.models.Kitten + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Kitten"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + # Construct URL + url = self.get_kitten.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.Error, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Kitten', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_kitten.metadata = {'url': '/multipleInheritance/kitten'} # type: ignore + + @distributed_trace + def put_kitten( + self, + kitten, # type: "models.Kitten" + **kwargs # type: Any + ): + # type: (...) -> str + """Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and eatsMiceYet is + true. + + :param kitten: Put a kitten with name 'Kitty' where likesMilk and hisses is false, meows and + eatsMiceYet is true. + :type kitten: ~multipleinheritance.models.Kitten + :keyword callable cls: A custom type or function that will be passed the direct response + :return: str, or the result of cls(response) + :rtype: str + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[str] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put_kitten.metadata['url'] # type: ignore + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(kitten, 'Kitten') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response) + + deserialized = self._deserialize('str', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + put_kitten.metadata = {'url': '/multipleInheritance/kitten'} # type: ignore diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/py.typed b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/setup.py b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/setup.py new file mode 100644 index 00000000000..6bff09e9f36 --- /dev/null +++ b/test/vanilla/Expected/AcceptanceTests/MultipleInheritance/setup.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "multipleinheritanceserviceclient" +VERSION = "0.1.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.6.0", "azure-core<2.0.0,>=1.2.0"] + +setup( + name=NAME, + version=VERSION, + description="MultipleInheritanceServiceClient", + author_email="", + url="", + keywords=["Swagger", "MultipleInheritanceServiceClient"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + Service client for multiinheritance client testing. + """ +)