diff --git a/sdk/purview/azure-mgmt-purview/_meta.json b/sdk/purview/azure-mgmt-purview/_meta.json index 8f43a3a92d0a..d38828b2c594 100644 --- a/sdk/purview/azure-mgmt-purview/_meta.json +++ b/sdk/purview/azure-mgmt-purview/_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": "ebe90b1dfef9ec9706dee06e84676a6c6979ab53", + "commit": "5f211aa39ff4fa8891fbdf7da840d13ef8ac5fcd", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/purview/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/purview/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/purview/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/__init__.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/__init__.py index 37b1aa4a9b3b..88178ede0834 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/__init__.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['PurviewManagementClient'] -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/purview/azure-mgmt-purview/azure/mgmt/purview/_configuration.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_configuration.py index 19097948256d..42071106ecf1 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_configuration.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING 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 if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class PurviewManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(PurviewManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(PurviewManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -68,4 +65,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/purview/azure-mgmt-purview/azure/mgmt/purview/_metadata.json b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_metadata.json index 96fa45190246..f287b51f9ff6 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_metadata.json +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_metadata.json @@ -5,13 +5,13 @@ "name": "PurviewManagementClient", "filename": "_purview_management_client", "description": "Creates a Microsoft.Purview management client.", - "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\": [\"PurviewManagementClientConfiguration\"]}}, \"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\": [\"PurviewManagementClientConfiguration\"]}}, \"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\": [\"PurviewManagementClientConfiguration\"]}}, \"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\": [\"PurviewManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,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 @@ -74,7 +74,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 @@ -91,11 +91,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": { "accounts": "AccountsOperations", diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_patch.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_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/purview/azure-mgmt-purview/azure/mgmt/purview/_purview_management_client.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_purview_management_client.py index 0c4cbaf22df6..618d9ac5f540 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_purview_management_client.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_purview_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import PurviewManagementClientConfiguration +from .operations import AccountsOperations, DefaultAccountsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations + 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 PurviewManagementClientConfiguration -from .operations import AccountsOperations -from .operations import DefaultAccountsOperations -from .operations import Operations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from . import models - -class PurviewManagementClient(object): +class PurviewManagementClient: """Creates a Microsoft.Purview management client. :ivar accounts: AccountsOperations operations @@ -37,63 +31,66 @@ class PurviewManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.purview.operations.Operations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.purview.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.purview.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.purview.operations.PrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :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" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = PurviewManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = PurviewManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **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.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.default_accounts = DefaultAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.accounts = AccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.default_accounts = DefaultAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - 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: Any + ) -> 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 """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - 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/purview/azure-mgmt-purview/azure/mgmt/purview/_vendor.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_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/purview/azure-mgmt-purview/azure/mgmt/purview/_version.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_version.py index c47f66669f1b..961c76eb77c1 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_version.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.1" diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/__init__.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/__init__.py index 9dad4e521c35..607fca078a8f 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/__init__.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/__init__.py @@ -8,3 +8,8 @@ from ._purview_management_client import PurviewManagementClient __all__ = ['PurviewManagementClient'] + +# `._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/purview/azure-mgmt-purview/azure/mgmt/purview/aio/_configuration.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/_configuration.py index 0fe146e261e7..0485e8a64903 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/_configuration.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/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 @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(PurviewManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(PurviewManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -64,4 +64,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/purview/azure-mgmt-purview/azure/mgmt/purview/aio/_patch.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/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/purview/azure-mgmt-purview/azure/mgmt/purview/aio/_purview_management_client.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/_purview_management_client.py index 7d856ac75df6..a3aec18dd4d5 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/_purview_management_client.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/_purview_management_client.py @@ -6,26 +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 PurviewManagementClientConfiguration +from .operations import AccountsOperations, DefaultAccountsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import PurviewManagementClientConfiguration -from .operations import AccountsOperations -from .operations import DefaultAccountsOperations -from .operations import Operations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .. import models - - -class PurviewManagementClient(object): +class PurviewManagementClient: """Creates a Microsoft.Purview management client. :ivar accounts: AccountsOperations operations @@ -35,61 +31,67 @@ class PurviewManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.purview.aio.operations.Operations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.purview.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.purview.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.purview.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.purview.aio.operations.PrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription identifier. :type subscription_id: str - :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", subscription_id: str, - 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 = PurviewManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = PurviewManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **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.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.default_accounts = DefaultAccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + - self.accounts = AccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.default_accounts = DefaultAccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - 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 """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - 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/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_accounts_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_accounts_operations.py index 6a8a8f6bae95..2ee39a6ead0f 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_accounts_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_accounts_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._accounts_operations import build_add_root_collection_admin_request, build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_keys_request, build_update_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_by_resource_group( self, resource_group_name: str, @@ -67,37 +73,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + skip_token=skip_token, + template_url=self.list_by_resource_group.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_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + skip_token=skip_token, + 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('AccountList', pipeline_response) + deserialized = self._deserialize("AccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,17 +112,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.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts'} # type: ignore + @distributed_trace def list_by_subscription( self, skip_token: Optional[str] = None, @@ -142,36 +146,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + template_url=self.list_by_subscription.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_by_subscription_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + 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('AccountList', pipeline_response) + deserialized = self._deserialize("AccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -184,17 +183,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.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -219,33 +220,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Account', pipeline_response) @@ -254,8 +245,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -268,39 +261,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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(account, 'Account') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_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(account, 'Account') - 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.ErrorResponseModel, 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('Account', pipeline_response) @@ -312,8 +294,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -333,15 +318,19 @@ async def begin_create_or_update( :type account: ~azure.mgmt.purview.models.Account :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 Account 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 Account or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.purview.models.Account] - :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.Account"] lro_delay = kwargs.pop( 'polling_interval', @@ -353,27 +342,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, account_name=account_name, account=account, + 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('Account', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -385,6 +368,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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore async def _delete_initial( @@ -398,40 +382,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_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.ErrorResponseModel, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -448,15 +423,17 @@ async def begin_delete( :type account_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', @@ -470,21 +447,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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -496,6 +466,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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore async def _update_initial( @@ -510,39 +481,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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] + + _json = self._serialize.body(account_update_parameters, 'AccountUpdateParameters') - # 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') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_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(account_update_parameters, 'AccountUpdateParameters') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, 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('Account', pipeline_response) @@ -554,8 +514,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -575,15 +538,19 @@ async def begin_update( :type account_update_parameters: ~azure.mgmt.purview.models.AccountUpdateParameters :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 Account 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 Account or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.purview.models.Account] - :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.Account"] lro_delay = kwargs.pop( 'polling_interval', @@ -595,27 +562,21 @@ async def begin_update( resource_group_name=resource_group_name, account_name=account_name, account_update_parameters=account_update_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('Account', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -627,8 +588,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + @distributed_trace_async async def list_keys( self, resource_group_name: str, @@ -653,33 +616,23 @@ async def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list_keys.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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -688,8 +641,11 @@ async def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/listkeys'} # type: ignore + + @distributed_trace_async async def add_root_collection_admin( self, resource_group_name: str, @@ -717,38 +673,28 @@ async def add_root_collection_admin( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.add_root_collection_admin.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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(collection_admin_update, 'CollectionAdminUpdate') + + request = build_add_root_collection_admin_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.add_root_collection_admin.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(collection_admin_update, 'CollectionAdminUpdate') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -756,6 +702,8 @@ async def add_root_collection_admin( add_root_collection_admin.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/addRootCollectionAdmin'} # type: ignore + + @distributed_trace_async async def check_name_availability( self, check_name_availability_request: "_models.CheckNameAvailabilityRequest", @@ -777,36 +725,26 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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(check_name_availability_request, 'CheckNameAvailabilityRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(check_name_availability_request, 'CheckNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) @@ -815,4 +753,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability'} # type: ignore + diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_default_accounts_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_default_accounts_operations.py index 2035ebb4737f..b603fce4518a 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_default_accounts_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_default_accounts_operations.py @@ -5,16 +5,20 @@ # 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, Callable, Dict, Generic, Optional, TypeVar, Union import warnings 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_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._default_accounts_operations import build_get_request, build_remove_request, build_set_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, scope_tenant_id: str, @@ -68,31 +73,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['scopeTenantId'] = self._serialize.query("scope_tenant_id", scope_tenant_id, 'str') - query_parameters['scopeType'] = self._serialize.query("scope_type", scope_type, 'str') - if scope is not None: - query_parameters['scope'] = self._serialize.query("scope", scope, 'str') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + scope_tenant_id=scope_tenant_id, + scope_type=scope_type, + scope=scope, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DefaultAccountPayload', pipeline_response) @@ -101,8 +98,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.Purview/getDefaultAccount'} # type: ignore + + @distributed_trace_async async def set( self, default_account_payload: "_models.DefaultAccountPayload", @@ -125,32 +125,25 @@ async def set( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set.metadata['url'] # type: ignore - - # 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(default_account_payload, 'DefaultAccountPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(default_account_payload, 'DefaultAccountPayload') + + request = build_set_request( + content_type=content_type, + json=_json, + template_url=self.set.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + 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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DefaultAccountPayload', pipeline_response) @@ -159,8 +152,11 @@ async def set( return cls(pipeline_response, deserialized, {}) return deserialized + set.metadata = {'url': '/providers/Microsoft.Purview/setDefaultAccount'} # type: ignore + + @distributed_trace_async async def remove( self, scope_tenant_id: str, @@ -189,34 +185,27 @@ async def remove( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = self.remove.metadata['url'] # type: ignore + + request = build_remove_request( + scope_tenant_id=scope_tenant_id, + scope_type=scope_type, + scope=scope, + template_url=self.remove.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['scopeTenantId'] = self._serialize.query("scope_tenant_id", scope_tenant_id, 'str') - query_parameters['scopeType'] = self._serialize.query("scope_type", scope_type, 'str') - if scope is not None: - query_parameters['scope'] = self._serialize.query("scope", scope, 'str') - 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 = 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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) remove.metadata = {'url': '/providers/Microsoft.Purview/removeDefaultAccount'} # type: ignore + diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_operations.py index 6a19ac9e24db..c0eb6450c1ed 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/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 @@ -59,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,12 +98,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.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_private_endpoint_connections_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_private_endpoint_connections_operations.py index 9e91fc476e11..5d2411d0f114 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_private_endpoint_connections_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._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_account_request 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_by_account( self, resource_group_name: str, @@ -61,8 +67,10 @@ def list_by_account( :param skip_token: The skip token. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.purview.models.PrivateEndpointConnectionList] + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.purview.models.PrivateEndpointConnectionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] @@ -70,38 +78,35 @@ def list_by_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + skip_token=skip_token, + template_url=self.list_by_account.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_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + skip_token=skip_token, + 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('PrivateEndpointConnectionList', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,17 +119,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.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -152,34 +159,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -188,8 +185,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -203,40 +202,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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] + + _json = self._serialize.body(request, 'PrivateEndpointConnection') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_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(request, 'PrivateEndpointConnection') - 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.ErrorResponseModel, 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('PrivateEndpointConnection', pipeline_response) @@ -248,8 +236,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -272,15 +263,20 @@ async def begin_create_or_update( :type request: ~azure.mgmt.purview.models.PrivateEndpointConnection :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 PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.purview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :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 PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.purview.models.PrivateEndpointConnection] + :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.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +289,21 @@ async def begin_create_or_update( account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, request=request, + 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('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -326,6 +315,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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -340,41 +330,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_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.ErrorResponseModel, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -394,15 +375,17 @@ async def begin_delete( :type private_endpoint_connection_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', @@ -417,22 +400,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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -444,4 +419,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_private_link_resources_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_private_link_resources_operations.py index 9a2669ee2ccb..d091a0bb09f9 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_private_link_resources_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/aio/operations/_private_link_resources_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._private_link_resources_operations import build_get_by_group_id_request, build_list_by_account_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_by_account( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list_by_account( :param account_name: The name of the account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.purview.models.PrivateLinkResourceList] + :return: An iterator like instance of either PrivateLinkResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.purview.models.PrivateLinkResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceList"] @@ -65,36 +73,33 @@ def list_by_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list_by_account.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_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateLinkResourceList', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,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.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources'} # type: ignore + @distributed_trace_async async def get_by_group_id( self, resource_group_name: str, @@ -145,34 +152,24 @@ async def get_by_group_id( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_by_group_id.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'groupId': self._serialize.url("group_id", group_id, '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_by_group_id_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + group_id=group_id, + template_url=self.get_by_group_id.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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -181,4 +178,6 @@ async def get_by_group_id( return cls(pipeline_response, deserialized, {}) return deserialized + get_by_group_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources/{groupId}'} # type: ignore + diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/__init__.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/__init__.py index e958a3eaf6e1..835896905195 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/__init__.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/__init__.py @@ -6,82 +6,46 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessKeys - from ._models_py3 import Account - from ._models_py3 import AccountEndpoints - from ._models_py3 import AccountList - from ._models_py3 import AccountProperties - from ._models_py3 import AccountPropertiesEndpoints - from ._models_py3 import AccountPropertiesManagedResources - from ._models_py3 import AccountSku - from ._models_py3 import AccountUpdateParameters - from ._models_py3 import CheckNameAvailabilityRequest - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudConnectors - from ._models_py3 import CollectionAdminUpdate - from ._models_py3 import DefaultAccountPayload - from ._models_py3 import DimensionProperties - from ._models_py3 import ErrorModel - from ._models_py3 import ErrorResponseModel - from ._models_py3 import ErrorResponseModelError - from ._models_py3 import Identity - from ._models_py3 import ManagedResources - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationList - from ._models_py3 import OperationMetaLogSpecification - from ._models_py3 import OperationMetaMetricSpecification - from ._models_py3 import OperationMetaServiceSpecification - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionList - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceList - from ._models_py3 import PrivateLinkResourceProperties - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProxyResource - from ._models_py3 import SystemData - from ._models_py3 import TrackedResource - from ._models_py3 import TrackedResourceSystemData -except (SyntaxError, ImportError): - from ._models import AccessKeys # type: ignore - from ._models import Account # type: ignore - from ._models import AccountEndpoints # type: ignore - from ._models import AccountList # type: ignore - from ._models import AccountProperties # type: ignore - from ._models import AccountPropertiesEndpoints # type: ignore - from ._models import AccountPropertiesManagedResources # type: ignore - from ._models import AccountSku # type: ignore - from ._models import AccountUpdateParameters # type: ignore - from ._models import CheckNameAvailabilityRequest # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudConnectors # type: ignore - from ._models import CollectionAdminUpdate # type: ignore - from ._models import DefaultAccountPayload # type: ignore - from ._models import DimensionProperties # type: ignore - from ._models import ErrorModel # type: ignore - from ._models import ErrorResponseModel # type: ignore - from ._models import ErrorResponseModelError # type: ignore - from ._models import Identity # type: ignore - from ._models import ManagedResources # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationList # type: ignore - from ._models import OperationMetaLogSpecification # type: ignore - from ._models import OperationMetaMetricSpecification # type: ignore - from ._models import OperationMetaServiceSpecification # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionList # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceList # type: ignore - from ._models import PrivateLinkResourceProperties # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import TrackedResourceSystemData # type: ignore +from ._models_py3 import AccessKeys +from ._models_py3 import Account +from ._models_py3 import AccountEndpoints +from ._models_py3 import AccountList +from ._models_py3 import AccountProperties +from ._models_py3 import AccountPropertiesEndpoints +from ._models_py3 import AccountPropertiesManagedResources +from ._models_py3 import AccountSku +from ._models_py3 import AccountSkuAutoGenerated +from ._models_py3 import AccountUpdateParameters +from ._models_py3 import CheckNameAvailabilityRequest +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudConnectors +from ._models_py3 import CollectionAdminUpdate +from ._models_py3 import DefaultAccountPayload +from ._models_py3 import DimensionProperties +from ._models_py3 import ErrorModel +from ._models_py3 import ErrorResponseModel +from ._models_py3 import ErrorResponseModelError +from ._models_py3 import Identity +from ._models_py3 import ManagedResources +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationList +from ._models_py3 import OperationMetaLogSpecification +from ._models_py3 import OperationMetaMetricSpecification +from ._models_py3 import OperationMetaServiceSpecification +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionList +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceList +from ._models_py3 import PrivateLinkResourceProperties +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyResource +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import TrackedResourceSystemData +from ._models_py3 import UserAssignedIdentity + from ._purview_management_client_enums import ( CreatedByType, @@ -104,6 +68,7 @@ 'AccountPropertiesEndpoints', 'AccountPropertiesManagedResources', 'AccountSku', + 'AccountSkuAutoGenerated', 'AccountUpdateParameters', 'CheckNameAvailabilityRequest', 'CheckNameAvailabilityResult', @@ -133,6 +98,7 @@ 'SystemData', 'TrackedResource', 'TrackedResourceSystemData', + 'UserAssignedIdentity', 'CreatedByType', 'LastModifiedByType', 'Name', diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_models.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_models.py deleted file mode 100644 index b0e8450b34b1..000000000000 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_models.py +++ /dev/null @@ -1,1365 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccessKeys(msrest.serialization.Model): - """The Account access keys. - - :param atlas_kafka_primary_endpoint: Gets or sets the primary connection string. - :type atlas_kafka_primary_endpoint: str - :param atlas_kafka_secondary_endpoint: Gets or sets the secondary connection string. - :type atlas_kafka_secondary_endpoint: str - """ - - _attribute_map = { - 'atlas_kafka_primary_endpoint': {'key': 'atlasKafkaPrimaryEndpoint', 'type': 'str'}, - 'atlas_kafka_secondary_endpoint': {'key': 'atlasKafkaSecondaryEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessKeys, self).__init__(**kwargs) - self.atlas_kafka_primary_endpoint = kwargs.get('atlas_kafka_primary_endpoint', None) - self.atlas_kafka_secondary_endpoint = kwargs.get('atlas_kafka_secondary_endpoint', None) - - -class TrackedResource(msrest.serialization.Model): - """Azure ARM Tracked Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets or sets the identifier. - :vartype id: str - :param identity: Identity Info on the tracked resource. - :type identity: ~azure.mgmt.purview.models.Identity - :param location: Gets or sets the location. - :type location: str - :ivar name: Gets or sets the name. - :vartype name: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.purview.models.TrackedResourceSystemData - :param tags: A set of tags. Tags on the azure resource. - :type tags: dict[str, str] - :ivar type: Gets or sets the type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'system_data': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'location': {'key': 'location', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'TrackedResourceSystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.id = None - self.identity = kwargs.get('identity', None) - self.location = kwargs.get('location', None) - self.name = None - self.system_data = None - self.tags = kwargs.get('tags', None) - self.type = None - - -class Account(TrackedResource): - """Account resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets or sets the identifier. - :vartype id: str - :param identity: Identity Info on the tracked resource. - :type identity: ~azure.mgmt.purview.models.Identity - :param location: Gets or sets the location. - :type location: str - :ivar name: Gets or sets the name. - :vartype name: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.purview.models.TrackedResourceSystemData - :param tags: A set of tags. Tags on the azure resource. - :type tags: dict[str, str] - :ivar type: Gets or sets the type. - :vartype type: str - :param sku: Gets or sets the Sku. - :type sku: ~azure.mgmt.purview.models.AccountSku - :param cloud_connectors: Cloud connectors. - External cloud identifier used as part of scanning configuration. - :type cloud_connectors: ~azure.mgmt.purview.models.CloudConnectors - :ivar created_at: Gets the time at which the entity was created. - :vartype created_at: ~datetime.datetime - :ivar created_by: Gets the creator of the entity. - :vartype created_by: str - :ivar created_by_object_id: Gets the creators of the entity's object id. - :vartype created_by_object_id: str - :ivar endpoints: The URIs that are the public endpoints of the account. - :vartype endpoints: ~azure.mgmt.purview.models.AccountPropertiesEndpoints - :ivar friendly_name: Gets or sets the friendly name. - :vartype friendly_name: str - :param managed_resource_group_name: Gets or sets the managed resource group name. - :type managed_resource_group_name: str - :ivar managed_resources: Gets the resource identifiers of the managed resources. - :vartype managed_resources: ~azure.mgmt.purview.models.AccountPropertiesManagedResources - :ivar private_endpoint_connections: Gets the private endpoint connections information. - :vartype private_endpoint_connections: - list[~azure.mgmt.purview.models.PrivateEndpointConnection] - :ivar provisioning_state: Gets or sets the state of the provisioning. Possible values include: - "Unknown", "Creating", "Moving", "Deleting", "SoftDeleting", "SoftDeleted", "Failed", - "Succeeded", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.purview.models.ProvisioningState - :param public_network_access: Gets or sets the public network access. Possible values include: - "NotSpecified", "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~azure.mgmt.purview.models.PublicNetworkAccess - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'system_data': {'readonly': True}, - 'type': {'readonly': True}, - 'created_at': {'readonly': True}, - 'created_by': {'readonly': True}, - 'created_by_object_id': {'readonly': True}, - 'endpoints': {'readonly': True}, - 'friendly_name': {'readonly': True}, - 'managed_resources': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'location': {'key': 'location', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'TrackedResourceSystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'AccountSku'}, - 'cloud_connectors': {'key': 'properties.cloudConnectors', 'type': 'CloudConnectors'}, - 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, - 'created_by': {'key': 'properties.createdBy', 'type': 'str'}, - 'created_by_object_id': {'key': 'properties.createdByObjectId', 'type': 'str'}, - 'endpoints': {'key': 'properties.endpoints', 'type': 'AccountPropertiesEndpoints'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'managed_resource_group_name': {'key': 'properties.managedResourceGroupName', 'type': 'str'}, - 'managed_resources': {'key': 'properties.managedResources', 'type': 'AccountPropertiesManagedResources'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Account, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.cloud_connectors = kwargs.get('cloud_connectors', None) - self.created_at = None - self.created_by = None - self.created_by_object_id = None - self.endpoints = None - self.friendly_name = None - self.managed_resource_group_name = kwargs.get('managed_resource_group_name', None) - self.managed_resources = None - self.private_endpoint_connections = None - self.provisioning_state = None - self.public_network_access = kwargs.get('public_network_access', "Enabled") - - -class AccountEndpoints(msrest.serialization.Model): - """The account endpoints. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar catalog: Gets the catalog endpoint. - :vartype catalog: str - :ivar guardian: Gets the guardian endpoint. - :vartype guardian: str - :ivar scan: Gets the scan endpoint. - :vartype scan: str - """ - - _validation = { - 'catalog': {'readonly': True}, - 'guardian': {'readonly': True}, - 'scan': {'readonly': True}, - } - - _attribute_map = { - 'catalog': {'key': 'catalog', 'type': 'str'}, - 'guardian': {'key': 'guardian', 'type': 'str'}, - 'scan': {'key': 'scan', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountEndpoints, self).__init__(**kwargs) - self.catalog = None - self.guardian = None - self.scan = None - - -class AccountList(msrest.serialization.Model): - """Paged list of account resources. - - All required parameters must be populated in order to send to Azure. - - :param count: Total item count. - :type count: long - :param next_link: The Url of next result page. - :type next_link: str - :param value: Required. Collection of items of type results. - :type value: list[~azure.mgmt.purview.models.Account] - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'count': {'key': 'count', 'type': 'long'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Account]'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountList, self).__init__(**kwargs) - self.count = kwargs.get('count', None) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs['value'] - - -class AccountProperties(msrest.serialization.Model): - """The account properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param cloud_connectors: Cloud connectors. - External cloud identifier used as part of scanning configuration. - :type cloud_connectors: ~azure.mgmt.purview.models.CloudConnectors - :ivar created_at: Gets the time at which the entity was created. - :vartype created_at: ~datetime.datetime - :ivar created_by: Gets the creator of the entity. - :vartype created_by: str - :ivar created_by_object_id: Gets the creators of the entity's object id. - :vartype created_by_object_id: str - :ivar endpoints: The URIs that are the public endpoints of the account. - :vartype endpoints: ~azure.mgmt.purview.models.AccountPropertiesEndpoints - :ivar friendly_name: Gets or sets the friendly name. - :vartype friendly_name: str - :param managed_resource_group_name: Gets or sets the managed resource group name. - :type managed_resource_group_name: str - :ivar managed_resources: Gets the resource identifiers of the managed resources. - :vartype managed_resources: ~azure.mgmt.purview.models.AccountPropertiesManagedResources - :ivar private_endpoint_connections: Gets the private endpoint connections information. - :vartype private_endpoint_connections: - list[~azure.mgmt.purview.models.PrivateEndpointConnection] - :ivar provisioning_state: Gets or sets the state of the provisioning. Possible values include: - "Unknown", "Creating", "Moving", "Deleting", "SoftDeleting", "SoftDeleted", "Failed", - "Succeeded", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.purview.models.ProvisioningState - :param public_network_access: Gets or sets the public network access. Possible values include: - "NotSpecified", "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~azure.mgmt.purview.models.PublicNetworkAccess - """ - - _validation = { - 'created_at': {'readonly': True}, - 'created_by': {'readonly': True}, - 'created_by_object_id': {'readonly': True}, - 'endpoints': {'readonly': True}, - 'friendly_name': {'readonly': True}, - 'managed_resources': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'cloud_connectors': {'key': 'cloudConnectors', 'type': 'CloudConnectors'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_object_id': {'key': 'createdByObjectId', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': 'AccountPropertiesEndpoints'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'managed_resource_group_name': {'key': 'managedResourceGroupName', 'type': 'str'}, - 'managed_resources': {'key': 'managedResources', 'type': 'AccountPropertiesManagedResources'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountProperties, self).__init__(**kwargs) - self.cloud_connectors = kwargs.get('cloud_connectors', None) - self.created_at = None - self.created_by = None - self.created_by_object_id = None - self.endpoints = None - self.friendly_name = None - self.managed_resource_group_name = kwargs.get('managed_resource_group_name', None) - self.managed_resources = None - self.private_endpoint_connections = None - self.provisioning_state = None - self.public_network_access = kwargs.get('public_network_access', "Enabled") - - -class AccountPropertiesEndpoints(AccountEndpoints): - """The URIs that are the public endpoints of the account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar catalog: Gets the catalog endpoint. - :vartype catalog: str - :ivar guardian: Gets the guardian endpoint. - :vartype guardian: str - :ivar scan: Gets the scan endpoint. - :vartype scan: str - """ - - _validation = { - 'catalog': {'readonly': True}, - 'guardian': {'readonly': True}, - 'scan': {'readonly': True}, - } - - _attribute_map = { - 'catalog': {'key': 'catalog', 'type': 'str'}, - 'guardian': {'key': 'guardian', 'type': 'str'}, - 'scan': {'key': 'scan', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountPropertiesEndpoints, self).__init__(**kwargs) - - -class ManagedResources(msrest.serialization.Model): - """The managed resources in customer subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar event_hub_namespace: Gets the managed event hub namespace resource identifier. - :vartype event_hub_namespace: str - :ivar resource_group: Gets the managed resource group resource identifier. This resource group - will host resource dependencies for the account. - :vartype resource_group: str - :ivar storage_account: Gets the managed storage account resource identifier. - :vartype storage_account: str - """ - - _validation = { - 'event_hub_namespace': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'storage_account': {'readonly': True}, - } - - _attribute_map = { - 'event_hub_namespace': {'key': 'eventHubNamespace', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, - 'storage_account': {'key': 'storageAccount', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedResources, self).__init__(**kwargs) - self.event_hub_namespace = None - self.resource_group = None - self.storage_account = None - - -class AccountPropertiesManagedResources(ManagedResources): - """Gets the resource identifiers of the managed resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar event_hub_namespace: Gets the managed event hub namespace resource identifier. - :vartype event_hub_namespace: str - :ivar resource_group: Gets the managed resource group resource identifier. This resource group - will host resource dependencies for the account. - :vartype resource_group: str - :ivar storage_account: Gets the managed storage account resource identifier. - :vartype storage_account: str - """ - - _validation = { - 'event_hub_namespace': {'readonly': True}, - 'resource_group': {'readonly': True}, - 'storage_account': {'readonly': True}, - } - - _attribute_map = { - 'event_hub_namespace': {'key': 'eventHubNamespace', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, - 'storage_account': {'key': 'storageAccount', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountPropertiesManagedResources, self).__init__(**kwargs) - - -class AccountSku(msrest.serialization.Model): - """The Sku. - - :param capacity: Gets or sets the sku capacity. Possible values include: 4, 16. - :type capacity: int - :param name: Gets or sets the sku name. Possible values include: "Standard". - :type name: str or ~azure.mgmt.purview.models.Name - """ - - _attribute_map = { - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountSku, self).__init__(**kwargs) - self.capacity = kwargs.get('capacity', None) - self.name = kwargs.get('name', None) - - -class AccountUpdateParameters(msrest.serialization.Model): - """The account update properties. - - :param properties: The account properties. - :type properties: ~azure.mgmt.purview.models.AccountProperties - :param tags: A set of tags. Tags on the azure resource. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'AccountProperties'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountUpdateParameters, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.tags = kwargs.get('tags', None) - - -class CheckNameAvailabilityRequest(msrest.serialization.Model): - """The request payload for CheckNameAvailability API. - - :param name: Resource name to verify for availability. - :type name: str - :param type: Fully qualified resource type which includes provider namespace. - :type type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The response payload for CheckNameAvailability API. - - :param message: Error message. - :type message: str - :param name_available: Indicates if name is valid and available. - :type name_available: bool - :param reason: The reason the name is not available. Possible values include: "Invalid", - "AlreadyExists". - :type reason: str or ~azure.mgmt.purview.models.Reason - """ - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.message = kwargs.get('message', None) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - - -class CloudConnectors(msrest.serialization.Model): - """CloudConnectors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aws_external_id: AWS external identifier. - Configured in AWS to allow use of the role arn used for scanning. - :vartype aws_external_id: str - """ - - _validation = { - 'aws_external_id': {'readonly': True}, - } - - _attribute_map = { - 'aws_external_id': {'key': 'awsExternalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudConnectors, self).__init__(**kwargs) - self.aws_external_id = None - - -class CollectionAdminUpdate(msrest.serialization.Model): - """Collection administrator update. - - :param object_id: Gets or sets the object identifier of the admin. - :type object_id: str - """ - - _attribute_map = { - 'object_id': {'key': 'objectId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CollectionAdminUpdate, self).__init__(**kwargs) - self.object_id = kwargs.get('object_id', None) - - -class DefaultAccountPayload(msrest.serialization.Model): - """Payload to get and set the default account in the given scope. - - :param account_name: The name of the account that is set as the default. - :type account_name: str - :param resource_group_name: The resource group name of the account that is set as the default. - :type resource_group_name: str - :param scope: The scope object ID. For example, sub ID or tenant ID. - :type scope: str - :param scope_tenant_id: The scope tenant in which the default account is set. - :type scope_tenant_id: str - :param scope_type: The scope where the default account is set. Possible values include: - "Tenant", "Subscription". - :type scope_type: str or ~azure.mgmt.purview.models.ScopeType - :param subscription_id: The subscription ID of the account that is set as the default. - :type subscription_id: str - """ - - _attribute_map = { - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'resource_group_name': {'key': 'resourceGroupName', 'type': 'str'}, - 'scope': {'key': 'scope', 'type': 'str'}, - 'scope_tenant_id': {'key': 'scopeTenantId', 'type': 'str'}, - 'scope_type': {'key': 'scopeType', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DefaultAccountPayload, self).__init__(**kwargs) - self.account_name = kwargs.get('account_name', None) - self.resource_group_name = kwargs.get('resource_group_name', None) - self.scope = kwargs.get('scope', None) - self.scope_tenant_id = kwargs.get('scope_tenant_id', None) - self.scope_type = kwargs.get('scope_type', None) - self.subscription_id = kwargs.get('subscription_id', None) - - -class DimensionProperties(msrest.serialization.Model): - """properties for dimension. - - :param display_name: localized display name of the dimension to customer. - :type display_name: str - :param name: dimension name. - :type name: str - :param to_be_exported_for_customer: flag indicating whether this dimension should be included - to the customer in Azure Monitor logs (aka Shoebox). - :type to_be_exported_for_customer: bool - """ - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'to_be_exported_for_customer': {'key': 'toBeExportedForCustomer', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DimensionProperties, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.name = kwargs.get('name', None) - self.to_be_exported_for_customer = kwargs.get('to_be_exported_for_customer', None) - - -class ErrorModel(msrest.serialization.Model): - """Default error model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Gets or sets the code. - :vartype code: str - :ivar details: Gets or sets the details. - :vartype details: list[~azure.mgmt.purview.models.ErrorModel] - :ivar message: Gets or sets the messages. - :vartype message: str - :ivar target: Gets or sets the target. - :vartype target: str - """ - - _validation = { - 'code': {'readonly': True}, - 'details': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorModel]'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorModel, self).__init__(**kwargs) - self.code = None - self.details = None - self.message = None - self.target = None - - -class ErrorResponseModel(msrest.serialization.Model): - """Default error response model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Gets or sets the error. - :vartype error: ~azure.mgmt.purview.models.ErrorResponseModelError - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseModelError'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseModel, self).__init__(**kwargs) - self.error = None - - -class ErrorResponseModelError(ErrorModel): - """Gets or sets the error. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Gets or sets the code. - :vartype code: str - :ivar details: Gets or sets the details. - :vartype details: list[~azure.mgmt.purview.models.ErrorModel] - :ivar message: Gets or sets the messages. - :vartype message: str - :ivar target: Gets or sets the target. - :vartype target: str - """ - - _validation = { - 'code': {'readonly': True}, - 'details': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorModel]'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseModelError, self).__init__(**kwargs) - - -class Identity(msrest.serialization.Model): - """The Managed Identity of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Service principal object Id. - :vartype principal_id: str - :ivar tenant_id: Tenant Id. - :vartype tenant_id: str - :param type: Identity Type. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.purview.models.Type - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class Operation(msrest.serialization.Model): - """Operation resource. - - :param display: Properties on the operation. - :type display: ~azure.mgmt.purview.models.OperationDisplay - :param is_data_action: Whether operation is a data action. - :type is_data_action: bool - :param name: Operation name for display purposes. - :type name: str - :param origin: origin of the operation. - :type origin: str - :param service_specification: meta service specification. - :type service_specification: ~azure.mgmt.purview.models.OperationMetaServiceSpecification - """ - - _attribute_map = { - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationMetaServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.display = kwargs.get('display', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.name = kwargs.get('name', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """The response model for get operation properties. - - :param description: Description of the operation for display purposes. - :type description: str - :param operation: Name of the operation for display purposes. - :type operation: str - :param provider: Name of the provider for display purposes. - :type provider: str - :param resource: Name of the resource type for display purposes. - :type resource: str - """ - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.operation = kwargs.get('operation', None) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - - -class OperationList(msrest.serialization.Model): - """Paged list of operation resources. - - All required parameters must be populated in order to send to Azure. - - :param count: Total item count. - :type count: long - :param next_link: The Url of next result page. - :type next_link: str - :param value: Required. Collection of items of type results. - :type value: list[~azure.mgmt.purview.models.Operation] - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'count': {'key': 'count', 'type': 'long'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.count = kwargs.get('count', None) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs['value'] - - -class OperationMetaLogSpecification(msrest.serialization.Model): - """log specifications for operation api. - - :param blob_duration: blob duration of the log. - :type blob_duration: str - :param display_name: localized name of the log category. - :type display_name: str - :param name: name of the log category. - :type name: str - """ - - _attribute_map = { - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetaLogSpecification, self).__init__(**kwargs) - self.blob_duration = kwargs.get('blob_duration', None) - self.display_name = kwargs.get('display_name', None) - self.name = kwargs.get('name', None) - - -class OperationMetaMetricSpecification(msrest.serialization.Model): - """metric specifications for the operation. - - :param aggregation_type: aggregation type of metric. - :type aggregation_type: str - :param dimensions: properties for dimension. - :type dimensions: list[~azure.mgmt.purview.models.DimensionProperties] - :param display_description: description of the metric. - :type display_description: str - :param display_name: localized name of the metric. - :type display_name: str - :param enable_regional_mdm_account: enable regional mdm account. - :type enable_regional_mdm_account: str - :param internal_metric_name: internal metric name. - :type internal_metric_name: str - :param name: name of the metric. - :type name: str - :param resource_id_dimension_name_override: dimension name use to replace resource id if - specified. - :type resource_id_dimension_name_override: str - :param source_mdm_namespace: Metric namespace. - Only set the namespace if different from the default value, - leaving it empty makes it use the value from the ARM manifest. - :type source_mdm_namespace: str - :param supported_aggregation_types: supported aggregation types. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: supported time grain types. - :type supported_time_grain_types: list[str] - :param unit: units for the metric. - :type unit: str - """ - - _attribute_map = { - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'str'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetaMetricSpecification, self).__init__(**kwargs) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.display_description = kwargs.get('display_description', None) - self.display_name = kwargs.get('display_name', None) - self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - self.name = kwargs.get('name', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.unit = kwargs.get('unit', None) - - -class OperationMetaServiceSpecification(msrest.serialization.Model): - """The operation meta service specification. - - :param log_specifications: log specifications for the operation. - :type log_specifications: list[~azure.mgmt.purview.models.OperationMetaLogSpecification] - :param metric_specifications: metric specifications for the operation. - :type metric_specifications: list[~azure.mgmt.purview.models.OperationMetaMetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationMetaLogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetaMetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetaServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """A private endpoint class. - - :param id: The private endpoint identifier. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class ProxyResource(msrest.serialization.Model): - """Proxy Azure Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets or sets the identifier. - :vartype id: str - :ivar name: Gets or sets the name. - :vartype name: str - :ivar type: Gets or sets the type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class PrivateEndpointConnection(ProxyResource): - """A private endpoint connection class. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets or sets the identifier. - :vartype id: str - :ivar name: Gets or sets the name. - :vartype name: str - :ivar type: Gets or sets the type. - :vartype type: str - :param private_endpoint: The private endpoint information. - :type private_endpoint: ~azure.mgmt.purview.models.PrivateEndpoint - :param private_link_service_connection_state: The private link service connection state. - :type private_link_service_connection_state: - ~azure.mgmt.purview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionList(msrest.serialization.Model): - """Paged list of private endpoint connections. - - All required parameters must be populated in order to send to Azure. - - :param count: Total item count. - :type count: long - :param next_link: The Url of next result page. - :type next_link: str - :param value: Required. Collection of items of type results. - :type value: list[~azure.mgmt.purview.models.PrivateEndpointConnection] - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'count': {'key': 'count', 'type': 'long'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionList, self).__init__(**kwargs) - self.count = kwargs.get('count', None) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs['value'] - - -class PrivateLinkResource(msrest.serialization.Model): - """A privately linkable resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The private link resource identifier. - :vartype id: str - :ivar name: The private link resource name. - :vartype name: str - :ivar properties: The private link resource properties. - :vartype properties: ~azure.mgmt.purview.models.PrivateLinkResourceProperties - :ivar type: The private link resource type. - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'properties': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.properties = None - self.type = None - - -class PrivateLinkResourceList(msrest.serialization.Model): - """Paged list of private link resources. - - All required parameters must be populated in order to send to Azure. - - :param count: Total item count. - :type count: long - :param next_link: The Url of next result page. - :type next_link: str - :param value: Required. Collection of items of type results. - :type value: list[~azure.mgmt.purview.models.PrivateLinkResource] - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'count': {'key': 'count', 'type': 'long'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceList, self).__init__(**kwargs) - self.count = kwargs.get('count', None) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs['value'] - - -class PrivateLinkResourceProperties(msrest.serialization.Model): - """A privately linkable resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar group_id: The private link resource group identifier. - :vartype group_id: str - :ivar required_members: This translates to how many Private IPs should be created for each - privately linkable resource. - :vartype required_members: list[str] - :ivar required_zone_names: The required zone names for private link resource. - :vartype required_zone_names: list[str] - """ - - _validation = { - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, - } - - _attribute_map = { - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceProperties, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = None - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """The private link service connection state. - - :param actions_required: The required actions. - :type actions_required: str - :param description: The description. - :type description: str - :param status: The status. Possible values include: "Unknown", "Pending", "Approved", - "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.purview.models.Status - """ - - _attribute_map = { - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.actions_required = kwargs.get('actions_required', None) - self.description = kwargs.get('description', None) - self.status = kwargs.get('status', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :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 ~azure.mgmt.purview.models.CreatedByType - :ivar last_modified_at: The timestamp of the last modification the resource (UTC). - :vartype last_modified_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". - :vartype last_modified_by_type: str or ~azure.mgmt.purview.models.LastModifiedByType - """ - - _validation = { - 'created_at': {'readonly': True}, - 'created_by': {'readonly': True}, - 'created_by_type': {'readonly': True}, - 'last_modified_at': {'readonly': True}, - 'last_modified_by': {'readonly': True}, - 'last_modified_by_type': {'readonly': True}, - } - - _attribute_map = { - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_at = None - self.created_by = None - self.created_by_type = None - self.last_modified_at = None - self.last_modified_by = None - self.last_modified_by_type = None - - -class TrackedResourceSystemData(SystemData): - """Metadata pertaining to creation and last modification of the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :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 ~azure.mgmt.purview.models.CreatedByType - :ivar last_modified_at: The timestamp of the last modification the resource (UTC). - :vartype last_modified_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". - :vartype last_modified_by_type: str or ~azure.mgmt.purview.models.LastModifiedByType - """ - - _validation = { - 'created_at': {'readonly': True}, - 'created_by': {'readonly': True}, - 'created_by_type': {'readonly': True}, - 'last_modified_at': {'readonly': True}, - 'last_modified_by': {'readonly': True}, - 'last_modified_by_type': {'readonly': True}, - } - - _attribute_map = { - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResourceSystemData, self).__init__(**kwargs) diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_models_py3.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_models_py3.py index 53e98175c4f4..41625516a272 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_models_py3.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_models_py3.py @@ -17,10 +17,10 @@ class AccessKeys(msrest.serialization.Model): """The Account access keys. - :param atlas_kafka_primary_endpoint: Gets or sets the primary connection string. - :type atlas_kafka_primary_endpoint: str - :param atlas_kafka_secondary_endpoint: Gets or sets the secondary connection string. - :type atlas_kafka_secondary_endpoint: str + :ivar atlas_kafka_primary_endpoint: Gets or sets the primary connection string. + :vartype atlas_kafka_primary_endpoint: str + :ivar atlas_kafka_secondary_endpoint: Gets or sets the secondary connection string. + :vartype atlas_kafka_secondary_endpoint: str """ _attribute_map = { @@ -35,6 +35,12 @@ def __init__( atlas_kafka_secondary_endpoint: Optional[str] = None, **kwargs ): + """ + :keyword atlas_kafka_primary_endpoint: Gets or sets the primary connection string. + :paramtype atlas_kafka_primary_endpoint: str + :keyword atlas_kafka_secondary_endpoint: Gets or sets the secondary connection string. + :paramtype atlas_kafka_secondary_endpoint: str + """ super(AccessKeys, self).__init__(**kwargs) self.atlas_kafka_primary_endpoint = atlas_kafka_primary_endpoint self.atlas_kafka_secondary_endpoint = atlas_kafka_secondary_endpoint @@ -47,16 +53,16 @@ class TrackedResource(msrest.serialization.Model): :ivar id: Gets or sets the identifier. :vartype id: str - :param identity: Identity Info on the tracked resource. - :type identity: ~azure.mgmt.purview.models.Identity - :param location: Gets or sets the location. - :type location: str + :ivar identity: Identity Info on the tracked resource. + :vartype identity: ~azure.mgmt.purview.models.Identity + :ivar location: Gets or sets the location. + :vartype location: str :ivar name: Gets or sets the name. :vartype name: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.purview.models.TrackedResourceSystemData - :param tags: A set of tags. Tags on the azure resource. - :type tags: dict[str, str] + :ivar tags: A set of tags. Tags on the azure resource. + :vartype tags: dict[str, str] :ivar type: Gets or sets the type. :vartype type: str """ @@ -86,6 +92,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword identity: Identity Info on the tracked resource. + :paramtype identity: ~azure.mgmt.purview.models.Identity + :keyword location: Gets or sets the location. + :paramtype location: str + :keyword tags: A set of tags. Tags on the azure resource. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(**kwargs) self.id = None self.identity = identity @@ -103,23 +117,23 @@ class Account(TrackedResource): :ivar id: Gets or sets the identifier. :vartype id: str - :param identity: Identity Info on the tracked resource. - :type identity: ~azure.mgmt.purview.models.Identity - :param location: Gets or sets the location. - :type location: str + :ivar identity: Identity Info on the tracked resource. + :vartype identity: ~azure.mgmt.purview.models.Identity + :ivar location: Gets or sets the location. + :vartype location: str :ivar name: Gets or sets the name. :vartype name: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.purview.models.TrackedResourceSystemData - :param tags: A set of tags. Tags on the azure resource. - :type tags: dict[str, str] + :ivar tags: A set of tags. Tags on the azure resource. + :vartype tags: dict[str, str] :ivar type: Gets or sets the type. :vartype type: str - :param sku: Gets or sets the Sku. - :type sku: ~azure.mgmt.purview.models.AccountSku - :param cloud_connectors: Cloud connectors. + :ivar sku: Gets or sets the Sku. + :vartype sku: ~azure.mgmt.purview.models.AccountSkuAutoGenerated + :ivar cloud_connectors: Cloud connectors. External cloud identifier used as part of scanning configuration. - :type cloud_connectors: ~azure.mgmt.purview.models.CloudConnectors + :vartype cloud_connectors: ~azure.mgmt.purview.models.CloudConnectors :ivar created_at: Gets the time at which the entity was created. :vartype created_at: ~datetime.datetime :ivar created_by: Gets the creator of the entity. @@ -130,8 +144,8 @@ class Account(TrackedResource): :vartype endpoints: ~azure.mgmt.purview.models.AccountPropertiesEndpoints :ivar friendly_name: Gets or sets the friendly name. :vartype friendly_name: str - :param managed_resource_group_name: Gets or sets the managed resource group name. - :type managed_resource_group_name: str + :ivar managed_resource_group_name: Gets or sets the managed resource group name. + :vartype managed_resource_group_name: str :ivar managed_resources: Gets the resource identifiers of the managed resources. :vartype managed_resources: ~azure.mgmt.purview.models.AccountPropertiesManagedResources :ivar private_endpoint_connections: Gets the private endpoint connections information. @@ -141,9 +155,9 @@ class Account(TrackedResource): "Unknown", "Creating", "Moving", "Deleting", "SoftDeleting", "SoftDeleted", "Failed", "Succeeded", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.purview.models.ProvisioningState - :param public_network_access: Gets or sets the public network access. Possible values include: + :ivar public_network_access: Gets or sets the public network access. Possible values include: "NotSpecified", "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~azure.mgmt.purview.models.PublicNetworkAccess + :vartype public_network_access: str or ~azure.mgmt.purview.models.PublicNetworkAccess """ _validation = { @@ -151,6 +165,7 @@ class Account(TrackedResource): 'name': {'readonly': True}, 'system_data': {'readonly': True}, 'type': {'readonly': True}, + 'sku': {'readonly': True}, 'created_at': {'readonly': True}, 'created_by': {'readonly': True}, 'created_by_object_id': {'readonly': True}, @@ -169,7 +184,7 @@ class Account(TrackedResource): 'system_data': {'key': 'systemData', 'type': 'TrackedResourceSystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'type': {'key': 'type', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'AccountSku'}, + 'sku': {'key': 'sku', 'type': 'AccountSkuAutoGenerated'}, 'cloud_connectors': {'key': 'properties.cloudConnectors', 'type': 'CloudConnectors'}, 'created_at': {'key': 'properties.createdAt', 'type': 'iso-8601'}, 'created_by': {'key': 'properties.createdBy', 'type': 'str'}, @@ -189,14 +204,29 @@ def __init__( identity: Optional["Identity"] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - sku: Optional["AccountSku"] = None, cloud_connectors: Optional["CloudConnectors"] = None, managed_resource_group_name: Optional[str] = None, public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", **kwargs ): + """ + :keyword identity: Identity Info on the tracked resource. + :paramtype identity: ~azure.mgmt.purview.models.Identity + :keyword location: Gets or sets the location. + :paramtype location: str + :keyword tags: A set of tags. Tags on the azure resource. + :paramtype tags: dict[str, str] + :keyword cloud_connectors: Cloud connectors. + External cloud identifier used as part of scanning configuration. + :paramtype cloud_connectors: ~azure.mgmt.purview.models.CloudConnectors + :keyword managed_resource_group_name: Gets or sets the managed resource group name. + :paramtype managed_resource_group_name: str + :keyword public_network_access: Gets or sets the public network access. Possible values + include: "NotSpecified", "Enabled", "Disabled". Default value: "Enabled". + :paramtype public_network_access: str or ~azure.mgmt.purview.models.PublicNetworkAccess + """ super(Account, self).__init__(identity=identity, location=location, tags=tags, **kwargs) - self.sku = sku + self.sku = None self.cloud_connectors = cloud_connectors self.created_at = None self.created_by = None @@ -239,6 +269,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccountEndpoints, self).__init__(**kwargs) self.catalog = None self.guardian = None @@ -250,12 +282,12 @@ class AccountList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param count: Total item count. - :type count: long - :param next_link: The Url of next result page. - :type next_link: str - :param value: Required. Collection of items of type results. - :type value: list[~azure.mgmt.purview.models.Account] + :ivar count: Total item count. + :vartype count: long + :ivar next_link: The Url of next result page. + :vartype next_link: str + :ivar value: Required. Collection of items of type results. + :vartype value: list[~azure.mgmt.purview.models.Account] """ _validation = { @@ -276,6 +308,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword count: Total item count. + :paramtype count: long + :keyword next_link: The Url of next result page. + :paramtype next_link: str + :keyword value: Required. Collection of items of type results. + :paramtype value: list[~azure.mgmt.purview.models.Account] + """ super(AccountList, self).__init__(**kwargs) self.count = count self.next_link = next_link @@ -287,9 +327,9 @@ class AccountProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param cloud_connectors: Cloud connectors. + :ivar cloud_connectors: Cloud connectors. External cloud identifier used as part of scanning configuration. - :type cloud_connectors: ~azure.mgmt.purview.models.CloudConnectors + :vartype cloud_connectors: ~azure.mgmt.purview.models.CloudConnectors :ivar created_at: Gets the time at which the entity was created. :vartype created_at: ~datetime.datetime :ivar created_by: Gets the creator of the entity. @@ -300,8 +340,8 @@ class AccountProperties(msrest.serialization.Model): :vartype endpoints: ~azure.mgmt.purview.models.AccountPropertiesEndpoints :ivar friendly_name: Gets or sets the friendly name. :vartype friendly_name: str - :param managed_resource_group_name: Gets or sets the managed resource group name. - :type managed_resource_group_name: str + :ivar managed_resource_group_name: Gets or sets the managed resource group name. + :vartype managed_resource_group_name: str :ivar managed_resources: Gets the resource identifiers of the managed resources. :vartype managed_resources: ~azure.mgmt.purview.models.AccountPropertiesManagedResources :ivar private_endpoint_connections: Gets the private endpoint connections information. @@ -311,9 +351,9 @@ class AccountProperties(msrest.serialization.Model): "Unknown", "Creating", "Moving", "Deleting", "SoftDeleting", "SoftDeleted", "Failed", "Succeeded", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.purview.models.ProvisioningState - :param public_network_access: Gets or sets the public network access. Possible values include: + :ivar public_network_access: Gets or sets the public network access. Possible values include: "NotSpecified", "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~azure.mgmt.purview.models.PublicNetworkAccess + :vartype public_network_access: str or ~azure.mgmt.purview.models.PublicNetworkAccess """ _validation = { @@ -349,6 +389,16 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = "Enabled", **kwargs ): + """ + :keyword cloud_connectors: Cloud connectors. + External cloud identifier used as part of scanning configuration. + :paramtype cloud_connectors: ~azure.mgmt.purview.models.CloudConnectors + :keyword managed_resource_group_name: Gets or sets the managed resource group name. + :paramtype managed_resource_group_name: str + :keyword public_network_access: Gets or sets the public network access. Possible values + include: "NotSpecified", "Enabled", "Disabled". Default value: "Enabled". + :paramtype public_network_access: str or ~azure.mgmt.purview.models.PublicNetworkAccess + """ super(AccountProperties, self).__init__(**kwargs) self.cloud_connectors = cloud_connectors self.created_at = None @@ -392,6 +442,8 @@ def __init__( self, **kwargs ): + """ + """ super(AccountPropertiesEndpoints, self).__init__(**kwargs) @@ -425,6 +477,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedResources, self).__init__(**kwargs) self.event_hub_namespace = None self.resource_group = None @@ -461,16 +515,18 @@ def __init__( self, **kwargs ): + """ + """ super(AccountPropertiesManagedResources, self).__init__(**kwargs) class AccountSku(msrest.serialization.Model): """The Sku. - :param capacity: Gets or sets the sku capacity. Possible values include: 4, 16. - :type capacity: int - :param name: Gets or sets the sku name. Possible values include: "Standard". - :type name: str or ~azure.mgmt.purview.models.Name + :ivar capacity: Gets or sets the sku capacity. + :vartype capacity: int + :ivar name: Gets or sets the sku name. Possible values include: "Standard". + :vartype name: str or ~azure.mgmt.purview.models.Name """ _attribute_map = { @@ -485,21 +541,60 @@ def __init__( name: Optional[Union[str, "Name"]] = None, **kwargs ): + """ + :keyword capacity: Gets or sets the sku capacity. + :paramtype capacity: int + :keyword name: Gets or sets the sku name. Possible values include: "Standard". + :paramtype name: str or ~azure.mgmt.purview.models.Name + """ super(AccountSku, self).__init__(**kwargs) self.capacity = capacity self.name = name +class AccountSkuAutoGenerated(AccountSku): + """Gets or sets the Sku. + + :ivar capacity: Gets or sets the sku capacity. + :vartype capacity: int + :ivar name: Gets or sets the sku name. Possible values include: "Standard". + :vartype name: str or ~azure.mgmt.purview.models.Name + """ + + _attribute_map = { + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + capacity: Optional[int] = None, + name: Optional[Union[str, "Name"]] = None, + **kwargs + ): + """ + :keyword capacity: Gets or sets the sku capacity. + :paramtype capacity: int + :keyword name: Gets or sets the sku name. Possible values include: "Standard". + :paramtype name: str or ~azure.mgmt.purview.models.Name + """ + super(AccountSkuAutoGenerated, self).__init__(capacity=capacity, name=name, **kwargs) + + class AccountUpdateParameters(msrest.serialization.Model): """The account update properties. - :param properties: The account properties. - :type properties: ~azure.mgmt.purview.models.AccountProperties - :param tags: A set of tags. Tags on the azure resource. - :type tags: dict[str, str] + :ivar identity: Identity related info to add/remove userAssignedIdentities. + :vartype identity: ~azure.mgmt.purview.models.Identity + :ivar properties: The account properties. + :vartype properties: ~azure.mgmt.purview.models.AccountProperties + :ivar tags: A set of tags. Tags on the azure resource. + :vartype tags: dict[str, str] """ _attribute_map = { + 'identity': {'key': 'identity', 'type': 'Identity'}, 'properties': {'key': 'properties', 'type': 'AccountProperties'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -507,11 +602,21 @@ class AccountUpdateParameters(msrest.serialization.Model): def __init__( self, *, + identity: Optional["Identity"] = None, properties: Optional["AccountProperties"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword identity: Identity related info to add/remove userAssignedIdentities. + :paramtype identity: ~azure.mgmt.purview.models.Identity + :keyword properties: The account properties. + :paramtype properties: ~azure.mgmt.purview.models.AccountProperties + :keyword tags: A set of tags. Tags on the azure resource. + :paramtype tags: dict[str, str] + """ super(AccountUpdateParameters, self).__init__(**kwargs) + self.identity = identity self.properties = properties self.tags = tags @@ -519,10 +624,10 @@ def __init__( class CheckNameAvailabilityRequest(msrest.serialization.Model): """The request payload for CheckNameAvailability API. - :param name: Resource name to verify for availability. - :type name: str - :param type: Fully qualified resource type which includes provider namespace. - :type type: str + :ivar name: Resource name to verify for availability. + :vartype name: str + :ivar type: Fully qualified resource type which includes provider namespace. + :vartype type: str """ _attribute_map = { @@ -537,6 +642,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword name: Resource name to verify for availability. + :paramtype name: str + :keyword type: Fully qualified resource type which includes provider namespace. + :paramtype type: str + """ super(CheckNameAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -545,13 +656,13 @@ def __init__( class CheckNameAvailabilityResult(msrest.serialization.Model): """The response payload for CheckNameAvailability API. - :param message: Error message. - :type message: str - :param name_available: Indicates if name is valid and available. - :type name_available: bool - :param reason: The reason the name is not available. Possible values include: "Invalid", + :ivar message: Error message. + :vartype message: str + :ivar name_available: Indicates if name is valid and available. + :vartype name_available: bool + :ivar reason: The reason the name is not available. Possible values include: "Invalid", "AlreadyExists". - :type reason: str or ~azure.mgmt.purview.models.Reason + :vartype reason: str or ~azure.mgmt.purview.models.Reason """ _attribute_map = { @@ -568,6 +679,15 @@ def __init__( reason: Optional[Union[str, "Reason"]] = None, **kwargs ): + """ + :keyword message: Error message. + :paramtype message: str + :keyword name_available: Indicates if name is valid and available. + :paramtype name_available: bool + :keyword reason: The reason the name is not available. Possible values include: "Invalid", + "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.purview.models.Reason + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.message = message self.name_available = name_available @@ -575,7 +695,7 @@ def __init__( class CloudConnectors(msrest.serialization.Model): - """CloudConnectors. + """External Cloud Service connectors. Variables are only populated by the server, and will be ignored when sending a request. @@ -596,6 +716,8 @@ def __init__( self, **kwargs ): + """ + """ super(CloudConnectors, self).__init__(**kwargs) self.aws_external_id = None @@ -603,8 +725,8 @@ def __init__( class CollectionAdminUpdate(msrest.serialization.Model): """Collection administrator update. - :param object_id: Gets or sets the object identifier of the admin. - :type object_id: str + :ivar object_id: Gets or sets the object identifier of the admin. + :vartype object_id: str """ _attribute_map = { @@ -617,6 +739,10 @@ def __init__( object_id: Optional[str] = None, **kwargs ): + """ + :keyword object_id: Gets or sets the object identifier of the admin. + :paramtype object_id: str + """ super(CollectionAdminUpdate, self).__init__(**kwargs) self.object_id = object_id @@ -624,19 +750,19 @@ def __init__( class DefaultAccountPayload(msrest.serialization.Model): """Payload to get and set the default account in the given scope. - :param account_name: The name of the account that is set as the default. - :type account_name: str - :param resource_group_name: The resource group name of the account that is set as the default. - :type resource_group_name: str - :param scope: The scope object ID. For example, sub ID or tenant ID. - :type scope: str - :param scope_tenant_id: The scope tenant in which the default account is set. - :type scope_tenant_id: str - :param scope_type: The scope where the default account is set. Possible values include: + :ivar account_name: The name of the account that is set as the default. + :vartype account_name: str + :ivar resource_group_name: The resource group name of the account that is set as the default. + :vartype resource_group_name: str + :ivar scope: The scope object ID. For example, sub ID or tenant ID. + :vartype scope: str + :ivar scope_tenant_id: The scope tenant in which the default account is set. + :vartype scope_tenant_id: str + :ivar scope_type: The scope where the default account is set. Possible values include: "Tenant", "Subscription". - :type scope_type: str or ~azure.mgmt.purview.models.ScopeType - :param subscription_id: The subscription ID of the account that is set as the default. - :type subscription_id: str + :vartype scope_type: str or ~azure.mgmt.purview.models.ScopeType + :ivar subscription_id: The subscription ID of the account that is set as the default. + :vartype subscription_id: str """ _attribute_map = { @@ -659,6 +785,22 @@ def __init__( subscription_id: Optional[str] = None, **kwargs ): + """ + :keyword account_name: The name of the account that is set as the default. + :paramtype account_name: str + :keyword resource_group_name: The resource group name of the account that is set as the + default. + :paramtype resource_group_name: str + :keyword scope: The scope object ID. For example, sub ID or tenant ID. + :paramtype scope: str + :keyword scope_tenant_id: The scope tenant in which the default account is set. + :paramtype scope_tenant_id: str + :keyword scope_type: The scope where the default account is set. Possible values include: + "Tenant", "Subscription". + :paramtype scope_type: str or ~azure.mgmt.purview.models.ScopeType + :keyword subscription_id: The subscription ID of the account that is set as the default. + :paramtype subscription_id: str + """ super(DefaultAccountPayload, self).__init__(**kwargs) self.account_name = account_name self.resource_group_name = resource_group_name @@ -671,13 +813,13 @@ def __init__( class DimensionProperties(msrest.serialization.Model): """properties for dimension. - :param display_name: localized display name of the dimension to customer. - :type display_name: str - :param name: dimension name. - :type name: str - :param to_be_exported_for_customer: flag indicating whether this dimension should be included - to the customer in Azure Monitor logs (aka Shoebox). - :type to_be_exported_for_customer: bool + :ivar display_name: localized display name of the dimension to customer. + :vartype display_name: str + :ivar name: dimension name. + :vartype name: str + :ivar to_be_exported_for_customer: flag indicating whether this dimension should be included to + the customer in Azure Monitor logs (aka Shoebox). + :vartype to_be_exported_for_customer: bool """ _attribute_map = { @@ -694,6 +836,15 @@ def __init__( to_be_exported_for_customer: Optional[bool] = None, **kwargs ): + """ + :keyword display_name: localized display name of the dimension to customer. + :paramtype display_name: str + :keyword name: dimension name. + :paramtype name: str + :keyword to_be_exported_for_customer: flag indicating whether this dimension should be included + to the customer in Azure Monitor logs (aka Shoebox). + :paramtype to_be_exported_for_customer: bool + """ super(DimensionProperties, self).__init__(**kwargs) self.display_name = display_name self.name = name @@ -733,6 +884,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorModel, self).__init__(**kwargs) self.code = None self.details = None @@ -761,6 +914,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponseModel, self).__init__(**kwargs) self.error = None @@ -798,6 +953,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponseModelError, self).__init__(**kwargs) @@ -810,8 +967,10 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: Tenant Id. :vartype tenant_id: str - :param type: Identity Type. Possible values include: "SystemAssigned". - :type type: str or ~azure.mgmt.purview.models.Type + :ivar type: Identity Type. Possible values include: "None", "SystemAssigned", "UserAssigned". + :vartype type: str or ~azure.mgmt.purview.models.Type + :ivar user_assigned_identities: User Assigned Identities. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.purview.models.UserAssignedIdentity] """ _validation = { @@ -823,33 +982,43 @@ class Identity(msrest.serialization.Model): 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, } def __init__( self, *, type: Optional[Union[str, "Type"]] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type: Identity Type. Possible values include: "None", "SystemAssigned", + "UserAssigned". + :paramtype type: str or ~azure.mgmt.purview.models.Type + :keyword user_assigned_identities: User Assigned Identities. + :paramtype user_assigned_identities: dict[str, ~azure.mgmt.purview.models.UserAssignedIdentity] + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type + self.user_assigned_identities = user_assigned_identities class Operation(msrest.serialization.Model): """Operation resource. - :param display: Properties on the operation. - :type display: ~azure.mgmt.purview.models.OperationDisplay - :param is_data_action: Whether operation is a data action. - :type is_data_action: bool - :param name: Operation name for display purposes. - :type name: str - :param origin: origin of the operation. - :type origin: str - :param service_specification: meta service specification. - :type service_specification: ~azure.mgmt.purview.models.OperationMetaServiceSpecification + :ivar display: Properties on the operation. + :vartype display: ~azure.mgmt.purview.models.OperationDisplay + :ivar is_data_action: Whether operation is a data action. + :vartype is_data_action: bool + :ivar name: Operation name for display purposes. + :vartype name: str + :ivar origin: origin of the operation. + :vartype origin: str + :ivar service_specification: meta service specification. + :vartype service_specification: ~azure.mgmt.purview.models.OperationMetaServiceSpecification """ _attribute_map = { @@ -870,6 +1039,18 @@ def __init__( service_specification: Optional["OperationMetaServiceSpecification"] = None, **kwargs ): + """ + :keyword display: Properties on the operation. + :paramtype display: ~azure.mgmt.purview.models.OperationDisplay + :keyword is_data_action: Whether operation is a data action. + :paramtype is_data_action: bool + :keyword name: Operation name for display purposes. + :paramtype name: str + :keyword origin: origin of the operation. + :paramtype origin: str + :keyword service_specification: meta service specification. + :paramtype service_specification: ~azure.mgmt.purview.models.OperationMetaServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.display = display self.is_data_action = is_data_action @@ -881,14 +1062,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The response model for get operation properties. - :param description: Description of the operation for display purposes. - :type description: str - :param operation: Name of the operation for display purposes. - :type operation: str - :param provider: Name of the provider for display purposes. - :type provider: str - :param resource: Name of the resource type for display purposes. - :type resource: str + :ivar description: Description of the operation for display purposes. + :vartype description: str + :ivar operation: Name of the operation for display purposes. + :vartype operation: str + :ivar provider: Name of the provider for display purposes. + :vartype provider: str + :ivar resource: Name of the resource type for display purposes. + :vartype resource: str """ _attribute_map = { @@ -907,6 +1088,16 @@ def __init__( resource: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of the operation for display purposes. + :paramtype description: str + :keyword operation: Name of the operation for display purposes. + :paramtype operation: str + :keyword provider: Name of the provider for display purposes. + :paramtype provider: str + :keyword resource: Name of the resource type for display purposes. + :paramtype resource: str + """ super(OperationDisplay, self).__init__(**kwargs) self.description = description self.operation = operation @@ -919,12 +1110,12 @@ class OperationList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param count: Total item count. - :type count: long - :param next_link: The Url of next result page. - :type next_link: str - :param value: Required. Collection of items of type results. - :type value: list[~azure.mgmt.purview.models.Operation] + :ivar count: Total item count. + :vartype count: long + :ivar next_link: The Url of next result page. + :vartype next_link: str + :ivar value: Required. Collection of items of type results. + :vartype value: list[~azure.mgmt.purview.models.Operation] """ _validation = { @@ -945,6 +1136,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword count: Total item count. + :paramtype count: long + :keyword next_link: The Url of next result page. + :paramtype next_link: str + :keyword value: Required. Collection of items of type results. + :paramtype value: list[~azure.mgmt.purview.models.Operation] + """ super(OperationList, self).__init__(**kwargs) self.count = count self.next_link = next_link @@ -954,12 +1153,12 @@ def __init__( class OperationMetaLogSpecification(msrest.serialization.Model): """log specifications for operation api. - :param blob_duration: blob duration of the log. - :type blob_duration: str - :param display_name: localized name of the log category. - :type display_name: str - :param name: name of the log category. - :type name: str + :ivar blob_duration: blob duration of the log. + :vartype blob_duration: str + :ivar display_name: localized name of the log category. + :vartype display_name: str + :ivar name: name of the log category. + :vartype name: str """ _attribute_map = { @@ -976,6 +1175,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword blob_duration: blob duration of the log. + :paramtype blob_duration: str + :keyword display_name: localized name of the log category. + :paramtype display_name: str + :keyword name: name of the log category. + :paramtype name: str + """ super(OperationMetaLogSpecification, self).__init__(**kwargs) self.blob_duration = blob_duration self.display_name = display_name @@ -985,33 +1192,33 @@ def __init__( class OperationMetaMetricSpecification(msrest.serialization.Model): """metric specifications for the operation. - :param aggregation_type: aggregation type of metric. - :type aggregation_type: str - :param dimensions: properties for dimension. - :type dimensions: list[~azure.mgmt.purview.models.DimensionProperties] - :param display_description: description of the metric. - :type display_description: str - :param display_name: localized name of the metric. - :type display_name: str - :param enable_regional_mdm_account: enable regional mdm account. - :type enable_regional_mdm_account: str - :param internal_metric_name: internal metric name. - :type internal_metric_name: str - :param name: name of the metric. - :type name: str - :param resource_id_dimension_name_override: dimension name use to replace resource id if + :ivar aggregation_type: aggregation type of metric. + :vartype aggregation_type: str + :ivar dimensions: properties for dimension. + :vartype dimensions: list[~azure.mgmt.purview.models.DimensionProperties] + :ivar display_description: description of the metric. + :vartype display_description: str + :ivar display_name: localized name of the metric. + :vartype display_name: str + :ivar enable_regional_mdm_account: enable regional mdm account. + :vartype enable_regional_mdm_account: str + :ivar internal_metric_name: internal metric name. + :vartype internal_metric_name: str + :ivar name: name of the metric. + :vartype name: str + :ivar resource_id_dimension_name_override: dimension name use to replace resource id if specified. - :type resource_id_dimension_name_override: str - :param source_mdm_namespace: Metric namespace. + :vartype resource_id_dimension_name_override: str + :ivar source_mdm_namespace: Metric namespace. Only set the namespace if different from the default value, leaving it empty makes it use the value from the ARM manifest. - :type source_mdm_namespace: str - :param supported_aggregation_types: supported aggregation types. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: supported time grain types. - :type supported_time_grain_types: list[str] - :param unit: units for the metric. - :type unit: str + :vartype source_mdm_namespace: str + :ivar supported_aggregation_types: supported aggregation types. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: supported time grain types. + :vartype supported_time_grain_types: list[str] + :ivar unit: units for the metric. + :vartype unit: str """ _attribute_map = { @@ -1046,6 +1253,35 @@ def __init__( unit: Optional[str] = None, **kwargs ): + """ + :keyword aggregation_type: aggregation type of metric. + :paramtype aggregation_type: str + :keyword dimensions: properties for dimension. + :paramtype dimensions: list[~azure.mgmt.purview.models.DimensionProperties] + :keyword display_description: description of the metric. + :paramtype display_description: str + :keyword display_name: localized name of the metric. + :paramtype display_name: str + :keyword enable_regional_mdm_account: enable regional mdm account. + :paramtype enable_regional_mdm_account: str + :keyword internal_metric_name: internal metric name. + :paramtype internal_metric_name: str + :keyword name: name of the metric. + :paramtype name: str + :keyword resource_id_dimension_name_override: dimension name use to replace resource id if + specified. + :paramtype resource_id_dimension_name_override: str + :keyword source_mdm_namespace: Metric namespace. + Only set the namespace if different from the default value, + leaving it empty makes it use the value from the ARM manifest. + :paramtype source_mdm_namespace: str + :keyword supported_aggregation_types: supported aggregation types. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: supported time grain types. + :paramtype supported_time_grain_types: list[str] + :keyword unit: units for the metric. + :paramtype unit: str + """ super(OperationMetaMetricSpecification, self).__init__(**kwargs) self.aggregation_type = aggregation_type self.dimensions = dimensions @@ -1064,10 +1300,11 @@ def __init__( class OperationMetaServiceSpecification(msrest.serialization.Model): """The operation meta service specification. - :param log_specifications: log specifications for the operation. - :type log_specifications: list[~azure.mgmt.purview.models.OperationMetaLogSpecification] - :param metric_specifications: metric specifications for the operation. - :type metric_specifications: list[~azure.mgmt.purview.models.OperationMetaMetricSpecification] + :ivar log_specifications: log specifications for the operation. + :vartype log_specifications: list[~azure.mgmt.purview.models.OperationMetaLogSpecification] + :ivar metric_specifications: metric specifications for the operation. + :vartype metric_specifications: + list[~azure.mgmt.purview.models.OperationMetaMetricSpecification] """ _attribute_map = { @@ -1082,6 +1319,13 @@ def __init__( metric_specifications: Optional[List["OperationMetaMetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: log specifications for the operation. + :paramtype log_specifications: list[~azure.mgmt.purview.models.OperationMetaLogSpecification] + :keyword metric_specifications: metric specifications for the operation. + :paramtype metric_specifications: + list[~azure.mgmt.purview.models.OperationMetaMetricSpecification] + """ super(OperationMetaServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -1090,8 +1334,8 @@ def __init__( class PrivateEndpoint(msrest.serialization.Model): """A private endpoint class. - :param id: The private endpoint identifier. - :type id: str + :ivar id: The private endpoint identifier. + :vartype id: str """ _attribute_map = { @@ -1104,6 +1348,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The private endpoint identifier. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = id @@ -1137,6 +1385,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1154,10 +1404,10 @@ class PrivateEndpointConnection(ProxyResource): :vartype name: str :ivar type: Gets or sets the type. :vartype type: str - :param private_endpoint: The private endpoint information. - :type private_endpoint: ~azure.mgmt.purview.models.PrivateEndpoint - :param private_link_service_connection_state: The private link service connection state. - :type private_link_service_connection_state: + :ivar private_endpoint: The private endpoint information. + :vartype private_endpoint: ~azure.mgmt.purview.models.PrivateEndpoint + :ivar private_link_service_connection_state: The private link service connection state. + :vartype private_link_service_connection_state: ~azure.mgmt.purview.models.PrivateLinkServiceConnectionState :ivar provisioning_state: The provisioning state. :vartype provisioning_state: str @@ -1186,6 +1436,13 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The private endpoint information. + :paramtype private_endpoint: ~azure.mgmt.purview.models.PrivateEndpoint + :keyword private_link_service_connection_state: The private link service connection state. + :paramtype private_link_service_connection_state: + ~azure.mgmt.purview.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -1197,12 +1454,12 @@ class PrivateEndpointConnectionList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param count: Total item count. - :type count: long - :param next_link: The Url of next result page. - :type next_link: str - :param value: Required. Collection of items of type results. - :type value: list[~azure.mgmt.purview.models.PrivateEndpointConnection] + :ivar count: Total item count. + :vartype count: long + :ivar next_link: The Url of next result page. + :vartype next_link: str + :ivar value: Required. Collection of items of type results. + :vartype value: list[~azure.mgmt.purview.models.PrivateEndpointConnection] """ _validation = { @@ -1223,6 +1480,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword count: Total item count. + :paramtype count: long + :keyword next_link: The Url of next result page. + :paramtype next_link: str + :keyword value: Required. Collection of items of type results. + :paramtype value: list[~azure.mgmt.purview.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionList, self).__init__(**kwargs) self.count = count self.next_link = next_link @@ -1262,6 +1527,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateLinkResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1274,12 +1541,12 @@ class PrivateLinkResourceList(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param count: Total item count. - :type count: long - :param next_link: The Url of next result page. - :type next_link: str - :param value: Required. Collection of items of type results. - :type value: list[~azure.mgmt.purview.models.PrivateLinkResource] + :ivar count: Total item count. + :vartype count: long + :ivar next_link: The Url of next result page. + :vartype next_link: str + :ivar value: Required. Collection of items of type results. + :vartype value: list[~azure.mgmt.purview.models.PrivateLinkResource] """ _validation = { @@ -1300,6 +1567,14 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword count: Total item count. + :paramtype count: long + :keyword next_link: The Url of next result page. + :paramtype next_link: str + :keyword value: Required. Collection of items of type results. + :paramtype value: list[~azure.mgmt.purview.models.PrivateLinkResource] + """ super(PrivateLinkResourceList, self).__init__(**kwargs) self.count = count self.next_link = next_link @@ -1336,6 +1611,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateLinkResourceProperties, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -1345,13 +1622,13 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """The private link service connection state. - :param actions_required: The required actions. - :type actions_required: str - :param description: The description. - :type description: str - :param status: The status. Possible values include: "Unknown", "Pending", "Approved", + :ivar actions_required: The required actions. + :vartype actions_required: str + :ivar description: The description. + :vartype description: str + :ivar status: The status. Possible values include: "Unknown", "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or ~azure.mgmt.purview.models.Status + :vartype status: str or ~azure.mgmt.purview.models.Status """ _attribute_map = { @@ -1368,6 +1645,15 @@ def __init__( status: Optional[Union[str, "Status"]] = None, **kwargs ): + """ + :keyword actions_required: The required actions. + :paramtype actions_required: str + :keyword description: The description. + :paramtype description: str + :keyword status: The status. Possible values include: "Unknown", "Pending", "Approved", + "Rejected", "Disconnected". + :paramtype status: str or ~azure.mgmt.purview.models.Status + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.actions_required = actions_required self.description = description @@ -1417,6 +1703,8 @@ def __init__( self, **kwargs ): + """ + """ super(SystemData, self).__init__(**kwargs) self.created_at = None self.created_by = None @@ -1469,4 +1757,38 @@ def __init__( self, **kwargs ): + """ + """ super(TrackedResourceSystemData, self).__init__(**kwargs) + + +class UserAssignedIdentity(msrest.serialization.Model): + """Uses client ID and Principal ID. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar client_id: Gets or Sets Client ID. + :vartype client_id: str + :ivar principal_id: Gets or Sets Principal ID. + :vartype principal_id: str + """ + + _validation = { + 'client_id': {'readonly': True}, + 'principal_id': {'readonly': True}, + } + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UserAssignedIdentity, self).__init__(**kwargs) + self.client_id = None + self.principal_id = None diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_purview_management_client_enums.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_purview_management_client_enums.py index f017663e5f5c..f16e0c7bb86b 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_purview_management_client_enums.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/models/_purview_management_client_enums.py @@ -6,27 +6,12 @@ # 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 CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -35,7 +20,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LastModifiedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that last modified the resource. """ @@ -44,13 +29,13 @@ class LastModifiedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Name(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Name(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the sku name. """ STANDARD = "Standard" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the state of the provisioning. """ @@ -64,7 +49,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" CANCELED = "Canceled" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the public network access. """ @@ -72,21 +57,21 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason the name is not available. """ INVALID = "Invalid" ALREADY_EXISTS = "AlreadyExists" -class ScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scope where the default account is set. """ TENANT = "Tenant" SUBSCRIPTION = "Subscription" -class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status. """ @@ -96,8 +81,10 @@ class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class Type(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Identity Type """ + NONE = "None" SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_accounts_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_accounts_operations.py index 94752f3fd608..1e7a37458984 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_accounts_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_accounts_operations.py @@ -5,25 +5,377 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, '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_list_by_subscription_request( + subscription_id: str, + *, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, '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') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, '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( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_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( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_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( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_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, + json=json, + content=content, + **kwargs + ) + + +def build_list_keys_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/listkeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_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_add_root_collection_admin_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/addRootCollectionAdmin') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, '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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class AccountsOperations(object): """AccountsOperations operations. @@ -47,13 +399,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AccountList"] + resource_group_name: str, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.AccountList"]: """Gets the accounts resources by resource group. List accounts in ResourceGroup. @@ -72,37 +424,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + skip_token=skip_token, + template_url=self.list_by_resource_group.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_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + skip_token=skip_token, + 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('AccountList', pipeline_response) + deserialized = self._deserialize("AccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,23 +463,24 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts'} # type: ignore + @distributed_trace def list_by_subscription( self, - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AccountList"] + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.AccountList"]: """Gets the accounts resources by subscription. List accounts in Subscription. @@ -148,36 +497,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + template_url=self.list_by_subscription.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_by_subscription_request( + subscription_id=self._config.subscription_id, + skip_token=skip_token, + 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('AccountList', pipeline_response) + deserialized = self._deserialize("AccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -190,24 +534,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Purview/accounts'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Account" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.Account": """Gets the account resource. Get an account. @@ -226,33 +571,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Account', pipeline_response) @@ -261,54 +596,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - account_name, # type: str - account, # type: "_models.Account" - **kwargs # type: Any - ): - # type: (...) -> "_models.Account" + resource_group_name: str, + account_name: str, + account: "_models.Account", + **kwargs: Any + ) -> "_models.Account": cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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(account, 'Account') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_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(account, 'Account') - 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.ErrorResponseModel, 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('Account', pipeline_response) @@ -320,16 +645,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - account, # type: "_models.Account" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Account"] + resource_group_name: str, + account_name: str, + account: "_models.Account", + **kwargs: Any + ) -> LROPoller["_models.Account"]: """Create or update an account resource. Creates or updates an account. @@ -342,15 +669,18 @@ def begin_create_or_update( :type account: ~azure.mgmt.purview.models.Account :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 Account or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.purview.models.Account] - :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.Account"] lro_delay = kwargs.pop( 'polling_interval', @@ -362,27 +692,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, account_name=account_name, account=account, + 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('Account', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -394,61 +718,51 @@ 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_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.ErrorResponseModel, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the account resource. Deletes an account resource. @@ -459,15 +773,17 @@ def begin_delete( :type account_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', @@ -481,21 +797,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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -507,54 +816,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - account_update_parameters, # type: "_models.AccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Account" + resource_group_name: str, + account_name: str, + account_update_parameters: "_models.AccountUpdateParameters", + **kwargs: Any + ) -> "_models.Account": cls = kwargs.pop('cls', None) # type: ClsType["_models.Account"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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(account_update_parameters, 'AccountUpdateParameters') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_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(account_update_parameters, 'AccountUpdateParameters') - 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, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, 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('Account', pipeline_response) @@ -566,16 +864,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - account_update_parameters, # type: "_models.AccountUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Account"] + resource_group_name: str, + account_name: str, + account_update_parameters: "_models.AccountUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Account"]: """Patches the account resource. Updates an account. @@ -588,15 +888,18 @@ def begin_update( :type account_update_parameters: ~azure.mgmt.purview.models.AccountUpdateParameters :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 Account or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.purview.models.Account] - :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.Account"] lro_delay = kwargs.pop( 'polling_interval', @@ -608,27 +911,21 @@ def begin_update( resource_group_name=resource_group_name, account_name=account_name, account_update_parameters=account_update_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('Account', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -640,15 +937,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}'} # type: ignore + @distributed_trace def list_keys( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AccessKeys" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.AccessKeys": """Lists the keys asynchronous. List the authorization keys associated with this account. @@ -667,33 +965,23 @@ def list_keys( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.list_keys.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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_keys_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list_keys.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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AccessKeys', pipeline_response) @@ -702,16 +990,18 @@ def list_keys( return cls(pipeline_response, deserialized, {}) return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/listkeys'} # type: ignore + + @distributed_trace def add_root_collection_admin( self, - resource_group_name, # type: str - account_name, # type: str - collection_admin_update, # type: "_models.CollectionAdminUpdate" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + collection_admin_update: "_models.CollectionAdminUpdate", + **kwargs: Any + ) -> None: """Add the administrator for root collection. Add the administrator for root collection associated with this account. @@ -732,38 +1022,28 @@ def add_root_collection_admin( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.add_root_collection_admin.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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(collection_admin_update, 'CollectionAdminUpdate') + + request = build_add_root_collection_admin_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self.add_root_collection_admin.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(collection_admin_update, 'CollectionAdminUpdate') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -771,12 +1051,13 @@ def add_root_collection_admin( add_root_collection_admin.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/addRootCollectionAdmin'} # type: ignore + + @distributed_trace def check_name_availability( self, - check_name_availability_request, # type: "_models.CheckNameAvailabilityRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + check_name_availability_request: "_models.CheckNameAvailabilityRequest", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks the account name availability. Checks if account name is available. @@ -793,36 +1074,26 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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(check_name_availability_request, 'CheckNameAvailabilityRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(check_name_availability_request, 'CheckNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) @@ -831,4 +1102,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Purview/checkNameAvailability'} # type: ignore + diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_default_accounts_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_default_accounts_operations.py index b6bbf95a34c7..c4b8230ce95c 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_default_accounts_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_default_accounts_operations.py @@ -5,22 +5,125 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error 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 - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + *, + scope_tenant_id: str, + scope_type: Union[str, "_models.ScopeType"], + scope: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Purview/getDefaultAccount') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['scopeTenantId'] = _SERIALIZER.query("scope_tenant_id", scope_tenant_id, 'str') + query_parameters['scopeType'] = _SERIALIZER.query("scope_type", scope_type, 'str') + if scope is not None: + query_parameters['scope'] = _SERIALIZER.query("scope", scope, 'str') + 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_set_request( + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Purview/setDefaultAccount') + + # 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_remove_request( + *, + scope_tenant_id: str, + scope_type: Union[str, "_models.ScopeType"], + scope: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Purview/removeDefaultAccount') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['scopeTenantId'] = _SERIALIZER.query("scope_tenant_id", scope_tenant_id, 'str') + query_parameters['scopeType'] = _SERIALIZER.query("scope_type", scope_type, 'str') + if scope is not None: + query_parameters['scope'] = _SERIALIZER.query("scope", scope, 'str') + 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 + ) class DefaultAccountsOperations(object): """DefaultAccountsOperations operations. @@ -44,14 +147,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - scope_tenant_id, # type: str - scope_type, # type: Union[str, "_models.ScopeType"] - scope=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.DefaultAccountPayload" + scope_tenant_id: str, + scope_type: Union[str, "_models.ScopeType"], + scope: Optional[str] = None, + **kwargs: Any + ) -> "_models.DefaultAccountPayload": """Gets the default account information set for the scope. Get the default account for the scope. @@ -73,31 +176,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['scopeTenantId'] = self._serialize.query("scope_tenant_id", scope_tenant_id, 'str') - query_parameters['scopeType'] = self._serialize.query("scope_type", scope_type, 'str') - if scope is not None: - query_parameters['scope'] = self._serialize.query("scope", scope, 'str') - 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( + scope_tenant_id=scope_tenant_id, + scope_type=scope_type, + scope=scope, + 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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DefaultAccountPayload', pipeline_response) @@ -106,14 +201,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/providers/Microsoft.Purview/getDefaultAccount'} # type: ignore + + @distributed_trace def set( self, - default_account_payload, # type: "_models.DefaultAccountPayload" - **kwargs # type: Any - ): - # type: (...) -> "_models.DefaultAccountPayload" + default_account_payload: "_models.DefaultAccountPayload", + **kwargs: Any + ) -> "_models.DefaultAccountPayload": """Sets the default account for the scope. Sets the default account for the scope. @@ -131,32 +228,25 @@ def set( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.set.metadata['url'] # type: ignore - - # 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(default_account_payload, 'DefaultAccountPayload') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(default_account_payload, 'DefaultAccountPayload') + + request = build_set_request( + content_type=content_type, + json=_json, + template_url=self.set.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + 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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DefaultAccountPayload', pipeline_response) @@ -165,16 +255,18 @@ def set( return cls(pipeline_response, deserialized, {}) return deserialized + set.metadata = {'url': '/providers/Microsoft.Purview/setDefaultAccount'} # type: ignore + + @distributed_trace def remove( self, - scope_tenant_id, # type: str - scope_type, # type: Union[str, "_models.ScopeType"] - scope=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None + scope_tenant_id: str, + scope_type: Union[str, "_models.ScopeType"], + scope: Optional[str] = None, + **kwargs: Any + ) -> None: """Removes the default account from the scope. Removes the default account from the scope. @@ -196,34 +288,27 @@ def remove( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - # Construct URL - url = self.remove.metadata['url'] # type: ignore + + request = build_remove_request( + scope_tenant_id=scope_tenant_id, + scope_type=scope_type, + scope=scope, + template_url=self.remove.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['scopeTenantId'] = self._serialize.query("scope_tenant_id", scope_tenant_id, 'str') - query_parameters['scopeType'] = self._serialize.query("scope_type", scope_type, 'str') - if scope is not None: - query_parameters['scope'] = self._serialize.query("scope", scope, 'str') - 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 = 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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) remove.metadata = {'url': '/providers/Microsoft.Purview/removeDefaultAccount'} # type: ignore + diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_operations.py index 1a77ad29b801..3028a0a1fee4 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Purview/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 + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationList"] + **kwargs: Any + ) -> Iterable["_models.OperationList"]: """Lists the available operations. List of available operations. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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('OperationList', pipeline_response) + deserialized = self._deserialize("OperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,12 +124,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.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_private_endpoint_connections_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_private_endpoint_connections_operations.py index 18fe2b9411e3..57a60d94bc57 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_private_endpoint_connections_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,187 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_account_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + skip_token: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_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') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, '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( + subscription_id: str, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_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( + subscription_id: str, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_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 + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,14 +209,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_account( self, - resource_group_name, # type: str - account_name, # type: str - skip_token=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionList"] + resource_group_name: str, + account_name: str, + skip_token: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionList"]: """Gets private endpoint connections. Get private endpoint connections for account. @@ -66,7 +228,8 @@ def list_by_account( :param skip_token: The skip token. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionList or the result of cls(response) + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.purview.models.PrivateEndpointConnectionList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -75,38 +238,35 @@ def list_by_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + skip_token=skip_token, + template_url=self.list_by_account.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_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + skip_token=skip_token, + 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('PrivateEndpointConnectionList', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,25 +279,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets private endpoint connection information. Get a private endpoint connection. @@ -158,34 +319,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -194,56 +345,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - request, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + request: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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(request, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_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(request, 'PrivateEndpointConnection') - 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.ErrorResponseModel, 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('PrivateEndpointConnection', pipeline_response) @@ -255,17 +396,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - request, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + request: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Approves/Rejects private endpoint connection request. Create or update a private endpoint connection. @@ -280,15 +423,19 @@ def begin_create_or_update( :type request: ~azure.mgmt.purview.models.PrivateEndpointConnection :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 PrivateEndpointConnection 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 PrivateEndpointConnection or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.purview.models.PrivateEndpointConnection] - :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.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -301,28 +448,21 @@ def begin_create_or_update( account_name=account_name, private_endpoint_connection_name=private_endpoint_connection_name, request=request, + 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('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -334,64 +474,54 @@ 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + private_endpoint_connection_name=private_endpoint_connection_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.ErrorResponseModel, 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': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes private endpoint connection. Delete a private endpoint connection. @@ -404,15 +534,17 @@ def begin_delete( :type private_endpoint_connection_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', @@ -427,22 +559,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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -454,4 +578,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_private_link_resources_operations.py b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_private_link_resources_operations.py index 15acb10923c1..35c6f5972e1d 100644 --- a/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_private_link_resources_operations.py +++ b/sdk/purview/azure-mgmt-purview/azure/mgmt/purview/operations/_private_link_resources_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar 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 - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_account_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_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_get_by_group_id_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + group_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources/{groupId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "groupId": _SERIALIZER.url("group_id", group_id, '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 + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_account( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceList"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceList"]: """Gets a list of privately linkable resources for an account. Gets a list of privately linkable resources for an account. @@ -61,7 +135,8 @@ def list_by_account( :param account_name: The name of the account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceList or the result of cls(response) + :return: An iterator like instance of either PrivateLinkResourceList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.purview.models.PrivateLinkResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +145,33 @@ def list_by_account( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - 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_by_account.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list_by_account.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_by_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + 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('PrivateLinkResourceList', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +184,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources'} # type: ignore + @distributed_trace def get_by_group_id( self, - resource_group_name, # type: str - account_name, # type: str - group_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResource" + resource_group_name: str, + account_name: str, + group_id: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": """Gets a privately linkable resources for an account with given group identifier. Gets a privately linkable resources for an account with given group identifier. @@ -151,34 +224,24 @@ def get_by_group_id( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-07-01" - accept = "application/json" - - # Construct URL - url = self.get_by_group_id.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'groupId': self._serialize.url("group_id", group_id, '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_by_group_id_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + group_id=group_id, + template_url=self.get_by_group_id.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.ErrorResponseModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -187,4 +250,6 @@ def get_by_group_id( return cls(pipeline_response, deserialized, {}) return deserialized + get_by_group_id.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Purview/accounts/{accountName}/privateLinkResources/{groupId}'} # type: ignore +