diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json b/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json index c5753df7c959..c577584a4748 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/_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": "b28a542b3eb4f2f4f384b14b635d0a835df818cd", + "commit": "754938e4cb9416358b02dcc11f444adf14b3b7b6", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/azurearcdata/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/azurearcdata/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/azurearcdata/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/__init__.py index 34107556bef3..129ea9a44421 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/__init__.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AzureArcDataManagementClient'] -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/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py index 8ddeb5be5dc3..a87c1a8647c5 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py @@ -6,89 +6,90 @@ # 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 AzureArcDataManagementClientConfiguration +from .operations import DataControllersOperations, Operations, SqlManagedInstancesOperations, SqlServerInstancesOperations + 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 AzureArcDataManagementClientConfiguration -from .operations import Operations -from .operations import SqlManagedInstancesOperations -from .operations import SqlServerInstancesOperations -from .operations import DataControllersOperations -from . import models - -class AzureArcDataManagementClient(object): +class AzureArcDataManagementClient: """The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. :ivar operations: Operations operations :vartype operations: azure_arc_data_management_client.operations.Operations :ivar sql_managed_instances: SqlManagedInstancesOperations operations - :vartype sql_managed_instances: azure_arc_data_management_client.operations.SqlManagedInstancesOperations + :vartype sql_managed_instances: + azure_arc_data_management_client.operations.SqlManagedInstancesOperations :ivar sql_server_instances: SqlServerInstancesOperations operations - :vartype sql_server_instances: azure_arc_data_management_client.operations.SqlServerInstancesOperations + :vartype sql_server_instances: + azure_arc_data_management_client.operations.SqlServerInstancesOperations :ivar data_controllers: DataControllersOperations operations - :vartype data_controllers: azure_arc_data_management_client.operations.DataControllersOperations + :vartype data_controllers: + azure_arc_data_management_client.operations.DataControllersOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the Azure subscription. :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 = AzureArcDataManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureArcDataManagementClientConfiguration(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.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.sql_managed_instances = SqlManagedInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_server_instances = SqlServerInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_controllers = DataControllersOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_managed_instances = SqlManagedInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_server_instances = SqlServerInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_controllers = DataControllersOperations( - 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/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py index 2f6a409cc15c..dd33a715545d 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_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 AzureArcDataManagementClientConfiguration(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(AzureArcDataManagementClientConfiguration, 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(AzureArcDataManagementClientConfiguration, 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/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_metadata.json b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_metadata.json index 686e24565896..bcbbaa9ccb4b 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_metadata.json +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_metadata.json @@ -5,13 +5,13 @@ "name": "AzureArcDataManagementClient", "filename": "_azure_arc_data_management_client", "description": "The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources.", - "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\": [\"AzureArcDataManagementClientConfiguration\"]}}, \"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\": [\"AzureArcDataManagementClientConfiguration\"]}}, \"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\": [\"AzureArcDataManagementClientConfiguration\"]}}, \"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\": [\"AzureArcDataManagementClientConfiguration\"]}}, \"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": { "operations": "Operations", diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_patch.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_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/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_vendor.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_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/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py index c47f66669f1b..653b73a4a199 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_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.1.0b1" diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/__init__.py index 57b761c5d123..c5126cc6ca95 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/__init__.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_arc_data_management_client import AzureArcDataManagementClient __all__ = ['AzureArcDataManagementClient'] + +# `._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/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py index c134ef59a1b8..3ed7d4c9cecb 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py @@ -6,85 +6,90 @@ # 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 AzureArcDataManagementClientConfiguration +from .operations import DataControllersOperations, Operations, SqlManagedInstancesOperations, SqlServerInstancesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AzureArcDataManagementClientConfiguration -from .operations import Operations -from .operations import SqlManagedInstancesOperations -from .operations import SqlServerInstancesOperations -from .operations import DataControllersOperations -from .. import models - - -class AzureArcDataManagementClient(object): +class AzureArcDataManagementClient: """The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. :ivar operations: Operations operations :vartype operations: azure_arc_data_management_client.aio.operations.Operations :ivar sql_managed_instances: SqlManagedInstancesOperations operations - :vartype sql_managed_instances: azure_arc_data_management_client.aio.operations.SqlManagedInstancesOperations + :vartype sql_managed_instances: + azure_arc_data_management_client.aio.operations.SqlManagedInstancesOperations :ivar sql_server_instances: SqlServerInstancesOperations operations - :vartype sql_server_instances: azure_arc_data_management_client.aio.operations.SqlServerInstancesOperations + :vartype sql_server_instances: + azure_arc_data_management_client.aio.operations.SqlServerInstancesOperations :ivar data_controllers: DataControllersOperations operations - :vartype data_controllers: azure_arc_data_management_client.aio.operations.DataControllersOperations + :vartype data_controllers: + azure_arc_data_management_client.aio.operations.DataControllersOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the Azure subscription. :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 = AzureArcDataManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AzureArcDataManagementClientConfiguration(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.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.sql_managed_instances = SqlManagedInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_server_instances = SqlServerInstancesOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_controllers = DataControllersOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_managed_instances = SqlManagedInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_server_instances = SqlServerInstancesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_controllers = DataControllersOperations( - 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/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_configuration.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_configuration.py index d7a60ffd7405..d522ba8b624d 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_configuration.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/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(AzureArcDataManagementClientConfiguration, 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(AzureArcDataManagementClientConfiguration, 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/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_patch.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/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/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_operations.py index 16ca096eeb50..7dbcf8410a1a 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_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._data_controllers_operations import build_delete_data_controller_request_initial, build_get_data_controller_request, build_list_in_group_request, build_list_in_subscription_request, build_patch_data_controller_request, build_put_data_controller_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_in_subscription( self, **kwargs: Any @@ -52,8 +58,10 @@ def list_in_subscription( List dataController resources in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PageOfDataControllerResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] + :return: An iterator like instance of either PageOfDataControllerResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PageOfDataControllerResource"] @@ -61,34 +69,29 @@ def list_in_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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_in_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_in_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_in_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_in_subscription_request( + subscription_id=self._config.subscription_id, + 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('PageOfDataControllerResource', pipeline_response) + deserialized = self._deserialize("PageOfDataControllerResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,17 +104,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers'} # type: ignore + @distributed_trace def list_in_group( self, resource_group_name: str, @@ -124,8 +129,10 @@ def list_in_group( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PageOfDataControllerResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] + :return: An iterator like instance of either PageOfDataControllerResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PageOfDataControllerResource"] @@ -133,35 +140,31 @@ def list_in_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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_in_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_in_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_in_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_in_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('PageOfDataControllerResource', pipeline_response) + deserialized = self._deserialize("PageOfDataControllerResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,12 +177,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -197,39 +201,28 @@ async def _put_data_controller_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._put_data_controller_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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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(data_controller_resource, 'DataControllerResource') + + request = build_put_data_controller_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + content_type=content_type, + json=_json, + template_url=self._put_data_controller_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(data_controller_resource, 'DataControllerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DataControllerResource', pipeline_response) @@ -241,8 +234,11 @@ async def _put_data_controller_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _put_data_controller_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + @distributed_trace_async async def begin_put_data_controller( self, resource_group_name: str, @@ -260,15 +256,20 @@ async def begin_put_data_controller( :type data_controller_resource: ~azure_arc_data_management_client.models.DataControllerResource :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 DataControllerResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_arc_data_management_client.models.DataControllerResource] - :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 DataControllerResource or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure_arc_data_management_client.models.DataControllerResource] + :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.DataControllerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -280,27 +281,21 @@ async def begin_put_data_controller( resource_group_name=resource_group_name, data_controller_name=data_controller_name, data_controller_resource=data_controller_resource, + 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('DataControllerResource', 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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -312,6 +307,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore async def _delete_data_controller_initial( @@ -325,40 +321,31 @@ async def _delete_data_controller_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - accept = "application/json" - - # Construct URL - url = self._delete_data_controller_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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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_data_controller_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + template_url=self._delete_data_controller_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_data_controller_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + @distributed_trace_async async def begin_delete_data_controller( self, resource_group_name: str, @@ -373,15 +360,17 @@ async def begin_delete_data_controller( :type data_controller_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', @@ -395,21 +384,14 @@ async def begin_delete_data_controller( 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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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: @@ -421,8 +403,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + @distributed_trace_async async def get_data_controller( self, resource_group_name: str, @@ -445,33 +429,23 @@ async def get_data_controller( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - accept = "application/json" - - # Construct URL - url = self.get_data_controller.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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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_data_controller_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + template_url=self.get_data_controller.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataControllerResource', pipeline_response) @@ -480,8 +454,11 @@ async def get_data_controller( return cls(pipeline_response, deserialized, {}) return deserialized + get_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + @distributed_trace_async async def patch_data_controller( self, resource_group_name: str, @@ -507,38 +484,28 @@ async def patch_data_controller( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch_data_controller.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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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(data_controller_resource, 'DataControllerUpdate') - # 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_patch_data_controller_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + content_type=content_type, + json=_json, + template_url=self.patch_data_controller.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(data_controller_resource, 'DataControllerUpdate') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataControllerResource', pipeline_response) @@ -547,4 +514,6 @@ async def patch_data_controller( return cls(pipeline_response, deserialized, {}) return deserialized + patch_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py index 07e2596f4dd3..3ff90a422057 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +97,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_operations.py index 419fe5dd5d3a..afe5f04a54a7 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_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._sql_managed_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_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( self, **kwargs: Any @@ -52,8 +58,10 @@ def list( List sqlManagedInstance resources in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlManagedInstanceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlManagedInstanceListResult] + :return: An iterator like instance of either SqlManagedInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlManagedInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstanceListResult"] @@ -61,34 +69,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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 - 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('SqlManagedInstanceListResult', pipeline_response) + deserialized = self._deserialize("SqlManagedInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,17 +104,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlManagedInstances'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -124,8 +129,10 @@ def list_by_resource_group( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlManagedInstanceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlManagedInstanceListResult] + :return: An iterator like instance of either SqlManagedInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlManagedInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstanceListResult"] @@ -133,35 +140,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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') - - 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, + 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, + 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('SqlManagedInstanceListResult', pipeline_response) + deserialized = self._deserialize("SqlManagedInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,17 +177,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -207,33 +212,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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, + sql_managed_instance_name=sql_managed_instance_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlManagedInstance', pipeline_response) @@ -242,8 +237,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -256,39 +253,28 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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(sql_managed_instance, 'SqlManagedInstance') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + content_type=content_type, + json=_json, + template_url=self._create_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(sql_managed_instance, 'SqlManagedInstance') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('SqlManagedInstance', pipeline_response) @@ -300,8 +286,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -319,15 +308,20 @@ async def begin_create( :type sql_managed_instance: ~azure_arc_data_management_client.models.SqlManagedInstance :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 SqlManagedInstance or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_arc_data_management_client.models.SqlManagedInstance] - :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 SqlManagedInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure_arc_data_management_client.models.SqlManagedInstance] + :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.SqlManagedInstance"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +333,21 @@ async def begin_create( resource_group_name=resource_group_name, sql_managed_instance_name=sql_managed_instance_name, sql_managed_instance=sql_managed_instance, + 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('SqlManagedInstance', 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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,6 +359,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore async def _delete_initial( @@ -384,40 +373,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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, + sql_managed_instance_name=sql_managed_instance_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -432,15 +412,17 @@ async def begin_delete( :type sql_managed_instance_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', @@ -454,21 +436,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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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: @@ -480,8 +455,10 @@ 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.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -507,38 +484,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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(parameters, 'SqlManagedInstanceUpdate') - # 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlManagedInstanceUpdate') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlManagedInstance', pipeline_response) @@ -547,4 +514,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_operations.py index 2a1087dd5af8..8650b3d0b4e0 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_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._sql_server_instances_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_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( self, **kwargs: Any @@ -52,8 +58,10 @@ def list( List sqlServerInstance resources in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlServerInstanceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlServerInstanceListResult] + :return: An iterator like instance of either SqlServerInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlServerInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstanceListResult"] @@ -61,34 +69,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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 - 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('SqlServerInstanceListResult', pipeline_response) + deserialized = self._deserialize("SqlServerInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,17 +104,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerInstances'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -124,8 +129,10 @@ def list_by_resource_group( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlServerInstanceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlServerInstanceListResult] + :return: An iterator like instance of either SqlServerInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlServerInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstanceListResult"] @@ -133,35 +140,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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') - - 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, + 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, + 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('SqlServerInstanceListResult', pipeline_response) + deserialized = self._deserialize("SqlServerInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,17 +177,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -207,33 +212,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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, + sql_server_instance_name=sql_server_instance_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlServerInstance', pipeline_response) @@ -242,8 +237,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -256,39 +253,28 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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(sql_server_instance, 'SqlServerInstance') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + content_type=content_type, + json=_json, + template_url=self._create_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(sql_server_instance, 'SqlServerInstance') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('SqlServerInstance', pipeline_response) @@ -300,8 +286,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -319,15 +308,20 @@ async def begin_create( :type sql_server_instance: ~azure_arc_data_management_client.models.SqlServerInstance :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 SqlServerInstance or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_arc_data_management_client.models.SqlServerInstance] - :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 SqlServerInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure_arc_data_management_client.models.SqlServerInstance] + :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.SqlServerInstance"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +333,21 @@ async def begin_create( resource_group_name=resource_group_name, sql_server_instance_name=sql_server_instance_name, sql_server_instance=sql_server_instance, + 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('SqlServerInstance', 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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,6 +359,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore async def _delete_initial( @@ -384,40 +373,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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, + sql_server_instance_name=sql_server_instance_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -432,15 +412,17 @@ async def begin_delete( :type sql_server_instance_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', @@ -454,21 +436,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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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: @@ -480,8 +455,10 @@ 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.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -507,38 +484,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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(parameters, 'SqlServerInstanceUpdate') - # 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlServerInstanceUpdate') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlServerInstance', pipeline_response) @@ -547,4 +514,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py index be72068b045e..812143dd5040 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py @@ -6,93 +6,48 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import BasicLoginInformation - from ._models_py3 import CommonSku - from ._models_py3 import DataControllerProperties - from ._models_py3 import DataControllerResource - from ._models_py3 import DataControllerUpdate - from ._models_py3 import ErrorResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import ExtendedLocation - from ._models_py3 import Identity - from ._models_py3 import K8SResourceRequirements - from ._models_py3 import K8SScheduling - from ._models_py3 import K8SSchedulingOptions - from ._models_py3 import LogAnalyticsWorkspaceConfig - from ._models_py3 import ODataError - from ._models_py3 import OnPremiseProperty - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PageOfDataControllerResource - from ._models_py3 import Plan - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceSku - from ._models_py3 import SqlManagedInstance - from ._models_py3 import SqlManagedInstanceK8SRaw - from ._models_py3 import SqlManagedInstanceK8SSpec - from ._models_py3 import SqlManagedInstanceListResult - from ._models_py3 import SqlManagedInstanceProperties - from ._models_py3 import SqlManagedInstanceSku - from ._models_py3 import SqlManagedInstanceUpdate - from ._models_py3 import SqlServerInstance - from ._models_py3 import SqlServerInstanceListResult - from ._models_py3 import SqlServerInstanceProperties - from ._models_py3 import SqlServerInstanceUpdate - from ._models_py3 import SystemData - from ._models_py3 import TrackedResource - from ._models_py3 import UploadServicePrincipal - from ._models_py3 import UploadWatermark -except (SyntaxError, ImportError): - from ._models import BasicLoginInformation # type: ignore - from ._models import CommonSku # type: ignore - from ._models import DataControllerProperties # type: ignore - from ._models import DataControllerResource # type: ignore - from ._models import DataControllerUpdate # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import ExtendedLocation # type: ignore - from ._models import Identity # type: ignore - from ._models import K8SResourceRequirements # type: ignore - from ._models import K8SScheduling # type: ignore - from ._models import K8SSchedulingOptions # type: ignore - from ._models import LogAnalyticsWorkspaceConfig # type: ignore - from ._models import ODataError # type: ignore - from ._models import OnPremiseProperty # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PageOfDataControllerResource # type: ignore - from ._models import Plan # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceSku # type: ignore - from ._models import SqlManagedInstance # type: ignore - from ._models import SqlManagedInstanceK8SRaw # type: ignore - from ._models import SqlManagedInstanceK8SSpec # type: ignore - from ._models import SqlManagedInstanceListResult # type: ignore - from ._models import SqlManagedInstanceProperties # type: ignore - from ._models import SqlManagedInstanceSku # type: ignore - from ._models import SqlManagedInstanceUpdate # type: ignore - from ._models import SqlServerInstance # type: ignore - from ._models import SqlServerInstanceListResult # type: ignore - from ._models import SqlServerInstanceProperties # type: ignore - from ._models import SqlServerInstanceUpdate # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UploadServicePrincipal # type: ignore - from ._models import UploadWatermark # type: ignore +from ._models_py3 import BasicLoginInformation +from ._models_py3 import DataControllerProperties +from ._models_py3 import DataControllerResource +from ._models_py3 import DataControllerUpdate +from ._models_py3 import ErrorResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import ExtendedLocation +from ._models_py3 import K8SResourceRequirements +from ._models_py3 import K8SScheduling +from ._models_py3 import K8SSchedulingOptions +from ._models_py3 import LogAnalyticsWorkspaceConfig +from ._models_py3 import OnPremiseProperty +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PageOfDataControllerResource +from ._models_py3 import Resource +from ._models_py3 import SqlManagedInstance +from ._models_py3 import SqlManagedInstanceK8SRaw +from ._models_py3 import SqlManagedInstanceK8SSpec +from ._models_py3 import SqlManagedInstanceListResult +from ._models_py3 import SqlManagedInstanceProperties +from ._models_py3 import SqlManagedInstanceSku +from ._models_py3 import SqlManagedInstanceUpdate +from ._models_py3 import SqlServerInstance +from ._models_py3 import SqlServerInstanceListResult +from ._models_py3 import SqlServerInstanceProperties +from ._models_py3 import SqlServerInstanceUpdate +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UploadServicePrincipal +from ._models_py3 import UploadWatermark + from ._azure_arc_data_management_client_enums import ( ArcSqlManagedInstanceLicenseType, ArcSqlServerLicenseType, ConnectionStatus, + CreatedByType, DefenderStatus, EditionType, ExtendedLocationTypes, - IdentityType, Infrastructure, OperationOrigin, SqlManagedInstanceSkuTier, @@ -101,28 +56,22 @@ __all__ = [ 'BasicLoginInformation', - 'CommonSku', 'DataControllerProperties', 'DataControllerResource', 'DataControllerUpdate', 'ErrorResponse', 'ErrorResponseBody', 'ExtendedLocation', - 'Identity', 'K8SResourceRequirements', 'K8SScheduling', 'K8SSchedulingOptions', 'LogAnalyticsWorkspaceConfig', - 'ODataError', 'OnPremiseProperty', 'Operation', 'OperationDisplay', 'OperationListResult', 'PageOfDataControllerResource', - 'Plan', - 'ProxyResource', 'Resource', - 'ResourceSku', 'SqlManagedInstance', 'SqlManagedInstanceK8SRaw', 'SqlManagedInstanceK8SSpec', @@ -141,10 +90,10 @@ 'ArcSqlManagedInstanceLicenseType', 'ArcSqlServerLicenseType', 'ConnectionStatus', + 'CreatedByType', 'DefenderStatus', 'EditionType', 'ExtendedLocationTypes', - 'IdentityType', 'Infrastructure', 'OperationOrigin', 'SqlManagedInstanceSkuTier', diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py index fac1c2934e44..1e9e6aeb65e8 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py @@ -6,34 +6,19 @@ # 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 ArcSqlManagedInstanceLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ArcSqlManagedInstanceLicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The license type to apply for this managed instance. """ BASE_PRICE = "BasePrice" LICENSE_INCLUDED = "LicenseIncluded" -class ArcSqlServerLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ArcSqlServerLicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SQL Server license type. """ @@ -42,7 +27,7 @@ class ArcSqlServerLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum HADR = "HADR" UNDEFINED = "Undefined" -class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The cloud connectivity status. """ @@ -50,7 +35,16 @@ class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DISCONNECTED = "Disconnected" UNKNOWN = "Unknown" -class DefenderStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DefenderStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of Azure Defender. """ @@ -58,7 +52,7 @@ class DefenderStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UNPROTECTED = "Unprotected" UNKNOWN = "Unknown" -class EditionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EditionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SQL Server edition. """ @@ -69,22 +63,13 @@ class EditionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEVELOPER = "Developer" EXPRESS = "Express" -class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ExtendedLocationTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of extendedLocation. """ CUSTOM_LOCATION = "CustomLocation" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The type of identity that creates/modifies resources - """ - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - -class Infrastructure(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Infrastructure(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The infrastructure the data controller is running on. """ @@ -95,21 +80,21 @@ class Infrastructure(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ONPREMISES = "onpremises" OTHER = "other" -class OperationOrigin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperationOrigin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The intended executor of the operation. """ USER = "user" SYSTEM = "system" -class SqlManagedInstanceSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SqlManagedInstanceSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The pricing tier for the instance. """ GENERAL_PURPOSE = "GeneralPurpose" BUSINESS_CRITICAL = "BusinessCritical" -class SqlVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SqlVersion(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SQL Server version. """ diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models.py deleted file mode 100644 index d14de2db3bb4..000000000000 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models.py +++ /dev/null @@ -1,1455 +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 BasicLoginInformation(msrest.serialization.Model): - """Username and password for basic login authentication. - - :param username: Login username. - :type username: str - :param password: Login password. - :type password: str - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BasicLoginInformation, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.password = kwargs.get('password', None) - - -class CommonSku(msrest.serialization.Model): - """The resource model definition representing SKU for ARM resources. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the SKU. It is typically a letter+number code. - :type name: str - :param dev: Whether dev/test is enabled. When the dev field is set to true, the resource is - used for dev/test purpose. - :type dev: bool - :param size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :type size: str - :param family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :type family: str - :param capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :type capacity: int - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'dev': {'key': 'dev', 'type': 'bool'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(CommonSku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.dev = kwargs.get('dev', True) - self.size = kwargs.get('size', None) - self.family = kwargs.get('family', None) - self.capacity = kwargs.get('capacity', None) - - -class DataControllerProperties(msrest.serialization.Model): - """The data controller properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param infrastructure: The infrastructure the data controller is running on. Possible values - include: "azure", "gcp", "aws", "alibaba", "onpremises", "other". Default value: "other". - :type infrastructure: str or ~azure_arc_data_management_client.models.Infrastructure - :param on_premise_property: Properties from the Kubernetes data controller. - :type on_premise_property: ~azure_arc_data_management_client.models.OnPremiseProperty - :param k8_s_raw: The raw kubernetes information. - :type k8_s_raw: any - :param upload_watermark: Properties on upload watermark. Mostly timestamp for each upload data - type. - :type upload_watermark: ~azure_arc_data_management_client.models.UploadWatermark - :param last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current date - time. - :type last_uploaded_date: ~datetime.datetime - :param basic_login_information: Deprecated. Azure Arc Data Services data controller no longer - expose any endpoint. All traffic are exposed through Kubernetes native API. - :type basic_login_information: ~azure_arc_data_management_client.models.BasicLoginInformation - :param metrics_dashboard_credential: Login credential for metrics dashboard on the Kubernetes - cluster. - :type metrics_dashboard_credential: - ~azure_arc_data_management_client.models.BasicLoginInformation - :param logs_dashboard_credential: Login credential for logs dashboard on the Kubernetes - cluster. - :type logs_dashboard_credential: ~azure_arc_data_management_client.models.BasicLoginInformation - :param log_analytics_workspace_config: Log analytics workspace id and primary key. - :type log_analytics_workspace_config: - ~azure_arc_data_management_client.models.LogAnalyticsWorkspaceConfig - :param upload_service_principal: Deprecated. Service principal is deprecated in favor of Arc - Kubernetes service extension managed identity. - :type upload_service_principal: ~azure_arc_data_management_client.models.UploadServicePrincipal - :ivar provisioning_state: - :vartype provisioning_state: str - :param cluster_id: If a CustomLocation is provided, this contains the ARM id of the connected - cluster the custom location belongs to. - :type cluster_id: str - :param extension_id: If a CustomLocation is provided, this contains the ARM id of the extension - the custom location belongs to. - :type extension_id: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'infrastructure': {'key': 'infrastructure', 'type': 'str'}, - 'on_premise_property': {'key': 'onPremiseProperty', 'type': 'OnPremiseProperty'}, - 'k8_s_raw': {'key': 'k8sRaw', 'type': 'object'}, - 'upload_watermark': {'key': 'uploadWatermark', 'type': 'UploadWatermark'}, - 'last_uploaded_date': {'key': 'lastUploadedDate', 'type': 'iso-8601'}, - 'basic_login_information': {'key': 'basicLoginInformation', 'type': 'BasicLoginInformation'}, - 'metrics_dashboard_credential': {'key': 'metricsDashboardCredential', 'type': 'BasicLoginInformation'}, - 'logs_dashboard_credential': {'key': 'logsDashboardCredential', 'type': 'BasicLoginInformation'}, - 'log_analytics_workspace_config': {'key': 'logAnalyticsWorkspaceConfig', 'type': 'LogAnalyticsWorkspaceConfig'}, - 'upload_service_principal': {'key': 'uploadServicePrincipal', 'type': 'UploadServicePrincipal'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'cluster_id': {'key': 'clusterId', 'type': 'str'}, - 'extension_id': {'key': 'extensionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataControllerProperties, self).__init__(**kwargs) - self.infrastructure = kwargs.get('infrastructure', "other") - self.on_premise_property = kwargs.get('on_premise_property', None) - self.k8_s_raw = kwargs.get('k8_s_raw', None) - self.upload_watermark = kwargs.get('upload_watermark', None) - self.last_uploaded_date = kwargs.get('last_uploaded_date', None) - self.basic_login_information = kwargs.get('basic_login_information', None) - self.metrics_dashboard_credential = kwargs.get('metrics_dashboard_credential', None) - self.logs_dashboard_credential = kwargs.get('logs_dashboard_credential', None) - self.log_analytics_workspace_config = kwargs.get('log_analytics_workspace_config', None) - self.upload_service_principal = kwargs.get('upload_service_principal', None) - self.provisioning_state = None - self.cluster_id = kwargs.get('cluster_id', None) - self.extension_id = kwargs.get('extension_id', None) - - -class Resource(msrest.serialization.Model): - """Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :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(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar system_data: Read only system data. - :vartype system_data: ~azure_arc_data_management_client.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - self.system_data = None - - -class DataControllerResource(TrackedResource): - """Data controller resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar system_data: Read only system data. - :vartype system_data: ~azure_arc_data_management_client.models.SystemData - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure_arc_data_management_client.models.ExtendedLocation - :param properties: Required. The data controller's properties. - :type properties: ~azure_arc_data_management_client.models.DataControllerProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'properties': {'key': 'properties', 'type': 'DataControllerProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DataControllerResource, self).__init__(**kwargs) - self.extended_location = kwargs.get('extended_location', None) - self.properties = kwargs['properties'] - - -class DataControllerUpdate(msrest.serialization.Model): - """Used for updating a data controller resource. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(DataControllerUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class ErrorResponse(msrest.serialization.Model): - """An error response from the Azure Data on Azure Arc service. - - :param error: null. - :type error: ~azure_arc_data_management_client.models.ErrorResponseBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """An error response from the Batch service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure_arc_data_management_client.models.ErrorResponseBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class ExtendedLocation(msrest.serialization.Model): - """The complex type of the extended location. - - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "CustomLocation". - :type type: str or ~azure_arc_data_management_client.models.ExtendedLocationTypes - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedLocation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _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 K8SResourceRequirements(msrest.serialization.Model): - """The kubernetes resource limits and requests used to restrict or reserve resource usage. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param requests: Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' - request must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default - 'memory' is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and - maximum 'memory' is '128Gi'. - :type requests: dict[str, str] - :param limits: Limits for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request - must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' - is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum - 'memory' is '128Gi'. - :type limits: dict[str, str] - """ - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'requests': {'key': 'requests', 'type': '{str}'}, - 'limits': {'key': 'limits', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(K8SResourceRequirements, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.requests = kwargs.get('requests', None) - self.limits = kwargs.get('limits', None) - - -class K8SScheduling(msrest.serialization.Model): - """The kubernetes scheduling information. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param default: The kubernetes scheduling options. It describes restrictions used to help - Kubernetes select appropriate nodes to host the database service. - :type default: ~azure_arc_data_management_client.models.K8SSchedulingOptions - """ - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'default': {'key': 'default', 'type': 'K8SSchedulingOptions'}, - } - - def __init__( - self, - **kwargs - ): - super(K8SScheduling, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.default = kwargs.get('default', None) - - -class K8SSchedulingOptions(msrest.serialization.Model): - """The kubernetes scheduling options. It describes restrictions used to help Kubernetes select appropriate nodes to host the database service. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param resources: The kubernetes resource limits and requests used to restrict or reserve - resource usage. - :type resources: ~azure_arc_data_management_client.models.K8SResourceRequirements - """ - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'resources': {'key': 'resources', 'type': 'K8SResourceRequirements'}, - } - - def __init__( - self, - **kwargs - ): - super(K8SSchedulingOptions, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.resources = kwargs.get('resources', None) - - -class LogAnalyticsWorkspaceConfig(msrest.serialization.Model): - """Log analytics workspace id and primary key. - - :param workspace_id: Azure Log Analytics workspace ID. - :type workspace_id: str - :param primary_key: Primary key of the workspace. - :type primary_key: str - """ - - _attribute_map = { - 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogAnalyticsWorkspaceConfig, self).__init__(**kwargs) - self.workspace_id = kwargs.get('workspace_id', None) - self.primary_key = kwargs.get('primary_key', None) - - -class ODataError(msrest.serialization.Model): - """Information about an error. - - :param code: A language-independent error name. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the error (for example, the name of the property in error). - :type target: str - :param details: The error details. - :type details: list[~azure_arc_data_management_client.models.ODataError] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ODataError]'}, - } - - def __init__( - self, - **kwargs - ): - super(ODataError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class OnPremiseProperty(msrest.serialization.Model): - """Properties from the Kubernetes data controller. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. A globally unique ID identifying the associated Kubernetes cluster. - :type id: str - :param public_signing_key: Required. Certificate that contains the Kubernetes cluster public - key used to verify signing. - :type public_signing_key: str - :param signing_certificate_thumbprint: Unique thumbprint returned to customer to verify the - certificate being uploaded. - :type signing_certificate_thumbprint: str - """ - - _validation = { - 'id': {'required': True}, - 'public_signing_key': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'public_signing_key': {'key': 'publicSigningKey', 'type': 'str'}, - 'signing_certificate_thumbprint': {'key': 'signingCertificateThumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OnPremiseProperty, self).__init__(**kwargs) - self.id = kwargs['id'] - self.public_signing_key = kwargs['public_signing_key'] - self.signing_certificate_thumbprint = kwargs.get('signing_certificate_thumbprint', None) - - -class Operation(msrest.serialization.Model): - """Azure Data Services on Azure Arc operation definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the operation being performed on this particular object. - :type name: str - :param display: Required. The localized display information for this particular operation / - action. - :type display: ~azure_arc_data_management_client.models.OperationDisplay - :ivar origin: The intended executor of the operation. Possible values include: "user", - "system". - :vartype origin: str or ~azure_arc_data_management_client.models.OperationOrigin - :param is_data_action: Required. Indicates whether the operation is a data action. - :type is_data_action: bool - :ivar properties: Additional descriptions for the operation. - :vartype properties: dict[str, any] - """ - - _validation = { - 'name': {'required': True}, - 'display': {'required': True}, - 'origin': {'readonly': True}, - 'is_data_action': {'required': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'properties': {'key': 'properties', 'type': '{object}'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs['name'] - self.display = kwargs['display'] - self.origin = None - self.is_data_action = kwargs['is_data_action'] - self.properties = None - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - All required parameters must be populated in order to send to Azure. - - :param provider: Required. The localized friendly form of the resource provider name. - :type provider: str - :param resource: Required. The localized friendly form of the resource type related to this - action/operation. - :type resource: str - :param operation: Required. The localized friendly name for the operation. - :type operation: str - :param description: Required. The localized friendly description for the operation. - :type description: str - """ - - _validation = { - 'provider': {'required': True}, - 'resource': {'required': True}, - 'operation': {'required': True}, - 'description': {'required': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs['provider'] - self.resource = kwargs['resource'] - self.operation = kwargs['operation'] - self.description = kwargs['description'] - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Azure Data Services on Azure Arc operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure_arc_data_management_client.models.Operation] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class PageOfDataControllerResource(msrest.serialization.Model): - """PageOfDataControllerResource. - - :param value: - :type value: list[~azure_arc_data_management_client.models.DataControllerResource] - :param next_link: Link to retrieve next page of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataControllerResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PageOfDataControllerResource, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class Plan(msrest.serialization.Model): - """Plan for the resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. - :type name: str - :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. - NewRelic. - :type publisher: str - :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product - maps to the OfferID specified for the artifact at the time of Data Market onboarding. - :type product: str - :param promotion_code: A publisher provided promotion code as provisioned in Data Market for - the said product/artifact. - :type promotion_code: str - :param version: The version of the desired product/artifact. - :type version: str - """ - - _validation = { - 'name': {'required': True}, - 'publisher': {'required': True}, - 'product': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Plan, self).__init__(**kwargs) - self.name = kwargs['name'] - self.publisher = kwargs['publisher'] - self.product = kwargs['product'] - self.promotion_code = kwargs.get('promotion_code', None) - self.version = kwargs.get('version', None) - - -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :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) - - -class ResourceSku(msrest.serialization.Model): - """ResourceSku. - - :param capacity: - :type capacity: int - :param family: - :type family: str - :param name: - :type name: str - :param size: - :type size: str - :param tier: - :type tier: str - """ - - _attribute_map = { - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceSku, self).__init__(**kwargs) - self.capacity = kwargs.get('capacity', None) - self.family = kwargs.get('family', None) - self.name = kwargs.get('name', None) - self.size = kwargs.get('size', None) - self.tier = kwargs.get('tier', None) - - -class SqlManagedInstance(TrackedResource): - """A SqlManagedInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar system_data: Read only system data. - :vartype system_data: ~azure_arc_data_management_client.models.SystemData - :param properties: Required. null. - :type properties: ~azure_arc_data_management_client.models.SqlManagedInstanceProperties - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure_arc_data_management_client.models.ExtendedLocation - :param sku: Resource sku. - :type sku: ~azure_arc_data_management_client.models.SqlManagedInstanceSku - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'SqlManagedInstanceProperties'}, - 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, - 'sku': {'key': 'sku', 'type': 'SqlManagedInstanceSku'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlManagedInstance, self).__init__(**kwargs) - self.properties = kwargs['properties'] - self.extended_location = kwargs.get('extended_location', None) - self.sku = kwargs.get('sku', None) - - -class SqlManagedInstanceK8SRaw(msrest.serialization.Model): - """The raw kubernetes information. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param spec: The kubernetes spec information. - :type spec: ~azure_arc_data_management_client.models.SqlManagedInstanceK8SSpec - """ - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'spec': {'key': 'spec', 'type': 'SqlManagedInstanceK8SSpec'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlManagedInstanceK8SRaw, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.spec = kwargs.get('spec', None) - - -class SqlManagedInstanceK8SSpec(msrest.serialization.Model): - """The kubernetes spec information. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param scheduling: The kubernetes scheduling information. - :type scheduling: ~azure_arc_data_management_client.models.K8SScheduling - :param replicas: This option specifies the number of SQL Managed Instance replicas that will be - deployed in your Kubernetes cluster for high availability purposes. If sku.tier is - BusinessCritical, allowed values are '2' or '3' with default of '3'. If sku.tier is - GeneralPurpose, replicas must be '1'. - :type replicas: int - """ - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'scheduling': {'key': 'scheduling', 'type': 'K8SScheduling'}, - 'replicas': {'key': 'replicas', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlManagedInstanceK8SSpec, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.scheduling = kwargs.get('scheduling', None) - self.replicas = kwargs.get('replicas', None) - - -class SqlManagedInstanceListResult(msrest.serialization.Model): - """A list of SqlManagedInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure_arc_data_management_client.models.SqlManagedInstance] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlManagedInstance]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlManagedInstanceListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SqlManagedInstanceProperties(msrest.serialization.Model): - """Properties of sqlManagedInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param data_controller_id: null. - :type data_controller_id: str - :param admin: The instance admin user. - :type admin: str - :param start_time: The instance start time. - :type start_time: str - :param end_time: The instance end time. - :type end_time: str - :param k8_s_raw: The raw kubernetes information. - :type k8_s_raw: ~azure_arc_data_management_client.models.SqlManagedInstanceK8SRaw - :param basic_login_information: Username and password for basic authentication. - :type basic_login_information: ~azure_arc_data_management_client.models.BasicLoginInformation - :param last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current date - time. - :type last_uploaded_date: ~datetime.datetime - :ivar provisioning_state: - :vartype provisioning_state: str - :param license_type: The license type to apply for this managed instance. Possible values - include: "BasePrice", "LicenseIncluded". Default value: "BasePrice". - :type license_type: str or - ~azure_arc_data_management_client.models.ArcSqlManagedInstanceLicenseType - :param cluster_id: If a CustomLocation is provided, this contains the ARM id of the connected - cluster the custom location belongs to. - :type cluster_id: str - :param extension_id: If a CustomLocation is provided, this contains the ARM id of the extension - the custom location belongs to. - :type extension_id: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'data_controller_id': {'key': 'dataControllerId', 'type': 'str'}, - 'admin': {'key': 'admin', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'end_time': {'key': 'endTime', 'type': 'str'}, - 'k8_s_raw': {'key': 'k8sRaw', 'type': 'SqlManagedInstanceK8SRaw'}, - 'basic_login_information': {'key': 'basicLoginInformation', 'type': 'BasicLoginInformation'}, - 'last_uploaded_date': {'key': 'lastUploadedDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'cluster_id': {'key': 'clusterId', 'type': 'str'}, - 'extension_id': {'key': 'extensionId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlManagedInstanceProperties, self).__init__(**kwargs) - self.data_controller_id = kwargs.get('data_controller_id', None) - self.admin = kwargs.get('admin', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.k8_s_raw = kwargs.get('k8_s_raw', None) - self.basic_login_information = kwargs.get('basic_login_information', None) - self.last_uploaded_date = kwargs.get('last_uploaded_date', None) - self.provisioning_state = None - self.license_type = kwargs.get('license_type', "BasePrice") - self.cluster_id = kwargs.get('cluster_id', None) - self.extension_id = kwargs.get('extension_id', None) - - -class SqlManagedInstanceSku(msrest.serialization.Model): - """The resource model definition representing SKU for Azure Managed Instance - Azure Arc. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar name: The name of the SKU. Has constant value: "vCore". - :vartype name: str - :param tier: The pricing tier for the instance. Possible values include: "GeneralPurpose", - "BusinessCritical". Default value: "GeneralPurpose". - :type tier: str or ~azure_arc_data_management_client.models.SqlManagedInstanceSkuTier - :param dev: Whether dev/test is enabled. When the dev field is set to true, the resource is - used for dev/test purpose. - :type dev: bool - :param size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :type size: str - :param family: - :type family: str - :param capacity: - :type capacity: int - """ - - _validation = { - 'name': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'dev': {'key': 'dev', 'type': 'bool'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - name = "vCore" - - def __init__( - self, - **kwargs - ): - super(SqlManagedInstanceSku, self).__init__(**kwargs) - self.tier = kwargs.get('tier', "GeneralPurpose") - self.dev = kwargs.get('dev', True) - self.size = kwargs.get('size', None) - self.family = kwargs.get('family', None) - self.capacity = kwargs.get('capacity', None) - - -class SqlManagedInstanceUpdate(msrest.serialization.Model): - """An update to a SQL Managed Instance. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlManagedInstanceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class SqlServerInstance(TrackedResource): - """A SqlServerInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar system_data: Read only system data. - :vartype system_data: ~azure_arc_data_management_client.models.SystemData - :param properties: null. - :type properties: ~azure_arc_data_management_client.models.SqlServerInstanceProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'SqlServerInstanceProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlServerInstance, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class SqlServerInstanceListResult(msrest.serialization.Model): - """A list of SqlServerInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure_arc_data_management_client.models.SqlServerInstance] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlServerInstance]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlServerInstanceListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SqlServerInstanceProperties(msrest.serialization.Model): - """Properties of SqlServerInstance. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param version: SQL Server version. Possible values include: "SQL Server 2019", "SQL Server - 2017", "SQL Server 2016". - :type version: str or ~azure_arc_data_management_client.models.SqlVersion - :param edition: SQL Server edition. Possible values include: "Evaluation", "Enterprise", - "Standard", "Web", "Developer", "Express". - :type edition: str or ~azure_arc_data_management_client.models.EditionType - :param container_resource_id: Required. ARM Resource id of the container resource (Azure Arc - for Servers). - :type container_resource_id: str - :ivar create_time: The time when the resource was created. - :vartype create_time: str - :param v_core: The number of logical processors used by the SQL Server instance. - :type v_core: str - :param status: Required. The cloud connectivity status. Possible values include: "Connected", - "Disconnected", "Unknown". - :type status: str or ~azure_arc_data_management_client.models.ConnectionStatus - :param patch_level: SQL Server update level. - :type patch_level: str - :param collation: SQL Server collation. - :type collation: str - :param current_version: SQL Server current version. - :type current_version: str - :param instance_name: SQL Server instance name. - :type instance_name: str - :param tcp_dynamic_ports: Dynamic TCP ports used by SQL Server. - :type tcp_dynamic_ports: str - :param tcp_static_ports: Static TCP ports used by SQL Server. - :type tcp_static_ports: str - :param product_id: SQL Server product ID. - :type product_id: str - :param license_type: SQL Server license type. Possible values include: "Paid", "Free", "HADR", - "Undefined". - :type license_type: str or ~azure_arc_data_management_client.models.ArcSqlServerLicenseType - :param azure_defender_status_last_updated: Timestamp of last Azure Defender status update. - :type azure_defender_status_last_updated: ~datetime.datetime - :param azure_defender_status: Status of Azure Defender. Possible values include: "Protected", - "Unprotected", "Unknown". - :type azure_defender_status: str or ~azure_arc_data_management_client.models.DefenderStatus - :ivar provisioning_state: - :vartype provisioning_state: str - """ - - _validation = { - 'container_resource_id': {'required': True}, - 'create_time': {'readonly': True}, - 'status': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'edition': {'key': 'edition', 'type': 'str'}, - 'container_resource_id': {'key': 'containerResourceId', 'type': 'str'}, - 'create_time': {'key': 'createTime', 'type': 'str'}, - 'v_core': {'key': 'vCore', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'patch_level': {'key': 'patchLevel', 'type': 'str'}, - 'collation': {'key': 'collation', 'type': 'str'}, - 'current_version': {'key': 'currentVersion', 'type': 'str'}, - 'instance_name': {'key': 'instanceName', 'type': 'str'}, - 'tcp_dynamic_ports': {'key': 'tcpDynamicPorts', 'type': 'str'}, - 'tcp_static_ports': {'key': 'tcpStaticPorts', 'type': 'str'}, - 'product_id': {'key': 'productId', 'type': 'str'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'azure_defender_status_last_updated': {'key': 'azureDefenderStatusLastUpdated', 'type': 'iso-8601'}, - 'azure_defender_status': {'key': 'azureDefenderStatus', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlServerInstanceProperties, self).__init__(**kwargs) - self.version = kwargs.get('version', None) - self.edition = kwargs.get('edition', None) - self.container_resource_id = kwargs['container_resource_id'] - self.create_time = None - self.v_core = kwargs.get('v_core', None) - self.status = kwargs['status'] - self.patch_level = kwargs.get('patch_level', None) - self.collation = kwargs.get('collation', None) - self.current_version = kwargs.get('current_version', None) - self.instance_name = kwargs.get('instance_name', None) - self.tcp_dynamic_ports = kwargs.get('tcp_dynamic_ports', None) - self.tcp_static_ports = kwargs.get('tcp_static_ports', None) - self.product_id = kwargs.get('product_id', None) - self.license_type = kwargs.get('license_type', None) - self.azure_defender_status_last_updated = kwargs.get('azure_defender_status_last_updated', None) - self.azure_defender_status = kwargs.get('azure_defender_status', None) - self.provisioning_state = None - - -class SqlServerInstanceUpdate(msrest.serialization.Model): - """An update to a SQL Server Instance. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlServerInstanceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class SystemData(msrest.serialization.Model): - """Read only system data. - - :param created_by: An identifier for the identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_arc_data_management_client.models.IdentityType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: An identifier for the identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_arc_data_management_client.models.IdentityType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class UploadServicePrincipal(msrest.serialization.Model): - """Service principal for uploading billing, metrics and logs. - - :param client_id: Client ID of the service principal for uploading data. - :type client_id: str - :param tenant_id: Tenant ID of the service principal. - :type tenant_id: str - :param authority: Authority for the service principal. Example: - https://login.microsoftonline.com/. - :type authority: str - :param client_secret: Secret of the service principal. - :type client_secret: str - """ - - _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'authority': {'key': 'authority', 'type': 'str'}, - 'client_secret': {'key': 'clientSecret', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadServicePrincipal, self).__init__(**kwargs) - self.client_id = kwargs.get('client_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.authority = kwargs.get('authority', None) - self.client_secret = kwargs.get('client_secret', None) - - -class UploadWatermark(msrest.serialization.Model): - """Properties on upload watermark. Mostly timestamp for each upload data type. - - :param metrics: Last uploaded date for metrics from kubernetes cluster. Defaults to current - date time. - :type metrics: ~datetime.datetime - :param logs: Last uploaded date for logs from kubernetes cluster. Defaults to current date - time. - :type logs: ~datetime.datetime - :param usages: Last uploaded date for usages from kubernetes cluster. Defaults to current date - time. - :type usages: ~datetime.datetime - """ - - _attribute_map = { - 'metrics': {'key': 'metrics', 'type': 'iso-8601'}, - 'logs': {'key': 'logs', 'type': 'iso-8601'}, - 'usages': {'key': 'usages', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(UploadWatermark, self).__init__(**kwargs) - self.metrics = kwargs.get('metrics', None) - self.logs = kwargs.get('logs', None) - self.usages = kwargs.get('usages', None) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py index 4ee4c9eab886..258b1ee8fd57 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py @@ -18,10 +18,10 @@ class BasicLoginInformation(msrest.serialization.Model): """Username and password for basic login authentication. - :param username: Login username. - :type username: str - :param password: Login password. - :type password: str + :ivar username: Login username. + :vartype username: str + :ivar password: Login password. + :vartype password: str """ _attribute_map = { @@ -36,104 +36,61 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword username: Login username. + :paramtype username: str + :keyword password: Login password. + :paramtype password: str + """ super(BasicLoginInformation, self).__init__(**kwargs) self.username = username self.password = password -class CommonSku(msrest.serialization.Model): - """The resource model definition representing SKU for ARM resources. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the SKU. It is typically a letter+number code. - :type name: str - :param dev: Whether dev/test is enabled. When the dev field is set to true, the resource is - used for dev/test purpose. - :type dev: bool - :param size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :type size: str - :param family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :type family: str - :param capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :type capacity: int - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'dev': {'key': 'dev', 'type': 'bool'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - *, - name: str, - dev: Optional[bool] = True, - size: Optional[str] = None, - family: Optional[str] = None, - capacity: Optional[int] = None, - **kwargs - ): - super(CommonSku, self).__init__(**kwargs) - self.name = name - self.dev = dev - self.size = size - self.family = family - self.capacity = capacity - - class DataControllerProperties(msrest.serialization.Model): """The data controller properties. Variables are only populated by the server, and will be ignored when sending a request. - :param infrastructure: The infrastructure the data controller is running on. Possible values + :ivar infrastructure: The infrastructure the data controller is running on. Possible values include: "azure", "gcp", "aws", "alibaba", "onpremises", "other". Default value: "other". - :type infrastructure: str or ~azure_arc_data_management_client.models.Infrastructure - :param on_premise_property: Properties from the Kubernetes data controller. - :type on_premise_property: ~azure_arc_data_management_client.models.OnPremiseProperty - :param k8_s_raw: The raw kubernetes information. - :type k8_s_raw: any - :param upload_watermark: Properties on upload watermark. Mostly timestamp for each upload data + :vartype infrastructure: str or ~azure_arc_data_management_client.models.Infrastructure + :ivar on_premise_property: Properties from the Kubernetes data controller. + :vartype on_premise_property: ~azure_arc_data_management_client.models.OnPremiseProperty + :ivar k8_s_raw: The raw kubernetes information. + :vartype k8_s_raw: any + :ivar upload_watermark: Properties on upload watermark. Mostly timestamp for each upload data type. - :type upload_watermark: ~azure_arc_data_management_client.models.UploadWatermark - :param last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current date + :vartype upload_watermark: ~azure_arc_data_management_client.models.UploadWatermark + :ivar last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current date time. - :type last_uploaded_date: ~datetime.datetime - :param basic_login_information: Deprecated. Azure Arc Data Services data controller no longer + :vartype last_uploaded_date: ~datetime.datetime + :ivar basic_login_information: Deprecated. Azure Arc Data Services data controller no longer expose any endpoint. All traffic are exposed through Kubernetes native API. - :type basic_login_information: ~azure_arc_data_management_client.models.BasicLoginInformation - :param metrics_dashboard_credential: Login credential for metrics dashboard on the Kubernetes - cluster. - :type metrics_dashboard_credential: + :vartype basic_login_information: ~azure_arc_data_management_client.models.BasicLoginInformation - :param logs_dashboard_credential: Login credential for logs dashboard on the Kubernetes + :ivar metrics_dashboard_credential: Login credential for metrics dashboard on the Kubernetes cluster. - :type logs_dashboard_credential: ~azure_arc_data_management_client.models.BasicLoginInformation - :param log_analytics_workspace_config: Log analytics workspace id and primary key. - :type log_analytics_workspace_config: + :vartype metrics_dashboard_credential: + ~azure_arc_data_management_client.models.BasicLoginInformation + :ivar logs_dashboard_credential: Login credential for logs dashboard on the Kubernetes cluster. + :vartype logs_dashboard_credential: + ~azure_arc_data_management_client.models.BasicLoginInformation + :ivar log_analytics_workspace_config: Log analytics workspace id and primary key. + :vartype log_analytics_workspace_config: ~azure_arc_data_management_client.models.LogAnalyticsWorkspaceConfig - :param upload_service_principal: Deprecated. Service principal is deprecated in favor of Arc + :ivar upload_service_principal: Deprecated. Service principal is deprecated in favor of Arc Kubernetes service extension managed identity. - :type upload_service_principal: ~azure_arc_data_management_client.models.UploadServicePrincipal + :vartype upload_service_principal: + ~azure_arc_data_management_client.models.UploadServicePrincipal :ivar provisioning_state: :vartype provisioning_state: str - :param cluster_id: If a CustomLocation is provided, this contains the ARM id of the connected + :ivar cluster_id: If a CustomLocation is provided, this contains the ARM id of the connected cluster the custom location belongs to. - :type cluster_id: str - :param extension_id: If a CustomLocation is provided, this contains the ARM id of the extension + :vartype cluster_id: str + :ivar extension_id: If a CustomLocation is provided, this contains the ARM id of the extension the custom location belongs to. - :type extension_id: str + :vartype extension_id: str """ _validation = { @@ -173,6 +130,46 @@ def __init__( extension_id: Optional[str] = None, **kwargs ): + """ + :keyword infrastructure: The infrastructure the data controller is running on. Possible values + include: "azure", "gcp", "aws", "alibaba", "onpremises", "other". Default value: "other". + :paramtype infrastructure: str or ~azure_arc_data_management_client.models.Infrastructure + :keyword on_premise_property: Properties from the Kubernetes data controller. + :paramtype on_premise_property: ~azure_arc_data_management_client.models.OnPremiseProperty + :keyword k8_s_raw: The raw kubernetes information. + :paramtype k8_s_raw: any + :keyword upload_watermark: Properties on upload watermark. Mostly timestamp for each upload + data type. + :paramtype upload_watermark: ~azure_arc_data_management_client.models.UploadWatermark + :keyword last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current + date time. + :paramtype last_uploaded_date: ~datetime.datetime + :keyword basic_login_information: Deprecated. Azure Arc Data Services data controller no longer + expose any endpoint. All traffic are exposed through Kubernetes native API. + :paramtype basic_login_information: + ~azure_arc_data_management_client.models.BasicLoginInformation + :keyword metrics_dashboard_credential: Login credential for metrics dashboard on the Kubernetes + cluster. + :paramtype metrics_dashboard_credential: + ~azure_arc_data_management_client.models.BasicLoginInformation + :keyword logs_dashboard_credential: Login credential for logs dashboard on the Kubernetes + cluster. + :paramtype logs_dashboard_credential: + ~azure_arc_data_management_client.models.BasicLoginInformation + :keyword log_analytics_workspace_config: Log analytics workspace id and primary key. + :paramtype log_analytics_workspace_config: + ~azure_arc_data_management_client.models.LogAnalyticsWorkspaceConfig + :keyword upload_service_principal: Deprecated. Service principal is deprecated in favor of Arc + Kubernetes service extension managed identity. + :paramtype upload_service_principal: + ~azure_arc_data_management_client.models.UploadServicePrincipal + :keyword cluster_id: If a CustomLocation is provided, this contains the ARM id of the connected + cluster the custom location belongs to. + :paramtype cluster_id: str + :keyword extension_id: If a CustomLocation is provided, this contains the ARM id of the + extension the custom location belongs to. + :paramtype extension_id: str + """ super(DataControllerProperties, self).__init__(**kwargs) self.infrastructure = infrastructure self.on_premise_property = on_premise_property @@ -190,80 +187,89 @@ def __init__( class Resource(msrest.serialization.Model): - """Resource. + """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure_arc_data_management_client.models.SystemData """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.type = None + self.system_data = None class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar system_data: Read only system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure_arc_data_management_client.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'required': True}, 'system_data': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( @@ -273,10 +279,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location - self.system_data = None class DataControllerResource(TrackedResource): @@ -286,32 +297,33 @@ class DataControllerResource(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar system_data: Read only system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure_arc_data_management_client.models.SystemData - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure_arc_data_management_client.models.ExtendedLocation - :param properties: Required. The data controller's properties. - :type properties: ~azure_arc_data_management_client.models.DataControllerProperties + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure_arc_data_management_client.models.ExtendedLocation + :ivar properties: Required. The data controller's properties. + :vartype properties: ~azure_arc_data_management_client.models.DataControllerProperties """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'required': True}, 'system_data': {'readonly': True}, + 'location': {'required': True}, 'properties': {'required': True}, } @@ -319,9 +331,9 @@ class DataControllerResource(TrackedResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, 'properties': {'key': 'properties', 'type': 'DataControllerProperties'}, } @@ -335,6 +347,16 @@ def __init__( extended_location: Optional["ExtendedLocation"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure_arc_data_management_client.models.ExtendedLocation + :keyword properties: Required. The data controller's properties. + :paramtype properties: ~azure_arc_data_management_client.models.DataControllerProperties + """ super(DataControllerResource, self).__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location self.properties = properties @@ -343,8 +365,8 @@ def __init__( class DataControllerUpdate(msrest.serialization.Model): """Used for updating a data controller resource. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -357,6 +379,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(DataControllerUpdate, self).__init__(**kwargs) self.tags = tags @@ -364,8 +390,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """An error response from the Azure Data on Azure Arc service. - :param error: null. - :type error: ~azure_arc_data_management_client.models.ErrorResponseBody + :ivar error: null. + :vartype error: ~azure_arc_data_management_client.models.ErrorResponseBody """ _attribute_map = { @@ -378,6 +404,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: null. + :paramtype error: ~azure_arc_data_management_client.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -385,17 +415,17 @@ def __init__( class ErrorResponseBody(msrest.serialization.Model): """An error response from the Batch service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~azure_arc_data_management_client.models.ErrorResponseBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~azure_arc_data_management_client.models.ErrorResponseBody] """ _attribute_map = { @@ -414,6 +444,19 @@ def __init__( details: Optional[List["ErrorResponseBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~azure_arc_data_management_client.models.ErrorResponseBody] + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -424,10 +467,10 @@ def __init__( class ExtendedLocation(msrest.serialization.Model): """The complex type of the extended location. - :param name: The name of the extended location. - :type name: str - :param type: The type of the extended location. Possible values include: "CustomLocation". - :type type: str or ~azure_arc_data_management_client.models.ExtendedLocationTypes + :ivar name: The name of the extended location. + :vartype name: str + :ivar type: The type of the extended location. Possible values include: "CustomLocation". + :vartype type: str or ~azure_arc_data_management_client.models.ExtendedLocationTypes """ _attribute_map = { @@ -442,64 +485,33 @@ def __init__( type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): + """ + :keyword name: The name of the extended location. + :paramtype name: str + :keyword type: The type of the extended location. Possible values include: "CustomLocation". + :paramtype type: str or ~azure_arc_data_management_client.models.ExtendedLocationTypes + """ super(ExtendedLocation, self).__init__(**kwargs) self.name = name self.type = type -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _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, - *, - type: Optional[str] = None, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - - class K8SResourceRequirements(msrest.serialization.Model): """The kubernetes resource limits and requests used to restrict or reserve resource usage. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param requests: Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' + :vartype additional_properties: dict[str, any] + :ivar requests: Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. - :type requests: dict[str, str] - :param limits: Limits for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request + :vartype requests: dict[str, str] + :ivar limits: Limits for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum 'memory' is '128Gi'. - :type limits: dict[str, str] + :vartype limits: dict[str, str] """ _attribute_map = { @@ -516,6 +528,21 @@ def __init__( limits: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword requests: Requests for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' + request must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default + 'memory' is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and + maximum 'memory' is '128Gi'. + :paramtype requests: dict[str, str] + :keyword limits: Limits for a kubernetes resource type (e.g 'cpu', 'memory'). The 'cpu' request + must be less than or equal to 'cpu' limit. Default 'cpu' is 2, minimum is 1. Default 'memory' + is '4Gi', minimum is '2Gi. If sku.tier is GeneralPurpose, maximum 'cpu' is 24 and maximum + 'memory' is '128Gi'. + :paramtype limits: dict[str, str] + """ super(K8SResourceRequirements, self).__init__(**kwargs) self.additional_properties = additional_properties self.requests = requests @@ -525,12 +552,12 @@ def __init__( class K8SScheduling(msrest.serialization.Model): """The kubernetes scheduling information. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param default: The kubernetes scheduling options. It describes restrictions used to help + :vartype additional_properties: dict[str, any] + :ivar default: The kubernetes scheduling options. It describes restrictions used to help Kubernetes select appropriate nodes to host the database service. - :type default: ~azure_arc_data_management_client.models.K8SSchedulingOptions + :vartype default: ~azure_arc_data_management_client.models.K8SSchedulingOptions """ _attribute_map = { @@ -545,6 +572,14 @@ def __init__( default: Optional["K8SSchedulingOptions"] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword default: The kubernetes scheduling options. It describes restrictions used to help + Kubernetes select appropriate nodes to host the database service. + :paramtype default: ~azure_arc_data_management_client.models.K8SSchedulingOptions + """ super(K8SScheduling, self).__init__(**kwargs) self.additional_properties = additional_properties self.default = default @@ -553,12 +588,12 @@ def __init__( class K8SSchedulingOptions(msrest.serialization.Model): """The kubernetes scheduling options. It describes restrictions used to help Kubernetes select appropriate nodes to host the database service. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param resources: The kubernetes resource limits and requests used to restrict or reserve + :vartype additional_properties: dict[str, any] + :ivar resources: The kubernetes resource limits and requests used to restrict or reserve resource usage. - :type resources: ~azure_arc_data_management_client.models.K8SResourceRequirements + :vartype resources: ~azure_arc_data_management_client.models.K8SResourceRequirements """ _attribute_map = { @@ -573,6 +608,14 @@ def __init__( resources: Optional["K8SResourceRequirements"] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword resources: The kubernetes resource limits and requests used to restrict or reserve + resource usage. + :paramtype resources: ~azure_arc_data_management_client.models.K8SResourceRequirements + """ super(K8SSchedulingOptions, self).__init__(**kwargs) self.additional_properties = additional_properties self.resources = resources @@ -581,10 +624,10 @@ def __init__( class LogAnalyticsWorkspaceConfig(msrest.serialization.Model): """Log analytics workspace id and primary key. - :param workspace_id: Azure Log Analytics workspace ID. - :type workspace_id: str - :param primary_key: Primary key of the workspace. - :type primary_key: str + :ivar workspace_id: Azure Log Analytics workspace ID. + :vartype workspace_id: str + :ivar primary_key: Primary key of the workspace. + :vartype primary_key: str """ _attribute_map = { @@ -599,60 +642,30 @@ def __init__( primary_key: Optional[str] = None, **kwargs ): + """ + :keyword workspace_id: Azure Log Analytics workspace ID. + :paramtype workspace_id: str + :keyword primary_key: Primary key of the workspace. + :paramtype primary_key: str + """ super(LogAnalyticsWorkspaceConfig, self).__init__(**kwargs) self.workspace_id = workspace_id self.primary_key = primary_key -class ODataError(msrest.serialization.Model): - """Information about an error. - - :param code: A language-independent error name. - :type code: str - :param message: The error message. - :type message: str - :param target: The target of the error (for example, the name of the property in error). - :type target: str - :param details: The error details. - :type details: list[~azure_arc_data_management_client.models.ODataError] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ODataError]'}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["ODataError"]] = None, - **kwargs - ): - super(ODataError, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - class OnPremiseProperty(msrest.serialization.Model): """Properties from the Kubernetes data controller. All required parameters must be populated in order to send to Azure. - :param id: Required. A globally unique ID identifying the associated Kubernetes cluster. - :type id: str - :param public_signing_key: Required. Certificate that contains the Kubernetes cluster public - key used to verify signing. - :type public_signing_key: str - :param signing_certificate_thumbprint: Unique thumbprint returned to customer to verify the + :ivar id: Required. A globally unique ID identifying the associated Kubernetes cluster. + :vartype id: str + :ivar public_signing_key: Required. Certificate that contains the Kubernetes cluster public key + used to verify signing. + :vartype public_signing_key: str + :ivar signing_certificate_thumbprint: Unique thumbprint returned to customer to verify the certificate being uploaded. - :type signing_certificate_thumbprint: str + :vartype signing_certificate_thumbprint: str """ _validation = { @@ -674,6 +687,16 @@ def __init__( signing_certificate_thumbprint: Optional[str] = None, **kwargs ): + """ + :keyword id: Required. A globally unique ID identifying the associated Kubernetes cluster. + :paramtype id: str + :keyword public_signing_key: Required. Certificate that contains the Kubernetes cluster public + key used to verify signing. + :paramtype public_signing_key: str + :keyword signing_certificate_thumbprint: Unique thumbprint returned to customer to verify the + certificate being uploaded. + :paramtype signing_certificate_thumbprint: str + """ super(OnPremiseProperty, self).__init__(**kwargs) self.id = id self.public_signing_key = public_signing_key @@ -687,16 +710,16 @@ class Operation(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the operation being performed on this particular object. - :type name: str - :param display: Required. The localized display information for this particular operation / + :ivar name: Required. The name of the operation being performed on this particular object. + :vartype name: str + :ivar display: Required. The localized display information for this particular operation / action. - :type display: ~azure_arc_data_management_client.models.OperationDisplay + :vartype display: ~azure_arc_data_management_client.models.OperationDisplay :ivar origin: The intended executor of the operation. Possible values include: "user", "system". :vartype origin: str or ~azure_arc_data_management_client.models.OperationOrigin - :param is_data_action: Required. Indicates whether the operation is a data action. - :type is_data_action: bool + :ivar is_data_action: Required. Indicates whether the operation is a data action. + :vartype is_data_action: bool :ivar properties: Additional descriptions for the operation. :vartype properties: dict[str, any] """ @@ -725,6 +748,15 @@ def __init__( is_data_action: bool, **kwargs ): + """ + :keyword name: Required. The name of the operation being performed on this particular object. + :paramtype name: str + :keyword display: Required. The localized display information for this particular operation / + action. + :paramtype display: ~azure_arc_data_management_client.models.OperationDisplay + :keyword is_data_action: Required. Indicates whether the operation is a data action. + :paramtype is_data_action: bool + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -738,15 +770,15 @@ class OperationDisplay(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param provider: Required. The localized friendly form of the resource provider name. - :type provider: str - :param resource: Required. The localized friendly form of the resource type related to this + :ivar provider: Required. The localized friendly form of the resource provider name. + :vartype provider: str + :ivar resource: Required. The localized friendly form of the resource type related to this action/operation. - :type resource: str - :param operation: Required. The localized friendly name for the operation. - :type operation: str - :param description: Required. The localized friendly description for the operation. - :type description: str + :vartype resource: str + :ivar operation: Required. The localized friendly name for the operation. + :vartype operation: str + :ivar description: Required. The localized friendly description for the operation. + :vartype description: str """ _validation = { @@ -772,6 +804,17 @@ def __init__( description: str, **kwargs ): + """ + :keyword provider: Required. The localized friendly form of the resource provider name. + :paramtype provider: str + :keyword resource: Required. The localized friendly form of the resource type related to this + action/operation. + :paramtype resource: str + :keyword operation: Required. The localized friendly name for the operation. + :paramtype operation: str + :keyword description: Required. The localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -804,6 +847,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -812,10 +857,10 @@ def __init__( class PageOfDataControllerResource(msrest.serialization.Model): """PageOfDataControllerResource. - :param value: - :type value: list[~azure_arc_data_management_client.models.DataControllerResource] - :param next_link: Link to retrieve next page of results. - :type next_link: str + :ivar value: + :vartype value: list[~azure_arc_data_management_client.models.DataControllerResource] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str """ _attribute_map = { @@ -830,138 +875,17 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure_arc_data_management_client.models.DataControllerResource] + :keyword next_link: Link to retrieve next page of results. + :paramtype next_link: str + """ super(PageOfDataControllerResource, self).__init__(**kwargs) self.value = value self.next_link = next_link -class Plan(msrest.serialization.Model): - """Plan for the resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. - :type name: str - :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. - NewRelic. - :type publisher: str - :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product - maps to the OfferID specified for the artifact at the time of Data Market onboarding. - :type product: str - :param promotion_code: A publisher provided promotion code as provisioned in Data Market for - the said product/artifact. - :type promotion_code: str - :param version: The version of the desired product/artifact. - :type version: str - """ - - _validation = { - 'name': {'required': True}, - 'publisher': {'required': True}, - 'product': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - *, - name: str, - publisher: str, - product: str, - promotion_code: Optional[str] = None, - version: Optional[str] = None, - **kwargs - ): - super(Plan, self).__init__(**kwargs) - self.name = name - self.publisher = publisher - self.product = product - self.promotion_code = promotion_code - self.version = version - - -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. - :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) - - -class ResourceSku(msrest.serialization.Model): - """ResourceSku. - - :param capacity: - :type capacity: int - :param family: - :type family: str - :param name: - :type name: str - :param size: - :type size: str - :param tier: - :type tier: str - """ - - _attribute_map = { - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - *, - capacity: Optional[int] = None, - family: Optional[str] = None, - name: Optional[str] = None, - size: Optional[str] = None, - tier: Optional[str] = None, - **kwargs - ): - super(ResourceSku, self).__init__(**kwargs) - self.capacity = capacity - self.family = family - self.name = name - self.size = size - self.tier = tier - - class SqlManagedInstance(TrackedResource): """A SqlManagedInstance. @@ -969,34 +893,35 @@ class SqlManagedInstance(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar system_data: Read only system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure_arc_data_management_client.models.SystemData - :param properties: Required. null. - :type properties: ~azure_arc_data_management_client.models.SqlManagedInstanceProperties - :param extended_location: The extendedLocation of the resource. - :type extended_location: ~azure_arc_data_management_client.models.ExtendedLocation - :param sku: Resource sku. - :type sku: ~azure_arc_data_management_client.models.SqlManagedInstanceSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar properties: Required. null. + :vartype properties: ~azure_arc_data_management_client.models.SqlManagedInstanceProperties + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure_arc_data_management_client.models.ExtendedLocation + :ivar sku: Resource sku. + :vartype sku: ~azure_arc_data_management_client.models.SqlManagedInstanceSku """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'required': True}, 'system_data': {'readonly': True}, + 'location': {'required': True}, 'properties': {'required': True}, } @@ -1004,9 +929,9 @@ class SqlManagedInstance(TrackedResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'properties': {'key': 'properties', 'type': 'SqlManagedInstanceProperties'}, 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, 'sku': {'key': 'sku', 'type': 'SqlManagedInstanceSku'}, @@ -1022,6 +947,18 @@ def __init__( sku: Optional["SqlManagedInstanceSku"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword properties: Required. null. + :paramtype properties: ~azure_arc_data_management_client.models.SqlManagedInstanceProperties + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure_arc_data_management_client.models.ExtendedLocation + :keyword sku: Resource sku. + :paramtype sku: ~azure_arc_data_management_client.models.SqlManagedInstanceSku + """ super(SqlManagedInstance, self).__init__(tags=tags, location=location, **kwargs) self.properties = properties self.extended_location = extended_location @@ -1031,11 +968,11 @@ def __init__( class SqlManagedInstanceK8SRaw(msrest.serialization.Model): """The raw kubernetes information. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param spec: The kubernetes spec information. - :type spec: ~azure_arc_data_management_client.models.SqlManagedInstanceK8SSpec + :vartype additional_properties: dict[str, any] + :ivar spec: The kubernetes spec information. + :vartype spec: ~azure_arc_data_management_client.models.SqlManagedInstanceK8SSpec """ _attribute_map = { @@ -1050,6 +987,13 @@ def __init__( spec: Optional["SqlManagedInstanceK8SSpec"] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword spec: The kubernetes spec information. + :paramtype spec: ~azure_arc_data_management_client.models.SqlManagedInstanceK8SSpec + """ super(SqlManagedInstanceK8SRaw, self).__init__(**kwargs) self.additional_properties = additional_properties self.spec = spec @@ -1058,16 +1002,16 @@ def __init__( class SqlManagedInstanceK8SSpec(msrest.serialization.Model): """The kubernetes spec information. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param scheduling: The kubernetes scheduling information. - :type scheduling: ~azure_arc_data_management_client.models.K8SScheduling - :param replicas: This option specifies the number of SQL Managed Instance replicas that will be + :vartype additional_properties: dict[str, any] + :ivar scheduling: The kubernetes scheduling information. + :vartype scheduling: ~azure_arc_data_management_client.models.K8SScheduling + :ivar replicas: This option specifies the number of SQL Managed Instance replicas that will be deployed in your Kubernetes cluster for high availability purposes. If sku.tier is BusinessCritical, allowed values are '2' or '3' with default of '3'. If sku.tier is GeneralPurpose, replicas must be '1'. - :type replicas: int + :vartype replicas: int """ _attribute_map = { @@ -1084,6 +1028,18 @@ def __init__( replicas: Optional[int] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword scheduling: The kubernetes scheduling information. + :paramtype scheduling: ~azure_arc_data_management_client.models.K8SScheduling + :keyword replicas: This option specifies the number of SQL Managed Instance replicas that will + be deployed in your Kubernetes cluster for high availability purposes. If sku.tier is + BusinessCritical, allowed values are '2' or '3' with default of '3'. If sku.tier is + GeneralPurpose, replicas must be '1'. + :paramtype replicas: int + """ super(SqlManagedInstanceK8SSpec, self).__init__(**kwargs) self.additional_properties = additional_properties self.scheduling = scheduling @@ -1115,6 +1071,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlManagedInstanceListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1125,33 +1083,34 @@ class SqlManagedInstanceProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param data_controller_id: null. - :type data_controller_id: str - :param admin: The instance admin user. - :type admin: str - :param start_time: The instance start time. - :type start_time: str - :param end_time: The instance end time. - :type end_time: str - :param k8_s_raw: The raw kubernetes information. - :type k8_s_raw: ~azure_arc_data_management_client.models.SqlManagedInstanceK8SRaw - :param basic_login_information: Username and password for basic authentication. - :type basic_login_information: ~azure_arc_data_management_client.models.BasicLoginInformation - :param last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current date + :ivar data_controller_id: null. + :vartype data_controller_id: str + :ivar admin: The instance admin user. + :vartype admin: str + :ivar start_time: The instance start time. + :vartype start_time: str + :ivar end_time: The instance end time. + :vartype end_time: str + :ivar k8_s_raw: The raw kubernetes information. + :vartype k8_s_raw: ~azure_arc_data_management_client.models.SqlManagedInstanceK8SRaw + :ivar basic_login_information: Username and password for basic authentication. + :vartype basic_login_information: + ~azure_arc_data_management_client.models.BasicLoginInformation + :ivar last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current date time. - :type last_uploaded_date: ~datetime.datetime + :vartype last_uploaded_date: ~datetime.datetime :ivar provisioning_state: :vartype provisioning_state: str - :param license_type: The license type to apply for this managed instance. Possible values + :ivar license_type: The license type to apply for this managed instance. Possible values include: "BasePrice", "LicenseIncluded". Default value: "BasePrice". - :type license_type: str or + :vartype license_type: str or ~azure_arc_data_management_client.models.ArcSqlManagedInstanceLicenseType - :param cluster_id: If a CustomLocation is provided, this contains the ARM id of the connected + :ivar cluster_id: If a CustomLocation is provided, this contains the ARM id of the connected cluster the custom location belongs to. - :type cluster_id: str - :param extension_id: If a CustomLocation is provided, this contains the ARM id of the extension + :vartype cluster_id: str + :ivar extension_id: If a CustomLocation is provided, this contains the ARM id of the extension the custom location belongs to. - :type extension_id: str + :vartype extension_id: str """ _validation = { @@ -1187,6 +1146,34 @@ def __init__( extension_id: Optional[str] = None, **kwargs ): + """ + :keyword data_controller_id: null. + :paramtype data_controller_id: str + :keyword admin: The instance admin user. + :paramtype admin: str + :keyword start_time: The instance start time. + :paramtype start_time: str + :keyword end_time: The instance end time. + :paramtype end_time: str + :keyword k8_s_raw: The raw kubernetes information. + :paramtype k8_s_raw: ~azure_arc_data_management_client.models.SqlManagedInstanceK8SRaw + :keyword basic_login_information: Username and password for basic authentication. + :paramtype basic_login_information: + ~azure_arc_data_management_client.models.BasicLoginInformation + :keyword last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current + date time. + :paramtype last_uploaded_date: ~datetime.datetime + :keyword license_type: The license type to apply for this managed instance. Possible values + include: "BasePrice", "LicenseIncluded". Default value: "BasePrice". + :paramtype license_type: str or + ~azure_arc_data_management_client.models.ArcSqlManagedInstanceLicenseType + :keyword cluster_id: If a CustomLocation is provided, this contains the ARM id of the connected + cluster the custom location belongs to. + :paramtype cluster_id: str + :keyword extension_id: If a CustomLocation is provided, this contains the ARM id of the + extension the custom location belongs to. + :paramtype extension_id: str + """ super(SqlManagedInstanceProperties, self).__init__(**kwargs) self.data_controller_id = data_controller_id self.admin = admin @@ -1210,19 +1197,19 @@ class SqlManagedInstanceSku(msrest.serialization.Model): :ivar name: The name of the SKU. Has constant value: "vCore". :vartype name: str - :param tier: The pricing tier for the instance. Possible values include: "GeneralPurpose", + :ivar tier: The pricing tier for the instance. Possible values include: "GeneralPurpose", "BusinessCritical". Default value: "GeneralPurpose". - :type tier: str or ~azure_arc_data_management_client.models.SqlManagedInstanceSkuTier - :param dev: Whether dev/test is enabled. When the dev field is set to true, the resource is - used for dev/test purpose. - :type dev: bool - :param size: The SKU size. When the name field is the combination of tier and some other value, + :vartype tier: str or ~azure_arc_data_management_client.models.SqlManagedInstanceSkuTier + :ivar dev: Whether dev/test is enabled. When the dev field is set to true, the resource is used + for dev/test purpose. + :vartype dev: bool + :ivar size: The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. - :type size: str - :param family: - :type family: str - :param capacity: - :type capacity: int + :vartype size: str + :ivar family: + :vartype family: str + :ivar capacity: + :vartype capacity: int """ _validation = { @@ -1250,6 +1237,21 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword tier: The pricing tier for the instance. Possible values include: "GeneralPurpose", + "BusinessCritical". Default value: "GeneralPurpose". + :paramtype tier: str or ~azure_arc_data_management_client.models.SqlManagedInstanceSkuTier + :keyword dev: Whether dev/test is enabled. When the dev field is set to true, the resource is + used for dev/test purpose. + :paramtype dev: bool + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword family: + :paramtype family: str + :keyword capacity: + :paramtype capacity: int + """ super(SqlManagedInstanceSku, self).__init__(**kwargs) self.tier = tier self.dev = dev @@ -1261,8 +1263,8 @@ def __init__( class SqlManagedInstanceUpdate(msrest.serialization.Model): """An update to a SQL Managed Instance. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1275,6 +1277,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(SqlManagedInstanceUpdate, self).__init__(**kwargs) self.tags = tags @@ -1286,39 +1292,40 @@ class SqlServerInstance(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or - Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar system_data: Read only system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure_arc_data_management_client.models.SystemData - :param properties: null. - :type properties: ~azure_arc_data_management_client.models.SqlServerInstanceProperties + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar properties: null. + :vartype properties: ~azure_arc_data_management_client.models.SqlServerInstanceProperties """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'required': True}, 'system_data': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'properties': {'key': 'properties', 'type': 'SqlServerInstanceProperties'}, } @@ -1330,6 +1337,14 @@ def __init__( properties: Optional["SqlServerInstanceProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword properties: null. + :paramtype properties: ~azure_arc_data_management_client.models.SqlServerInstanceProperties + """ super(SqlServerInstance, self).__init__(tags=tags, location=location, **kwargs) self.properties = properties @@ -1359,6 +1374,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlServerInstanceListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1371,44 +1388,44 @@ class SqlServerInstanceProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: SQL Server version. Possible values include: "SQL Server 2019", "SQL Server + :ivar version: SQL Server version. Possible values include: "SQL Server 2019", "SQL Server 2017", "SQL Server 2016". - :type version: str or ~azure_arc_data_management_client.models.SqlVersion - :param edition: SQL Server edition. Possible values include: "Evaluation", "Enterprise", + :vartype version: str or ~azure_arc_data_management_client.models.SqlVersion + :ivar edition: SQL Server edition. Possible values include: "Evaluation", "Enterprise", "Standard", "Web", "Developer", "Express". - :type edition: str or ~azure_arc_data_management_client.models.EditionType - :param container_resource_id: Required. ARM Resource id of the container resource (Azure Arc - for Servers). - :type container_resource_id: str + :vartype edition: str or ~azure_arc_data_management_client.models.EditionType + :ivar container_resource_id: Required. ARM Resource id of the container resource (Azure Arc for + Servers). + :vartype container_resource_id: str :ivar create_time: The time when the resource was created. :vartype create_time: str - :param v_core: The number of logical processors used by the SQL Server instance. - :type v_core: str - :param status: Required. The cloud connectivity status. Possible values include: "Connected", + :ivar v_core: The number of logical processors used by the SQL Server instance. + :vartype v_core: str + :ivar status: Required. The cloud connectivity status. Possible values include: "Connected", "Disconnected", "Unknown". - :type status: str or ~azure_arc_data_management_client.models.ConnectionStatus - :param patch_level: SQL Server update level. - :type patch_level: str - :param collation: SQL Server collation. - :type collation: str - :param current_version: SQL Server current version. - :type current_version: str - :param instance_name: SQL Server instance name. - :type instance_name: str - :param tcp_dynamic_ports: Dynamic TCP ports used by SQL Server. - :type tcp_dynamic_ports: str - :param tcp_static_ports: Static TCP ports used by SQL Server. - :type tcp_static_ports: str - :param product_id: SQL Server product ID. - :type product_id: str - :param license_type: SQL Server license type. Possible values include: "Paid", "Free", "HADR", + :vartype status: str or ~azure_arc_data_management_client.models.ConnectionStatus + :ivar patch_level: SQL Server update level. + :vartype patch_level: str + :ivar collation: SQL Server collation. + :vartype collation: str + :ivar current_version: SQL Server current version. + :vartype current_version: str + :ivar instance_name: SQL Server instance name. + :vartype instance_name: str + :ivar tcp_dynamic_ports: Dynamic TCP ports used by SQL Server. + :vartype tcp_dynamic_ports: str + :ivar tcp_static_ports: Static TCP ports used by SQL Server. + :vartype tcp_static_ports: str + :ivar product_id: SQL Server product ID. + :vartype product_id: str + :ivar license_type: SQL Server license type. Possible values include: "Paid", "Free", "HADR", "Undefined". - :type license_type: str or ~azure_arc_data_management_client.models.ArcSqlServerLicenseType - :param azure_defender_status_last_updated: Timestamp of last Azure Defender status update. - :type azure_defender_status_last_updated: ~datetime.datetime - :param azure_defender_status: Status of Azure Defender. Possible values include: "Protected", + :vartype license_type: str or ~azure_arc_data_management_client.models.ArcSqlServerLicenseType + :ivar azure_defender_status_last_updated: Timestamp of last Azure Defender status update. + :vartype azure_defender_status_last_updated: ~datetime.datetime + :ivar azure_defender_status: Status of Azure Defender. Possible values include: "Protected", "Unprotected", "Unknown". - :type azure_defender_status: str or ~azure_arc_data_management_client.models.DefenderStatus + :vartype azure_defender_status: str or ~azure_arc_data_management_client.models.DefenderStatus :ivar provisioning_state: :vartype provisioning_state: str """ @@ -1460,6 +1477,46 @@ def __init__( azure_defender_status: Optional[Union[str, "DefenderStatus"]] = None, **kwargs ): + """ + :keyword version: SQL Server version. Possible values include: "SQL Server 2019", "SQL Server + 2017", "SQL Server 2016". + :paramtype version: str or ~azure_arc_data_management_client.models.SqlVersion + :keyword edition: SQL Server edition. Possible values include: "Evaluation", "Enterprise", + "Standard", "Web", "Developer", "Express". + :paramtype edition: str or ~azure_arc_data_management_client.models.EditionType + :keyword container_resource_id: Required. ARM Resource id of the container resource (Azure Arc + for Servers). + :paramtype container_resource_id: str + :keyword v_core: The number of logical processors used by the SQL Server instance. + :paramtype v_core: str + :keyword status: Required. The cloud connectivity status. Possible values include: "Connected", + "Disconnected", "Unknown". + :paramtype status: str or ~azure_arc_data_management_client.models.ConnectionStatus + :keyword patch_level: SQL Server update level. + :paramtype patch_level: str + :keyword collation: SQL Server collation. + :paramtype collation: str + :keyword current_version: SQL Server current version. + :paramtype current_version: str + :keyword instance_name: SQL Server instance name. + :paramtype instance_name: str + :keyword tcp_dynamic_ports: Dynamic TCP ports used by SQL Server. + :paramtype tcp_dynamic_ports: str + :keyword tcp_static_ports: Static TCP ports used by SQL Server. + :paramtype tcp_static_ports: str + :keyword product_id: SQL Server product ID. + :paramtype product_id: str + :keyword license_type: SQL Server license type. Possible values include: "Paid", "Free", + "HADR", "Undefined". + :paramtype license_type: str or + ~azure_arc_data_management_client.models.ArcSqlServerLicenseType + :keyword azure_defender_status_last_updated: Timestamp of last Azure Defender status update. + :paramtype azure_defender_status_last_updated: ~datetime.datetime + :keyword azure_defender_status: Status of Azure Defender. Possible values include: "Protected", + "Unprotected", "Unknown". + :paramtype azure_defender_status: str or + ~azure_arc_data_management_client.models.DefenderStatus + """ super(SqlServerInstanceProperties, self).__init__(**kwargs) self.version = version self.edition = edition @@ -1483,8 +1540,8 @@ def __init__( class SqlServerInstanceUpdate(msrest.serialization.Model): """An update to a SQL Server Instance. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1497,27 +1554,31 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(SqlServerInstanceUpdate, self).__init__(**kwargs) self.tags = tags class SystemData(msrest.serialization.Model): - """Read only system data. - - :param created_by: An identifier for the identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_arc_data_management_client.models.IdentityType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: An identifier for the identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + """Metadata pertaining to creation and last modification of the resource. + + :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_arc_data_management_client.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_arc_data_management_client.models.IdentityType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure_arc_data_management_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1533,13 +1594,29 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "IdentityType"]] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "IdentityType"]] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure_arc_data_management_client.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure_arc_data_management_client.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -1552,15 +1629,15 @@ def __init__( class UploadServicePrincipal(msrest.serialization.Model): """Service principal for uploading billing, metrics and logs. - :param client_id: Client ID of the service principal for uploading data. - :type client_id: str - :param tenant_id: Tenant ID of the service principal. - :type tenant_id: str - :param authority: Authority for the service principal. Example: + :ivar client_id: Client ID of the service principal for uploading data. + :vartype client_id: str + :ivar tenant_id: Tenant ID of the service principal. + :vartype tenant_id: str + :ivar authority: Authority for the service principal. Example: https://login.microsoftonline.com/. - :type authority: str - :param client_secret: Secret of the service principal. - :type client_secret: str + :vartype authority: str + :ivar client_secret: Secret of the service principal. + :vartype client_secret: str """ _attribute_map = { @@ -1579,6 +1656,17 @@ def __init__( client_secret: Optional[str] = None, **kwargs ): + """ + :keyword client_id: Client ID of the service principal for uploading data. + :paramtype client_id: str + :keyword tenant_id: Tenant ID of the service principal. + :paramtype tenant_id: str + :keyword authority: Authority for the service principal. Example: + https://login.microsoftonline.com/. + :paramtype authority: str + :keyword client_secret: Secret of the service principal. + :paramtype client_secret: str + """ super(UploadServicePrincipal, self).__init__(**kwargs) self.client_id = client_id self.tenant_id = tenant_id @@ -1589,15 +1677,14 @@ def __init__( class UploadWatermark(msrest.serialization.Model): """Properties on upload watermark. Mostly timestamp for each upload data type. - :param metrics: Last uploaded date for metrics from kubernetes cluster. Defaults to current - date time. - :type metrics: ~datetime.datetime - :param logs: Last uploaded date for logs from kubernetes cluster. Defaults to current date + :ivar metrics: Last uploaded date for metrics from kubernetes cluster. Defaults to current date time. - :type logs: ~datetime.datetime - :param usages: Last uploaded date for usages from kubernetes cluster. Defaults to current date + :vartype metrics: ~datetime.datetime + :ivar logs: Last uploaded date for logs from kubernetes cluster. Defaults to current date time. + :vartype logs: ~datetime.datetime + :ivar usages: Last uploaded date for usages from kubernetes cluster. Defaults to current date time. - :type usages: ~datetime.datetime + :vartype usages: ~datetime.datetime """ _attribute_map = { @@ -1614,6 +1701,17 @@ def __init__( usages: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword metrics: Last uploaded date for metrics from kubernetes cluster. Defaults to current + date time. + :paramtype metrics: ~datetime.datetime + :keyword logs: Last uploaded date for logs from kubernetes cluster. Defaults to current date + time. + :paramtype logs: ~datetime.datetime + :keyword usages: Last uploaded date for usages from kubernetes cluster. Defaults to current + date time. + :paramtype usages: ~datetime.datetime + """ super(UploadWatermark, self).__init__(**kwargs) self.metrics = metrics self.logs = logs diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py index 301f241c855a..e29d9d58c102 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py @@ -5,25 +5,250 @@ # 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_in_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers') + 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] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_in_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers') + 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') + + # 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_put_data_controller_request_initial( + subscription_id: str, + resource_group_name: str, + data_controller_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "dataControllerName": _SERIALIZER.url("data_controller_name", data_controller_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_data_controller_request_initial( + subscription_id: str, + resource_group_name: str, + data_controller_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "dataControllerName": _SERIALIZER.url("data_controller_name", data_controller_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_get_data_controller_request( + subscription_id: str, + resource_group_name: str, + data_controller_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "dataControllerName": _SERIALIZER.url("data_controller_name", data_controller_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_patch_data_controller_request( + subscription_id: str, + resource_group_name: str, + data_controller_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "dataControllerName": _SERIALIZER.url("data_controller_name", data_controller_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 + ) class DataControllersOperations(object): """DataControllersOperations operations. @@ -47,18 +272,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_in_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PageOfDataControllerResource"] + **kwargs: Any + ) -> Iterable["_models.PageOfDataControllerResource"]: """List dataController resources in the subscription. List dataController resources in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PageOfDataControllerResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] + :return: An iterator like instance of either PageOfDataControllerResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PageOfDataControllerResource"] @@ -66,34 +293,29 @@ def list_in_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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_in_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_in_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_in_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_in_subscription_request( + subscription_id=self._config.subscription_id, + 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('PageOfDataControllerResource', pipeline_response) + deserialized = self._deserialize("PageOfDataControllerResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,23 +328,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_in_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/dataControllers'} # type: ignore + @distributed_trace def list_in_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PageOfDataControllerResource"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.PageOfDataControllerResource"]: """List dataController resources in the resource group. List dataController resources in the resource group. @@ -130,8 +353,10 @@ def list_in_group( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PageOfDataControllerResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] + :return: An iterator like instance of either PageOfDataControllerResource or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PageOfDataControllerResource"] @@ -139,35 +364,31 @@ def list_in_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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_in_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_in_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_in_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_in_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('PageOfDataControllerResource', pipeline_response) + deserialized = self._deserialize("PageOfDataControllerResource", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,12 +401,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -193,50 +415,38 @@ def get_next(next_link=None): def _put_data_controller_initial( self, - resource_group_name, # type: str - data_controller_name, # type: str - data_controller_resource, # type: "_models.DataControllerResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataControllerResource" + resource_group_name: str, + data_controller_name: str, + data_controller_resource: "_models.DataControllerResource", + **kwargs: Any + ) -> "_models.DataControllerResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataControllerResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._put_data_controller_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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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(data_controller_resource, 'DataControllerResource') + + request = build_put_data_controller_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + content_type=content_type, + json=_json, + template_url=self._put_data_controller_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(data_controller_resource, 'DataControllerResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DataControllerResource', pipeline_response) @@ -248,16 +458,18 @@ def _put_data_controller_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _put_data_controller_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + @distributed_trace def begin_put_data_controller( self, - resource_group_name, # type: str - data_controller_name, # type: str - data_controller_resource, # type: "_models.DataControllerResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataControllerResource"] + resource_group_name: str, + data_controller_name: str, + data_controller_resource: "_models.DataControllerResource", + **kwargs: Any + ) -> LROPoller["_models.DataControllerResource"]: """Creates or replaces a dataController resource. :param resource_group_name: The name of the Azure resource group. @@ -268,15 +480,20 @@ def begin_put_data_controller( :type data_controller_resource: ~azure_arc_data_management_client.models.DataControllerResource :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 DataControllerResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure_arc_data_management_client.models.DataControllerResource] - :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 LROPoller that returns either DataControllerResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure_arc_data_management_client.models.DataControllerResource] + :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.DataControllerResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -288,27 +505,21 @@ def begin_put_data_controller( resource_group_name=resource_group_name, data_controller_name=data_controller_name, data_controller_resource=data_controller_resource, + 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('DataControllerResource', 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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -320,61 +531,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_put_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore def _delete_data_controller_initial( self, - resource_group_name, # type: str - data_controller_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + data_controller_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-11-01" - accept = "application/json" - - # Construct URL - url = self._delete_data_controller_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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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_data_controller_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + template_url=self._delete_data_controller_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_data_controller_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + @distributed_trace def begin_delete_data_controller( self, - resource_group_name, # type: str - data_controller_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + data_controller_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a dataController resource. :param resource_group_name: The name of the Azure resource group. @@ -383,15 +584,17 @@ def begin_delete_data_controller( :type data_controller_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', @@ -405,21 +608,14 @@ def begin_delete_data_controller( 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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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: @@ -431,15 +627,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + @distributed_trace def get_data_controller( self, - resource_group_name, # type: str - data_controller_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataControllerResource" + resource_group_name: str, + data_controller_name: str, + **kwargs: Any + ) -> "_models.DataControllerResource": """Retrieves a dataController resource. :param resource_group_name: The name of the Azure resource group. @@ -456,33 +653,23 @@ def get_data_controller( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - accept = "application/json" - - # Construct URL - url = self.get_data_controller.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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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_data_controller_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + template_url=self.get_data_controller.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataControllerResource', pipeline_response) @@ -491,16 +678,18 @@ def get_data_controller( return cls(pipeline_response, deserialized, {}) return deserialized + get_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + @distributed_trace def patch_data_controller( self, - resource_group_name, # type: str - data_controller_name, # type: str - data_controller_resource, # type: "_models.DataControllerUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataControllerResource" + resource_group_name: str, + data_controller_name: str, + data_controller_resource: "_models.DataControllerUpdate", + **kwargs: Any + ) -> "_models.DataControllerResource": """Updates a dataController resource. :param resource_group_name: The name of the Azure resource group. @@ -519,38 +708,28 @@ def patch_data_controller( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.patch_data_controller.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'), - 'dataControllerName': self._serialize.url("data_controller_name", data_controller_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(data_controller_resource, 'DataControllerUpdate') - # 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_patch_data_controller_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + content_type=content_type, + json=_json, + template_url=self.patch_data_controller.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(data_controller_resource, 'DataControllerUpdate') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataControllerResource', pipeline_response) @@ -559,4 +738,6 @@ def patch_data_controller( return cls(pipeline_response, deserialized, {}) return deserialized + patch_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_operations.py index 5383f5f48288..d9d27aba7f2a 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/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-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AzureArcData/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,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Azure Data Services on Azure Arc API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +123,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py index cde261e6d94f..f066ec4c63de 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py @@ -5,25 +5,250 @@ # 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_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlManagedInstances') + 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] + 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_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances') + 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') + + # 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, + sql_managed_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sqlManagedInstanceName": _SERIALIZER.url("sql_managed_instance_name", sql_managed_instance_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_request_initial( + subscription_id: str, + resource_group_name: str, + sql_managed_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sqlManagedInstanceName": _SERIALIZER.url("sql_managed_instance_name", sql_managed_instance_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, + sql_managed_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sqlManagedInstanceName": _SERIALIZER.url("sql_managed_instance_name", sql_managed_instance_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( + subscription_id: str, + resource_group_name: str, + sql_managed_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sqlManagedInstanceName": _SERIALIZER.url("sql_managed_instance_name", sql_managed_instance_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 + ) class SqlManagedInstancesOperations(object): """SqlManagedInstancesOperations operations. @@ -47,18 +272,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlManagedInstanceListResult"] + **kwargs: Any + ) -> Iterable["_models.SqlManagedInstanceListResult"]: """List sqlManagedInstance resources in the subscription. List sqlManagedInstance resources in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlManagedInstanceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.SqlManagedInstanceListResult] + :return: An iterator like instance of either SqlManagedInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.SqlManagedInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstanceListResult"] @@ -66,34 +293,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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 - 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('SqlManagedInstanceListResult', pipeline_response) + deserialized = self._deserialize("SqlManagedInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,23 +328,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlManagedInstances'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlManagedInstanceListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SqlManagedInstanceListResult"]: """List sqlManagedInstance resources in the resource group. Gets all sqlManagedInstances in a resource group. @@ -130,8 +353,10 @@ def list_by_resource_group( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlManagedInstanceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.SqlManagedInstanceListResult] + :return: An iterator like instance of either SqlManagedInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.SqlManagedInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstanceListResult"] @@ -139,35 +364,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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') - - 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, + 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, + 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('SqlManagedInstanceListResult', pipeline_response) + deserialized = self._deserialize("SqlManagedInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,24 +401,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - sql_managed_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlManagedInstance" + resource_group_name: str, + sql_managed_instance_name: str, + **kwargs: Any + ) -> "_models.SqlManagedInstance": """Retrieves a SQL Managed Instance resource. :param resource_group_name: The name of the Azure resource group. @@ -214,33 +436,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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, + sql_managed_instance_name=sql_managed_instance_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlManagedInstance', pipeline_response) @@ -249,54 +461,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - sql_managed_instance_name, # type: str - sql_managed_instance, # type: "_models.SqlManagedInstance" - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlManagedInstance" + resource_group_name: str, + sql_managed_instance_name: str, + sql_managed_instance: "_models.SqlManagedInstance", + **kwargs: Any + ) -> "_models.SqlManagedInstance": cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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(sql_managed_instance, 'SqlManagedInstance') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + content_type=content_type, + json=_json, + template_url=self._create_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(sql_managed_instance, 'SqlManagedInstance') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('SqlManagedInstance', pipeline_response) @@ -308,16 +510,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - sql_managed_instance_name, # type: str - sql_managed_instance, # type: "_models.SqlManagedInstance" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SqlManagedInstance"] + resource_group_name: str, + sql_managed_instance_name: str, + sql_managed_instance: "_models.SqlManagedInstance", + **kwargs: Any + ) -> LROPoller["_models.SqlManagedInstance"]: """Creates or replaces a SQL Managed Instance resource. :param resource_group_name: The name of the Azure resource group. @@ -328,15 +532,20 @@ def begin_create( :type sql_managed_instance: ~azure_arc_data_management_client.models.SqlManagedInstance :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 SqlManagedInstance or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure_arc_data_management_client.models.SqlManagedInstance] - :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 LROPoller that returns either SqlManagedInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure_arc_data_management_client.models.SqlManagedInstance] + :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.SqlManagedInstance"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +557,21 @@ def begin_create( resource_group_name=resource_group_name, sql_managed_instance_name=sql_managed_instance_name, sql_managed_instance=sql_managed_instance, + 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('SqlManagedInstance', 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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,61 +583,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - sql_managed_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + sql_managed_instance_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-11-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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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, + sql_managed_instance_name=sql_managed_instance_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - sql_managed_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + sql_managed_instance_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a SQL Managed Instance resource. :param resource_group_name: The name of the Azure resource group. @@ -443,15 +636,17 @@ def begin_delete( :type sql_managed_instance_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', @@ -465,21 +660,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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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: @@ -491,16 +679,17 @@ 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.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - sql_managed_instance_name, # type: str - parameters, # type: "_models.SqlManagedInstanceUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlManagedInstance" + resource_group_name: str, + sql_managed_instance_name: str, + parameters: "_models.SqlManagedInstanceUpdate", + **kwargs: Any + ) -> "_models.SqlManagedInstance": """Updates a SQL Managed Instance resource. :param resource_group_name: The name of the Azure resource group. @@ -519,38 +708,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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'), - 'sqlManagedInstanceName': self._serialize.url("sql_managed_instance_name", sql_managed_instance_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(parameters, 'SqlManagedInstanceUpdate') - # 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sql_managed_instance_name=sql_managed_instance_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlManagedInstanceUpdate') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlManagedInstance', pipeline_response) @@ -559,4 +738,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py index a350c5729774..d66970d9b040 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py @@ -5,25 +5,250 @@ # 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_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerInstances') + 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] + 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_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances') + 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') + + # 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, + sql_server_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sqlServerInstanceName": _SERIALIZER.url("sql_server_instance_name", sql_server_instance_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_request_initial( + subscription_id: str, + resource_group_name: str, + sql_server_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sqlServerInstanceName": _SERIALIZER.url("sql_server_instance_name", sql_server_instance_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, + sql_server_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sqlServerInstanceName": _SERIALIZER.url("sql_server_instance_name", sql_server_instance_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( + subscription_id: str, + resource_group_name: str, + sql_server_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "sqlServerInstanceName": _SERIALIZER.url("sql_server_instance_name", sql_server_instance_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 + ) class SqlServerInstancesOperations(object): """SqlServerInstancesOperations operations. @@ -47,18 +272,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlServerInstanceListResult"] + **kwargs: Any + ) -> Iterable["_models.SqlServerInstanceListResult"]: """List sqlServerInstance resources in the subscription. List sqlServerInstance resources in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlServerInstanceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.SqlServerInstanceListResult] + :return: An iterator like instance of either SqlServerInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.SqlServerInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstanceListResult"] @@ -66,34 +293,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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 - 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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + 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('SqlServerInstanceListResult', pipeline_response) + deserialized = self._deserialize("SqlServerInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,23 +328,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/sqlServerInstances'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlServerInstanceListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.SqlServerInstanceListResult"]: """List sqlServerInstance resources in the resource group. Gets all sqlServerInstances in a resource group. @@ -130,8 +353,10 @@ def list_by_resource_group( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlServerInstanceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.SqlServerInstanceListResult] + :return: An iterator like instance of either SqlServerInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.SqlServerInstanceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstanceListResult"] @@ -139,35 +364,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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') - - 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, + 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, + 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('SqlServerInstanceListResult', pipeline_response) + deserialized = self._deserialize("SqlServerInstanceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,24 +401,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - sql_server_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlServerInstance" + resource_group_name: str, + sql_server_instance_name: str, + **kwargs: Any + ) -> "_models.SqlServerInstance": """Retrieves a SQL Server Instance resource. :param resource_group_name: The name of the Azure resource group. @@ -214,33 +436,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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, + sql_server_instance_name=sql_server_instance_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlServerInstance', pipeline_response) @@ -249,54 +461,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - sql_server_instance_name, # type: str - sql_server_instance, # type: "_models.SqlServerInstance" - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlServerInstance" + resource_group_name: str, + sql_server_instance_name: str, + sql_server_instance: "_models.SqlServerInstance", + **kwargs: Any + ) -> "_models.SqlServerInstance": cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstance"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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(sql_server_instance, 'SqlServerInstance') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + content_type=content_type, + json=_json, + template_url=self._create_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(sql_server_instance, 'SqlServerInstance') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('SqlServerInstance', pipeline_response) @@ -308,16 +510,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - sql_server_instance_name, # type: str - sql_server_instance, # type: "_models.SqlServerInstance" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SqlServerInstance"] + resource_group_name: str, + sql_server_instance_name: str, + sql_server_instance: "_models.SqlServerInstance", + **kwargs: Any + ) -> LROPoller["_models.SqlServerInstance"]: """Creates or replaces a SQL Server Instance resource. :param resource_group_name: The name of the Azure resource group. @@ -328,15 +532,20 @@ def begin_create( :type sql_server_instance: ~azure_arc_data_management_client.models.SqlServerInstance :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 SqlServerInstance or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure_arc_data_management_client.models.SqlServerInstance] - :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 LROPoller that returns either SqlServerInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure_arc_data_management_client.models.SqlServerInstance] + :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.SqlServerInstance"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +557,21 @@ def begin_create( resource_group_name=resource_group_name, sql_server_instance_name=sql_server_instance_name, sql_server_instance=sql_server_instance, + 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('SqlServerInstance', 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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,61 +583,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - sql_server_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + sql_server_instance_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-11-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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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, + sql_server_instance_name=sql_server_instance_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - sql_server_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + sql_server_instance_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a SQL Server Instance resource. :param resource_group_name: The name of the Azure resource group. @@ -443,15 +636,17 @@ def begin_delete( :type sql_server_instance_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', @@ -465,21 +660,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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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: @@ -491,16 +679,17 @@ 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.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - sql_server_instance_name, # type: str - parameters, # type: "_models.SqlServerInstanceUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlServerInstance" + resource_group_name: str, + sql_server_instance_name: str, + parameters: "_models.SqlServerInstanceUpdate", + **kwargs: Any + ) -> "_models.SqlServerInstance": """Updates a SQL Server Instance resource. :param resource_group_name: The name of the Azure resource group. @@ -519,38 +708,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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'), - 'sqlServerInstanceName': self._serialize.url("sql_server_instance_name", sql_server_instance_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(parameters, 'SqlServerInstanceUpdate') - # 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + sql_server_instance_name=sql_server_instance_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlServerInstanceUpdate') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlServerInstance', pipeline_response) @@ -559,4 +738,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore +