diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json index 7802fd517b390..de6ceff25d8b4 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json +++ b/sdk/servicelinker/azure-mgmt-servicelinker/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "5dbc2b65a3329f246971fa72c758d19bb72a8e83", + "commit": "5a1b7262be0a4f6a9004d35403b854429475cdf4", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/servicelinker/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/servicelinker/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/servicelinker/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py index dd98467359654..f44afd12a1c74 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['MicrosoftServiceLinker'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py index ab3e7eccff205..aca766bd32c0e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -37,9 +37,9 @@ def __init__( **kwargs # type: Any ): # type: (...) -> None + super(MicrosoftServiceLinkerConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MicrosoftServiceLinkerConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2021-11-01-preview" @@ -62,4 +62,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_metadata.json b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_metadata.json index 47506e4ec7a58..8924f4b63eb24 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_metadata.json +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_metadata.json @@ -5,13 +5,13 @@ "name": "MicrosoftServiceLinker", "filename": "_microsoft_service_linker", "description": "Microsoft.ServiceLinker provider.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftServiceLinkerConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftServiceLinkerConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftServiceLinkerConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MicrosoftServiceLinkerConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -42,7 +42,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -62,7 +62,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -79,11 +79,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "linker": "LinkerOperations", diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_microsoft_service_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_microsoft_service_linker.py index d7b0dc4021a73..e51dad20666b2 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_microsoft_service_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_microsoft_service_linker.py @@ -6,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import MicrosoftServiceLinkerConfiguration +from .operations import LinkerOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import MicrosoftServiceLinkerConfiguration -from .operations import LinkerOperations -from .operations import Operations -from . import models - + from azure.core.rest import HttpRequest, HttpResponse class MicrosoftServiceLinker(object): """Microsoft.ServiceLinker provider. @@ -33,46 +32,56 @@ class MicrosoftServiceLinker(object): :vartype operations: microsoft_service_linker.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential, # type: "TokenCredential" - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = MicrosoftServiceLinkerConfiguration(credential, **kwargs) + self._config = MicrosoftServiceLinkerConfiguration(credential=credential, **kwargs) self._client = ARMPipelineClient(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.linker = LinkerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - http_request.url = self._client.format_url(http_request.url) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_patch.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py index 774d140f5a52c..853922ac9ee0d 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/__init__.py @@ -8,3 +8,8 @@ from ._microsoft_service_linker import MicrosoftServiceLinker __all__ = ['MicrosoftServiceLinker'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py index 1baecd99d20b3..ac4924edb15a6 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -34,9 +34,9 @@ def __init__( credential: "AsyncTokenCredential", **kwargs: Any ) -> None: + super(MicrosoftServiceLinkerConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") - super(MicrosoftServiceLinkerConfiguration, self).__init__(**kwargs) self.credential = credential self.api_version = "2021-11-01-preview" @@ -58,4 +58,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_microsoft_service_linker.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_microsoft_service_linker.py index d6de8b6375f96..ef2247fd1ab1f 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_microsoft_service_linker.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_microsoft_service_linker.py @@ -6,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import MicrosoftServiceLinkerConfiguration +from .operations import LinkerOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import MicrosoftServiceLinkerConfiguration -from .operations import LinkerOperations -from .operations import Operations -from .. import models - - -class MicrosoftServiceLinker(object): +class MicrosoftServiceLinker: """Microsoft.ServiceLinker provider. :ivar linker: LinkerOperations operations @@ -31,44 +30,54 @@ class MicrosoftServiceLinker(object): :vartype operations: microsoft_service_linker.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = MicrosoftServiceLinkerConfiguration(credential, **kwargs) + self._config = MicrosoftServiceLinkerConfiguration(credential=credential, **kwargs) self._client = AsyncARMPipelineClient(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._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.linker = LinkerOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.linker = LinkerOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - http_request.url = self._client.format_url(http_request.url) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_patch.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py index 514ee5a3e94dc..a3ff51cedba95 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_linker_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools 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 ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +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 from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._linker_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_configurations_request, build_list_request, build_update_request_initial, build_validate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_uri: str, @@ -63,34 +69,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_uri=resource_uri, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_uri=resource_uri, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('LinkerList', pipeline_response) + deserialized = self._deserialize("LinkerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,17 +104,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers'} # type: ignore + @distributed_trace_async async def get( self, resource_uri: str, @@ -137,32 +140,22 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_uri=resource_uri, + linker_name=linker_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LinkerResource', pipeline_response) @@ -171,8 +164,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore + async def _create_or_update_initial( self, resource_uri: str, @@ -185,38 +180,27 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'LinkerResource') + + request = build_create_or_update_request_initial( + resource_uri=resource_uri, + linker_name=linker_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LinkerResource') - 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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('LinkerResource', pipeline_response) @@ -228,8 +212,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_uri: str, @@ -248,15 +235,19 @@ async def begin_create_or_update( :type parameters: ~microsoft_service_linker.models.LinkerResource :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_service_linker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -268,26 +259,21 @@ async def begin_create_or_update( resource_uri=resource_uri, linker_name=linker_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('LinkerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + 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 if cont_token: @@ -299,6 +285,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore async def _delete_initial( @@ -312,39 +299,30 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_uri=resource_uri, + linker_name=linker_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_uri: str, @@ -360,15 +338,17 @@ async def begin_delete( :type linker_name: 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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :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: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -382,20 +362,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + 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 if cont_token: @@ -407,6 +381,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore async def _update_initial( @@ -421,38 +396,27 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'LinkerPatch') + + request = build_update_request_initial( + resource_uri=resource_uri, + linker_name=linker_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LinkerPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('LinkerResource', pipeline_response) @@ -464,8 +428,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_uri: str, @@ -484,15 +451,19 @@ async def begin_update( :type parameters: ~microsoft_service_linker.models.LinkerPatch :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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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: An instance of AsyncLROPoller that returns either LinkerResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either LinkerResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_service_linker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -504,26 +475,21 @@ async def begin_update( resource_uri=resource_uri, linker_name=linker_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('LinkerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + 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 if cont_token: @@ -535,6 +501,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore async def _validate_initial( @@ -548,33 +515,22 @@ async def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_validate_request_initial( + resource_uri=resource_uri, + linker_name=linker_name, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -584,8 +540,11 @@ async def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker'} # type: ignore + + @distributed_trace_async async def begin_validate( self, resource_uri: str, @@ -601,15 +560,18 @@ async def begin_validate( :type linker_name: 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: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a 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: An instance of AsyncLROPoller that returns either ValidateResult or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ValidateResult or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~microsoft_service_linker.models.ValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -623,23 +585,17 @@ async def begin_validate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + 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 if cont_token: @@ -651,8 +607,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker'} # type: ignore + @distributed_trace_async async def list_configurations( self, resource_uri: str, @@ -676,32 +634,22 @@ async def list_configurations( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_configurations.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_configurations_request( + resource_uri=resource_uri, + linker_name=linker_name, + template_url=self.list_configurations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceConfigurationResult', pipeline_response) @@ -710,4 +658,6 @@ async def list_configurations( return cls(pipeline_response, deserialized, {}) return deserialized + list_configurations.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations'} # type: ignore + diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py index 13a1fc23033bc..3887e2c97f10f 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +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 from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~microsoft_service_linker.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~microsoft_service_linker.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +97,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_microsoft_service_linker_enums.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_microsoft_service_linker_enums.py index de5aebfafedf3..fbb334c7a31b5 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_microsoft_service_linker_enums.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_microsoft_service_linker_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ INTERNAL = "Internal" -class AuthType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The authentication type. """ @@ -42,7 +27,7 @@ class AuthType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE_PRINCIPAL_CERTIFICATE = "servicePrincipalCertificate" SECRET = "secret" -class ClientType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClientType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The application client type """ @@ -57,7 +42,7 @@ class ClientType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NODEJS = "nodejs" SPRING_BOOT = "springBoot" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -66,14 +51,14 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class LinkerStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LinkerStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies if the linker is healthy. """ HEALTHY = "Healthy" NOT_HEALTHY = "Not healthy" -class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" """ diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models.py index 86ce993725b23..6ca826338820d 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models.py @@ -18,10 +18,10 @@ class AuthInfoBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType """ _validation = { @@ -40,6 +40,8 @@ def __init__( self, **kwargs ): + """ + """ super(AuthInfoBase, self).__init__(**kwargs) self.auth_type = None # type: Optional[str] @@ -69,6 +71,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -111,6 +115,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -122,8 +128,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~microsoft_service_linker.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~microsoft_service_linker.models.ErrorDetail """ _attribute_map = { @@ -134,6 +140,10 @@ def __init__( self, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~microsoft_service_linker.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = kwargs.get('error', None) @@ -141,10 +151,10 @@ def __init__( class LinkerList(msrest.serialization.Model): """The list of Linker. - :param next_link: The link used to get the next page of Linker list. - :type next_link: str - :param value: The list of Linkers. - :type value: list[~microsoft_service_linker.models.LinkerResource] + :ivar next_link: The link used to get the next page of Linker list. + :vartype next_link: str + :ivar value: The list of Linkers. + :vartype value: list[~microsoft_service_linker.models.LinkerResource] """ _attribute_map = { @@ -156,6 +166,12 @@ def __init__( self, **kwargs ): + """ + :keyword next_link: The link used to get the next page of Linker list. + :paramtype next_link: str + :keyword value: The list of Linkers. + :paramtype value: list[~microsoft_service_linker.models.LinkerResource] + """ super(LinkerList, self).__init__(**kwargs) self.next_link = kwargs.get('next_link', None) self.value = kwargs.get('value', None) @@ -166,13 +182,13 @@ class LinkerPatch(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param target_id: The resource Id of target service. - :type target_id: str - :param auth_info: The authentication type. - :type auth_info: ~microsoft_service_linker.models.AuthInfoBase - :param client_type: The application client type. Possible values include: "none", "dotnet", + :ivar target_id: The resource Id of target service. + :vartype target_id: str + :ivar auth_info: The authentication type. + :vartype auth_info: ~microsoft_service_linker.models.AuthInfoBase + :ivar client_type: The application client type. Possible values include: "none", "dotnet", "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". - :type client_type: str or ~microsoft_service_linker.models.ClientType + :vartype client_type: str or ~microsoft_service_linker.models.ClientType :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -192,6 +208,15 @@ def __init__( self, **kwargs ): + """ + :keyword target_id: The resource Id of target service. + :paramtype target_id: str + :keyword auth_info: The authentication type. + :paramtype auth_info: ~microsoft_service_linker.models.AuthInfoBase + :keyword client_type: The application client type. Possible values include: "none", "dotnet", + "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". + :paramtype client_type: str or ~microsoft_service_linker.models.ClientType + """ super(LinkerPatch, self).__init__(**kwargs) self.target_id = kwargs.get('target_id', None) self.auth_info = kwargs.get('auth_info', None) @@ -230,6 +255,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -267,6 +294,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -285,13 +314,13 @@ class LinkerResource(ProxyResource): :vartype type: str :ivar system_data: The system data. :vartype system_data: ~microsoft_service_linker.models.SystemData - :param target_id: The resource Id of target service. - :type target_id: str - :param auth_info: The authentication type. - :type auth_info: ~microsoft_service_linker.models.AuthInfoBase - :param client_type: The application client type. Possible values include: "none", "dotnet", + :ivar target_id: The resource Id of target service. + :vartype target_id: str + :ivar auth_info: The authentication type. + :vartype auth_info: ~microsoft_service_linker.models.AuthInfoBase + :ivar client_type: The application client type. Possible values include: "none", "dotnet", "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". - :type client_type: str or ~microsoft_service_linker.models.ClientType + :vartype client_type: str or ~microsoft_service_linker.models.ClientType :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -319,6 +348,15 @@ def __init__( self, **kwargs ): + """ + :keyword target_id: The resource Id of target service. + :paramtype target_id: str + :keyword auth_info: The authentication type. + :paramtype auth_info: ~microsoft_service_linker.models.AuthInfoBase + :keyword client_type: The application client type. Possible values include: "none", "dotnet", + "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". + :paramtype client_type: str or ~microsoft_service_linker.models.ClientType + """ super(LinkerResource, self).__init__(**kwargs) self.system_data = None self.target_id = kwargs.get('target_id', None) @@ -338,8 +376,8 @@ class Operation(msrest.serialization.Model): :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~microsoft_service_linker.models.OperationDisplay + :ivar display: Localized display information for this particular operation. + :vartype display: ~microsoft_service_linker.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", "system", "user,system". @@ -368,6 +406,10 @@ def __init__( self, **kwargs ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~microsoft_service_linker.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = None self.is_data_action = None @@ -413,6 +455,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -445,6 +489,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -455,14 +501,14 @@ class SecretAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType - :param name: Username or account name for secret auth. - :type name: str - :param secret: Password or account key for secret auth. - :type secret: str + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType + :ivar name: Username or account name for secret auth. + :vartype name: str + :ivar secret: Password or account key for secret auth. + :vartype secret: str """ _validation = { @@ -479,6 +525,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Username or account name for secret auth. + :paramtype name: str + :keyword secret: Password or account key for secret auth. + :paramtype secret: str + """ super(SecretAuthInfo, self).__init__(**kwargs) self.auth_type = 'secret' # type: str self.name = kwargs.get('name', None) @@ -490,16 +542,16 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType - :param client_id: Required. Application clientId for servicePrincipal auth. - :type client_id: str - :param principal_id: Required. Principal Id for servicePrincipal auth. - :type principal_id: str - :param certificate: Required. ServicePrincipal certificate for servicePrincipal auth. - :type certificate: str + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType + :ivar client_id: Required. Application clientId for servicePrincipal auth. + :vartype client_id: str + :ivar principal_id: Required. Principal Id for servicePrincipal auth. + :vartype principal_id: str + :ivar certificate: Required. ServicePrincipal certificate for servicePrincipal auth. + :vartype certificate: str """ _validation = { @@ -520,6 +572,14 @@ def __init__( self, **kwargs ): + """ + :keyword client_id: Required. Application clientId for servicePrincipal auth. + :paramtype client_id: str + :keyword principal_id: Required. Principal Id for servicePrincipal auth. + :paramtype principal_id: str + :keyword certificate: Required. ServicePrincipal certificate for servicePrincipal auth. + :paramtype certificate: str + """ super(ServicePrincipalCertificateAuthInfo, self).__init__(**kwargs) self.auth_type = 'servicePrincipalCertificate' # type: str self.client_id = kwargs['client_id'] @@ -532,16 +592,16 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType - :param client_id: Required. ServicePrincipal application clientId for servicePrincipal auth. - :type client_id: str - :param principal_id: Required. Principal Id for servicePrincipal auth. - :type principal_id: str - :param secret: Required. Secret for servicePrincipal auth. - :type secret: str + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType + :ivar client_id: Required. ServicePrincipal application clientId for servicePrincipal auth. + :vartype client_id: str + :ivar principal_id: Required. Principal Id for servicePrincipal auth. + :vartype principal_id: str + :ivar secret: Required. Secret for servicePrincipal auth. + :vartype secret: str """ _validation = { @@ -562,6 +622,14 @@ def __init__( self, **kwargs ): + """ + :keyword client_id: Required. ServicePrincipal application clientId for servicePrincipal auth. + :paramtype client_id: str + :keyword principal_id: Required. Principal Id for servicePrincipal auth. + :paramtype principal_id: str + :keyword secret: Required. Secret for servicePrincipal auth. + :paramtype secret: str + """ super(ServicePrincipalSecretAuthInfo, self).__init__(**kwargs) self.auth_type = 'servicePrincipalSecret' # type: str self.client_id = kwargs['client_id'] @@ -572,10 +640,10 @@ def __init__( class SourceConfiguration(msrest.serialization.Model): """A configuration item for source resource. - :param name: The name of setting. - :type name: str - :param value: The value of setting. - :type value: str + :ivar name: The name of setting. + :vartype name: str + :ivar value: The value of setting. + :vartype value: str """ _attribute_map = { @@ -587,6 +655,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: The name of setting. + :paramtype name: str + :keyword value: The value of setting. + :paramtype value: str + """ super(SourceConfiguration, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.value = kwargs.get('value', None) @@ -595,8 +669,8 @@ def __init__( class SourceConfigurationResult(msrest.serialization.Model): """Configurations for source resource, include appSettings, connectionString and serviceBindings. - :param configurations: The configuration properties for source resource. - :type configurations: list[~microsoft_service_linker.models.SourceConfiguration] + :ivar configurations: The configuration properties for source resource. + :vartype configurations: list[~microsoft_service_linker.models.SourceConfiguration] """ _attribute_map = { @@ -607,6 +681,10 @@ def __init__( self, **kwargs ): + """ + :keyword configurations: The configuration properties for source resource. + :paramtype configurations: list[~microsoft_service_linker.models.SourceConfiguration] + """ super(SourceConfigurationResult, self).__init__(**kwargs) self.configurations = kwargs.get('configurations', None) @@ -616,10 +694,10 @@ class SystemAssignedIdentityAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType """ _validation = { @@ -634,6 +712,8 @@ def __init__( self, **kwargs ): + """ + """ super(SystemAssignedIdentityAuthInfo, self).__init__(**kwargs) self.auth_type = 'systemAssignedIdentity' # type: str @@ -641,20 +721,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~microsoft_service_linker.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~microsoft_service_linker.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~microsoft_service_linker.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~microsoft_service_linker.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -670,6 +750,22 @@ def __init__( self, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~microsoft_service_linker.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~microsoft_service_linker.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -684,14 +780,14 @@ class UserAssignedIdentityAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType - :param client_id: Required. Client Id for userAssignedIdentity. - :type client_id: str - :param subscription_id: Required. Subscription id for userAssignedIdentity. - :type subscription_id: str + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType + :ivar client_id: Required. Client Id for userAssignedIdentity. + :vartype client_id: str + :ivar subscription_id: Required. Subscription id for userAssignedIdentity. + :vartype subscription_id: str """ _validation = { @@ -710,6 +806,12 @@ def __init__( self, **kwargs ): + """ + :keyword client_id: Required. Client Id for userAssignedIdentity. + :paramtype client_id: str + :keyword subscription_id: Required. Subscription id for userAssignedIdentity. + :paramtype subscription_id: str + """ super(UserAssignedIdentityAuthInfo, self).__init__(**kwargs) self.auth_type = 'userAssignedIdentity' # type: str self.client_id = kwargs['client_id'] @@ -719,22 +821,22 @@ def __init__( class ValidateResult(msrest.serialization.Model): """The validation result for a linker. - :param name: The linker name. - :type name: str - :param linker_status: Specifies if the linker is healthy. Possible values include: "Healthy", + :ivar name: The linker name. + :vartype name: str + :ivar linker_status: Specifies if the linker is healthy. Possible values include: "Healthy", "Not healthy". - :type linker_status: str or ~microsoft_service_linker.models.LinkerStatus - :param reason: The reason of the error. - :type reason: str - :param report_start_time_utc: The start time of the validation report. - :type report_start_time_utc: ~datetime.datetime - :param report_end_time_utc: The end time of the validation report. - :type report_end_time_utc: ~datetime.datetime - :param target_id: The resource Id of target service. - :type target_id: str - :param auth_type: The authentication type. Possible values include: "systemAssignedIdentity", + :vartype linker_status: str or ~microsoft_service_linker.models.LinkerStatus + :ivar reason: The reason of the error. + :vartype reason: str + :ivar report_start_time_utc: The start time of the validation report. + :vartype report_start_time_utc: ~datetime.datetime + :ivar report_end_time_utc: The end time of the validation report. + :vartype report_end_time_utc: ~datetime.datetime + :ivar target_id: The resource Id of target service. + :vartype target_id: str + :ivar auth_type: The authentication type. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType """ _attribute_map = { @@ -751,6 +853,24 @@ def __init__( self, **kwargs ): + """ + :keyword name: The linker name. + :paramtype name: str + :keyword linker_status: Specifies if the linker is healthy. Possible values include: "Healthy", + "Not healthy". + :paramtype linker_status: str or ~microsoft_service_linker.models.LinkerStatus + :keyword reason: The reason of the error. + :paramtype reason: str + :keyword report_start_time_utc: The start time of the validation report. + :paramtype report_start_time_utc: ~datetime.datetime + :keyword report_end_time_utc: The end time of the validation report. + :paramtype report_end_time_utc: ~datetime.datetime + :keyword target_id: The resource Id of target service. + :paramtype target_id: str + :keyword auth_type: The authentication type. Possible values include: "systemAssignedIdentity", + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". + :paramtype auth_type: str or ~microsoft_service_linker.models.AuthType + """ super(ValidateResult, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.linker_status = kwargs.get('linker_status', None) diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py index 422f79617f46f..3d6030a57ef3e 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/models/_models_py3.py @@ -23,10 +23,10 @@ class AuthInfoBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType """ _validation = { @@ -45,6 +45,8 @@ def __init__( self, **kwargs ): + """ + """ super(AuthInfoBase, self).__init__(**kwargs) self.auth_type = None # type: Optional[str] @@ -74,6 +76,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -116,6 +120,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -127,8 +133,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~microsoft_service_linker.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~microsoft_service_linker.models.ErrorDetail """ _attribute_map = { @@ -141,6 +147,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~microsoft_service_linker.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -148,10 +158,10 @@ def __init__( class LinkerList(msrest.serialization.Model): """The list of Linker. - :param next_link: The link used to get the next page of Linker list. - :type next_link: str - :param value: The list of Linkers. - :type value: list[~microsoft_service_linker.models.LinkerResource] + :ivar next_link: The link used to get the next page of Linker list. + :vartype next_link: str + :ivar value: The list of Linkers. + :vartype value: list[~microsoft_service_linker.models.LinkerResource] """ _attribute_map = { @@ -166,6 +176,12 @@ def __init__( value: Optional[List["LinkerResource"]] = None, **kwargs ): + """ + :keyword next_link: The link used to get the next page of Linker list. + :paramtype next_link: str + :keyword value: The list of Linkers. + :paramtype value: list[~microsoft_service_linker.models.LinkerResource] + """ super(LinkerList, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -176,13 +192,13 @@ class LinkerPatch(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param target_id: The resource Id of target service. - :type target_id: str - :param auth_info: The authentication type. - :type auth_info: ~microsoft_service_linker.models.AuthInfoBase - :param client_type: The application client type. Possible values include: "none", "dotnet", + :ivar target_id: The resource Id of target service. + :vartype target_id: str + :ivar auth_info: The authentication type. + :vartype auth_info: ~microsoft_service_linker.models.AuthInfoBase + :ivar client_type: The application client type. Possible values include: "none", "dotnet", "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". - :type client_type: str or ~microsoft_service_linker.models.ClientType + :vartype client_type: str or ~microsoft_service_linker.models.ClientType :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -206,6 +222,15 @@ def __init__( client_type: Optional[Union[str, "ClientType"]] = None, **kwargs ): + """ + :keyword target_id: The resource Id of target service. + :paramtype target_id: str + :keyword auth_info: The authentication type. + :paramtype auth_info: ~microsoft_service_linker.models.AuthInfoBase + :keyword client_type: The application client type. Possible values include: "none", "dotnet", + "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". + :paramtype client_type: str or ~microsoft_service_linker.models.ClientType + """ super(LinkerPatch, self).__init__(**kwargs) self.target_id = target_id self.auth_info = auth_info @@ -244,6 +269,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -281,6 +308,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -299,13 +328,13 @@ class LinkerResource(ProxyResource): :vartype type: str :ivar system_data: The system data. :vartype system_data: ~microsoft_service_linker.models.SystemData - :param target_id: The resource Id of target service. - :type target_id: str - :param auth_info: The authentication type. - :type auth_info: ~microsoft_service_linker.models.AuthInfoBase - :param client_type: The application client type. Possible values include: "none", "dotnet", + :ivar target_id: The resource Id of target service. + :vartype target_id: str + :ivar auth_info: The authentication type. + :vartype auth_info: ~microsoft_service_linker.models.AuthInfoBase + :ivar client_type: The application client type. Possible values include: "none", "dotnet", "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". - :type client_type: str or ~microsoft_service_linker.models.ClientType + :vartype client_type: str or ~microsoft_service_linker.models.ClientType :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str """ @@ -337,6 +366,15 @@ def __init__( client_type: Optional[Union[str, "ClientType"]] = None, **kwargs ): + """ + :keyword target_id: The resource Id of target service. + :paramtype target_id: str + :keyword auth_info: The authentication type. + :paramtype auth_info: ~microsoft_service_linker.models.AuthInfoBase + :keyword client_type: The application client type. Possible values include: "none", "dotnet", + "java", "python", "go", "php", "ruby", "django", "nodejs", "springBoot". + :paramtype client_type: str or ~microsoft_service_linker.models.ClientType + """ super(LinkerResource, self).__init__(**kwargs) self.system_data = None self.target_id = target_id @@ -356,8 +394,8 @@ class Operation(msrest.serialization.Model): :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~microsoft_service_linker.models.OperationDisplay + :ivar display: Localized display information for this particular operation. + :vartype display: ~microsoft_service_linker.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", "system", "user,system". @@ -388,6 +426,10 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~microsoft_service_linker.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = None self.is_data_action = None @@ -433,6 +475,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -465,6 +509,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -475,14 +521,14 @@ class SecretAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType - :param name: Username or account name for secret auth. - :type name: str - :param secret: Password or account key for secret auth. - :type secret: str + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType + :ivar name: Username or account name for secret auth. + :vartype name: str + :ivar secret: Password or account key for secret auth. + :vartype secret: str """ _validation = { @@ -502,6 +548,12 @@ def __init__( secret: Optional[str] = None, **kwargs ): + """ + :keyword name: Username or account name for secret auth. + :paramtype name: str + :keyword secret: Password or account key for secret auth. + :paramtype secret: str + """ super(SecretAuthInfo, self).__init__(**kwargs) self.auth_type = 'secret' # type: str self.name = name @@ -513,16 +565,16 @@ class ServicePrincipalCertificateAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType - :param client_id: Required. Application clientId for servicePrincipal auth. - :type client_id: str - :param principal_id: Required. Principal Id for servicePrincipal auth. - :type principal_id: str - :param certificate: Required. ServicePrincipal certificate for servicePrincipal auth. - :type certificate: str + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType + :ivar client_id: Required. Application clientId for servicePrincipal auth. + :vartype client_id: str + :ivar principal_id: Required. Principal Id for servicePrincipal auth. + :vartype principal_id: str + :ivar certificate: Required. ServicePrincipal certificate for servicePrincipal auth. + :vartype certificate: str """ _validation = { @@ -547,6 +599,14 @@ def __init__( certificate: str, **kwargs ): + """ + :keyword client_id: Required. Application clientId for servicePrincipal auth. + :paramtype client_id: str + :keyword principal_id: Required. Principal Id for servicePrincipal auth. + :paramtype principal_id: str + :keyword certificate: Required. ServicePrincipal certificate for servicePrincipal auth. + :paramtype certificate: str + """ super(ServicePrincipalCertificateAuthInfo, self).__init__(**kwargs) self.auth_type = 'servicePrincipalCertificate' # type: str self.client_id = client_id @@ -559,16 +619,16 @@ class ServicePrincipalSecretAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType - :param client_id: Required. ServicePrincipal application clientId for servicePrincipal auth. - :type client_id: str - :param principal_id: Required. Principal Id for servicePrincipal auth. - :type principal_id: str - :param secret: Required. Secret for servicePrincipal auth. - :type secret: str + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType + :ivar client_id: Required. ServicePrincipal application clientId for servicePrincipal auth. + :vartype client_id: str + :ivar principal_id: Required. Principal Id for servicePrincipal auth. + :vartype principal_id: str + :ivar secret: Required. Secret for servicePrincipal auth. + :vartype secret: str """ _validation = { @@ -593,6 +653,14 @@ def __init__( secret: str, **kwargs ): + """ + :keyword client_id: Required. ServicePrincipal application clientId for servicePrincipal auth. + :paramtype client_id: str + :keyword principal_id: Required. Principal Id for servicePrincipal auth. + :paramtype principal_id: str + :keyword secret: Required. Secret for servicePrincipal auth. + :paramtype secret: str + """ super(ServicePrincipalSecretAuthInfo, self).__init__(**kwargs) self.auth_type = 'servicePrincipalSecret' # type: str self.client_id = client_id @@ -603,10 +671,10 @@ def __init__( class SourceConfiguration(msrest.serialization.Model): """A configuration item for source resource. - :param name: The name of setting. - :type name: str - :param value: The value of setting. - :type value: str + :ivar name: The name of setting. + :vartype name: str + :ivar value: The value of setting. + :vartype value: str """ _attribute_map = { @@ -621,6 +689,12 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of setting. + :paramtype name: str + :keyword value: The value of setting. + :paramtype value: str + """ super(SourceConfiguration, self).__init__(**kwargs) self.name = name self.value = value @@ -629,8 +703,8 @@ def __init__( class SourceConfigurationResult(msrest.serialization.Model): """Configurations for source resource, include appSettings, connectionString and serviceBindings. - :param configurations: The configuration properties for source resource. - :type configurations: list[~microsoft_service_linker.models.SourceConfiguration] + :ivar configurations: The configuration properties for source resource. + :vartype configurations: list[~microsoft_service_linker.models.SourceConfiguration] """ _attribute_map = { @@ -643,6 +717,10 @@ def __init__( configurations: Optional[List["SourceConfiguration"]] = None, **kwargs ): + """ + :keyword configurations: The configuration properties for source resource. + :paramtype configurations: list[~microsoft_service_linker.models.SourceConfiguration] + """ super(SourceConfigurationResult, self).__init__(**kwargs) self.configurations = configurations @@ -652,10 +730,10 @@ class SystemAssignedIdentityAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType """ _validation = { @@ -670,6 +748,8 @@ def __init__( self, **kwargs ): + """ + """ super(SystemAssignedIdentityAuthInfo, self).__init__(**kwargs) self.auth_type = 'systemAssignedIdentity' # type: str @@ -677,20 +757,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~microsoft_service_linker.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~microsoft_service_linker.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~microsoft_service_linker.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~microsoft_service_linker.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -713,6 +793,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~microsoft_service_linker.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~microsoft_service_linker.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -727,14 +823,14 @@ class UserAssignedIdentityAuthInfo(AuthInfoBase): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. The authentication type.Constant filled by server. Possible values + :ivar auth_type: Required. The authentication type.Constant filled by server. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType - :param client_id: Required. Client Id for userAssignedIdentity. - :type client_id: str - :param subscription_id: Required. Subscription id for userAssignedIdentity. - :type subscription_id: str + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType + :ivar client_id: Required. Client Id for userAssignedIdentity. + :vartype client_id: str + :ivar subscription_id: Required. Subscription id for userAssignedIdentity. + :vartype subscription_id: str """ _validation = { @@ -756,6 +852,12 @@ def __init__( subscription_id: str, **kwargs ): + """ + :keyword client_id: Required. Client Id for userAssignedIdentity. + :paramtype client_id: str + :keyword subscription_id: Required. Subscription id for userAssignedIdentity. + :paramtype subscription_id: str + """ super(UserAssignedIdentityAuthInfo, self).__init__(**kwargs) self.auth_type = 'userAssignedIdentity' # type: str self.client_id = client_id @@ -765,22 +867,22 @@ def __init__( class ValidateResult(msrest.serialization.Model): """The validation result for a linker. - :param name: The linker name. - :type name: str - :param linker_status: Specifies if the linker is healthy. Possible values include: "Healthy", + :ivar name: The linker name. + :vartype name: str + :ivar linker_status: Specifies if the linker is healthy. Possible values include: "Healthy", "Not healthy". - :type linker_status: str or ~microsoft_service_linker.models.LinkerStatus - :param reason: The reason of the error. - :type reason: str - :param report_start_time_utc: The start time of the validation report. - :type report_start_time_utc: ~datetime.datetime - :param report_end_time_utc: The end time of the validation report. - :type report_end_time_utc: ~datetime.datetime - :param target_id: The resource Id of target service. - :type target_id: str - :param auth_type: The authentication type. Possible values include: "systemAssignedIdentity", + :vartype linker_status: str or ~microsoft_service_linker.models.LinkerStatus + :ivar reason: The reason of the error. + :vartype reason: str + :ivar report_start_time_utc: The start time of the validation report. + :vartype report_start_time_utc: ~datetime.datetime + :ivar report_end_time_utc: The end time of the validation report. + :vartype report_end_time_utc: ~datetime.datetime + :ivar target_id: The resource Id of target service. + :vartype target_id: str + :ivar auth_type: The authentication type. Possible values include: "systemAssignedIdentity", "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". - :type auth_type: str or ~microsoft_service_linker.models.AuthType + :vartype auth_type: str or ~microsoft_service_linker.models.AuthType """ _attribute_map = { @@ -805,6 +907,24 @@ def __init__( auth_type: Optional[Union[str, "AuthType"]] = None, **kwargs ): + """ + :keyword name: The linker name. + :paramtype name: str + :keyword linker_status: Specifies if the linker is healthy. Possible values include: "Healthy", + "Not healthy". + :paramtype linker_status: str or ~microsoft_service_linker.models.LinkerStatus + :keyword reason: The reason of the error. + :paramtype reason: str + :keyword report_start_time_utc: The start time of the validation report. + :paramtype report_start_time_utc: ~datetime.datetime + :keyword report_end_time_utc: The end time of the validation report. + :paramtype report_end_time_utc: ~datetime.datetime + :keyword target_id: The resource Id of target service. + :paramtype target_id: str + :keyword auth_type: The authentication type. Possible values include: "systemAssignedIdentity", + "userAssignedIdentity", "servicePrincipalSecret", "servicePrincipalCertificate", "secret". + :paramtype auth_type: str or ~microsoft_service_linker.models.AuthType + """ super(ValidateResult, self).__init__(**kwargs) self.name = name self.linker_status = linker_status diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py index b1ae62320f74b..eeb739d226ed2 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_linker_operations.py @@ -5,26 +5,278 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_uri, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers') + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_uri, # type: str + linker_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}') + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "linkerName": _SERIALIZER.url("linker_name", linker_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_uri, # type: str + linker_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}') + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "linkerName": _SERIALIZER.url("linker_name", linker_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + resource_uri, # type: str + linker_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}') + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "linkerName": _SERIALIZER.url("linker_name", linker_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + resource_uri, # type: str + linker_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}') + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "linkerName": _SERIALIZER.url("linker_name", linker_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_validate_request_initial( + resource_uri, # type: str + linker_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker') + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "linkerName": _SERIALIZER.url("linker_name", linker_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_configurations_request( + resource_uri, # type: str + linker_name, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations') + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, 'str', skip_quote=True), + "linkerName": _SERIALIZER.url("linker_name", linker_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class LinkerOperations(object): """LinkerOperations operations. @@ -47,6 +299,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_uri, # type: str @@ -68,34 +321,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_uri=resource_uri, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_uri=resource_uri, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('LinkerList', pipeline_response) + deserialized = self._deserialize("LinkerList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +356,19 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers'} # type: ignore + @distributed_trace def get( self, resource_uri, # type: str @@ -143,32 +393,22 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_uri=resource_uri, + linker_name=linker_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LinkerResource', pipeline_response) @@ -177,8 +417,10 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore + def _create_or_update_initial( self, resource_uri, # type: str @@ -192,38 +434,27 @@ def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'LinkerResource') + + request = build_create_or_update_request_initial( + resource_uri=resource_uri, + linker_name=linker_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LinkerResource') - 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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('LinkerResource', pipeline_response) @@ -235,8 +466,11 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, resource_uri, # type: str @@ -256,15 +490,19 @@ def begin_create_or_update( :type parameters: ~microsoft_service_linker.models.LinkerResource :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LinkerResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~microsoft_service_linker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,26 +514,21 @@ def begin_create_or_update( resource_uri=resource_uri, linker_name=linker_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('LinkerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + 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 if cont_token: @@ -307,6 +540,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore def _delete_initial( @@ -321,39 +555,30 @@ def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_uri=resource_uri, + linker_name=linker_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(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, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore + + @distributed_trace def begin_delete( self, resource_uri, # type: str @@ -370,15 +595,17 @@ def begin_delete( :type linker_name: 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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -392,20 +619,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + 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 if cont_token: @@ -417,6 +638,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore def _update_initial( @@ -432,38 +654,27 @@ def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'LinkerPatch') + + request = build_update_request_initial( + resource_uri=resource_uri, + linker_name=linker_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'LinkerPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('LinkerResource', pipeline_response) @@ -475,8 +686,11 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore + + @distributed_trace def begin_update( self, resource_uri, # type: str @@ -496,15 +710,19 @@ def begin_update( :type parameters: ~microsoft_service_linker.models.LinkerPatch :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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either LinkerResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either LinkerResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~microsoft_service_linker.models.LinkerResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.LinkerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -516,26 +734,21 @@ def begin_update( resource_uri=resource_uri, linker_name=linker_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('LinkerResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + 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 if cont_token: @@ -547,6 +760,7 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}'} # type: ignore def _validate_initial( @@ -561,33 +775,22 @@ def _validate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self._validate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_validate_request_initial( + resource_uri=resource_uri, + linker_name=linker_name, + template_url=self._validate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -597,8 +800,11 @@ def _validate_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _validate_initial.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker'} # type: ignore + + @distributed_trace def begin_validate( self, resource_uri, # type: str @@ -615,15 +821,18 @@ def begin_validate( :type linker_name: 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: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ValidateResult or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ValidateResult or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~microsoft_service_linker.models.ValidateResult] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ValidateResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -637,23 +846,17 @@ def begin_validate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ValidateResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + 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 if cont_token: @@ -665,8 +868,10 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_validate.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/validateLinker'} # type: ignore + @distributed_trace def list_configurations( self, resource_uri, # type: str @@ -691,32 +896,22 @@ def list_configurations( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_configurations.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceUri': self._serialize.url("resource_uri", resource_uri, 'str', skip_quote=True), - 'linkerName': self._serialize.url("linker_name", linker_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_configurations_request( + resource_uri=resource_uri, + linker_name=linker_name, + template_url=self.list_configurations.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(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.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceConfigurationResult', pipeline_response) @@ -725,4 +920,6 @@ def list_configurations( return cls(pipeline_response, deserialized, {}) return deserialized + list_configurations.metadata = {'url': '/{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/listConfigurations'} # type: ignore + diff --git a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py index 447bec40dd000..b1f3f2fc0313a 100644 --- a/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py +++ b/sdk/servicelinker/azure-mgmt-servicelinker/azure/mgmt/servicelinker/operations/_operations.py @@ -5,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.ServiceLinker/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,30 +97,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +130,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data )