From 9b63801e53ce6f88c70869da6428f7143244f608 Mon Sep 17 00:00:00 2001 From: Azure CLI Bot Date: Fri, 17 Sep 2021 15:00:44 +0800 Subject: [PATCH] [AutoRelease] t2-azurearcdata-2021-09-15-74995 (#20714) * CodeGen from PR 15874 in Azure/azure-rest-api-specs Adding 202 Accepted for deletion call (#15874) * Adding 202 for deletion call * Adding headers to suppress warnings * version,CHANGELOG Co-authored-by: SDKAuto Co-authored-by: PythonSdkPipelines --- .../azure-mgmt-azurearcdata/CHANGELOG.md | 5 + .../azure-mgmt-azurearcdata/MANIFEST.in | 6 + .../azure-mgmt-azurearcdata/README.md | 27 + .../azure-mgmt-azurearcdata/_meta.json | 11 + .../azure-mgmt-azurearcdata/azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../azure/mgmt/azurearcdata/__init__.py | 19 + .../_azure_arc_data_management_client.py | 104 ++ .../azure/mgmt/azurearcdata/_configuration.py | 71 + .../azure/mgmt/azurearcdata/_metadata.json | 106 ++ .../azure/mgmt/azurearcdata/_version.py | 9 + .../azure/mgmt/azurearcdata/aio/__init__.py | 10 + .../aio/_azure_arc_data_management_client.py | 97 + .../mgmt/azurearcdata/aio/_configuration.py | 67 + .../azurearcdata/aio/operations/__init__.py | 19 + .../_data_controllers_operations.py | 550 ++++++ .../aio/operations/_operations.py | 105 ++ .../_sql_managed_instances_operations.py | 550 ++++++ .../_sql_server_instances_operations.py | 550 ++++++ .../mgmt/azurearcdata/models/__init__.py | 152 ++ ..._azure_arc_data_management_client_enums.py | 118 ++ .../azure/mgmt/azurearcdata/models/_models.py | 1442 +++++++++++++++ .../mgmt/azurearcdata/models/_models_py3.py | 1605 +++++++++++++++++ .../mgmt/azurearcdata/operations/__init__.py | 19 + .../_data_controllers_operations.py | 562 ++++++ .../azurearcdata/operations/_operations.py | 110 ++ .../_sql_managed_instances_operations.py | 562 ++++++ .../_sql_server_instances_operations.py | 562 ++++++ .../azure/mgmt/azurearcdata/py.typed | 1 + .../sdk_packaging.toml | 9 + .../azure-mgmt-azurearcdata/setup.cfg | 2 + .../azure-mgmt-azurearcdata/setup.py | 90 + sdk/azurearcdata/ci.yml | 33 + shared_requirements.txt | 1 + 34 files changed, 7576 insertions(+) create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/CHANGELOG.md create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/MANIFEST.in create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/README.md create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/__init__.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/__init__.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/__init__.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_metadata.json create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/__init__.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_configuration.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/__init__.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/__init__.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/py.typed create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/sdk_packaging.toml create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/setup.cfg create mode 100644 sdk/azurearcdata/azure-mgmt-azurearcdata/setup.py create mode 100644 sdk/azurearcdata/ci.yml diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/CHANGELOG.md b/sdk/azurearcdata/azure-mgmt-azurearcdata/CHANGELOG.md new file mode 100644 index 000000000000..f24747b3b8cc --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2021-09-15) + +* Initial Release diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/MANIFEST.in b/sdk/azurearcdata/azure-mgmt-azurearcdata/MANIFEST.in new file mode 100644 index 000000000000..3a9b6517412b --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/README.md b/sdk/azurearcdata/azure-mgmt-azurearcdata/README.md new file mode 100644 index 000000000000..98453a844f83 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Azurearcdata Management Client Library. +This package has been tested with Python 2.7, 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Azurearcdata Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-azurearcdata%2FREADME.png) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json b/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json new file mode 100644 index 000000000000..39f2055663a1 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "e23a590abc2f98437bafac9da5ccd608b2981a45", + "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", + "readme": "specification/azurearcdata/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/__init__.py new file mode 100644 index 000000000000..34107556bef3 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._azure_arc_data_management_client import AzureArcDataManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['AzureArcDataManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass 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 new file mode 100644 index 000000000000..8ddeb5be5dc3 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_azure_arc_data_management_client.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +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): + """The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. + + :ivar operations: Operations operations + :vartype operations: azure_arc_data_management_client.operations.Operations + :ivar sql_managed_instances: SqlManagedInstancesOperations operations + :vartype sql_managed_instances: azure_arc_data_management_client.operations.SqlManagedInstancesOperations + :ivar sql_server_instances: SqlServerInstancesOperations operations + :vartype sql_server_instances: azure_arc_data_management_client.operations.SqlServerInstancesOperations + :ivar data_controllers: DataControllersOperations operations + :vartype data_controllers: azure_arc_data_management_client.operations.DataControllersOperations + :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. + """ + + 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) + 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.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 + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> AzureArcDataManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py new file mode 100644 index 000000000000..06e0bd8f8958 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class AzureArcDataManagementClientConfiguration(Configuration): + """Configuration for AzureArcDataManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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 + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-azurearcdata/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(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 new file mode 100644 index 000000000000..cf806c606565 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_metadata.json @@ -0,0 +1,106 @@ +{ + "chosen_version": "2021-08-01", + "total_api_version_list": ["2021-08-01"], + "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, + "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\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the Azure subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the Azure subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "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\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "sql_managed_instances": "SqlManagedInstancesOperations", + "sql_server_instances": "SqlServerInstancesOperations", + "data_controllers": "DataControllersOperations" + } +} \ No newline at end of file diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/_version.py @@ -0,0 +1,9 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/__init__.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/__init__.py new file mode 100644 index 000000000000..57b761c5d123 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._azure_arc_data_management_client import AzureArcDataManagementClient +__all__ = ['AzureArcDataManagementClient'] 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 new file mode 100644 index 000000000000..c134ef59a1b8 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_azure_arc_data_management_client.py @@ -0,0 +1,97 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +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): + """The AzureArcData management API provides a RESTful set of web APIs to manage Azure Data Services on Azure Arc Resources. + + :ivar operations: Operations operations + :vartype operations: azure_arc_data_management_client.aio.operations.Operations + :ivar sql_managed_instances: SqlManagedInstancesOperations operations + :vartype sql_managed_instances: azure_arc_data_management_client.aio.operations.SqlManagedInstancesOperations + :ivar sql_server_instances: SqlServerInstancesOperations operations + :vartype sql_server_instances: azure_arc_data_management_client.aio.operations.SqlServerInstancesOperations + :ivar data_controllers: DataControllersOperations operations + :vartype data_controllers: azure_arc_data_management_client.aio.operations.DataControllersOperations + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = AzureArcDataManagementClientConfiguration(credential, 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.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: + """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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "AzureArcDataManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) 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 new file mode 100644 index 000000000000..dbff5e916631 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class AzureArcDataManagementClientConfiguration(Configuration): + """Configuration for AzureArcDataManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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 + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + 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-08-01" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-azurearcdata/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) 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 new file mode 100644 index 000000000000..71f1823a000e --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._sql_managed_instances_operations import SqlManagedInstancesOperations +from ._sql_server_instances_operations import SqlServerInstancesOperations +from ._data_controllers_operations import DataControllersOperations + +__all__ = [ + 'Operations', + 'SqlManagedInstancesOperations', + 'SqlServerInstancesOperations', + 'DataControllersOperations', +] 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 new file mode 100644 index 000000000000..a2358f6cad23 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_data_controllers_operations.py @@ -0,0 +1,550 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataControllersOperations: + """DataControllersOperations 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_arc_data_management_client.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 + + def list_in_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_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.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PageOfDataControllerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PageOfDataControllerResource', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + def list_in_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PageOfDataControllerResource"]: + """List dataController resources in the resource group. + + List dataController resources in the 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 PageOfDataControllerResource or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PageOfDataControllerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PageOfDataControllerResource', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_in_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers'} # type: ignore + + async def _put_data_controller_initial( + self, + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + + if response.status_code == 200: + deserialized = self._deserialize('DataControllerResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataControllerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _put_data_controller_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + async def begin_put_data_controller( + self, + resource_group_name: str, + data_controller_name: str, + data_controller_resource: "_models.DataControllerResource", + **kwargs: Any + ) -> AsyncLROPoller["_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: + :type data_controller_name: str + :param data_controller_resource: desc. + :type data_controller_resource: ~azure_arc_data_management_client.models.DataControllerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataControllerResource"] + 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._put_data_controller_initial( + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + data_controller_resource=data_controller_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + 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_put_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + async def _delete_data_controller_initial( + self, + 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-08-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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_data_controller_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + async def begin_delete_data_controller( + self, + resource_group_name: str, + data_controller_name: str, + **kwargs: Any + ) -> AsyncLROPoller[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: + :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. + :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, 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_data_controller_initial( + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + 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) + 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_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + async def get_data_controller( + self, + 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: + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataControllerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + async def patch_data_controller( + self, + resource_group_name: str, + data_controller_name: str, + data_controller_resource: "_models.DataControllerUpdate", + **kwargs: Any + ) -> "_models.DataControllerResource": + """Updates a dataController resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(data_controller_resource, 'DataControllerUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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 new file mode 100644 index 000000000000..90194487b71b --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_operations.py @@ -0,0 +1,105 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations 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_arc_data_management_client.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 + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_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.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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 = 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) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AzureArcData/operations'} # 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 new file mode 100644 index 000000000000..ba47da5e7381 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_managed_instances_operations.py @@ -0,0 +1,550 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlManagedInstancesOperations: + """SqlManagedInstancesOperations 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_arc_data_management_client.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 + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_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.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlManagedInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlManagedInstanceListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SqlManagedInstanceListResult"]: + """List sqlManagedInstance resources in the resource group. + + Gets all sqlManagedInstances in a 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlManagedInstanceListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + 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. + :type resource_group_name: str + :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 + :return: SqlManagedInstance, or the result of cls(response) + :rtype: ~azure_arc_data_management_client.models.SqlManagedInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlManagedInstance', pipeline_response) + + if cls: + 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, + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + + if response.status_code == 200: + deserialized = self._deserialize('SqlManagedInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SqlManagedInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + sql_managed_instance_name: str, + sql_managed_instance: "_models.SqlManagedInstance", + **kwargs: Any + ) -> AsyncLROPoller["_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. + :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 + :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 SqlManagedInstance or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure_arc_data_management_client.models.SqlManagedInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstance"] + 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, + sql_managed_instance_name=sql_managed_instance_name, + sql_managed_instance=sql_managed_instance, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + 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/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + async def _delete_initial( + self, + 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-08-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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + sql_managed_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller[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. + :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. + :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, 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, + sql_managed_instance_name=sql_managed_instance_name, + 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) + 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/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + async def update( + self, + 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. + :type sql_managed_instance_name: str + :param parameters: The SQL Managed Instance. + :type parameters: ~azure_arc_data_management_client.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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlManagedInstance', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..31bb1b0649ba --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/aio/operations/_sql_server_instances_operations.py @@ -0,0 +1,550 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlServerInstancesOperations: + """SqlServerInstancesOperations 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_arc_data_management_client.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 + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_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.async_paging.AsyncItemPaged[~azure_arc_data_management_client.models.SqlServerInstanceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlServerInstanceListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SqlServerInstanceListResult"]: + """List sqlServerInstance resources in the resource group. + + Gets all sqlServerInstances in a 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlServerInstanceListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def get( + self, + 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. + :type resource_group_name: str + :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 + :return: SqlServerInstance, or the result of cls(response) + :rtype: ~azure_arc_data_management_client.models.SqlServerInstance + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlServerInstance', pipeline_response) + + if cls: + 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, + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + + if response.status_code == 200: + deserialized = self._deserialize('SqlServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SqlServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + sql_server_instance_name: str, + sql_server_instance: "_models.SqlServerInstance", + **kwargs: Any + ) -> AsyncLROPoller["_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. + :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 + :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 SqlServerInstance or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure_arc_data_management_client.models.SqlServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstance"] + 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, + sql_server_instance_name=sql_server_instance_name, + sql_server_instance=sql_server_instance, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + 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/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + async def _delete_initial( + self, + 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-08-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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + sql_server_instance_name: str, + **kwargs: Any + ) -> AsyncLROPoller[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. + :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. + :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, 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, + sql_server_instance_name=sql_server_instance_name, + 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) + 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/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + async def update( + self, + 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. + :type sql_server_instance_name: str + :param parameters: The SQL Server Instance. + :type parameters: ~azure_arc_data_management_client.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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlServerInstance', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..be72068b045e --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/__init__.py @@ -0,0 +1,152 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import 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 ._azure_arc_data_management_client_enums import ( + ArcSqlManagedInstanceLicenseType, + ArcSqlServerLicenseType, + ConnectionStatus, + DefenderStatus, + EditionType, + ExtendedLocationTypes, + IdentityType, + Infrastructure, + OperationOrigin, + SqlManagedInstanceSkuTier, + SqlVersion, +) + +__all__ = [ + 'BasicLoginInformation', + 'CommonSku', + 'DataControllerProperties', + 'DataControllerResource', + 'DataControllerUpdate', + 'ErrorResponse', + 'ErrorResponseBody', + 'ExtendedLocation', + 'Identity', + 'K8SResourceRequirements', + 'K8SScheduling', + 'K8SSchedulingOptions', + 'LogAnalyticsWorkspaceConfig', + 'ODataError', + 'OnPremiseProperty', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'PageOfDataControllerResource', + 'Plan', + 'ProxyResource', + 'Resource', + 'ResourceSku', + 'SqlManagedInstance', + 'SqlManagedInstanceK8SRaw', + 'SqlManagedInstanceK8SSpec', + 'SqlManagedInstanceListResult', + 'SqlManagedInstanceProperties', + 'SqlManagedInstanceSku', + 'SqlManagedInstanceUpdate', + 'SqlServerInstance', + 'SqlServerInstanceListResult', + 'SqlServerInstanceProperties', + 'SqlServerInstanceUpdate', + 'SystemData', + 'TrackedResource', + 'UploadServicePrincipal', + 'UploadWatermark', + 'ArcSqlManagedInstanceLicenseType', + 'ArcSqlServerLicenseType', + 'ConnectionStatus', + 'DefenderStatus', + 'EditionType', + 'ExtendedLocationTypes', + 'IdentityType', + 'Infrastructure', + 'OperationOrigin', + 'SqlManagedInstanceSkuTier', + 'SqlVersion', +] 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 new file mode 100644 index 000000000000..fac1c2934e44 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_azure_arc_data_management_client_enums.py @@ -0,0 +1,118 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ArcSqlManagedInstanceLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The license type to apply for this managed instance. + """ + + BASE_PRICE = "BasePrice" + LICENSE_INCLUDED = "LicenseIncluded" + +class ArcSqlServerLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SQL Server license type. + """ + + PAID = "Paid" + FREE = "Free" + HADR = "HADR" + UNDEFINED = "Undefined" + +class ConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The cloud connectivity status. + """ + + CONNECTED = "Connected" + DISCONNECTED = "Disconnected" + UNKNOWN = "Unknown" + +class DefenderStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of Azure Defender. + """ + + PROTECTED = "Protected" + UNPROTECTED = "Unprotected" + UNKNOWN = "Unknown" + +class EditionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SQL Server edition. + """ + + EVALUATION = "Evaluation" + ENTERPRISE = "Enterprise" + STANDARD = "Standard" + WEB = "Web" + DEVELOPER = "Developer" + EXPRESS = "Express" + +class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of extendedLocation. + """ + + CUSTOM_LOCATION = "CustomLocation" + +class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that creates/modifies resources + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class Infrastructure(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The infrastructure the data controller is running on. + """ + + AZURE = "azure" + GCP = "gcp" + AWS = "aws" + ALIBABA = "alibaba" + ONPREMISES = "onpremises" + OTHER = "other" + +class OperationOrigin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The intended executor of the operation. + """ + + USER = "user" + SYSTEM = "system" + +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)): + """SQL Server version. + """ + + SQL_SERVER2019 = "SQL Server 2019" + SQL_SERVER2017 = "SQL Server 2017" + SQL_SERVER2016 = "SQL Server 2016" 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 new file mode 100644 index 000000000000..1cfa963b8a04 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models.py @@ -0,0 +1,1442 @@ +# 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: Username and password for basic login authentication. + :type basic_login_information: ~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: Service principal for uploading billing, metrics and logs. + :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'}, + '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.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 new file mode 100644 index 000000000000..822cf32d7820 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/models/_models_py3.py @@ -0,0 +1,1605 @@ +# 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 datetime +from typing import Any, Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._azure_arc_data_management_client_enums import * + + +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, + *, + username: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): + super(BasicLoginInformation, self).__init__(**kwargs) + self.username = username + self.password = password + + +class CommonSku(msrest.serialization.Model): + """The resource model definition representing SKU for ARM resources. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. It is typically a letter+number code. + :type name: str + :param dev: Whether dev/test is enabled. When the dev field is set to true, the resource is + used for dev/test purpose. + :type dev: bool + :param size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :type size: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'dev': {'key': 'dev', 'type': 'bool'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: str, + dev: Optional[bool] = True, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(CommonSku, self).__init__(**kwargs) + self.name = name + self.dev = dev + self.size = size + self.family = family + self.capacity = capacity + + +class DataControllerProperties(msrest.serialization.Model): + """The data controller properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param infrastructure: The infrastructure the data controller is running on. Possible values + 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: Username and password for basic login authentication. + :type basic_login_information: ~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: Service principal for uploading billing, metrics and logs. + :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'}, + '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, + *, + infrastructure: Optional[Union[str, "Infrastructure"]] = "other", + on_premise_property: Optional["OnPremiseProperty"] = None, + k8_s_raw: Optional[Any] = None, + upload_watermark: Optional["UploadWatermark"] = None, + last_uploaded_date: Optional[datetime.datetime] = None, + basic_login_information: Optional["BasicLoginInformation"] = None, + log_analytics_workspace_config: Optional["LogAnalyticsWorkspaceConfig"] = None, + upload_service_principal: Optional["UploadServicePrincipal"] = None, + cluster_id: Optional[str] = None, + extension_id: Optional[str] = None, + **kwargs + ): + super(DataControllerProperties, self).__init__(**kwargs) + self.infrastructure = infrastructure + self.on_premise_property = on_premise_property + self.k8_s_raw = k8_s_raw + self.upload_watermark = upload_watermark + self.last_uploaded_date = last_uploaded_date + self.basic_login_information = basic_login_information + self.log_analytics_workspace_config = log_analytics_workspace_config + self.upload_service_principal = upload_service_principal + self.provisioning_state = None + self.cluster_id = cluster_id + 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. + + 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, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = 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, + *, + location: str, + properties: "DataControllerProperties", + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + **kwargs + ): + super(DataControllerResource, self).__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.properties = 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, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(DataControllerUpdate, self).__init__(**kwargs) + self.tags = tags + + +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, + *, + error: Optional["ErrorResponseBody"] = None, + **kwargs + ): + super(ErrorResponse, self).__init__(**kwargs) + self.error = error + + +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, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["ErrorResponseBody"]] = None, + **kwargs + ): + super(ErrorResponseBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +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, + *, + name: Optional[str] = None, + type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + **kwargs + ): + 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 + 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, + *, + additional_properties: Optional[Dict[str, Any]] = None, + requests: Optional[Dict[str, str]] = None, + limits: Optional[Dict[str, str]] = None, + **kwargs + ): + super(K8SResourceRequirements, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.requests = requests + self.limits = limits + + +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, + *, + additional_properties: Optional[Dict[str, Any]] = None, + default: Optional["K8SSchedulingOptions"] = None, + **kwargs + ): + super(K8SScheduling, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.default = default + + +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, + *, + additional_properties: Optional[Dict[str, Any]] = None, + resources: Optional["K8SResourceRequirements"] = None, + **kwargs + ): + 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. + + :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, + *, + workspace_id: Optional[str] = None, + primary_key: Optional[str] = None, + **kwargs + ): + super(LogAnalyticsWorkspaceConfig, self).__init__(**kwargs) + self.workspace_id = workspace_id + self.primary_key = primary_key + + +class ODataError(msrest.serialization.Model): + """Information about an error. + + :param code: A language-independent error name. + :type code: str + :param message: The error message. + :type message: str + :param target: The target of the error (for example, the name of the property in error). + :type target: str + :param details: The error details. + :type details: list[~azure_arc_data_management_client.models.ODataError] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[ODataError]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["ODataError"]] = None, + **kwargs + ): + super(ODataError, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class OnPremiseProperty(msrest.serialization.Model): + """Properties from the Kubernetes data controller. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. A globally unique ID identifying the associated Kubernetes cluster. + :type id: str + :param public_signing_key: Required. Certificate that contains the Kubernetes cluster public + key used to verify signing. + :type public_signing_key: str + :param signing_certificate_thumbprint: Unique thumbprint returned to customer to verify the + 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, + *, + id: str, + public_signing_key: str, + signing_certificate_thumbprint: Optional[str] = None, + **kwargs + ): + super(OnPremiseProperty, self).__init__(**kwargs) + self.id = id + self.public_signing_key = public_signing_key + self.signing_certificate_thumbprint = signing_certificate_thumbprint + + +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, + *, + name: str, + display: "OperationDisplay", + is_data_action: bool, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = None + self.is_data_action = 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, + *, + provider: str, + resource: str, + operation: str, + description: str, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = 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, + *, + value: Optional[List["DataControllerResource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PageOfDataControllerResource, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Plan(msrest.serialization.Model): + """Plan for the resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. + :type name: str + :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. + NewRelic. + :type publisher: str + :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product + maps to the OfferID specified for the artifact at the time of Data Market onboarding. + :type product: str + :param promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :type promotion_code: str + :param version: The version of the desired product/artifact. + :type version: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'product': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + publisher: str, + product: str, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class ResourceSku(msrest.serialization.Model): + """ResourceSku. + + :param capacity: + :type capacity: int + :param family: + :type family: str + :param name: + :type name: str + :param size: + :type size: str + :param tier: + :type tier: str + """ + + _attribute_map = { + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + capacity: Optional[int] = None, + family: Optional[str] = None, + name: Optional[str] = None, + size: Optional[str] = None, + tier: Optional[str] = None, + **kwargs + ): + super(ResourceSku, self).__init__(**kwargs) + self.capacity = capacity + self.family = family + self.name = name + self.size = size + self.tier = tier + + +class SqlManagedInstance(TrackedResource): + """A SqlManagedInstance. + + 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, + *, + location: str, + properties: "SqlManagedInstanceProperties", + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + sku: Optional["SqlManagedInstanceSku"] = None, + **kwargs + ): + super(SqlManagedInstance, self).__init__(tags=tags, location=location, **kwargs) + self.properties = properties + self.extended_location = extended_location + self.sku = sku + + +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, + *, + additional_properties: Optional[Dict[str, Any]] = None, + spec: Optional["SqlManagedInstanceK8SSpec"] = None, + **kwargs + ): + super(SqlManagedInstanceK8SRaw, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.spec = spec + + +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, + *, + additional_properties: Optional[Dict[str, Any]] = None, + scheduling: Optional["K8SScheduling"] = None, + replicas: Optional[int] = None, + **kwargs + ): + super(SqlManagedInstanceK8SSpec, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.scheduling = scheduling + self.replicas = replicas + + +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, + *, + data_controller_id: Optional[str] = None, + admin: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + k8_s_raw: Optional["SqlManagedInstanceK8SRaw"] = None, + basic_login_information: Optional["BasicLoginInformation"] = None, + last_uploaded_date: Optional[datetime.datetime] = None, + license_type: Optional[Union[str, "ArcSqlManagedInstanceLicenseType"]] = "BasePrice", + cluster_id: Optional[str] = None, + extension_id: Optional[str] = None, + **kwargs + ): + super(SqlManagedInstanceProperties, self).__init__(**kwargs) + self.data_controller_id = data_controller_id + self.admin = admin + self.start_time = start_time + self.end_time = end_time + self.k8_s_raw = k8_s_raw + self.basic_login_information = basic_login_information + self.last_uploaded_date = last_uploaded_date + self.provisioning_state = None + self.license_type = license_type + self.cluster_id = cluster_id + self.extension_id = extension_id + + +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, + *, + tier: Optional[Union[str, "SqlManagedInstanceSkuTier"]] = "GeneralPurpose", + dev: Optional[bool] = True, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(SqlManagedInstanceSku, self).__init__(**kwargs) + self.tier = tier + self.dev = dev + self.size = size + self.family = family + self.capacity = capacity + + +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, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(SqlManagedInstanceUpdate, self).__init__(**kwargs) + self.tags = tags + + +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, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["SqlServerInstanceProperties"] = None, + **kwargs + ): + super(SqlServerInstance, self).__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +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, + *, + container_resource_id: str, + status: Union[str, "ConnectionStatus"], + version: Optional[Union[str, "SqlVersion"]] = None, + edition: Optional[Union[str, "EditionType"]] = None, + v_core: Optional[str] = None, + patch_level: Optional[str] = None, + collation: Optional[str] = None, + current_version: Optional[str] = None, + instance_name: Optional[str] = None, + tcp_dynamic_ports: Optional[str] = None, + tcp_static_ports: Optional[str] = None, + product_id: Optional[str] = None, + license_type: Optional[Union[str, "ArcSqlServerLicenseType"]] = None, + azure_defender_status_last_updated: Optional[datetime.datetime] = None, + azure_defender_status: Optional[Union[str, "DefenderStatus"]] = None, + **kwargs + ): + super(SqlServerInstanceProperties, self).__init__(**kwargs) + self.version = version + self.edition = edition + self.container_resource_id = container_resource_id + self.create_time = None + self.v_core = v_core + self.status = status + self.patch_level = patch_level + self.collation = collation + self.current_version = current_version + self.instance_name = instance_name + self.tcp_dynamic_ports = tcp_dynamic_ports + self.tcp_static_ports = tcp_static_ports + self.product_id = product_id + self.license_type = license_type + self.azure_defender_status_last_updated = azure_defender_status_last_updated + self.azure_defender_status = azure_defender_status + 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, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + 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 + 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, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "IdentityType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "IdentityType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +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, + *, + client_id: Optional[str] = None, + tenant_id: Optional[str] = None, + authority: Optional[str] = None, + client_secret: Optional[str] = None, + **kwargs + ): + super(UploadServicePrincipal, self).__init__(**kwargs) + self.client_id = client_id + self.tenant_id = tenant_id + self.authority = authority + self.client_secret = client_secret + + +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, + *, + metrics: Optional[datetime.datetime] = None, + logs: Optional[datetime.datetime] = None, + usages: Optional[datetime.datetime] = None, + **kwargs + ): + super(UploadWatermark, self).__init__(**kwargs) + self.metrics = metrics + self.logs = logs + self.usages = usages 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 new file mode 100644 index 000000000000..71f1823a000e --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._sql_managed_instances_operations import SqlManagedInstancesOperations +from ._sql_server_instances_operations import SqlServerInstancesOperations +from ._data_controllers_operations import DataControllersOperations + +__all__ = [ + 'Operations', + 'SqlManagedInstancesOperations', + 'SqlServerInstancesOperations', + 'DataControllersOperations', +] 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 new file mode 100644 index 000000000000..c0afcbc34fac --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_data_controllers_operations.py @@ -0,0 +1,562 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class DataControllersOperations(object): + """DataControllersOperations 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_arc_data_management_client.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 + + def list_in_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PageOfDataControllerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PageOfDataControllerResource', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + def list_in_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PageOfDataControllerResource"] + """List dataController resources in the resource group. + + List dataController resources in the 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 PageOfDataControllerResource or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure_arc_data_management_client.models.PageOfDataControllerResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PageOfDataControllerResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PageOfDataControllerResource', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_in_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers'} # type: ignore + + 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" + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + + if response.status_code == 200: + deserialized = self._deserialize('DataControllerResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataControllerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _put_data_controller_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + 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"] + """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: + :type data_controller_name: str + :param data_controller_resource: desc. + :type data_controller_resource: ~azure_arc_data_management_client.models.DataControllerResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataControllerResource"] + 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._put_data_controller_initial( + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + data_controller_resource=data_controller_resource, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + 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_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 + 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-08-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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_data_controller_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + def begin_delete_data_controller( + self, + resource_group_name, # type: str + data_controller_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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: + :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. + :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, 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_data_controller_initial( + resource_group_name=resource_group_name, + data_controller_name=data_controller_name, + 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) + 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_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + def get_data_controller( + self, + resource_group_name, # type: str + data_controller_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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: + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataControllerResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_data_controller.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/dataControllers/{dataControllerName}'} # type: ignore + + 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" + """Updates a dataController resource. + + :param resource_group_name: The name of the Azure resource group. + :type resource_group_name: str + :param data_controller_name: + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(data_controller_resource, 'DataControllerUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + 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 new file mode 100644 index 000000000000..94732fb29a25 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class Operations(object): + """Operations 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_arc_data_management_client.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 + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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 = 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) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.AzureArcData/operations'} # 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 new file mode 100644 index 000000000000..9c06d6b09103 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_managed_instances_operations.py @@ -0,0 +1,562 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class SqlManagedInstancesOperations(object): + """SqlManagedInstancesOperations 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_arc_data_management_client.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 + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlManagedInstanceListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SqlManagedInstanceListResult"] + """List sqlManagedInstance resources in the resource group. + + Gets all sqlManagedInstances in a 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlManagedInstanceListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + def get( + self, + resource_group_name, # type: str + sql_managed_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SqlManagedInstance" + """Retrieves 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 SQL Managed Instance. + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlManagedInstance', pipeline_response) + + if cls: + 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" + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + + if response.status_code == 200: + deserialized = self._deserialize('SqlManagedInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SqlManagedInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + 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"] + """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. + :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 + :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 SqlManagedInstance or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure_arc_data_management_client.models.SqlManagedInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlManagedInstance"] + 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, + sql_managed_instance_name=sql_managed_instance_name, + sql_managed_instance=sql_managed_instance, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + 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/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + sql_managed_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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-08-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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + sql_managed_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :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. + :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, 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, + sql_managed_instance_name=sql_managed_instance_name, + 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) + 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/sqlManagedInstances/{sqlManagedInstanceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + sql_managed_instance_name, # type: str + parameters, # type: "_models.SqlManagedInstanceUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type sql_managed_instance_name: str + :param parameters: The SQL Managed Instance. + :type parameters: ~azure_arc_data_management_client.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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlManagedInstance', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..768ad1eaf582 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/operations/_sql_server_instances_operations.py @@ -0,0 +1,562 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class SqlServerInstancesOperations(object): + """SqlServerInstancesOperations 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_arc_data_management_client.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 + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlServerInstanceListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SqlServerInstanceListResult"] + """List sqlServerInstance resources in the resource group. + + Gets all sqlServerInstances in a 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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstanceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-08-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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlServerInstanceListResult', 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]: + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + def get( + self, + resource_group_name, # type: str + sql_server_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SqlServerInstance" + """Retrieves 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 SQL Server Instance. + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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 = 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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlServerInstance', pipeline_response) + + if cls: + 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" + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + + if response.status_code == 200: + deserialized = self._deserialize('SqlServerInstance', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SqlServerInstance', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + 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"] + """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. + :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 + :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 SqlServerInstance or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure_arc_data_management_client.models.SqlServerInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlServerInstance"] + 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, + sql_server_instance_name=sql_server_instance_name, + sql_server_instance=sql_server_instance, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_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) + 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/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + sql_server_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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-08-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 = 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) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureArcData/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + sql_server_instance_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :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. + :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, 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, + sql_server_instance_name=sql_server_instance_name, + 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) + 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/sqlServerInstances/{sqlServerInstanceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + sql_server_instance_name, # type: str + parameters, # type: "_models.SqlServerInstanceUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type sql_server_instance_name: str + :param parameters: The SQL Server Instance. + :type parameters: ~azure_arc_data_management_client.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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-08-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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(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) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlServerInstance', pipeline_response) + + if cls: + 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/py.typed b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/azure/mgmt/azurearcdata/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/sdk_packaging.toml b/sdk/azurearcdata/azure-mgmt-azurearcdata/sdk_packaging.toml new file mode 100644 index 000000000000..e7ca90eac1d5 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-azurearcdata" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Azurearcdata Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/setup.cfg b/sdk/azurearcdata/azure-mgmt-azurearcdata/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/azurearcdata/azure-mgmt-azurearcdata/setup.py b/sdk/azurearcdata/azure-mgmt-azurearcdata/setup.py new file mode 100644 index 000000000000..e8339e57c249 --- /dev/null +++ b/sdk/azurearcdata/azure-mgmt-azurearcdata/setup.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-azurearcdata" +PACKAGE_PPRINT_NAME = "Azurearcdata Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/azurearcdata/ci.yml b/sdk/azurearcdata/ci.yml new file mode 100644 index 000000000000..48168494a8e0 --- /dev/null +++ b/sdk/azurearcdata/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/azurearcdata/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/azurearcdata/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: azurearcdata + Artifacts: + - name: azure-mgmt-azurearcdata + safeName: azuremgmtazurearcdata diff --git a/shared_requirements.txt b/shared_requirements.txt index bc96cd664b58..04535562eb8e 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -344,3 +344,4 @@ opentelemetry-sdk<2.0.0,>=1.0.0 #override azure-mgmt-security msrest>=0.6.21 #override azure-mgmt-apimanagement msrest>=0.6.21 #override azure-mgmt-relay msrest>=0.6.21 +#override azure-mgmt-azurearcdata msrest>=0.6.21