diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json b/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json index 855e09f59f87d..b0586fe9d6a6a 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.1", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "e34a41692e241c432c775a81207f24c631b82b7c", + "commit": "ea1aed264817addfa71d334e56cca3f21a8c37f0", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/azurestackhci/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.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "autorest_command": "autorest specification/azurestackhci/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/azurestackhci/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/__init__.py index dcbb5159c6bfe..bd633465c2d38 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AzureStackHCIClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py index d23a9ffe61419..f487b24bfe19a 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py @@ -6,27 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AzureStackHCIClientConfiguration +from .operations import ArcSettingsOperations, ClustersOperations, ExtensionsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import AzureStackHCIClientConfiguration -from .operations import ArcSettingsOperations -from .operations import ClustersOperations -from .operations import ExtensionsOperations -from .operations import Operations -from . import models - -class AzureStackHCIClient(object): +class AzureStackHCIClient: """Azure Stack HCI management service. :ivar arc_settings: ArcSettingsOperations operations @@ -41,54 +36,57 @@ class AzureStackHCIClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureStackHCIClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AzureStackHCIClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.arc_settings = ArcSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.arc_settings = ArcSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py index 7bf8e4c73e83f..f91f030c86b06 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,20 +33,19 @@ class AzureStackHCIClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AzureStackHCIClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AzureStackHCIClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-01-01-preview" + self.api_version = "2022-01-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-azurestackhci/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_metadata.json b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_metadata.json index b1bed7064c617..ee877386b9c76 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_metadata.json +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-01-01-preview", - "total_api_version_list": ["2021-01-01-preview"], + "chosen_version": "2022-01-01", + "total_api_version_list": ["2022-01-01"], "client": { "name": "AzureStackHCIClient", "filename": "_azure_stack_hci_client", "description": "Azure Stack HCI management service.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureStackHCIClientConfiguration\"]}}, \"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\": [\"AzureStackHCIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureStackHCIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureStackHCIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "arc_settings": "ArcSettingsOperations", diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_patch.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py index c096871cfd889..e5754a47ce68f 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "6.1.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/__init__.py index 8953a4893913a..9e9956942c047 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/__init__.py @@ -8,3 +8,8 @@ from ._azure_stack_hci_client import AzureStackHCIClient __all__ = ['AzureStackHCIClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py index 4eff22044a773..496b23423324d 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AzureStackHCIClientConfiguration +from .operations import ArcSettingsOperations, ClustersOperations, ExtensionsOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AzureStackHCIClientConfiguration -from .operations import ArcSettingsOperations -from .operations import ClustersOperations -from .operations import ExtensionsOperations -from .operations import Operations -from .. import models - - -class AzureStackHCIClient(object): +class AzureStackHCIClient: """Azure Stack HCI management service. :ivar arc_settings: ArcSettingsOperations operations @@ -39,52 +36,57 @@ class AzureStackHCIClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = AzureStackHCIClientConfiguration(credential, subscription_id, **kwargs) + self._config = AzureStackHCIClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.arc_settings = ArcSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.arc_settings = ArcSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py index d5dc0073a910f..feb87a2cc13ee 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AzureStackHCIClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(AzureStackHCIClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-01-01-preview" + self.api_version = "2022-01-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-azurestackhci/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_patch.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py index 9c62aa2d29f47..854db0b3f1e76 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._arc_settings_operations import build_create_request, build_delete_request_initial, build_get_request, build_list_by_cluster_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_cluster( self, resource_group_name: str, @@ -65,36 +71,33 @@ def list_by_cluster( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.list_by_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ArcSettingList', pipeline_response) + deserialized = self._deserialize("ArcSettingList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +110,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,34 +149,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ArcSetting', pipeline_response) @@ -180,8 +175,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -211,39 +209,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(arc_setting, 'ArcSetting') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(arc_setting, 'ArcSetting') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ArcSetting', pipeline_response) @@ -252,8 +240,10 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -266,41 +256,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -319,15 +300,17 @@ async def begin_delete( :type arc_setting_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -342,22 +325,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -369,4 +344,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py index 527d5651a1435..08a8fb907973f 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._clusters_operations import build_create_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -57,34 +63,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) + deserialized = self._deserialize("ClusterList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -97,17 +98,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -127,35 +130,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) + deserialized = self._deserialize("ClusterList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -168,17 +167,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -201,33 +202,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -236,8 +227,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -263,38 +257,28 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(cluster, 'Cluster') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cluster, 'Cluster') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -303,8 +287,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -330,38 +317,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(cluster, 'ClusterPatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cluster, 'ClusterPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -370,8 +347,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -394,36 +374,27 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py index 6a9801001e6b1..9ce4b9df00706 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_arc_setting_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_arc_setting( self, resource_group_name: str, @@ -69,37 +75,35 @@ def list_by_arc_setting( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_arc_setting.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_arc_setting_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + template_url=self.list_by_arc_setting.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_arc_setting_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionList', pipeline_response) + deserialized = self._deserialize("ExtensionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,17 +116,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_arc_setting.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -152,35 +158,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -189,8 +185,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -205,41 +203,30 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -251,8 +238,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -277,15 +267,19 @@ async def begin_create( :type extension: ~azure_stack_hci_client.models.Extension :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Extension or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Extension or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure_stack_hci_client.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +293,21 @@ async def begin_create( arc_setting_name=arc_setting_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -333,6 +319,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore async def _update_initial( @@ -349,41 +336,30 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension, 'Extension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - 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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -391,8 +367,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -417,15 +396,19 @@ async def begin_update( :type extension: ~azure_stack_hci_client.models.Extension :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Extension or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Extension or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure_stack_hci_client.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -439,29 +422,21 @@ async def begin_update( arc_setting_name=arc_setting_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -473,6 +448,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore async def _delete_initial( @@ -488,42 +464,33 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -545,15 +512,17 @@ async def begin_delete( :type extension_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -569,23 +538,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -597,4 +557,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py index 019128f65482e..c9ae2251e5bef 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, **kwargs: Any @@ -56,27 +61,20 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - - # 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationListResult', pipeline_response) @@ -85,4 +83,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.AzureStackHCI/operations'} # type: ignore + diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py index 6675e25c82930..8427ffcef4aeb 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py @@ -6,65 +6,49 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ArcSetting - from ._models_py3 import ArcSettingList - from ._models_py3 import Cluster - from ._models_py3 import ClusterList - from ._models_py3 import ClusterNode - from ._models_py3 import ClusterPatch - from ._models_py3 import ClusterReportedProperties - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Extension - from ._models_py3 import ExtensionList - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PerNodeExtensionState - from ._models_py3 import PerNodeState - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import TrackedResource -except (SyntaxError, ImportError): - from ._models import ArcSetting # type: ignore - from ._models import ArcSettingList # type: ignore - from ._models import Cluster # type: ignore - from ._models import ClusterList # type: ignore - from ._models import ClusterNode # type: ignore - from ._models import ClusterPatch # type: ignore - from ._models import ClusterReportedProperties # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Extension # type: ignore - from ._models import ExtensionList # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PerNodeExtensionState # type: ignore - from ._models import PerNodeState # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import TrackedResource # type: ignore +from ._models_py3 import ArcSetting +from ._models_py3 import ArcSettingList +from ._models_py3 import Cluster +from ._models_py3 import ClusterDesiredProperties +from ._models_py3 import ClusterList +from ._models_py3 import ClusterNode +from ._models_py3 import ClusterPatch +from ._models_py3 import ClusterReportedProperties +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionList +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PerNodeExtensionState +from ._models_py3 import PerNodeState +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import TrackedResource + from ._azure_stack_hci_client_enums import ( ActionType, ArcSettingAggregateState, CreatedByType, + DiagnosticLevel, ExtensionAggregateState, + ImdsAttestation, NodeArcState, NodeExtensionState, Origin, ProvisioningState, Status, + WindowsServerSubscription, ) __all__ = [ 'ArcSetting', 'ArcSettingList', 'Cluster', + 'ClusterDesiredProperties', 'ClusterList', 'ClusterNode', 'ClusterPatch', @@ -85,10 +69,13 @@ 'ActionType', 'ArcSettingAggregateState', 'CreatedByType', + 'DiagnosticLevel', 'ExtensionAggregateState', + 'ImdsAttestation', 'NodeArcState', 'NodeExtensionState', 'Origin', 'ProvisioningState', 'Status', + 'WindowsServerSubscription', ] diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py index 5b3ae6cc1a3cc..a6c41299232ce 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_azure_stack_hci_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ INTERNAL = "Internal" -class ArcSettingAggregateState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ArcSettingAggregateState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Aggregate state of Arc agent across the nodes in this HCI cluster. """ @@ -52,7 +37,7 @@ class ArcSettingAggregateState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu PARTIALLY_CONNECTED = "PartiallyConnected" IN_PROGRESS = "InProgress" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -61,7 +46,15 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class ExtensionAggregateState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiagnosticLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Desired level of diagnostic data emitted by the cluster. + """ + + OFF = "Off" + BASIC = "Basic" + ENHANCED = "Enhanced" + +class ExtensionAggregateState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Aggregate state of Arc Extensions across the nodes in this HCI cluster. """ @@ -81,7 +74,14 @@ class ExtensionAggregateState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum PARTIALLY_CONNECTED = "PartiallyConnected" IN_PROGRESS = "InProgress" -class NodeArcState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ImdsAttestation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """IMDS attestation status of the cluster. + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" + +class NodeArcState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of Arc agent in this node. """ @@ -98,7 +98,7 @@ class NodeArcState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETING = "Deleting" MOVING = "Moving" -class NodeExtensionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeExtensionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of Arc Extension in this node. """ @@ -115,7 +115,7 @@ class NodeExtensionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETING = "Deleting" MOVING = "Moving" -class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" """ @@ -124,7 +124,7 @@ class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM = "system" USER_SYSTEM = "user,system" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the ArcSetting proxy resource. """ @@ -134,7 +134,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCEPTED = "Accepted" PROVISIONING = "Provisioning" -class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the cluster agent. """ @@ -143,3 +143,10 @@ class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): NOT_CONNECTED_RECENTLY = "NotConnectedRecently" DISCONNECTED = "Disconnected" ERROR = "Error" + +class WindowsServerSubscription(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Desired state of Windows Server Subscription. + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models.py deleted file mode 100644 index 4564c9472f420..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models.py +++ /dev/null @@ -1,963 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _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 ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _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 ArcSetting(ProxyResource): - """ArcSetting details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar provisioning_state: Provisioning state of the ArcSetting proxy resource. Possible values - include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning". - :vartype provisioning_state: str or ~azure_stack_hci_client.models.ProvisioningState - :ivar arc_instance_resource_group: The resource group that hosts the Arc agents, ie. Hybrid - Compute Machine resources. - :vartype arc_instance_resource_group: str - :ivar aggregate_state: Aggregate state of Arc agent across the nodes in this HCI cluster. - Possible values include: "NotSpecified", "Error", "Succeeded", "Canceled", "Failed", - "Connected", "Disconnected", "Deleted", "Creating", "Updating", "Deleting", "Moving", - "PartiallySucceeded", "PartiallyConnected", "InProgress". - :vartype aggregate_state: str or ~azure_stack_hci_client.models.ArcSettingAggregateState - :ivar per_node_details: State of Arc agent in each of the nodes. - :vartype per_node_details: list[~azure_stack_hci_client.models.PerNodeState] - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'arc_instance_resource_group': {'readonly': True}, - 'aggregate_state': {'readonly': True}, - 'per_node_details': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'arc_instance_resource_group': {'key': 'properties.arcInstanceResourceGroup', 'type': 'str'}, - 'aggregate_state': {'key': 'properties.aggregateState', 'type': 'str'}, - 'per_node_details': {'key': 'properties.perNodeDetails', 'type': '[PerNodeState]'}, - 'created_by': {'key': 'systemData.createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'systemData.createdByType', 'type': 'str'}, - 'created_at': {'key': 'systemData.createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'systemData.lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'systemData.lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'systemData.lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ArcSetting, self).__init__(**kwargs) - self.provisioning_state = None - self.arc_instance_resource_group = None - self.aggregate_state = None - self.per_node_details = None - 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 ArcSettingList(msrest.serialization.Model): - """List of ArcSetting proxy resources for the HCI cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of ArcSetting proxy resources. - :vartype value: list[~azure_stack_hci_client.models.ArcSetting] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ArcSetting]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ArcSettingList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :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 - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'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'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class Cluster(TrackedResource): - """Cluster details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :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 provisioning_state: Provisioning state. Possible values include: "Succeeded", "Failed", - "Canceled", "Accepted", "Provisioning". - :vartype provisioning_state: str or ~azure_stack_hci_client.models.ProvisioningState - :ivar status: Status of the cluster agent. Possible values include: "NotYetRegistered", - "ConnectedRecently", "NotConnectedRecently", "Disconnected", "Error". - :vartype status: str or ~azure_stack_hci_client.models.Status - :ivar cloud_id: Unique, immutable resource id. - :vartype cloud_id: str - :param cloud_management_endpoint: Endpoint configured for management from the Azure portal. - :type cloud_management_endpoint: str - :param aad_client_id: App id of cluster AAD identity. - :type aad_client_id: str - :param aad_tenant_id: Tenant id of cluster AAD identity. - :type aad_tenant_id: str - :ivar reported_properties: Properties reported by cluster agent. - :vartype reported_properties: ~azure_stack_hci_client.models.ClusterReportedProperties - :ivar trial_days_remaining: Number of days remaining in the trial period. - :vartype trial_days_remaining: float - :ivar billing_model: Type of billing applied to the resource. - :vartype billing_model: str - :ivar registration_timestamp: First cluster sync timestamp. - :vartype registration_timestamp: ~datetime.datetime - :ivar last_sync_timestamp: Most recent cluster sync timestamp. - :vartype last_sync_timestamp: ~datetime.datetime - :ivar last_billing_timestamp: Most recent billing meter timestamp. - :vartype last_billing_timestamp: ~datetime.datetime - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'status': {'readonly': True}, - 'cloud_id': {'readonly': True}, - 'reported_properties': {'readonly': True}, - 'trial_days_remaining': {'readonly': True}, - 'billing_model': {'readonly': True}, - 'registration_timestamp': {'readonly': True}, - 'last_sync_timestamp': {'readonly': True}, - 'last_billing_timestamp': {'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'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'cloud_id': {'key': 'properties.cloudId', 'type': 'str'}, - 'cloud_management_endpoint': {'key': 'properties.cloudManagementEndpoint', 'type': 'str'}, - 'aad_client_id': {'key': 'properties.aadClientId', 'type': 'str'}, - 'aad_tenant_id': {'key': 'properties.aadTenantId', 'type': 'str'}, - 'reported_properties': {'key': 'properties.reportedProperties', 'type': 'ClusterReportedProperties'}, - 'trial_days_remaining': {'key': 'properties.trialDaysRemaining', 'type': 'float'}, - 'billing_model': {'key': 'properties.billingModel', 'type': 'str'}, - 'registration_timestamp': {'key': 'properties.registrationTimestamp', 'type': 'iso-8601'}, - 'last_sync_timestamp': {'key': 'properties.lastSyncTimestamp', 'type': 'iso-8601'}, - 'last_billing_timestamp': {'key': 'properties.lastBillingTimestamp', 'type': 'iso-8601'}, - 'created_by': {'key': 'systemData.createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'systemData.createdByType', 'type': 'str'}, - 'created_at': {'key': 'systemData.createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'systemData.lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'systemData.lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'systemData.lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Cluster, self).__init__(**kwargs) - self.provisioning_state = None - self.status = None - self.cloud_id = None - self.cloud_management_endpoint = kwargs.get('cloud_management_endpoint', None) - self.aad_client_id = kwargs.get('aad_client_id', None) - self.aad_tenant_id = kwargs.get('aad_tenant_id', None) - self.reported_properties = None - self.trial_days_remaining = None - self.billing_model = None - self.registration_timestamp = None - self.last_sync_timestamp = None - self.last_billing_timestamp = None - 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 ClusterList(msrest.serialization.Model): - """List of clusters. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of clusters. - :type value: list[~azure_stack_hci_client.models.Cluster] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Cluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ClusterNode(msrest.serialization.Model): - """Cluster node details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the cluster node. - :vartype name: str - :ivar id: Id of the node in the cluster. - :vartype id: float - :ivar manufacturer: Manufacturer of the cluster node hardware. - :vartype manufacturer: str - :ivar model: Model name of the cluster node hardware. - :vartype model: str - :ivar os_name: Operating system running on the cluster node. - :vartype os_name: str - :ivar os_version: Version of the operating system running on the cluster node. - :vartype os_version: str - :ivar serial_number: Immutable id of the cluster node. - :vartype serial_number: str - :ivar core_count: Number of physical cores on the cluster node. - :vartype core_count: float - :ivar memory_in_gi_b: Total available memory on the cluster node (in GiB). - :vartype memory_in_gi_b: float - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - 'manufacturer': {'readonly': True}, - 'model': {'readonly': True}, - 'os_name': {'readonly': True}, - 'os_version': {'readonly': True}, - 'serial_number': {'readonly': True}, - 'core_count': {'readonly': True}, - 'memory_in_gi_b': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'float'}, - 'manufacturer': {'key': 'manufacturer', 'type': 'str'}, - 'model': {'key': 'model', 'type': 'str'}, - 'os_name': {'key': 'osName', 'type': 'str'}, - 'os_version': {'key': 'osVersion', 'type': 'str'}, - 'serial_number': {'key': 'serialNumber', 'type': 'str'}, - 'core_count': {'key': 'coreCount', 'type': 'float'}, - 'memory_in_gi_b': {'key': 'memoryInGiB', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterNode, self).__init__(**kwargs) - self.name = None - self.id = None - self.manufacturer = None - self.model = None - self.os_name = None - self.os_version = None - self.serial_number = None - self.core_count = None - self.memory_in_gi_b = None - - -class ClusterPatch(msrest.serialization.Model): - """Cluster details to update. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param cloud_management_endpoint: Endpoint configured for management from the Azure portal. - :type cloud_management_endpoint: str - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'cloud_management_endpoint': {'key': 'properties.cloudManagementEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterPatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.cloud_management_endpoint = kwargs.get('cloud_management_endpoint', None) - - -class ClusterReportedProperties(msrest.serialization.Model): - """Properties reported by cluster agent. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar cluster_name: Name of the on-prem cluster connected to this resource. - :vartype cluster_name: str - :ivar cluster_id: Unique id generated by the on-prem cluster. - :vartype cluster_id: str - :ivar cluster_version: Version of the cluster software. - :vartype cluster_version: str - :ivar nodes: List of nodes reported by the cluster. - :vartype nodes: list[~azure_stack_hci_client.models.ClusterNode] - :ivar last_updated: Last time the cluster reported the data. - :vartype last_updated: ~datetime.datetime - """ - - _validation = { - 'cluster_name': {'readonly': True}, - 'cluster_id': {'readonly': True}, - 'cluster_version': {'readonly': True}, - 'nodes': {'readonly': True}, - 'last_updated': {'readonly': True}, - } - - _attribute_map = { - 'cluster_name': {'key': 'clusterName', 'type': 'str'}, - 'cluster_id': {'key': 'clusterId', 'type': 'str'}, - 'cluster_version': {'key': 'clusterVersion', 'type': 'str'}, - 'nodes': {'key': 'nodes', 'type': '[ClusterNode]'}, - 'last_updated': {'key': 'lastUpdated', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterReportedProperties, self).__init__(**kwargs) - self.cluster_name = None - self.cluster_id = None - self.cluster_version = None - self.nodes = None - self.last_updated = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure_stack_hci_client.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure_stack_hci_client.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure_stack_hci_client.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Extension(ProxyResource): - """Details of a particular extension in HCI Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar provisioning_state: Provisioning state of the Extension proxy resource. Possible values - include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning". - :vartype provisioning_state: str or ~azure_stack_hci_client.models.ProvisioningState - :ivar aggregate_state: Aggregate state of Arc Extensions across the nodes in this HCI cluster. - Possible values include: "NotSpecified", "Error", "Succeeded", "Canceled", "Failed", - "Connected", "Disconnected", "Deleted", "Creating", "Updating", "Deleting", "Moving", - "PartiallySucceeded", "PartiallyConnected", "InProgress". - :vartype aggregate_state: str or ~azure_stack_hci_client.models.ExtensionAggregateState - :ivar per_node_extension_details: State of Arc Extension in each of the nodes. - :vartype per_node_extension_details: list[~azure_stack_hci_client.models.PerNodeExtensionState] - :param force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :type force_update_tag: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type_properties_extension_parameters_type: Specifies the type of the extension; an - example is "CustomScriptExtension". - :type type_properties_extension_parameters_type: str - :param type_handler_version: Specifies the version of the script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: Protected settings (may contain secrets). - :type protected_settings: any - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'aggregate_state': {'readonly': True}, - 'per_node_extension_details': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'aggregate_state': {'key': 'properties.aggregateState', 'type': 'str'}, - 'per_node_extension_details': {'key': 'properties.perNodeExtensionDetails', 'type': '[PerNodeExtensionState]'}, - 'force_update_tag': {'key': 'properties.extensionParameters.forceUpdateTag', 'type': 'str'}, - 'publisher': {'key': 'properties.extensionParameters.publisher', 'type': 'str'}, - 'type_properties_extension_parameters_type': {'key': 'properties.extensionParameters.type', 'type': 'str'}, - 'type_handler_version': {'key': 'properties.extensionParameters.typeHandlerVersion', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.extensionParameters.autoUpgradeMinorVersion', 'type': 'bool'}, - 'settings': {'key': 'properties.extensionParameters.settings', 'type': 'object'}, - 'protected_settings': {'key': 'properties.extensionParameters.protectedSettings', 'type': 'object'}, - 'created_by': {'key': 'systemData.createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'systemData.createdByType', 'type': 'str'}, - 'created_at': {'key': 'systemData.createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'systemData.lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'systemData.lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'systemData.lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.provisioning_state = None - self.aggregate_state = None - self.per_node_extension_details = None - self.force_update_tag = kwargs.get('force_update_tag', None) - self.publisher = kwargs.get('publisher', None) - self.type_properties_extension_parameters_type = kwargs.get('type_properties_extension_parameters_type', None) - self.type_handler_version = kwargs.get('type_handler_version', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - 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 ExtensionList(msrest.serialization.Model): - """List of Extensions in HCI cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Extensions in HCI cluster. - :vartype value: list[~azure_stack_hci_client.models.Extension] - :ivar next_link: Link to the next set of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Operation(msrest.serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~azure_stack_hci_client.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". - :vartype origin: str or ~azure_stack_hci_client.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~azure_stack_hci_client.models.ActionType - """ - - _validation = { - 'name': {'readonly': True}, - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - 'action_type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = kwargs.get('display', None) - self.origin = None - self.action_type = None - - -class OperationDisplay(msrest.serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': 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 = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(msrest.serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure_stack_hci_client.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :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 PerNodeExtensionState(msrest.serialization.Model): - """Status of Arc Extension for a particular node in HCI Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the node in HCI Cluster. - :vartype name: str - :ivar extension: Fully qualified resource ID for the particular Arc Extension on this node. - :vartype extension: str - :ivar state: State of Arc Extension in this node. Possible values include: "NotSpecified", - "Error", "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", - "Updating", "Deleting", "Moving". - :vartype state: str or ~azure_stack_hci_client.models.NodeExtensionState - """ - - _validation = { - 'name': {'readonly': True}, - 'extension': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'extension': {'key': 'extension', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PerNodeExtensionState, self).__init__(**kwargs) - self.name = None - self.extension = None - self.state = None - - -class PerNodeState(msrest.serialization.Model): - """Status of Arc agent for a particular node in HCI Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Node in HCI Cluster. - :vartype name: str - :ivar arc_instance: Fully qualified resource ID for the Arc agent of this node. - :vartype arc_instance: str - :ivar state: State of Arc agent in this node. Possible values include: "NotSpecified", "Error", - "Succeeded", "Canceled", "Failed", "Connected", "Disconnected", "Deleted", "Creating", - "Updating", "Deleting", "Moving". - :vartype state: str or ~azure_stack_hci_client.models.NodeArcState - """ - - _validation = { - 'name': {'readonly': True}, - 'arc_instance': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'arc_instance': {'key': 'arcInstance', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PerNodeState, self).__init__(**kwargs) - self.name = None - self.arc_instance = None - self.state = None diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py index cfede6b86641a..5ecbb09293d37 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models_py3.py @@ -46,6 +46,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -83,6 +85,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -112,20 +116,20 @@ class ArcSetting(ProxyResource): :vartype aggregate_state: str or ~azure_stack_hci_client.models.ArcSettingAggregateState :ivar per_node_details: State of Arc agent in each of the nodes. :vartype per_node_details: list[~azure_stack_hci_client.models.PerNodeState] - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _validation = { @@ -133,7 +137,6 @@ class ArcSetting(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, - 'arc_instance_resource_group': {'readonly': True}, 'aggregate_state': {'readonly': True}, 'per_node_details': {'readonly': True}, } @@ -157,6 +160,7 @@ class ArcSetting(ProxyResource): def __init__( self, *, + arc_instance_resource_group: Optional[str] = None, created_by: Optional[str] = None, created_by_type: Optional[Union[str, "CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, @@ -165,9 +169,28 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword arc_instance_resource_group: The resource group that hosts the Arc agents, ie. Hybrid + Compute Machine resources. + :paramtype arc_instance_resource_group: str + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(ArcSetting, self).__init__(**kwargs) self.provisioning_state = None - self.arc_instance_resource_group = None + self.arc_instance_resource_group = arc_instance_resource_group self.aggregate_state = None self.per_node_details = None self.created_by = created_by @@ -203,6 +226,8 @@ def __init__( self, **kwargs ): + """ + """ super(ArcSettingList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -223,10 +248,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -251,6 +276,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -271,10 +302,10 @@ class Cluster(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning". :vartype provisioning_state: str or ~azure_stack_hci_client.models.ProvisioningState @@ -283,12 +314,14 @@ class Cluster(TrackedResource): :vartype status: str or ~azure_stack_hci_client.models.Status :ivar cloud_id: Unique, immutable resource id. :vartype cloud_id: str - :param cloud_management_endpoint: Endpoint configured for management from the Azure portal. - :type cloud_management_endpoint: str - :param aad_client_id: App id of cluster AAD identity. - :type aad_client_id: str - :param aad_tenant_id: Tenant id of cluster AAD identity. - :type aad_tenant_id: str + :ivar cloud_management_endpoint: Endpoint configured for management from the Azure portal. + :vartype cloud_management_endpoint: str + :ivar aad_client_id: App id of cluster AAD identity. + :vartype aad_client_id: str + :ivar aad_tenant_id: Tenant id of cluster AAD identity. + :vartype aad_tenant_id: str + :ivar desired_properties: Desired properties of the cluster. + :vartype desired_properties: ~azure_stack_hci_client.models.ClusterDesiredProperties :ivar reported_properties: Properties reported by cluster agent. :vartype reported_properties: ~azure_stack_hci_client.models.ClusterReportedProperties :ivar trial_days_remaining: Number of days remaining in the trial period. @@ -301,20 +334,20 @@ class Cluster(TrackedResource): :vartype last_sync_timestamp: ~datetime.datetime :ivar last_billing_timestamp: Most recent billing meter timestamp. :vartype last_billing_timestamp: ~datetime.datetime - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _validation = { @@ -345,6 +378,7 @@ class Cluster(TrackedResource): 'cloud_management_endpoint': {'key': 'properties.cloudManagementEndpoint', 'type': 'str'}, 'aad_client_id': {'key': 'properties.aadClientId', 'type': 'str'}, 'aad_tenant_id': {'key': 'properties.aadTenantId', 'type': 'str'}, + 'desired_properties': {'key': 'properties.desiredProperties', 'type': 'ClusterDesiredProperties'}, 'reported_properties': {'key': 'properties.reportedProperties', 'type': 'ClusterReportedProperties'}, 'trial_days_remaining': {'key': 'properties.trialDaysRemaining', 'type': 'float'}, 'billing_model': {'key': 'properties.billingModel', 'type': 'str'}, @@ -367,6 +401,7 @@ def __init__( cloud_management_endpoint: Optional[str] = None, aad_client_id: Optional[str] = None, aad_tenant_id: Optional[str] = None, + desired_properties: Optional["ClusterDesiredProperties"] = None, created_by: Optional[str] = None, created_by_type: Optional[Union[str, "CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, @@ -375,6 +410,34 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword cloud_management_endpoint: Endpoint configured for management from the Azure portal. + :paramtype cloud_management_endpoint: str + :keyword aad_client_id: App id of cluster AAD identity. + :paramtype aad_client_id: str + :keyword aad_tenant_id: Tenant id of cluster AAD identity. + :paramtype aad_tenant_id: str + :keyword desired_properties: Desired properties of the cluster. + :paramtype desired_properties: ~azure_stack_hci_client.models.ClusterDesiredProperties + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(Cluster, self).__init__(tags=tags, location=location, **kwargs) self.provisioning_state = None self.status = None @@ -382,6 +445,7 @@ def __init__( self.cloud_management_endpoint = cloud_management_endpoint self.aad_client_id = aad_client_id self.aad_tenant_id = aad_tenant_id + self.desired_properties = desired_properties self.reported_properties = None self.trial_days_remaining = None self.billing_model = None @@ -396,13 +460,51 @@ def __init__( self.last_modified_at = last_modified_at +class ClusterDesiredProperties(msrest.serialization.Model): + """Desired properties of the cluster. + + :ivar windows_server_subscription: Desired state of Windows Server Subscription. Possible + values include: "Disabled", "Enabled". + :vartype windows_server_subscription: str or + ~azure_stack_hci_client.models.WindowsServerSubscription + :ivar diagnostic_level: Desired level of diagnostic data emitted by the cluster. Possible + values include: "Off", "Basic", "Enhanced". + :vartype diagnostic_level: str or ~azure_stack_hci_client.models.DiagnosticLevel + """ + + _attribute_map = { + 'windows_server_subscription': {'key': 'windowsServerSubscription', 'type': 'str'}, + 'diagnostic_level': {'key': 'diagnosticLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + windows_server_subscription: Optional[Union[str, "WindowsServerSubscription"]] = None, + diagnostic_level: Optional[Union[str, "DiagnosticLevel"]] = None, + **kwargs + ): + """ + :keyword windows_server_subscription: Desired state of Windows Server Subscription. Possible + values include: "Disabled", "Enabled". + :paramtype windows_server_subscription: str or + ~azure_stack_hci_client.models.WindowsServerSubscription + :keyword diagnostic_level: Desired level of diagnostic data emitted by the cluster. Possible + values include: "Off", "Basic", "Enhanced". + :paramtype diagnostic_level: str or ~azure_stack_hci_client.models.DiagnosticLevel + """ + super(ClusterDesiredProperties, self).__init__(**kwargs) + self.windows_server_subscription = windows_server_subscription + self.diagnostic_level = diagnostic_level + + class ClusterList(msrest.serialization.Model): """List of clusters. Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of clusters. - :type value: list[~azure_stack_hci_client.models.Cluster] + :ivar value: List of clusters. + :vartype value: list[~azure_stack_hci_client.models.Cluster] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -422,6 +524,10 @@ def __init__( value: Optional[List["Cluster"]] = None, **kwargs ): + """ + :keyword value: List of clusters. + :paramtype value: list[~azure_stack_hci_client.models.Cluster] + """ super(ClusterList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -436,6 +542,10 @@ class ClusterNode(msrest.serialization.Model): :vartype name: str :ivar id: Id of the node in the cluster. :vartype id: float + :ivar windows_server_subscription: State of Windows Server Subscription. Possible values + include: "Disabled", "Enabled". + :vartype windows_server_subscription: str or + ~azure_stack_hci_client.models.WindowsServerSubscription :ivar manufacturer: Manufacturer of the cluster node hardware. :vartype manufacturer: str :ivar model: Model name of the cluster node hardware. @@ -455,6 +565,7 @@ class ClusterNode(msrest.serialization.Model): _validation = { 'name': {'readonly': True}, 'id': {'readonly': True}, + 'windows_server_subscription': {'readonly': True}, 'manufacturer': {'readonly': True}, 'model': {'readonly': True}, 'os_name': {'readonly': True}, @@ -467,6 +578,7 @@ class ClusterNode(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'float'}, + 'windows_server_subscription': {'key': 'windowsServerSubscription', 'type': 'str'}, 'manufacturer': {'key': 'manufacturer', 'type': 'str'}, 'model': {'key': 'model', 'type': 'str'}, 'os_name': {'key': 'osName', 'type': 'str'}, @@ -480,9 +592,12 @@ def __init__( self, **kwargs ): + """ + """ super(ClusterNode, self).__init__(**kwargs) self.name = None self.id = None + self.windows_server_subscription = None self.manufacturer = None self.model = None self.os_name = None @@ -495,15 +610,24 @@ def __init__( class ClusterPatch(msrest.serialization.Model): """Cluster details to update. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param cloud_management_endpoint: Endpoint configured for management from the Azure portal. - :type cloud_management_endpoint: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar cloud_management_endpoint: Endpoint configured for management from the Azure portal. + :vartype cloud_management_endpoint: str + :ivar aad_client_id: App id of cluster AAD identity. + :vartype aad_client_id: str + :ivar aad_tenant_id: Tenant id of cluster AAD identity. + :vartype aad_tenant_id: str + :ivar desired_properties: Desired properties of the cluster. + :vartype desired_properties: ~azure_stack_hci_client.models.ClusterDesiredProperties """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, 'cloud_management_endpoint': {'key': 'properties.cloudManagementEndpoint', 'type': 'str'}, + 'aad_client_id': {'key': 'properties.aadClientId', 'type': 'str'}, + 'aad_tenant_id': {'key': 'properties.aadTenantId', 'type': 'str'}, + 'desired_properties': {'key': 'properties.desiredProperties', 'type': 'ClusterDesiredProperties'}, } def __init__( @@ -511,11 +635,29 @@ def __init__( *, tags: Optional[Dict[str, str]] = None, cloud_management_endpoint: Optional[str] = None, + aad_client_id: Optional[str] = None, + aad_tenant_id: Optional[str] = None, + desired_properties: Optional["ClusterDesiredProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword cloud_management_endpoint: Endpoint configured for management from the Azure portal. + :paramtype cloud_management_endpoint: str + :keyword aad_client_id: App id of cluster AAD identity. + :paramtype aad_client_id: str + :keyword aad_tenant_id: Tenant id of cluster AAD identity. + :paramtype aad_tenant_id: str + :keyword desired_properties: Desired properties of the cluster. + :paramtype desired_properties: ~azure_stack_hci_client.models.ClusterDesiredProperties + """ super(ClusterPatch, self).__init__(**kwargs) self.tags = tags self.cloud_management_endpoint = cloud_management_endpoint + self.aad_client_id = aad_client_id + self.aad_tenant_id = aad_tenant_id + self.desired_properties = desired_properties class ClusterReportedProperties(msrest.serialization.Model): @@ -533,6 +675,12 @@ class ClusterReportedProperties(msrest.serialization.Model): :vartype nodes: list[~azure_stack_hci_client.models.ClusterNode] :ivar last_updated: Last time the cluster reported the data. :vartype last_updated: ~datetime.datetime + :ivar imds_attestation: IMDS attestation status of the cluster. Possible values include: + "Disabled", "Enabled". + :vartype imds_attestation: str or ~azure_stack_hci_client.models.ImdsAttestation + :ivar diagnostic_level: Level of diagnostic data emitted by the cluster. Possible values + include: "Off", "Basic", "Enhanced". + :vartype diagnostic_level: str or ~azure_stack_hci_client.models.DiagnosticLevel """ _validation = { @@ -541,6 +689,7 @@ class ClusterReportedProperties(msrest.serialization.Model): 'cluster_version': {'readonly': True}, 'nodes': {'readonly': True}, 'last_updated': {'readonly': True}, + 'imds_attestation': {'readonly': True}, } _attribute_map = { @@ -549,18 +698,29 @@ class ClusterReportedProperties(msrest.serialization.Model): 'cluster_version': {'key': 'clusterVersion', 'type': 'str'}, 'nodes': {'key': 'nodes', 'type': '[ClusterNode]'}, 'last_updated': {'key': 'lastUpdated', 'type': 'iso-8601'}, + 'imds_attestation': {'key': 'imdsAttestation', 'type': 'str'}, + 'diagnostic_level': {'key': 'diagnosticLevel', 'type': 'str'}, } def __init__( self, + *, + diagnostic_level: Optional[Union[str, "DiagnosticLevel"]] = None, **kwargs ): + """ + :keyword diagnostic_level: Level of diagnostic data emitted by the cluster. Possible values + include: "Off", "Basic", "Enhanced". + :paramtype diagnostic_level: str or ~azure_stack_hci_client.models.DiagnosticLevel + """ super(ClusterReportedProperties, self).__init__(**kwargs) self.cluster_name = None self.cluster_id = None self.cluster_version = None self.nodes = None self.last_updated = None + self.imds_attestation = None + self.diagnostic_level = diagnostic_level class ErrorAdditionalInfo(msrest.serialization.Model): @@ -588,6 +748,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -630,6 +792,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -641,8 +805,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure_stack_hci_client.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure_stack_hci_client.models.ErrorDetail """ _attribute_map = { @@ -655,6 +819,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure_stack_hci_client.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -682,38 +850,38 @@ class Extension(ProxyResource): :vartype aggregate_state: str or ~azure_stack_hci_client.models.ExtensionAggregateState :ivar per_node_extension_details: State of Arc Extension in each of the nodes. :vartype per_node_extension_details: list[~azure_stack_hci_client.models.PerNodeExtensionState] - :param force_update_tag: How the extension handler should be forced to update even if the + :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. - :type force_update_tag: str - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type_properties_extension_parameters_type: Specifies the type of the extension; an + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type_properties_extension_parameters_type: Specifies the type of the extension; an example is "CustomScriptExtension". - :type type_properties_extension_parameters_type: str - :param type_handler_version: Specifies the version of the script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + :vartype type_properties_extension_parameters_type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: any - :param protected_settings: Protected settings (may contain secrets). - :type protected_settings: any - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: Protected settings (may contain secrets). + :vartype protected_settings: any + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _validation = { @@ -765,6 +933,40 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :paramtype force_update_tag: str + :keyword publisher: The name of the extension handler publisher. + :paramtype publisher: str + :keyword type_properties_extension_parameters_type: Specifies the type of the extension; an + example is "CustomScriptExtension". + :paramtype type_properties_extension_parameters_type: str + :keyword type_handler_version: Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: Protected settings (may contain secrets). + :paramtype protected_settings: any + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(Extension, self).__init__(**kwargs) self.provisioning_state = None self.aggregate_state = None @@ -809,6 +1011,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -825,8 +1029,8 @@ class Operation(msrest.serialization.Model): :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~azure_stack_hci_client.models.OperationDisplay + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure_stack_hci_client.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", "system", "user,system". @@ -857,6 +1061,10 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure_stack_hci_client.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = None self.is_data_action = None @@ -902,6 +1110,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -934,6 +1144,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -970,6 +1182,8 @@ def __init__( self, **kwargs ): + """ + """ super(PerNodeExtensionState, self).__init__(**kwargs) self.name = None self.extension = None @@ -1007,6 +1221,8 @@ def __init__( self, **kwargs ): + """ + """ super(PerNodeState, self).__init__(**kwargs) self.name = None self.arc_instance = None diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py index f27601576940d..7ab5b3237a349 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_cluster_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ArcSettingsOperations(object): """ArcSettingsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_cluster( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ArcSettingList"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ArcSettingList"]: """Get ArcSetting resources of HCI Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -70,36 +228,33 @@ def list_by_cluster( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.list_by_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ArcSettingList', pipeline_response) + deserialized = self._deserialize("ArcSettingList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +267,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ArcSetting" + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any + ) -> "_models.ArcSetting": """Get ArcSetting resource details of HCI Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -150,34 +306,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ArcSetting', pipeline_response) @@ -186,17 +332,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - arc_setting, # type: "_models.ArcSetting" - **kwargs # type: Any - ): - # type: (...) -> "_models.ArcSetting" + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + arc_setting: "_models.ArcSetting", + **kwargs: Any + ) -> "_models.ArcSetting": """Create ArcSetting for HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -218,39 +366,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(arc_setting, 'ArcSetting') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(arc_setting, 'ArcSetting') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ArcSetting', pipeline_response) @@ -259,64 +397,55 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + arc_setting_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-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete ArcSetting resource details of HCI Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -328,15 +457,17 @@ def begin_delete( :type arc_setting_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -351,22 +482,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -378,4 +501,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py index 9e1231d58a238..0f46242f198ea 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py @@ -5,23 +5,248 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ClustersOperations(object): """ClustersOperations operations. @@ -45,11 +270,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClusterList"] + **kwargs: Any + ) -> Iterable["_models.ClusterList"]: """List all HCI clusters in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,34 +287,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) + deserialized = self._deserialize("ClusterList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,23 +322,24 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClusterList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ClusterList"]: """List all HCI clusters in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -133,35 +354,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) + deserialized = self._deserialize("ClusterList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,24 +391,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.Cluster": """Get HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -208,33 +426,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -243,16 +451,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - cluster_name, # type: str - cluster, # type: "_models.Cluster" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + cluster: "_models.Cluster", + **kwargs: Any + ) -> "_models.Cluster": """Create an HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -271,38 +481,28 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(cluster, 'Cluster') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cluster, 'Cluster') - 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -311,16 +511,18 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_name, # type: str - cluster, # type: "_models.ClusterPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + cluster: "_models.ClusterPatch", + **kwargs: Any + ) -> "_models.Cluster": """Update an HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -339,38 +541,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(cluster, 'ClusterPatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(cluster, 'ClusterPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -379,15 +571,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> None: """Delete an HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -404,36 +598,27 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py index 012182e3a12e2..253e196f81b03 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py @@ -5,25 +5,239 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_arc_setting_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -47,14 +261,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_arc_setting( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionList"] + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionList"]: """List all Extensions under ArcSetting resource. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -74,37 +288,35 @@ def list_by_arc_setting( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_arc_setting.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_arc_setting_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + template_url=self.list_by_arc_setting.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_arc_setting_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionList', pipeline_response) + deserialized = self._deserialize("ExtensionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,26 +329,27 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_arc_setting.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": """Get particular Arc Extension of HCI Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -158,35 +371,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -195,58 +398,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension, 'Extension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Extension', pipeline_response) @@ -258,18 +451,20 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Create Extension for HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -285,15 +480,18 @@ def begin_create( :type extension: ~azure_stack_hci_client.models.Extension :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Extension or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure_stack_hci_client.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,29 +505,21 @@ def begin_create( arc_setting_name=arc_setting_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -341,58 +531,47 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(extension, 'Extension') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - 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 [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -400,18 +579,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Update Extension for HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -427,15 +608,18 @@ def begin_update( :type extension: ~azure_stack_hci_client.models.Extension :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Extension or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure_stack_hci_client.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -449,29 +633,21 @@ def begin_update( arc_setting_name=arc_setting_name, extension_name=extension_name, extension=extension, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -483,67 +659,57 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_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-01-01-preview" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + extension_name=extension_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete particular Arc Extension of HCI Cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -557,15 +723,17 @@ def begin_delete( :type extension_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -581,23 +749,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'arcSettingName': self._serialize.url("arc_setting_name", arc_setting_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -609,4 +768,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py index 8a40fa3d701ce..e1fdc6e61f452 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py @@ -5,22 +5,49 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.AzureStackHCI/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -44,11 +71,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationListResult" + **kwargs: Any + ) -> "_models.OperationListResult": """List all available Microsoft.AzureStackHCI provider operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,27 +88,20 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-01-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationListResult', pipeline_response) @@ -90,4 +110,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.AzureStackHCI/operations'} # type: ignore +