From 1696fe855c9e56e5eb9e54a1c70eb788c8350b7a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 12 Apr 2022 03:13:01 +0000 Subject: [PATCH] CodeGen from PR 18588 in Azure/azure-rest-api-specs Active Directory connector automatic mode properties (#18588) * Active Directory connector automatic mode properties * fixed capitalization * adding new property to examples --- .../azure-mgmt-azurearcdata/_meta.json | 10 +- .../azure/mgmt/azurearcdata/__init__.py | 9 +- .../_azure_arc_data_management_client.py | 108 +- .../azure/mgmt/azurearcdata/_configuration.py | 21 +- .../azure/mgmt/azurearcdata/_metadata.json | 29 +- .../azure/mgmt/azurearcdata/_patch.py | 31 + .../azure/mgmt/azurearcdata/_vendor.py | 27 + .../azure/mgmt/azurearcdata/_version.py | 2 +- .../azure/mgmt/azurearcdata/aio/__init__.py | 5 + .../aio/_azure_arc_data_management_client.py | 95 +- .../mgmt/azurearcdata/aio/_configuration.py | 8 +- .../azure/mgmt/azurearcdata/aio/_patch.py | 31 + .../azurearcdata/aio/operations/__init__.py | 4 + ..._active_directory_connectors_operations.py | 413 ++++ .../_data_controllers_operations.py | 341 ++- .../aio/operations/_operations.py | 49 +- .../_postgres_instances_operations.py | 518 +++++ .../_sql_managed_instances_operations.py | 328 ++- .../_sql_server_instances_operations.py | 328 ++- .../mgmt/azurearcdata/models/__init__.py | 157 +- ..._azure_arc_data_management_client_enums.py | 74 +- .../azure/mgmt/azurearcdata/models/_models.py | 1455 ------------- .../mgmt/azurearcdata/models/_models_py3.py | 1897 +++++++++++++---- .../mgmt/azurearcdata/operations/__init__.py | 4 + ..._active_directory_connectors_operations.py | 570 +++++ .../_data_controllers_operations.py | 644 ++++-- .../azurearcdata/operations/_operations.py | 89 +- .../_postgres_instances_operations.py | 742 +++++++ .../_sql_managed_instances_operations.py | 634 ++++-- .../_sql_server_instances_operations.py | 634 ++++-- 30 files changed, 5808 insertions(+), 3449 deletions(-) create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_patch.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_vendor.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_patch.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_active_directory_connectors_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_postgres_instances_operations.py delete mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_active_directory_connectors_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_postgres_instances_operations.py diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json b/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json index c5753df7c959..51f61d8a4830 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": "91a910eeec41625fa6c7082deae5bad871ea30f1", "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-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --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..6335c96412ca 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,95 @@ # 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 ActiveDirectoryConnectorsOperations, DataControllersOperations, Operations, PostgresInstancesOperations, 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 + :vartype operations: azure.mgmt.azurearcdata.operations.Operations :ivar sql_managed_instances: SqlManagedInstancesOperations operations - :vartype sql_managed_instances: azure_arc_data_management_client.operations.SqlManagedInstancesOperations + :vartype sql_managed_instances: + azure.mgmt.azurearcdata.operations.SqlManagedInstancesOperations :ivar sql_server_instances: SqlServerInstancesOperations operations - :vartype sql_server_instances: azure_arc_data_management_client.operations.SqlServerInstancesOperations + :vartype sql_server_instances: azure.mgmt.azurearcdata.operations.SqlServerInstancesOperations :ivar data_controllers: DataControllersOperations operations - :vartype data_controllers: azure_arc_data_management_client.operations.DataControllersOperations + :vartype data_controllers: azure.mgmt.azurearcdata.operations.DataControllersOperations + :ivar active_directory_connectors: ActiveDirectoryConnectorsOperations operations + :vartype active_directory_connectors: + azure.mgmt.azurearcdata.operations.ActiveDirectoryConnectorsOperations + :ivar postgres_instances: PostgresInstancesOperations operations + :vartype postgres_instances: azure.mgmt.azurearcdata.operations.PostgresInstancesOperations :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.active_directory_connectors = ActiveDirectoryConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.postgres_instances = PostgresInstancesOperations(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..9fdcfa592224 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,20 +33,19 @@ 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 - self.api_version = "2021-11-01" + self.api_version = "2022-03-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-azurearcdata/{}'.format(VERSION)) self._configure(**kwargs) @@ -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..2c7943157c20 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_metadata.json +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-11-01", - "total_api_version_list": ["2021-11-01"], + "chosen_version": "2022-03-01-preview", + "total_api_version_list": ["2022-03-01-preview"], "client": { "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,16 +91,17 @@ "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", "sql_managed_instances": "SqlManagedInstancesOperations", "sql_server_instances": "SqlServerInstancesOperations", - "data_controllers": "DataControllersOperations" + "data_controllers": "DataControllersOperations", + "active_directory_connectors": "ActiveDirectoryConnectorsOperations", + "postgres_instances": "PostgresInstancesOperations" } } \ No newline at end of file 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..6f230afed6d7 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.1b1" 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..bcd36e8a676e 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,96 @@ # 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 ActiveDirectoryConnectorsOperations, DataControllersOperations, Operations, PostgresInstancesOperations, 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 + :vartype operations: azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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.mgmt.azurearcdata.aio.operations.SqlServerInstancesOperations :ivar data_controllers: DataControllersOperations operations - :vartype data_controllers: azure_arc_data_management_client.aio.operations.DataControllersOperations + :vartype data_controllers: azure.mgmt.azurearcdata.aio.operations.DataControllersOperations + :ivar active_directory_connectors: ActiveDirectoryConnectorsOperations operations + :vartype active_directory_connectors: + azure.mgmt.azurearcdata.aio.operations.ActiveDirectoryConnectorsOperations + :ivar postgres_instances: PostgresInstancesOperations operations + :vartype postgres_instances: azure.mgmt.azurearcdata.aio.operations.PostgresInstancesOperations :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.active_directory_connectors = ActiveDirectoryConnectorsOperations(self._client, self._config, self._serialize, self._deserialize) + self.postgres_instances = PostgresInstancesOperations(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..3c9e02507840 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,15 +37,15 @@ 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 - self.api_version = "2021-11-01" + self.api_version = "2022-03-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-azurearcdata/{}'.format(VERSION)) self._configure(**kwargs) @@ -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/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/__init__.py index 71f1823a000e..4eb6cc2bf62b 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/__init__.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/__init__.py @@ -10,10 +10,14 @@ from ._sql_managed_instances_operations import SqlManagedInstancesOperations from ._sql_server_instances_operations import SqlServerInstancesOperations from ._data_controllers_operations import DataControllersOperations +from ._active_directory_connectors_operations import ActiveDirectoryConnectorsOperations +from ._postgres_instances_operations import PostgresInstancesOperations __all__ = [ 'Operations', 'SqlManagedInstancesOperations', 'SqlServerInstancesOperations', 'DataControllersOperations', + 'ActiveDirectoryConnectorsOperations', + 'PostgresInstancesOperations', ] diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_active_directory_connectors_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_active_directory_connectors_operations.py new file mode 100644 index 000000000000..4b5bc54ad50e --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_active_directory_connectors_operations.py @@ -0,0 +1,413 @@ +# 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. +# -------------------------------------------------------------------------- +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 +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._active_directory_connectors_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ActiveDirectoryConnectorsOperations: + """ActiveDirectoryConnectorsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurearcdata.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + data_controller_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ActiveDirectoryConnectorListResult"]: + """List the active directory connectors associated with the given data controller. + + List the active directory connectors associated with the given data controller. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: The name of the data controller. + :type data_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ActiveDirectoryConnectorListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveDirectoryConnectorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_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("ActiveDirectoryConnectorListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + 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, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + active_directory_connector_resource: "_models.ActiveDirectoryConnectorResource", + **kwargs: Any + ) -> "_models.ActiveDirectoryConnectorResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveDirectoryConnectorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(active_directory_connector_resource, 'ActiveDirectoryConnectorResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_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) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ActiveDirectoryConnectorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ActiveDirectoryConnectorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + active_directory_connector_resource: "_models.ActiveDirectoryConnectorResource", + **kwargs: Any + ) -> AsyncLROPoller["_models.ActiveDirectoryConnectorResource"]: + """Creates or replaces an Active Directory connector resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: The name of the data controller. + :type data_controller_name: str + :param active_directory_connector_name: The name of the Active Directory connector instance. + :type active_directory_connector_name: str + :param active_directory_connector_resource: desc. + :type active_directory_connector_resource: + ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorResource + :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. + :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 ActiveDirectoryConnectorResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.ActiveDirectoryConnectorResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_name, + active_directory_connector_resource=active_directory_connector_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ActiveDirectoryConnectorResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes an Active Directory connector resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: The name of the data controller. + :type data_controller_name: str + :param active_directory_connector_name: The name of the Active Directory connector instance. + :type active_directory_connector_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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + **kwargs: Any + ) -> "_models.ActiveDirectoryConnectorResource": + """Retrieves an Active Directory connector resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: The name of the data controller. + :type data_controller_name: str + :param active_directory_connector_name: The name of the Active Directory connector instance. + :type active_directory_connector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveDirectoryConnectorResource, or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveDirectoryConnectorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveDirectoryConnectorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + 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..65e67cd42331 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]] @@ -28,7 +33,7 @@ class DataControllersOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_arc_data_management_client.models + :type models: ~azure.mgmt.azurearcdata.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -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.mgmt.azurearcdata.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.mgmt.azurearcdata.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] + + _json = self._serialize.body(data_controller_resource, 'DataControllerResource') - # 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_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, @@ -254,21 +250,26 @@ async def begin_put_data_controller( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param data_controller_name: + :param data_controller_name: The name of the data controller. :type data_controller_name: str :param data_controller_resource: desc. - :type data_controller_resource: ~azure_arc_data_management_client.models.DataControllerResource + :type data_controller_resource: ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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, @@ -369,19 +356,21 @@ async def begin_delete_data_controller( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param data_controller_name: + :param data_controller_name: The name of the 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, @@ -433,11 +417,11 @@ async def get_data_controller( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param data_controller_name: + :param data_controller_name: The name of the data controller. :type data_controller_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DataControllerResource, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.DataControllerResource + :rtype: ~azure.mgmt.azurearcdata.models.DataControllerResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataControllerResource"] @@ -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,71 +454,68 @@ 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, data_controller_name: str, data_controller_resource: "_models.DataControllerUpdate", **kwargs: Any - ) -> "_models.DataControllerResource": + ) -> Optional["_models.DataControllerResource"]: """Updates a dataController resource. :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param data_controller_name: + :param data_controller_name: The name of the data controller. :type data_controller_name: str :param data_controller_resource: The update data controller resource. - :type data_controller_resource: ~azure_arc_data_management_client.models.DataControllerUpdate + :type data_controller_resource: ~azure.mgmt.azurearcdata.models.DataControllerUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataControllerResource, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.DataControllerResource + :rtype: ~azure.mgmt.azurearcdata.models.DataControllerResource or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataControllerResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_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.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] - # 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, 'DataControllerUpdate') + + 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]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DataControllerResource', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DataControllerResource', pipeline_response) if cls: 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..178dffedd00f 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]] @@ -26,7 +31,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_arc_data_management_client.models + :type models: ~azure.mgmt.azurearcdata.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -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.mgmt.azurearcdata.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/_postgres_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_postgres_instances_operations.py new file mode 100644 index 000000000000..4ba991fab45a --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_postgres_instances_operations.py @@ -0,0 +1,518 @@ +# 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. +# -------------------------------------------------------------------------- +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 +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._postgres_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]] + +class PostgresInstancesOperations: + """PostgresInstancesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurearcdata.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.PostgresInstanceListResult"]: + """List postgres Instance resources in the subscription. + + List postgres Instance 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 PostgresInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurearcdata.models.PostgresInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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("PostgresInstanceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + 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, 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/postgresInstances'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PostgresInstanceListResult"]: + """List postgres Instance resources in the resource group. + + Get a postgres Instances list by Resource group name. + + :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 PostgresInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurearcdata.models.PostgresInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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("PostgresInstanceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + 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, 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/postgresInstances'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + postgres_instance_name: str, + **kwargs: Any + ) -> "_models.PostgresInstance": + """Retrieves a postgres Instance resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param postgres_instance_name: Name of Postgres Instance. + :type postgres_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PostgresInstance, or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.PostgresInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + postgres_instance_name=postgres_instance_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PostgresInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + postgres_instance_name: str, + resource: "_models.PostgresInstance", + **kwargs: Any + ) -> "_models.PostgresInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'PostgresInstance') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + postgres_instance_name=postgres_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) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PostgresInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PostgresInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + postgres_instance_name: str, + resource: "_models.PostgresInstance", + **kwargs: Any + ) -> AsyncLROPoller["_models.PostgresInstance"]: + """Creates or replaces a postgres Instance resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param postgres_instance_name: Name of Postgres Instance. + :type postgres_instance_name: str + :param resource: The postgres instance. + :type resource: ~azure.mgmt.azurearcdata.models.PostgresInstance + :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. + :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 PostgresInstance or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurearcdata.models.PostgresInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.PostgresInstance"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + postgres_instance_name=postgres_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PostgresInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + postgres_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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + postgres_instance_name=postgres_instance_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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/postgresInstances/{postgresInstanceName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + postgres_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a postgres Instance resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param postgres_instance_name: Name of Postgres Instance. + :type postgres_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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + postgres_instance_name=postgres_instance_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + postgres_instance_name: str, + parameters: "_models.PostgresInstanceUpdate", + **kwargs: Any + ) -> "_models.PostgresInstance": + """Updates a postgres Instance resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param postgres_instance_name: Name of Postgres Instance. + :type postgres_instance_name: str + :param parameters: The Postgres Instance. + :type parameters: ~azure.mgmt.azurearcdata.models.PostgresInstanceUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PostgresInstance, or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.PostgresInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PostgresInstanceUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + postgres_instance_name=postgres_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) + + 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, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PostgresInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + 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..e57b5523b536 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]] @@ -28,7 +33,7 @@ class SqlManagedInstancesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_arc_data_management_client.models + :type models: ~azure.mgmt.azurearcdata.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -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.mgmt.azurearcdata.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.mgmt.azurearcdata.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, @@ -199,7 +204,7 @@ async def get( :type sql_managed_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlManagedInstance, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.SqlManagedInstance + :rtype: ~azure.mgmt.azurearcdata.models.SqlManagedInstance :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstance"] @@ -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] + + _json = self._serialize.body(sql_managed_instance, 'SqlManagedInstance') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_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, @@ -313,21 +302,25 @@ async def begin_create( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param sql_managed_instance_name: The name of SQL Managed Instances. + :param sql_managed_instance_name: Name of SQL Managed Instance. :type sql_managed_instance_name: str :param sql_managed_instance: The SQL Managed Instance to be created or updated. - :type sql_managed_instance: ~azure_arc_data_management_client.models.SqlManagedInstance + :type sql_managed_instance: ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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 +332,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 +358,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 +372,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, @@ -428,19 +407,21 @@ async def begin_delete( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param sql_managed_instance_name: The name of Sql Managed Instances. + :param sql_managed_instance_name: Name of SQL Managed Instance. :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 +435,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 +454,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, @@ -493,13 +469,13 @@ async def update( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param sql_managed_instance_name: Name of sqlManagedInstance. + :param sql_managed_instance_name: Name of SQL Managed Instance. :type sql_managed_instance_name: str :param parameters: The SQL Managed Instance. - :type parameters: ~azure_arc_data_management_client.models.SqlManagedInstanceUpdate + :type parameters: ~azure.mgmt.azurearcdata.models.SqlManagedInstanceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlManagedInstance, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.SqlManagedInstance + :rtype: ~azure.mgmt.azurearcdata.models.SqlManagedInstance :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstance"] @@ -507,38 +483,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 +513,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..ac1f65ec307b 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]] @@ -28,7 +33,7 @@ class SqlServerInstancesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_arc_data_management_client.models + :type models: ~azure.mgmt.azurearcdata.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -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.mgmt.azurearcdata.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.mgmt.azurearcdata.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, @@ -199,7 +204,7 @@ async def get( :type sql_server_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlServerInstance, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.SqlServerInstance + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerInstance :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstance"] @@ -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] + + _json = self._serialize.body(sql_server_instance, 'SqlServerInstance') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_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, @@ -313,21 +302,25 @@ async def begin_create( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param sql_server_instance_name: The name of SQL Server Instance. + :param sql_server_instance_name: Name of SQL Server Instance. :type sql_server_instance_name: str :param sql_server_instance: The SQL Server Instance to be created or updated. - :type sql_server_instance: ~azure_arc_data_management_client.models.SqlServerInstance + :type sql_server_instance: ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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 +332,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 +358,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 +372,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, @@ -428,19 +407,21 @@ async def begin_delete( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param sql_server_instance_name: The name of SQL Server Instance. + :param sql_server_instance_name: Name of SQL Server Instance. :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 +435,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 +454,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, @@ -493,13 +469,13 @@ async def update( :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param sql_server_instance_name: Name of sqlServerInstance. + :param sql_server_instance_name: Name of SQL Server Instance. :type sql_server_instance_name: str :param parameters: The SQL Server Instance. - :type parameters: ~azure_arc_data_management_client.models.SqlServerInstanceUpdate + :type parameters: ~azure.mgmt.azurearcdata.models.SqlServerInstanceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlServerInstance, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.SqlServerInstance + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerInstance :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstance"] @@ -507,38 +483,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 +513,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..721b341ac217 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,68 @@ # 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 ActiveDirectoryConnectorDNSDetails +from ._models_py3 import ActiveDirectoryConnectorDomainDetails +from ._models_py3 import ActiveDirectoryConnectorListResult +from ._models_py3 import ActiveDirectoryConnectorProperties +from ._models_py3 import ActiveDirectoryConnectorResource +from ._models_py3 import ActiveDirectoryConnectorSpec +from ._models_py3 import ActiveDirectoryConnectorStatus +from ._models_py3 import ActiveDirectoryDomainController +from ._models_py3 import ActiveDirectoryDomainControllers +from ._models_py3 import ActiveDirectoryInformation +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 K8SResourceRequirements +from ._models_py3 import K8SScheduling +from ._models_py3 import K8SSchedulingOptions +from ._models_py3 import KeytabInformation +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 PostgresInstance +from ._models_py3 import PostgresInstanceListResult +from ._models_py3 import PostgresInstanceProperties +from ._models_py3 import PostgresInstanceSku +from ._models_py3 import PostgresInstanceUpdate +from ._models_py3 import ProxyResource +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 ( + AccountProvisioningMode, ArcSqlManagedInstanceLicenseType, ArcSqlServerLicenseType, ConnectionStatus, + CreatedByType, DefenderStatus, EditionType, ExtendedLocationTypes, - IdentityType, + HostType, Infrastructure, OperationOrigin, SqlManagedInstanceSkuTier, @@ -100,6 +75,16 @@ ) __all__ = [ + 'ActiveDirectoryConnectorDNSDetails', + 'ActiveDirectoryConnectorDomainDetails', + 'ActiveDirectoryConnectorListResult', + 'ActiveDirectoryConnectorProperties', + 'ActiveDirectoryConnectorResource', + 'ActiveDirectoryConnectorSpec', + 'ActiveDirectoryConnectorStatus', + 'ActiveDirectoryDomainController', + 'ActiveDirectoryDomainControllers', + 'ActiveDirectoryInformation', 'BasicLoginInformation', 'CommonSku', 'DataControllerProperties', @@ -108,21 +93,23 @@ 'ErrorResponse', 'ErrorResponseBody', 'ExtendedLocation', - 'Identity', 'K8SResourceRequirements', 'K8SScheduling', 'K8SSchedulingOptions', + 'KeytabInformation', 'LogAnalyticsWorkspaceConfig', - 'ODataError', 'OnPremiseProperty', 'Operation', 'OperationDisplay', 'OperationListResult', 'PageOfDataControllerResource', - 'Plan', + 'PostgresInstance', + 'PostgresInstanceListResult', + 'PostgresInstanceProperties', + 'PostgresInstanceSku', + 'PostgresInstanceUpdate', 'ProxyResource', 'Resource', - 'ResourceSku', 'SqlManagedInstance', 'SqlManagedInstanceK8SRaw', 'SqlManagedInstanceK8SSpec', @@ -138,13 +125,15 @@ 'TrackedResource', 'UploadServicePrincipal', 'UploadWatermark', + 'AccountProvisioningMode', 'ArcSqlManagedInstanceLicenseType', 'ArcSqlServerLicenseType', 'ConnectionStatus', + 'CreatedByType', 'DefenderStatus', 'EditionType', 'ExtendedLocationTypes', - 'IdentityType', + 'HostType', '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..c3556ce2fa13 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,27 @@ # 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 AccountProvisioningMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The service account provisioning mode for this Active Directory connector. + """ + AUTOMATIC = "automatic" + MANUAL = "manual" -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" + DISASTER_RECOVERY = "DisasterRecovery" -class ArcSqlServerLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ArcSqlServerLicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SQL Server license type. """ @@ -42,15 +35,25 @@ 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. """ CONNECTED = "Connected" DISCONNECTED = "Disconnected" + REGISTERED = "Registered" 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 +61,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 +72,23 @@ 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 +class HostType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of host for Azure Arc SQL Server """ - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" + VIRTUAL_MACHINE = "Virtual Machine" + PHYSICAL_SERVER = "Physical Server" + AWS_VIRTUAL_MACHINE = "AWS Virtual Machine" + GCP_VIRTUAL_MACHINE = "GCP Virtual Machine" + OTHER = "Other" -class Infrastructure(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Infrastructure(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The infrastructure the data controller is running on. """ @@ -95,24 +99,28 @@ 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. """ - SQL_SERVER2019 = "SQL Server 2019" - SQL_SERVER2017 = "SQL Server 2017" + SQL_SERVER2012 = "SQL Server 2012" + SQL_SERVER2014 = "SQL Server 2014" SQL_SERVER2016 = "SQL Server 2016" + SQL_SERVER2017 = "SQL Server 2017" + SQL_SERVER2019 = "SQL Server 2019" + SQL_SERVER2022 = "SQL Server 2022" + UNKNOWN = "Unknown" 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..e074a99652d4 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 @@ -15,13 +15,551 @@ from ._azure_arc_data_management_client_enums import * +class ActiveDirectoryConnectorDNSDetails(msrest.serialization.Model): + """DNS server details. + + All required parameters must be populated in order to send to Azure. + + :ivar domain_name: DNS domain name for which DNS lookups should be forwarded to the Active + Directory DNS servers. + :vartype domain_name: str + :ivar nameserver_ip_addresses: Required. List of Active Directory DNS server IP addresses. + :vartype nameserver_ip_addresses: list[str] + :ivar replicas: Replica count for DNS proxy service. Default value is 1. + :vartype replicas: long + :ivar prefer_k8_s_dns_for_ptr_lookups: Flag indicating whether to prefer Kubernetes DNS server + response over AD DNS server response for IP address lookups. + :vartype prefer_k8_s_dns_for_ptr_lookups: bool + """ + + _validation = { + 'nameserver_ip_addresses': {'required': True}, + } + + _attribute_map = { + 'domain_name': {'key': 'domainName', 'type': 'str'}, + 'nameserver_ip_addresses': {'key': 'nameserverIPAddresses', 'type': '[str]'}, + 'replicas': {'key': 'replicas', 'type': 'long'}, + 'prefer_k8_s_dns_for_ptr_lookups': {'key': 'preferK8sDnsForPtrLookups', 'type': 'bool'}, + } + + def __init__( + self, + *, + nameserver_ip_addresses: List[str], + domain_name: Optional[str] = None, + replicas: Optional[int] = 1, + prefer_k8_s_dns_for_ptr_lookups: Optional[bool] = True, + **kwargs + ): + """ + :keyword domain_name: DNS domain name for which DNS lookups should be forwarded to the Active + Directory DNS servers. + :paramtype domain_name: str + :keyword nameserver_ip_addresses: Required. List of Active Directory DNS server IP addresses. + :paramtype nameserver_ip_addresses: list[str] + :keyword replicas: Replica count for DNS proxy service. Default value is 1. + :paramtype replicas: long + :keyword prefer_k8_s_dns_for_ptr_lookups: Flag indicating whether to prefer Kubernetes DNS + server response over AD DNS server response for IP address lookups. + :paramtype prefer_k8_s_dns_for_ptr_lookups: bool + """ + super(ActiveDirectoryConnectorDNSDetails, self).__init__(**kwargs) + self.domain_name = domain_name + self.nameserver_ip_addresses = nameserver_ip_addresses + self.replicas = replicas + self.prefer_k8_s_dns_for_ptr_lookups = prefer_k8_s_dns_for_ptr_lookups + + +class ActiveDirectoryConnectorDomainDetails(msrest.serialization.Model): + """Active Directory domain details. + + All required parameters must be populated in order to send to Azure. + + :ivar realm: Required. Name (uppercase) of the Active Directory domain that this AD connector + will be associated with. + :vartype realm: str + :ivar netbios_domain_name: NETBIOS name of the Active Directory domain. + :vartype netbios_domain_name: str + :ivar service_account_provisioning: The service account provisioning mode for this Active + Directory connector. Possible values include: "automatic", "manual". Default value: "manual". + :vartype service_account_provisioning: str or + ~azure.mgmt.azurearcdata.models.AccountProvisioningMode + :ivar ou_distinguished_name: The distinguished name of the Active Directory Organizational + Unit. + :vartype ou_distinguished_name: str + :ivar domain_controllers: Required. null. + :vartype domain_controllers: ~azure.mgmt.azurearcdata.models.ActiveDirectoryDomainControllers + """ + + _validation = { + 'realm': {'required': True}, + 'domain_controllers': {'required': True}, + } + + _attribute_map = { + 'realm': {'key': 'realm', 'type': 'str'}, + 'netbios_domain_name': {'key': 'netbiosDomainName', 'type': 'str'}, + 'service_account_provisioning': {'key': 'serviceAccountProvisioning', 'type': 'str'}, + 'ou_distinguished_name': {'key': 'ouDistinguishedName', 'type': 'str'}, + 'domain_controllers': {'key': 'domainControllers', 'type': 'ActiveDirectoryDomainControllers'}, + } + + def __init__( + self, + *, + realm: str, + domain_controllers: "ActiveDirectoryDomainControllers", + netbios_domain_name: Optional[str] = None, + service_account_provisioning: Optional[Union[str, "AccountProvisioningMode"]] = "manual", + ou_distinguished_name: Optional[str] = None, + **kwargs + ): + """ + :keyword realm: Required. Name (uppercase) of the Active Directory domain that this AD + connector will be associated with. + :paramtype realm: str + :keyword netbios_domain_name: NETBIOS name of the Active Directory domain. + :paramtype netbios_domain_name: str + :keyword service_account_provisioning: The service account provisioning mode for this Active + Directory connector. Possible values include: "automatic", "manual". Default value: "manual". + :paramtype service_account_provisioning: str or + ~azure.mgmt.azurearcdata.models.AccountProvisioningMode + :keyword ou_distinguished_name: The distinguished name of the Active Directory Organizational + Unit. + :paramtype ou_distinguished_name: str + :keyword domain_controllers: Required. null. + :paramtype domain_controllers: ~azure.mgmt.azurearcdata.models.ActiveDirectoryDomainControllers + """ + super(ActiveDirectoryConnectorDomainDetails, self).__init__(**kwargs) + self.realm = realm + self.netbios_domain_name = netbios_domain_name + self.service_account_provisioning = service_account_provisioning + self.ou_distinguished_name = ou_distinguished_name + self.domain_controllers = domain_controllers + + +class ActiveDirectoryConnectorListResult(msrest.serialization.Model): + """A list of active directory connectors. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of results. + :vartype value: list[~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorResource] + :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': '[ActiveDirectoryConnectorResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ActiveDirectoryConnectorListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class ActiveDirectoryConnectorProperties(msrest.serialization.Model): + """The properties of an Active Directory connector 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 domain_service_account_login_information: Username and password for domain service + account authentication. + :vartype domain_service_account_login_information: + ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :ivar provisioning_state: The provisioning state of the Active Directory connector resource. + :vartype provisioning_state: str + :ivar spec: Required. null. + :vartype spec: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorSpec + :ivar status: null. + :vartype status: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorStatus + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'spec': {'required': True}, + } + + _attribute_map = { + 'domain_service_account_login_information': {'key': 'domainServiceAccountLoginInformation', 'type': 'BasicLoginInformation'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'spec': {'key': 'spec', 'type': 'ActiveDirectoryConnectorSpec'}, + 'status': {'key': 'status', 'type': 'ActiveDirectoryConnectorStatus'}, + } + + def __init__( + self, + *, + spec: "ActiveDirectoryConnectorSpec", + domain_service_account_login_information: Optional["BasicLoginInformation"] = None, + status: Optional["ActiveDirectoryConnectorStatus"] = None, + **kwargs + ): + """ + :keyword domain_service_account_login_information: Username and password for domain service + account authentication. + :paramtype domain_service_account_login_information: + ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :keyword spec: Required. null. + :paramtype spec: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorSpec + :keyword status: null. + :paramtype status: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorStatus + """ + super(ActiveDirectoryConnectorProperties, self).__init__(**kwargs) + self.domain_service_account_login_information = domain_service_account_login_information + self.provisioning_state = None + self.spec = spec + self.status = status + + +class Resource(msrest.serialization.Model): + """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 - + /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. 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.mgmt.azurearcdata.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 ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + 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. 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.mgmt.azurearcdata.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(ProxyResource, self).__init__(**kwargs) + + +class ActiveDirectoryConnectorResource(ProxyResource): + """Active directory connector 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. 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.mgmt.azurearcdata.models.SystemData + :ivar properties: Required. null. + :vartype properties: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': 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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ActiveDirectoryConnectorProperties'}, + } + + def __init__( + self, + *, + properties: "ActiveDirectoryConnectorProperties", + **kwargs + ): + """ + :keyword properties: Required. null. + :paramtype properties: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorProperties + """ + super(ActiveDirectoryConnectorResource, self).__init__(**kwargs) + self.properties = properties + + +class ActiveDirectoryConnectorSpec(msrest.serialization.Model): + """The specifications of the AD Kubernetes resource. + + All required parameters must be populated in order to send to Azure. + + :ivar active_directory: Required. null. + :vartype active_directory: + ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorDomainDetails + :ivar dns: Required. null. + :vartype dns: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorDNSDetails + """ + + _validation = { + 'active_directory': {'required': True}, + 'dns': {'required': True}, + } + + _attribute_map = { + 'active_directory': {'key': 'activeDirectory', 'type': 'ActiveDirectoryConnectorDomainDetails'}, + 'dns': {'key': 'dns', 'type': 'ActiveDirectoryConnectorDNSDetails'}, + } + + def __init__( + self, + *, + active_directory: "ActiveDirectoryConnectorDomainDetails", + dns: "ActiveDirectoryConnectorDNSDetails", + **kwargs + ): + """ + :keyword active_directory: Required. null. + :paramtype active_directory: + ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorDomainDetails + :keyword dns: Required. null. + :paramtype dns: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorDNSDetails + """ + super(ActiveDirectoryConnectorSpec, self).__init__(**kwargs) + self.active_directory = active_directory + self.dns = dns + + +class ActiveDirectoryConnectorStatus(msrest.serialization.Model): + """The status of the Kubernetes custom resource. + + :ivar additional_properties: Unmatched properties from the message are deserialized to this + collection. + :vartype additional_properties: dict[str, any] + :ivar last_update_time: The time that the custom resource was last updated. + :vartype last_update_time: str + :ivar observed_generation: The version of the replicaSet associated with the AD connector + custom resource. + :vartype observed_generation: long + :ivar state: The state of the AD connector custom resource. + :vartype state: str + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'last_update_time': {'key': 'lastUpdateTime', 'type': 'str'}, + 'observed_generation': {'key': 'observedGeneration', 'type': 'long'}, + 'state': {'key': 'state', 'type': 'str'}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, Any]] = None, + last_update_time: Optional[str] = None, + observed_generation: Optional[int] = None, + state: Optional[str] = None, + **kwargs + ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword last_update_time: The time that the custom resource was last updated. + :paramtype last_update_time: str + :keyword observed_generation: The version of the replicaSet associated with the AD connector + custom resource. + :paramtype observed_generation: long + :keyword state: The state of the AD connector custom resource. + :paramtype state: str + """ + super(ActiveDirectoryConnectorStatus, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.last_update_time = last_update_time + self.observed_generation = observed_generation + self.state = state + + +class ActiveDirectoryDomainController(msrest.serialization.Model): + """Information about a domain controller in the AD domain. + + All required parameters must be populated in order to send to Azure. + + :ivar hostname: Required. Fully-qualified domain name of a domain controller in the AD domain. + :vartype hostname: str + """ + + _validation = { + 'hostname': {'required': True}, + } + + _attribute_map = { + 'hostname': {'key': 'hostname', 'type': 'str'}, + } + + def __init__( + self, + *, + hostname: str, + **kwargs + ): + """ + :keyword hostname: Required. Fully-qualified domain name of a domain controller in the AD + domain. + :paramtype hostname: str + """ + super(ActiveDirectoryDomainController, self).__init__(**kwargs) + self.hostname = hostname + + +class ActiveDirectoryDomainControllers(msrest.serialization.Model): + """Details about the Active Directory domain controllers associated with this AD connector instance. + + :ivar primary_domain_controller: Information about the Primary Domain Controller (PDC) in the + AD domain. + :vartype primary_domain_controller: + ~azure.mgmt.azurearcdata.models.ActiveDirectoryDomainController + :ivar secondary_domain_controllers: null. + :vartype secondary_domain_controllers: + list[~azure.mgmt.azurearcdata.models.ActiveDirectoryDomainController] + """ + + _attribute_map = { + 'primary_domain_controller': {'key': 'primaryDomainController', 'type': 'ActiveDirectoryDomainController'}, + 'secondary_domain_controllers': {'key': 'secondaryDomainControllers', 'type': '[ActiveDirectoryDomainController]'}, + } + + def __init__( + self, + *, + primary_domain_controller: Optional["ActiveDirectoryDomainController"] = None, + secondary_domain_controllers: Optional[List["ActiveDirectoryDomainController"]] = None, + **kwargs + ): + """ + :keyword primary_domain_controller: Information about the Primary Domain Controller (PDC) in + the AD domain. + :paramtype primary_domain_controller: + ~azure.mgmt.azurearcdata.models.ActiveDirectoryDomainController + :keyword secondary_domain_controllers: null. + :paramtype secondary_domain_controllers: + list[~azure.mgmt.azurearcdata.models.ActiveDirectoryDomainController] + """ + super(ActiveDirectoryDomainControllers, self).__init__(**kwargs) + self.primary_domain_controller = primary_domain_controller + self.secondary_domain_controllers = secondary_domain_controllers + + +class ActiveDirectoryInformation(msrest.serialization.Model): + """Active Directory information that related to the resource. + + :ivar keytab_information: Keytab information that is used for the Sql Managed Instance when + Active Directory authentication is used. + :vartype keytab_information: ~azure.mgmt.azurearcdata.models.KeytabInformation + """ + + _attribute_map = { + 'keytab_information': {'key': 'keytabInformation', 'type': 'KeytabInformation'}, + } + + def __init__( + self, + *, + keytab_information: Optional["KeytabInformation"] = None, + **kwargs + ): + """ + :keyword keytab_information: Keytab information that is used for the Sql Managed Instance when + Active Directory authentication is used. + :paramtype keytab_information: ~azure.mgmt.azurearcdata.models.KeytabInformation + """ + super(ActiveDirectoryInformation, self).__init__(**kwargs) + self.keytab_information = keytab_information + + 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,6 +574,12 @@ 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 @@ -46,20 +590,20 @@ class CommonSku(msrest.serialization.Model): 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, + :ivar name: Required. The name of the SKU. It is typically a letter+number code. + :vartype name: str + :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: 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. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar 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 + :vartype capacity: int """ _validation = { @@ -84,6 +628,22 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Required. The name of the SKU. It is typically a letter+number code. + :paramtype name: str + :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: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword 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. + :paramtype capacity: int + """ super(CommonSku, self).__init__(**kwargs) self.name = name self.dev = dev @@ -97,43 +657,41 @@ class DataControllerProperties(msrest.serialization.Model): 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.mgmt.azurearcdata.models.Infrastructure + :ivar on_premise_property: Properties from the Kubernetes data controller. + :vartype on_premise_property: ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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: - ~azure_arc_data_management_client.models.BasicLoginInformation - :param logs_dashboard_credential: Login credential for logs dashboard on the Kubernetes + :vartype basic_login_information: ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :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: - ~azure_arc_data_management_client.models.LogAnalyticsWorkspaceConfig - :param upload_service_principal: Deprecated. Service principal is deprecated in favor of Arc + :vartype metrics_dashboard_credential: ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :ivar logs_dashboard_credential: Login credential for logs dashboard on the Kubernetes cluster. + :vartype logs_dashboard_credential: ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :ivar log_analytics_workspace_config: Log analytics workspace id and primary key. + :vartype log_analytics_workspace_config: + ~azure.mgmt.azurearcdata.models.LogAnalyticsWorkspaceConfig + :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 - :ivar provisioning_state: + :vartype upload_service_principal: ~azure.mgmt.azurearcdata.models.UploadServicePrincipal + :ivar provisioning_state: The provisioning state of the Arc Data Controller resource. :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 +731,42 @@ 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.mgmt.azurearcdata.models.Infrastructure + :keyword on_premise_property: Properties from the Kubernetes data controller. + :paramtype on_premise_property: ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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.mgmt.azurearcdata.models.BasicLoginInformation + :keyword metrics_dashboard_credential: Login credential for metrics dashboard on the Kubernetes + cluster. + :paramtype metrics_dashboard_credential: ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :keyword logs_dashboard_credential: Login credential for logs dashboard on the Kubernetes + cluster. + :paramtype logs_dashboard_credential: ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :keyword log_analytics_workspace_config: Log analytics workspace id and primary key. + :paramtype log_analytics_workspace_config: + ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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 @@ -189,81 +783,45 @@ def __init__( self.extension_id = extension_id -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. + """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. - :vartype system_data: ~azure_arc_data_management_client.models.SystemData + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurearcdata.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 +831,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 +849,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. - :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurearcdata.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 + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.azurearcdata.models.ExtendedLocation + :ivar properties: Required. The data controller's properties. + :vartype properties: ~azure.mgmt.azurearcdata.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 +883,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 +899,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.mgmt.azurearcdata.models.ExtendedLocation + :keyword properties: Required. The data controller's properties. + :paramtype properties: ~azure.mgmt.azurearcdata.models.DataControllerProperties + """ super(DataControllerResource, self).__init__(tags=tags, location=location, **kwargs) self.extended_location = extended_location self.properties = properties @@ -343,29 +917,40 @@ 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] + :ivar properties: The data controller's properties. + :vartype properties: ~azure.mgmt.azurearcdata.models.DataControllerProperties """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'DataControllerProperties'}, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, + properties: Optional["DataControllerProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: The data controller's properties. + :paramtype properties: ~azure.mgmt.azurearcdata.models.DataControllerProperties + """ super(DataControllerUpdate, self).__init__(**kwargs) self.tags = tags + self.properties = properties 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.mgmt.azurearcdata.models.ErrorResponseBody """ _attribute_map = { @@ -378,6 +963,10 @@ def __init__( error: Optional["ErrorResponseBody"] = None, **kwargs ): + """ + :keyword error: null. + :paramtype error: ~azure.mgmt.azurearcdata.models.ErrorResponseBody + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -385,17 +974,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.mgmt.azurearcdata.models.ErrorResponseBody] """ _attribute_map = { @@ -414,6 +1003,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.mgmt.azurearcdata.models.ErrorResponseBody] + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = code self.message = message @@ -424,10 +1026,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.mgmt.azurearcdata.models.ExtendedLocationTypes """ _attribute_map = { @@ -442,64 +1044,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.mgmt.azurearcdata.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 +1087,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 +1111,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.mgmt.azurearcdata.models.K8SSchedulingOptions """ _attribute_map = { @@ -545,6 +1131,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.mgmt.azurearcdata.models.K8SSchedulingOptions + """ super(K8SScheduling, self).__init__(**kwargs) self.additional_properties = additional_properties self.default = default @@ -553,12 +1147,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.mgmt.azurearcdata.models.K8SResourceRequirements """ _attribute_map = { @@ -573,71 +1167,74 @@ 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.mgmt.azurearcdata.models.K8SResourceRequirements + """ super(K8SSchedulingOptions, self).__init__(**kwargs) self.additional_properties = additional_properties self.resources = resources -class LogAnalyticsWorkspaceConfig(msrest.serialization.Model): - """Log analytics workspace id and primary key. +class KeytabInformation(msrest.serialization.Model): + """Keytab used for authenticate with Active Directory. - :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 keytab: A base64-encoded keytab. + :vartype keytab: str """ _attribute_map = { - 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, + 'keytab': {'key': 'keytab', 'type': 'str'}, } def __init__( self, *, - workspace_id: Optional[str] = None, - primary_key: Optional[str] = None, + keytab: Optional[str] = None, **kwargs ): - super(LogAnalyticsWorkspaceConfig, self).__init__(**kwargs) - self.workspace_id = workspace_id - self.primary_key = primary_key + """ + :keyword keytab: A base64-encoded keytab. + :paramtype keytab: str + """ + super(KeytabInformation, self).__init__(**kwargs) + self.keytab = keytab -class ODataError(msrest.serialization.Model): - """Information about an error. +class LogAnalyticsWorkspaceConfig(msrest.serialization.Model): + """Log analytics workspace id and primary key. - :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] + :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 = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ODataError]'}, + 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, + 'primary_key': {'key': 'primaryKey', 'type': 'str'}, } def __init__( self, *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["ODataError"]] = None, + workspace_id: Optional[str] = None, + primary_key: Optional[str] = None, **kwargs ): - super(ODataError, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details + """ + :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 OnPremiseProperty(msrest.serialization.Model): @@ -645,14 +1242,14 @@ class OnPremiseProperty(msrest.serialization.Model): 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 +1271,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 +1294,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.mgmt.azurearcdata.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 + :vartype origin: str or ~azure.mgmt.azurearcdata.models.OperationOrigin + :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 +1332,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.mgmt.azurearcdata.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 +1354,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 +1388,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 @@ -785,7 +1412,7 @@ class OperationListResult(msrest.serialization.Model): 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] + :vartype value: list[~azure.mgmt.azurearcdata.models.Operation] :ivar next_link: Link to retrieve next page of results. :vartype next_link: str """ @@ -804,18 +1431,20 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None class PageOfDataControllerResource(msrest.serialization.Model): - """PageOfDataControllerResource. + """A list of data controllers. - :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: Array of results. + :vartype value: list[~azure.mgmt.azurearcdata.models.DataControllerResource] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str """ _attribute_map = { @@ -830,138 +1459,298 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Array of results. + :paramtype value: list[~azure.mgmt.azurearcdata.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. +class PostgresInstance(TrackedResource): + """A Postgres Instance. + + 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. 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 + :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. 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.mgmt.azurearcdata.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 + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.azurearcdata.models.ExtendedLocation + :ivar properties: Required. null. + :vartype properties: ~azure.mgmt.azurearcdata.models.PostgresInstanceProperties + :ivar sku: Resource sku. + :vartype sku: ~azure.mgmt.azurearcdata.models.PostgresInstanceSku """ _validation = { - 'name': {'required': True}, - 'publisher': {'required': True}, - 'product': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'properties': {'required': True}, } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, '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'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'properties': {'key': 'properties', 'type': 'PostgresInstanceProperties'}, + 'sku': {'key': 'sku', 'type': 'PostgresInstanceSku'}, } def __init__( self, *, - name: str, - publisher: str, - product: str, - promotion_code: Optional[str] = None, - version: Optional[str] = None, + location: str, + properties: "PostgresInstanceProperties", + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + sku: Optional["PostgresInstanceSku"] = None, **kwargs ): - super(Plan, self).__init__(**kwargs) - self.name = name - self.publisher = publisher - self.product = product - self.promotion_code = promotion_code - self.version = version + """ + :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.mgmt.azurearcdata.models.ExtendedLocation + :keyword properties: Required. null. + :paramtype properties: ~azure.mgmt.azurearcdata.models.PostgresInstanceProperties + :keyword sku: Resource sku. + :paramtype sku: ~azure.mgmt.azurearcdata.models.PostgresInstanceSku + """ + super(PostgresInstance, self).__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.properties = properties + self.sku = sku -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. +class PostgresInstanceListResult(msrest.serialization.Model): + """A list of PostgresInstance. 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 + :ivar value: Array of results. + :vartype value: list[~azure.mgmt.azurearcdata.models.PostgresInstance] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PostgresInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ProxyResource, self).__init__(**kwargs) + """ + """ + super(PostgresInstanceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class ResourceSku(msrest.serialization.Model): - """ResourceSku. +class PostgresInstanceProperties(msrest.serialization.Model): + """Postgres Instance properties. - :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 + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar data_controller_id: The data controller id. + :vartype data_controller_id: str + :ivar admin: The instance admin. + :vartype admin: str + :ivar basic_login_information: Username and password for basic authentication. + :vartype basic_login_information: ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :ivar k8_s_raw: The raw kubernetes information. + :vartype k8_s_raw: any + :ivar last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current date + time. + :vartype last_uploaded_date: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the Azure Arc-enabled PostgreSQL instance. + :vartype provisioning_state: str """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'data_controller_id': {'key': 'dataControllerId', 'type': 'str'}, + 'admin': {'key': 'admin', 'type': 'str'}, + 'basic_login_information': {'key': 'basicLoginInformation', 'type': 'BasicLoginInformation'}, + 'k8_s_raw': {'key': 'k8sRaw', 'type': 'object'}, + 'last_uploaded_date': {'key': 'lastUploadedDate', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + data_controller_id: Optional[str] = None, + admin: Optional[str] = None, + basic_login_information: Optional["BasicLoginInformation"] = None, + k8_s_raw: Optional[Any] = None, + last_uploaded_date: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword data_controller_id: The data controller id. + :paramtype data_controller_id: str + :keyword admin: The instance admin. + :paramtype admin: str + :keyword basic_login_information: Username and password for basic authentication. + :paramtype basic_login_information: ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :keyword k8_s_raw: The raw kubernetes information. + :paramtype k8_s_raw: any + :keyword last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current + date time. + :paramtype last_uploaded_date: ~datetime.datetime + """ + super(PostgresInstanceProperties, self).__init__(**kwargs) + self.data_controller_id = data_controller_id + self.admin = admin + self.basic_login_information = basic_login_information + self.k8_s_raw = k8_s_raw + self.last_uploaded_date = last_uploaded_date + self.provisioning_state = None + + +class PostgresInstanceSku(CommonSku): + """The resource model definition representing SKU for Azure Database for PostgresSQL - Azure Arc. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The name of the SKU. It is typically a letter+number code. + :vartype name: str + :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. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar 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. + :vartype capacity: int + :ivar tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier. The only acceptable values to pass in are None and "Hyperscale". The + default value is "Hyperscale". + :vartype tier: str + """ + + _validation = { + 'name': {'required': True}, + } + _attribute_map = { - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'family': {'key': 'family', 'type': 'str'}, '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'}, 'tier': {'key': 'tier', 'type': 'str'}, } def __init__( self, *, - capacity: Optional[int] = None, - family: Optional[str] = None, - name: Optional[str] = None, + name: str, + dev: Optional[bool] = True, size: Optional[str] = None, - tier: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + tier: Optional[str] = "Hyperscale", **kwargs ): - super(ResourceSku, self).__init__(**kwargs) - self.capacity = capacity - self.family = family - self.name = name - self.size = size + """ + :keyword name: Required. The name of the SKU. It is typically a letter+number code. + :paramtype name: str + :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: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword 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. + :paramtype capacity: int + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier. The only acceptable values to pass in are None and "Hyperscale". The + default value is "Hyperscale". + :paramtype tier: str + """ + super(PostgresInstanceSku, self).__init__(name=name, dev=dev, size=size, family=family, capacity=capacity, **kwargs) self.tier = tier +class PostgresInstanceUpdate(msrest.serialization.Model): + """An update to a Postgres Instance. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Postgres Instance properties. + :vartype properties: ~azure.mgmt.azurearcdata.models.PostgresInstanceProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'PostgresInstanceProperties'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["PostgresInstanceProperties"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Postgres Instance properties. + :paramtype properties: ~azure.mgmt.azurearcdata.models.PostgresInstanceProperties + """ + super(PostgresInstanceUpdate, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + class SqlManagedInstance(TrackedResource): """A SqlManagedInstance. @@ -969,34 +1758,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. - :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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurearcdata.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 + :ivar properties: Required. null. + :vartype properties: ~azure.mgmt.azurearcdata.models.SqlManagedInstanceProperties + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.azurearcdata.models.ExtendedLocation + :ivar sku: Resource sku. + :vartype sku: ~azure.mgmt.azurearcdata.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 +1794,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 +1812,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.mgmt.azurearcdata.models.SqlManagedInstanceProperties + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.azurearcdata.models.ExtendedLocation + :keyword sku: Resource sku. + :paramtype sku: ~azure.mgmt.azurearcdata.models.SqlManagedInstanceSku + """ super(SqlManagedInstance, self).__init__(tags=tags, location=location, **kwargs) self.properties = properties self.extended_location = extended_location @@ -1031,11 +1833,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.mgmt.azurearcdata.models.SqlManagedInstanceK8SSpec """ _attribute_map = { @@ -1050,6 +1852,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.mgmt.azurearcdata.models.SqlManagedInstanceK8SSpec + """ super(SqlManagedInstanceK8SRaw, self).__init__(**kwargs) self.additional_properties = additional_properties self.spec = spec @@ -1058,16 +1867,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.mgmt.azurearcdata.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 +1893,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.mgmt.azurearcdata.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 @@ -1096,7 +1917,7 @@ class SqlManagedInstanceListResult(msrest.serialization.Model): 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] + :vartype value: list[~azure.mgmt.azurearcdata.models.SqlManagedInstance] :ivar next_link: Link to retrieve next page of results. :vartype next_link: str """ @@ -1115,6 +1936,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlManagedInstanceListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1125,33 +1948,37 @@ 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.mgmt.azurearcdata.models.SqlManagedInstanceK8SRaw + :ivar basic_login_information: Username and password for basic authentication. + :vartype basic_login_information: ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :ivar last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current date time. - :type last_uploaded_date: ~datetime.datetime - :ivar provisioning_state: + :vartype last_uploaded_date: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the Arc-enabled SQL Managed Instance + resource. :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 + :ivar active_directory_information: Active Directory information related to this SQL Managed + Instance. + :vartype active_directory_information: + ~azure.mgmt.azurearcdata.models.ActiveDirectoryInformation + :ivar license_type: The license type to apply for this managed instance. Possible values + include: "BasePrice", "LicenseIncluded", "DisasterRecovery". Default value: "BasePrice". + :vartype license_type: str or ~azure.mgmt.azurearcdata.models.ArcSqlManagedInstanceLicenseType + :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 = { @@ -1167,6 +1994,7 @@ class SqlManagedInstanceProperties(msrest.serialization.Model): 'basic_login_information': {'key': 'basicLoginInformation', 'type': 'BasicLoginInformation'}, 'last_uploaded_date': {'key': 'lastUploadedDate', 'type': 'iso-8601'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'active_directory_information': {'key': 'activeDirectoryInformation', 'type': 'ActiveDirectoryInformation'}, 'license_type': {'key': 'licenseType', 'type': 'str'}, 'cluster_id': {'key': 'clusterId', 'type': 'str'}, 'extension_id': {'key': 'extensionId', 'type': 'str'}, @@ -1182,11 +2010,43 @@ def __init__( k8_s_raw: Optional["SqlManagedInstanceK8SRaw"] = None, basic_login_information: Optional["BasicLoginInformation"] = None, last_uploaded_date: Optional[datetime.datetime] = None, + active_directory_information: Optional["ActiveDirectoryInformation"] = None, license_type: Optional[Union[str, "ArcSqlManagedInstanceLicenseType"]] = "BasePrice", cluster_id: Optional[str] = None, 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.mgmt.azurearcdata.models.SqlManagedInstanceK8SRaw + :keyword basic_login_information: Username and password for basic authentication. + :paramtype basic_login_information: ~azure.mgmt.azurearcdata.models.BasicLoginInformation + :keyword last_uploaded_date: Last uploaded date from Kubernetes cluster. Defaults to current + date time. + :paramtype last_uploaded_date: ~datetime.datetime + :keyword active_directory_information: Active Directory information related to this SQL Managed + Instance. + :paramtype active_directory_information: + ~azure.mgmt.azurearcdata.models.ActiveDirectoryInformation + :keyword license_type: The license type to apply for this managed instance. Possible values + include: "BasePrice", "LicenseIncluded", "DisasterRecovery". Default value: "BasePrice". + :paramtype license_type: str or + ~azure.mgmt.azurearcdata.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 @@ -1196,6 +2056,7 @@ def __init__( self.basic_login_information = basic_login_information self.last_uploaded_date = last_uploaded_date self.provisioning_state = None + self.active_directory_information = active_directory_information self.license_type = license_type self.cluster_id = cluster_id self.extension_id = extension_id @@ -1210,19 +2071,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.mgmt.azurearcdata.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: The SKU family. + :vartype family: str + :ivar capacity: The SKU capacity. + :vartype capacity: int """ _validation = { @@ -1250,6 +2111,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.mgmt.azurearcdata.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: The SKU family. + :paramtype family: str + :keyword capacity: The SKU capacity. + :paramtype capacity: int + """ super(SqlManagedInstanceSku, self).__init__(**kwargs) self.tier = tier self.dev = dev @@ -1261,8 +2137,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 +2151,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 +2166,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. - :vartype system_data: ~azure_arc_data_management_client.models.SystemData - :param properties: null. - :type properties: ~azure_arc_data_management_client.models.SqlServerInstanceProperties + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurearcdata.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 + :ivar properties: null. + :vartype properties: ~azure.mgmt.azurearcdata.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 +2211,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.mgmt.azurearcdata.models.SqlServerInstanceProperties + """ super(SqlServerInstance, self).__init__(tags=tags, location=location, **kwargs) self.properties = properties @@ -1340,7 +2229,7 @@ class SqlServerInstanceListResult(msrest.serialization.Model): 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] + :vartype value: list[~azure.mgmt.azurearcdata.models.SqlServerInstance] :ivar next_link: Link to retrieve next page of results. :vartype next_link: str """ @@ -1359,6 +2248,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlServerInstanceListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1371,46 +2262,49 @@ 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 - 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", + :ivar version: SQL Server version. Possible values include: "SQL Server 2012", "SQL Server + 2014", "SQL Server 2016", "SQL Server 2017", "SQL Server 2019", "SQL Server 2022", "Unknown". + :vartype version: str or ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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", - "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", + :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", "Registered", "Unknown". + :vartype status: str or ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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 - :ivar provisioning_state: + :vartype azure_defender_status: str or ~azure.mgmt.azurearcdata.models.DefenderStatus + :ivar provisioning_state: The provisioning state of the Arc-enabled SQL Server resource. :vartype provisioning_state: str + :ivar host_type: Type of host for Azure Arc SQL Server. Possible values include: "Virtual + Machine", "Physical Server", "AWS Virtual Machine", "GCP Virtual Machine", "Other". + :vartype host_type: str or ~azure.mgmt.azurearcdata.models.HostType """ _validation = { @@ -1438,6 +2332,7 @@ class SqlServerInstanceProperties(msrest.serialization.Model): 'azure_defender_status_last_updated': {'key': 'azureDefenderStatusLastUpdated', 'type': 'iso-8601'}, 'azure_defender_status': {'key': 'azureDefenderStatus', 'type': 'str'}, 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'host_type': {'key': 'hostType', 'type': 'str'}, } def __init__( @@ -1458,8 +2353,50 @@ def __init__( license_type: Optional[Union[str, "ArcSqlServerLicenseType"]] = None, azure_defender_status_last_updated: Optional[datetime.datetime] = None, azure_defender_status: Optional[Union[str, "DefenderStatus"]] = None, + host_type: Optional[Union[str, "HostType"]] = None, **kwargs ): + """ + :keyword version: SQL Server version. Possible values include: "SQL Server 2012", "SQL Server + 2014", "SQL Server 2016", "SQL Server 2017", "SQL Server 2019", "SQL Server 2022", "Unknown". + :paramtype version: str or ~azure.mgmt.azurearcdata.models.SqlVersion + :keyword edition: SQL Server edition. Possible values include: "Evaluation", "Enterprise", + "Standard", "Web", "Developer", "Express". + :paramtype edition: str or ~azure.mgmt.azurearcdata.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", "Registered", "Unknown". + :paramtype status: str or ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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.mgmt.azurearcdata.models.DefenderStatus + :keyword host_type: Type of host for Azure Arc SQL Server. Possible values include: "Virtual + Machine", "Physical Server", "AWS Virtual Machine", "GCP Virtual Machine", "Other". + :paramtype host_type: str or ~azure.mgmt.azurearcdata.models.HostType + """ super(SqlServerInstanceProperties, self).__init__(**kwargs) self.version = version self.edition = edition @@ -1478,13 +2415,14 @@ def __init__( self.azure_defender_status_last_updated = azure_defender_status_last_updated self.azure_defender_status = azure_defender_status self.provisioning_state = None + self.host_type = host_type 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 +2435,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.mgmt.azurearcdata.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.mgmt.azurearcdata.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1533,13 +2475,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.mgmt.azurearcdata.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.mgmt.azurearcdata.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 +2510,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 +2537,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 +2558,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 +2582,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/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/__init__.py index 71f1823a000e..4eb6cc2bf62b 100644 --- a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/__init__.py +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/__init__.py @@ -10,10 +10,14 @@ from ._sql_managed_instances_operations import SqlManagedInstancesOperations from ._sql_server_instances_operations import SqlServerInstancesOperations from ._data_controllers_operations import DataControllersOperations +from ._active_directory_connectors_operations import ActiveDirectoryConnectorsOperations +from ._postgres_instances_operations import PostgresInstancesOperations __all__ = [ 'Operations', 'SqlManagedInstancesOperations', 'SqlServerInstancesOperations', 'DataControllersOperations', + 'ActiveDirectoryConnectorsOperations', + 'PostgresInstancesOperations', ] diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_active_directory_connectors_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_active_directory_connectors_operations.py new file mode 100644 index 000000000000..0594c0415c81 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_active_directory_connectors_operations.py @@ -0,0 +1,570 @@ +# 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. +# -------------------------------------------------------------------------- +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +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, + resource_group_name: str, + data_controller_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors') + 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_create_request_initial( + subscription_id: str, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}') + 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'), + "activeDirectoryConnectorName": _SERIALIZER.url("active_directory_connector_name", active_directory_connector_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, + data_controller_name: str, + active_directory_connector_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}') + 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'), + "activeDirectoryConnectorName": _SERIALIZER.url("active_directory_connector_name", active_directory_connector_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_request( + subscription_id: str, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}') + 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'), + "activeDirectoryConnectorName": _SERIALIZER.url("active_directory_connector_name", active_directory_connector_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 + ) + +class ActiveDirectoryConnectorsOperations(object): + """ActiveDirectoryConnectorsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurearcdata.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + data_controller_name: str, + **kwargs: Any + ) -> Iterable["_models.ActiveDirectoryConnectorListResult"]: + """List the active directory connectors associated with the given data controller. + + List the active directory connectors associated with the given data controller. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: The name of the data controller. + :type data_controller_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ActiveDirectoryConnectorListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveDirectoryConnectorListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_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("ActiveDirectoryConnectorListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + 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, 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors'} # type: ignore + + def _create_initial( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + active_directory_connector_resource: "_models.ActiveDirectoryConnectorResource", + **kwargs: Any + ) -> "_models.ActiveDirectoryConnectorResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveDirectoryConnectorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(active_directory_connector_resource, 'ActiveDirectoryConnectorResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_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) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ActiveDirectoryConnectorResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ActiveDirectoryConnectorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + active_directory_connector_resource: "_models.ActiveDirectoryConnectorResource", + **kwargs: Any + ) -> LROPoller["_models.ActiveDirectoryConnectorResource"]: + """Creates or replaces an Active Directory connector resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: The name of the data controller. + :type data_controller_name: str + :param active_directory_connector_name: The name of the Active Directory connector instance. + :type active_directory_connector_name: str + :param active_directory_connector_resource: desc. + :type active_directory_connector_resource: + ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorResource + :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. + :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 ActiveDirectoryConnectorResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.ActiveDirectoryConnectorResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_name, + active_directory_connector_resource=active_directory_connector_resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ActiveDirectoryConnectorResource', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes an Active Directory connector resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: The name of the data controller. + :type data_controller_name: str + :param active_directory_connector_name: The name of the Active Directory connector instance. + :type active_directory_connector_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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + data_controller_name: str, + active_directory_connector_name: str, + **kwargs: Any + ) -> "_models.ActiveDirectoryConnectorResource": + """Retrieves an Active Directory connector resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: The name of the data controller. + :type data_controller_name: str + :param active_directory_connector_name: The name of the Active Directory connector instance. + :type active_directory_connector_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ActiveDirectoryConnectorResource, or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.ActiveDirectoryConnectorResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ActiveDirectoryConnectorResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + active_directory_connector_name=active_directory_connector_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ActiveDirectoryConnectorResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}/activeDirectoryConnectors/{activeDirectoryConnectorName}'} # type: ignore + 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..163f31513cef 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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. @@ -32,7 +257,7 @@ class DataControllersOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_arc_data_management_client.models + :type models: ~azure.mgmt.azurearcdata.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -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.mgmt.azurearcdata.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.mgmt.azurearcdata.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,35 +458,41 @@ 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. :type resource_group_name: str - :param data_controller_name: + :param data_controller_name: The name of the data controller. :type data_controller_name: str :param data_controller_resource: desc. - :type data_controller_resource: ~azure_arc_data_management_client.models.DataControllerResource + :type data_controller_resource: ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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 +504,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,78 +530,70 @@ 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. :type resource_group_name: str - :param data_controller_name: + :param data_controller_name: The name of the 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 +607,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,24 +626,25 @@ 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. :type resource_group_name: str - :param data_controller_name: + :param data_controller_name: The name of the data controller. :type data_controller_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: DataControllerResource, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.DataControllerResource + :rtype: ~azure.mgmt.azurearcdata.models.DataControllerResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataControllerResource"] @@ -456,33 +652,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,72 +677,68 @@ 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 + ) -> Optional["_models.DataControllerResource"]: """Updates a dataController resource. :param resource_group_name: The name of the Azure resource group. :type resource_group_name: str - :param data_controller_name: + :param data_controller_name: The name of the data controller. :type data_controller_name: str :param data_controller_resource: The update data controller resource. - :type data_controller_resource: ~azure_arc_data_management_client.models.DataControllerUpdate + :type data_controller_resource: ~azure.mgmt.azurearcdata.models.DataControllerUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: DataControllerResource, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.DataControllerResource + :rtype: ~azure.mgmt.azurearcdata.models.DataControllerResource or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DataControllerResource"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_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.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] - # 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, 'DataControllerUpdate') + + 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]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('DataControllerResource', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DataControllerResource', pipeline_response) if cls: 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..df1ad8a4f875 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 = "2022-03-01-preview" + 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. @@ -30,7 +57,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_arc_data_management_client.models + :type models: ~azure.mgmt.azurearcdata.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,16 +72,16 @@ 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.mgmt.azurearcdata.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +89,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 +122,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/_postgres_instances_operations.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_postgres_instances_operations.py new file mode 100644 index 000000000000..24190c2b4eea --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_postgres_instances_operations.py @@ -0,0 +1,742 @@ +# 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. +# -------------------------------------------------------------------------- +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 HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +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 = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureArcData/postgresInstances') + 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 = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances') + 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, + postgres_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "postgresInstanceName": _SERIALIZER.url("postgres_instance_name", postgres_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, + postgres_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "postgresInstanceName": _SERIALIZER.url("postgres_instance_name", postgres_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, + postgres_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "postgresInstanceName": _SERIALIZER.url("postgres_instance_name", postgres_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, + postgres_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-03-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "postgresInstanceName": _SERIALIZER.url("postgres_instance_name", postgres_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 PostgresInstancesOperations(object): + """PostgresInstancesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurearcdata.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.PostgresInstanceListResult"]: + """List postgres Instance resources in the subscription. + + List postgres Instance 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 PostgresInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurearcdata.models.PostgresInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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("PostgresInstanceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + 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, 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/postgresInstances'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.PostgresInstanceListResult"]: + """List postgres Instance resources in the resource group. + + Get a postgres Instances list by Resource group name. + + :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 PostgresInstanceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurearcdata.models.PostgresInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + 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: + + 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("PostgresInstanceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + 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, 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/postgresInstances'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + postgres_instance_name: str, + **kwargs: Any + ) -> "_models.PostgresInstance": + """Retrieves a postgres Instance resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param postgres_instance_name: Name of Postgres Instance. + :type postgres_instance_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PostgresInstance, or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.PostgresInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + postgres_instance_name=postgres_instance_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PostgresInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + postgres_instance_name: str, + resource: "_models.PostgresInstance", + **kwargs: Any + ) -> "_models.PostgresInstance": + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource, 'PostgresInstance') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + postgres_instance_name=postgres_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) + + 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PostgresInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PostgresInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + postgres_instance_name: str, + resource: "_models.PostgresInstance", + **kwargs: Any + ) -> LROPoller["_models.PostgresInstance"]: + """Creates or replaces a postgres Instance resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param postgres_instance_name: Name of Postgres Instance. + :type postgres_instance_name: str + :param resource: The postgres instance. + :type resource: ~azure.mgmt.azurearcdata.models.PostgresInstance + :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. + :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 PostgresInstance or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurearcdata.models.PostgresInstance] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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.PostgresInstance"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + postgres_instance_name=postgres_instance_name, + resource=resource, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('PostgresInstance', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + postgres_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', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + postgres_instance_name=postgres_instance_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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/postgresInstances/{postgresInstanceName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + postgres_instance_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a postgres Instance resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param postgres_instance_name: Name of Postgres Instance. + :type postgres_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. + :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 None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + postgres_instance_name=postgres_instance_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + postgres_instance_name: str, + parameters: "_models.PostgresInstanceUpdate", + **kwargs: Any + ) -> "_models.PostgresInstance": + """Updates a postgres Instance resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param postgres_instance_name: Name of Postgres Instance. + :type postgres_instance_name: str + :param parameters: The Postgres Instance. + :type parameters: ~azure.mgmt.azurearcdata.models.PostgresInstanceUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PostgresInstance, or the result of cls(response) + :rtype: ~azure.mgmt.azurearcdata.models.PostgresInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PostgresInstance"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'PostgresInstanceUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + postgres_instance_name=postgres_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) + + 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, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PostgresInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/postgresInstances/{postgresInstanceName}'} # type: ignore + 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..54e795cbad5a 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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. @@ -32,7 +257,7 @@ class SqlManagedInstancesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_arc_data_management_client.models + :type models: ~azure.mgmt.azurearcdata.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -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.mgmt.azurearcdata.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.mgmt.azurearcdata.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. @@ -206,7 +428,7 @@ def get( :type sql_managed_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlManagedInstance, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.SqlManagedInstance + :rtype: ~azure.mgmt.azurearcdata.models.SqlManagedInstance :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstance"] @@ -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,35 +510,41 @@ 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. :type resource_group_name: str - :param sql_managed_instance_name: The name of SQL Managed Instances. + :param sql_managed_instance_name: Name of SQL Managed Instance. :type sql_managed_instance_name: str :param sql_managed_instance: The SQL Managed Instance to be created or updated. - :type sql_managed_instance: ~azure_arc_data_management_client.models.SqlManagedInstance + :type sql_managed_instance: ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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 +556,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,78 +582,70 @@ 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. :type resource_group_name: str - :param sql_managed_instance_name: The name of Sql Managed Instances. + :param sql_managed_instance_name: Name of SQL Managed Instance. :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 +659,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,27 +678,28 @@ 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. :type resource_group_name: str - :param sql_managed_instance_name: Name of sqlManagedInstance. + :param sql_managed_instance_name: Name of SQL Managed Instance. :type sql_managed_instance_name: str :param parameters: The SQL Managed Instance. - :type parameters: ~azure_arc_data_management_client.models.SqlManagedInstanceUpdate + :type parameters: ~azure.mgmt.azurearcdata.models.SqlManagedInstanceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlManagedInstance, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.SqlManagedInstance + :rtype: ~azure.mgmt.azurearcdata.models.SqlManagedInstance :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstance"] @@ -519,38 +707,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 +737,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..4fe3c6b21fd8 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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 = "2022-03-01-preview" + 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. @@ -32,7 +257,7 @@ class SqlServerInstancesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_arc_data_management_client.models + :type models: ~azure.mgmt.azurearcdata.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -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.mgmt.azurearcdata.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.mgmt.azurearcdata.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. @@ -206,7 +428,7 @@ def get( :type sql_server_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlServerInstance, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.SqlServerInstance + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerInstance :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstance"] @@ -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,35 +510,41 @@ 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. :type resource_group_name: str - :param sql_server_instance_name: The name of SQL Server Instance. + :param sql_server_instance_name: Name of SQL Server Instance. :type sql_server_instance_name: str :param sql_server_instance: The SQL Server Instance to be created or updated. - :type sql_server_instance: ~azure_arc_data_management_client.models.SqlServerInstance + :type sql_server_instance: ~azure.mgmt.azurearcdata.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.mgmt.azurearcdata.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 +556,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,78 +582,70 @@ 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. :type resource_group_name: str - :param sql_server_instance_name: The name of SQL Server Instance. + :param sql_server_instance_name: Name of SQL Server Instance. :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 +659,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,27 +678,28 @@ 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. :type resource_group_name: str - :param sql_server_instance_name: Name of sqlServerInstance. + :param sql_server_instance_name: Name of SQL Server Instance. :type sql_server_instance_name: str :param parameters: The SQL Server Instance. - :type parameters: ~azure_arc_data_management_client.models.SqlServerInstanceUpdate + :type parameters: ~azure.mgmt.azurearcdata.models.SqlServerInstanceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlServerInstance, or the result of cls(response) - :rtype: ~azure_arc_data_management_client.models.SqlServerInstance + :rtype: ~azure.mgmt.azurearcdata.models.SqlServerInstance :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstance"] @@ -519,38 +707,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 +737,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore +