From 8b5a29a4214de874364133956335ccba1a90c4f6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 18 Mar 2022 11:19:18 +0000 Subject: [PATCH] CodeGen from PR 18152 in Azure/azure-rest-api-specs Merge 905805503d0e69e5d3437fca0a8db57629d733e4 into 8a9da8395b884de6af8a16e727c9e8dca0a5949d --- .../azure-mgmt-azurestackhci/_meta.json | 10 +- .../azure/mgmt/azurestackhci/__init__.py | 9 +- .../azurestackhci/_azure_stack_hci_client.py | 112 +- .../mgmt/azurestackhci/_configuration.py | 21 +- .../azure/mgmt/azurestackhci/_metadata.json | 33 +- .../azure/mgmt/azurestackhci/_patch.py | 31 + .../azure/mgmt/azurestackhci/_vendor.py | 27 + .../azure/mgmt/azurestackhci/_version.py | 2 +- .../azure/mgmt/azurestackhci/aio/__init__.py | 5 + .../aio/_azure_stack_hci_client.py | 98 +- .../mgmt/azurestackhci/aio/_configuration.py | 8 +- .../azure/mgmt/azurestackhci/aio/_patch.py | 31 + .../azurestackhci/aio/operations/__init__.py | 16 +- .../operations/_arc_settings_operations.py | 372 --- .../aio/operations/_clusters_operations.py | 429 --- .../aio/operations/_extensions_operations.py | 600 ---- .../operations/_galleryimages_operations.py | 466 +++ .../_networkinterfaces_operations.py | 466 +++ .../aio/operations/_operations.py | 36 +- .../_virtualharddisks_operations.py | 466 +++ .../operations/_virtualmachines_operations.py | 754 +++++ .../operations/_virtualnetworks_operations.py | 466 +++ .../mgmt/azurestackhci/models/__init__.py | 207 +- .../models/_azure_stack_hci_client_enums.py | 190 +- .../mgmt/azurestackhci/models/_models.py | 963 ------ .../mgmt/azurestackhci/models/_models_py3.py | 2846 +++++++++++++---- .../mgmt/azurestackhci/operations/__init__.py | 16 +- .../operations/_arc_settings_operations.py | 381 --- .../operations/_clusters_operations.py | 439 --- .../operations/_extensions_operations.py | 612 ---- .../operations/_galleryimages_operations.py | 688 ++++ .../_networkinterfaces_operations.py | 690 ++++ .../azurestackhci/operations/_operations.py | 78 +- .../_virtualharddisks_operations.py | 690 ++++ .../operations/_virtualmachines_operations.py | 1083 +++++++ .../operations/_virtualnetworks_operations.py | 690 ++++ 36 files changed, 9333 insertions(+), 4698 deletions(-) create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_patch.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_vendor.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_patch.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/_models.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py delete mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py create mode 100644 sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json b/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json index 855e09f59f87d..fb28f9095090a 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": "a6ceaff8e7f1d1b435e2b5363ca34885605137d1", "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..072fd8a857ae6 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,89 +6,93 @@ # 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 GalleryimagesOperations, NetworkinterfacesOperations, Operations, VirtualharddisksOperations, VirtualmachinesOperations, VirtualnetworksOperations + 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 - :vartype arc_settings: azure_stack_hci_client.operations.ArcSettingsOperations - :ivar clusters: ClustersOperations operations - :vartype clusters: azure_stack_hci_client.operations.ClustersOperations - :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure_stack_hci_client.operations.ExtensionsOperations + :ivar galleryimages: GalleryimagesOperations operations + :vartype galleryimages: azure.mgmt.azurestackhci.operations.GalleryimagesOperations + :ivar networkinterfaces: NetworkinterfacesOperations operations + :vartype networkinterfaces: azure.mgmt.azurestackhci.operations.NetworkinterfacesOperations + :ivar virtualharddisks: VirtualharddisksOperations operations + :vartype virtualharddisks: azure.mgmt.azurestackhci.operations.VirtualharddisksOperations + :ivar virtualmachines: VirtualmachinesOperations operations + :vartype virtualmachines: azure.mgmt.azurestackhci.operations.VirtualmachinesOperations + :ivar virtualnetworks: VirtualnetworksOperations operations + :vartype virtualnetworks: azure.mgmt.azurestackhci.operations.VirtualnetworksOperations :ivar operations: Operations operations - :vartype operations: azure_stack_hci_client.operations.Operations + :vartype operations: azure.mgmt.azurestackhci.operations.Operations :param credential: Credential needed for the client to connect to Azure. :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.galleryimages = GalleryimagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.networkinterfaces = NetworkinterfacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtualharddisks = VirtualharddisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtualmachines = VirtualmachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtualnetworks = VirtualnetworksOperations(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..1e94f66357097 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 = "2021-07-01-preview" 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..71afac6db6831 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": "2021-07-01-preview", + "total_api_version_list": ["2021-07-01-preview"], "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,16 +91,17 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "arc_settings": "ArcSettingsOperations", - "clusters": "ClustersOperations", - "extensions": "ExtensionsOperations", + "galleryimages": "GalleryimagesOperations", + "networkinterfaces": "NetworkinterfacesOperations", + "virtualharddisks": "VirtualharddisksOperations", + "virtualmachines": "VirtualmachinesOperations", + "virtualnetworks": "VirtualnetworksOperations", "operations": "Operations" } } \ No newline at end of file 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..91b5a0781ca92 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,85 +6,93 @@ # 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 GalleryimagesOperations, NetworkinterfacesOperations, Operations, VirtualharddisksOperations, VirtualmachinesOperations, VirtualnetworksOperations + 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 - :vartype arc_settings: azure_stack_hci_client.aio.operations.ArcSettingsOperations - :ivar clusters: ClustersOperations operations - :vartype clusters: azure_stack_hci_client.aio.operations.ClustersOperations - :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure_stack_hci_client.aio.operations.ExtensionsOperations + :ivar galleryimages: GalleryimagesOperations operations + :vartype galleryimages: azure.mgmt.azurestackhci.aio.operations.GalleryimagesOperations + :ivar networkinterfaces: NetworkinterfacesOperations operations + :vartype networkinterfaces: azure.mgmt.azurestackhci.aio.operations.NetworkinterfacesOperations + :ivar virtualharddisks: VirtualharddisksOperations operations + :vartype virtualharddisks: azure.mgmt.azurestackhci.aio.operations.VirtualharddisksOperations + :ivar virtualmachines: VirtualmachinesOperations operations + :vartype virtualmachines: azure.mgmt.azurestackhci.aio.operations.VirtualmachinesOperations + :ivar virtualnetworks: VirtualnetworksOperations operations + :vartype virtualnetworks: azure.mgmt.azurestackhci.aio.operations.VirtualnetworksOperations :ivar operations: Operations operations - :vartype operations: azure_stack_hci_client.aio.operations.Operations + :vartype operations: azure.mgmt.azurestackhci.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the 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.galleryimages = GalleryimagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.networkinterfaces = NetworkinterfacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtualharddisks = VirtualharddisksOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtualmachines = VirtualmachinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.virtualnetworks = VirtualnetworksOperations(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..4dcd97da89fac 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 = "2021-07-01-preview" 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/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py index d3211472e48c4..65984a9c92b97 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/__init__.py @@ -6,14 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._arc_settings_operations import ArcSettingsOperations -from ._clusters_operations import ClustersOperations -from ._extensions_operations import ExtensionsOperations +from ._galleryimages_operations import GalleryimagesOperations +from ._networkinterfaces_operations import NetworkinterfacesOperations +from ._virtualharddisks_operations import VirtualharddisksOperations +from ._virtualmachines_operations import VirtualmachinesOperations +from ._virtualnetworks_operations import VirtualnetworksOperations from ._operations import Operations __all__ = [ - 'ArcSettingsOperations', - 'ClustersOperations', - 'ExtensionsOperations', + 'GalleryimagesOperations', + 'NetworkinterfacesOperations', + 'VirtualharddisksOperations', + 'VirtualmachinesOperations', + 'VirtualnetworksOperations', 'Operations', ] 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 deleted file mode 100644 index 9c62aa2d29f47..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py +++ /dev/null @@ -1,372 +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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ArcSettingsOperations: - """ArcSettingsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_stack_hci_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_cluster( - self, - resource_group_name: str, - cluster_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ArcSettingList"]: - """Get ArcSetting resources of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArcSettingList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_stack_hci_client.models.ArcSettingList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSettingList"] - error_map = { - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ArcSettingList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings'} # type: ignore - - async def get( - self, - 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. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArcSetting, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.ArcSetting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSetting"] - 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.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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ArcSetting', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore - - async def create( - self, - 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. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - :type arc_setting: ~azure_stack_hci_client.models.ArcSetting - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArcSetting, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.ArcSetting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSetting"] - 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.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ArcSetting', pipeline_response) - - if cls: - 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, - 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 = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete ArcSetting resource details of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :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. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', 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) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 deleted file mode 100644 index 527d5651a1435..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py +++ /dev/null @@ -1,429 +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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ClustersOperations: - """ClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_stack_hci_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_subscription( - self, - **kwargs: Any - ) -> AsyncIterable["_models.ClusterList"]: - """List all HCI clusters in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClusterList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_stack_hci_client.models.ClusterList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] - error_map = { - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs: Any - ) -> AsyncIterable["_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. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClusterList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_stack_hci_client.models.ClusterList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] - error_map = { - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore - - async def get( - self, - 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. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cluster, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.Cluster - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] - 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.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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore - - async def create( - self, - 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. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param cluster: Details of the HCI cluster. - :type cluster: ~azure_stack_hci_client.models.Cluster - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cluster, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.Cluster - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] - 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.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore - - async def update( - self, - 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. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param cluster: Details of the HCI cluster. - :type cluster: ~azure_stack_hci_client.models.ClusterPatch - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cluster, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.Cluster - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] - 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.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore - - async def delete( - self, - 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. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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.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 = 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) - 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 deleted file mode 100644 index 6a9801001e6b1..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py +++ /dev/null @@ -1,600 +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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ExtensionsOperations: - """ExtensionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_stack_hci_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_arc_setting( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - **kwargs: Any - ) -> AsyncIterable["_models.ExtensionList"]: - """List all Extensions under ArcSetting resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_stack_hci_client.models.ExtensionList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionList"] - error_map = { - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_by_arc_setting.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions'} # type: ignore - - async def get( - self, - 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. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Extension, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.Extension - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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" - 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Extension', pipeline_response) - - if cls: - 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, - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - - if response.status_code == 200: - deserialized = self._deserialize('Extension', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Extension', pipeline_response) - - if cls: - 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 - - async def begin_create( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: "_models.Extension", - **kwargs: Any - ) -> AsyncLROPoller["_models.Extension"]: - """Create Extension for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. - :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. - :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) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_stack_hci_client.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - extension=extension, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('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) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore - - async def _update_initial( - self, - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - - deserialized = self._deserialize('Extension', pipeline_response) - - if cls: - 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 - - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - extension: "_models.Extension", - **kwargs: Any - ) -> AsyncLROPoller["_models.Extension"]: - """Update Extension for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. - :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. - :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) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure_stack_hci_client.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - extension=extension, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('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) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore - - async def _delete_initial( - self, - 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 = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - arc_setting_name: str, - extension_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete particular Arc Extension of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. - :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. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', 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) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py new file mode 100644 index 0000000000000..d126e78967c41 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_galleryimages_operations.py @@ -0,0 +1,466 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._galleryimages_operations import build_create_or_update_request_initial, build_delete_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_retrieve_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class GalleryimagesOperations: + """GalleryimagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def retrieve( + self, + resource_group_name: str, + galleryimages_name: str, + **kwargs: Any + ) -> "_models.Galleryimages": + """Lists all galleryimages under the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param galleryimages_name: Name of the gallery image. + :type galleryimages_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Galleryimages, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Galleryimages"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Galleryimages', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + galleryimages_name: str, + galleryimages: "_models.Galleryimages", + **kwargs: Any + ) -> "_models.Galleryimages": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Galleryimages"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(galleryimages, 'Galleryimages') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Galleryimages', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Galleryimages', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + galleryimages_name: str, + galleryimages: "_models.Galleryimages", + **kwargs: Any + ) -> AsyncLROPoller["_models.Galleryimages"]: + """Create or update a galleryimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param galleryimages_name: Name of the gallery image. + :type galleryimages_name: str + :param galleryimages: + :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Galleryimages or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Galleryimages"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + galleryimages=galleryimages, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Galleryimages', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + galleryimages_name: str, + **kwargs: Any + ) -> None: + """Delete a galleryimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param galleryimages_name: Name of the gallery image. + :type galleryimages_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + galleryimages_name: str, + galleryimages: "_models.GalleryimagesPatch", + **kwargs: Any + ) -> "_models.Galleryimages": + """Update a galleryimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param galleryimages_name: Name of the gallery image. + :type galleryimages_name: str + :param galleryimages: + :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Galleryimages, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Galleryimages"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(galleryimages, 'GalleryimagesPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Galleryimages', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.GalleryimagesListResult"]: + """Lists all galleryimages under the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryimagesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.GalleryimagesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryimagesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryimagesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.GalleryimagesListResult"]: + """List all galleryimages under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryimagesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.GalleryimagesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryimagesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("GalleryimagesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryimages'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py new file mode 100644 index 0000000000000..9b110e4084933 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_networkinterfaces_operations.py @@ -0,0 +1,466 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._networkinterfaces_operations import build_create_or_update_request_initial, build_delete_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_retrieve_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NetworkinterfacesOperations: + """NetworkinterfacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def retrieve( + self, + resource_group_name: str, + networkinterfaces_name: str, + **kwargs: Any + ) -> "_models.Networkinterfaces": + """retrieve. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param networkinterfaces_name: + :type networkinterfaces_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Networkinterfaces, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Networkinterfaces"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + networkinterfaces_name: str, + networkinterfaces: "_models.Networkinterfaces", + **kwargs: Any + ) -> "_models.Networkinterfaces": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Networkinterfaces"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(networkinterfaces, 'Networkinterfaces') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + networkinterfaces_name: str, + networkinterfaces: "_models.Networkinterfaces", + **kwargs: Any + ) -> AsyncLROPoller["_models.Networkinterfaces"]: + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param networkinterfaces_name: + :type networkinterfaces_name: str + :param networkinterfaces: + :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Networkinterfaces or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Networkinterfaces"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + networkinterfaces=networkinterfaces, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + networkinterfaces_name: str, + **kwargs: Any + ) -> None: + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param networkinterfaces_name: + :type networkinterfaces_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + networkinterfaces_name: str, + networkinterfaces: "_models.NetworkinterfacesPatch", + **kwargs: Any + ) -> "_models.Networkinterfaces": + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param networkinterfaces_name: + :type networkinterfaces_name: str + :param networkinterfaces: + :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Networkinterfaces, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Networkinterfaces"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(networkinterfaces, 'NetworkinterfacesPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkinterfacesListResult"]: + """list_by_resource_group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkinterfacesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.NetworkinterfacesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkinterfacesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkinterfacesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.NetworkinterfacesListResult"]: + """list_by_subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkinterfacesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.NetworkinterfacesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkinterfacesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("NetworkinterfacesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkinterfaces'} # 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..eb54e5aff88ae 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]] @@ -25,7 +29,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_stack_hci_client.models + :type models: ~azure.mgmt.azurestackhci.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -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 @@ -48,7 +53,7 @@ async def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationListResult, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.OperationListResult + :rtype: ~azure.mgmt.azurestackhci.models.OperationListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -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/aio/operations/_virtualharddisks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py new file mode 100644 index 0000000000000..983589d591dc6 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualharddisks_operations.py @@ -0,0 +1,466 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._virtualharddisks_operations import build_create_or_update_request_initial, build_delete_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_retrieve_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualharddisksOperations: + """VirtualharddisksOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def retrieve( + self, + resource_group_name: str, + virtualharddisks_name: str, + **kwargs: Any + ) -> "_models.Virtualharddisks": + """retrieve. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualharddisks_name: + :type virtualharddisks_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualharddisks, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualharddisks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtualharddisks_name: str, + virtualharddisks: "_models.Virtualharddisks", + **kwargs: Any + ) -> "_models.Virtualharddisks": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualharddisks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualharddisks, 'Virtualharddisks') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtualharddisks_name: str, + virtualharddisks: "_models.Virtualharddisks", + **kwargs: Any + ) -> AsyncLROPoller["_models.Virtualharddisks"]: + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualharddisks_name: + :type virtualharddisks_name: str + :param virtualharddisks: + :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Virtualharddisks or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualharddisks"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + virtualharddisks=virtualharddisks, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + virtualharddisks_name: str, + **kwargs: Any + ) -> None: + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualharddisks_name: + :type virtualharddisks_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + virtualharddisks_name: str, + virtualharddisks: "_models.VirtualharddisksPatch", + **kwargs: Any + ) -> "_models.Virtualharddisks": + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualharddisks_name: + :type virtualharddisks_name: str + :param virtualharddisks: + :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualharddisks, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualharddisks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualharddisks, 'VirtualharddisksPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualharddisksListResult"]: + """list_by_resource_group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualharddisksListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.VirtualharddisksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualharddisksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualharddisksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualharddisksListResult"]: + """list_by_subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualharddisksListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.VirtualharddisksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualharddisksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("VirtualharddisksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualharddisks'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py new file mode 100644 index 0000000000000..8f28197c122de --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualmachines_operations.py @@ -0,0 +1,754 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._virtualmachines_operations import build_create_or_update_request_initial, build_delete_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_restart_request_initial, build_retrieve_request, build_start_request_initial, build_stop_request_initial, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualmachinesOperations: + """VirtualmachinesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def retrieve( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> "_models.Virtualmachines": + """retrieve. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualmachines, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualmachines"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualmachines', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtualmachines_name: str, + virtualmachines: "_models.Virtualmachines", + **kwargs: Any + ) -> "_models.Virtualmachines": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualmachines"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualmachines, 'Virtualmachines') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Virtualmachines', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Virtualmachines', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtualmachines_name: str, + virtualmachines: "_models.Virtualmachines", + **kwargs: Any + ) -> AsyncLROPoller["_models.Virtualmachines"]: + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :param virtualmachines: + :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Virtualmachines or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualmachines"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + virtualmachines=virtualmachines, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Virtualmachines', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> None: + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + virtualmachines_name: str, + virtualmachines: "_models.VirtualmachinesPatch", + **kwargs: Any + ) -> "_models.Virtualmachines": + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :param virtualmachines: + :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualmachines, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualmachines"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualmachines, 'VirtualmachinesPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualmachines', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + + async def _start_initial( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start'} # type: ignore + + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """start. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start'} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop'} # type: ignore + + + @distributed_trace_async + async def begin_stop( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """stop. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart'} # type: ignore + + + @distributed_trace_async + async def begin_restart( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """restart. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualmachinesListResult"]: + """list_by_resource_group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualmachinesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.VirtualmachinesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualmachinesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualmachinesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualmachinesListResult"]: + """list_by_subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualmachinesListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.VirtualmachinesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualmachinesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("VirtualmachinesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualmachines'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py new file mode 100644 index 0000000000000..ff067c20feb5e --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_virtualnetworks_operations.py @@ -0,0 +1,466 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._virtualnetworks_operations import build_create_or_update_request_initial, build_delete_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_retrieve_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualnetworksOperations: + """VirtualnetworksOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def retrieve( + self, + resource_group_name: str, + virtualnetworks_name: str, + **kwargs: Any + ) -> "_models.Virtualnetworks": + """retrieve. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualnetworks_name: + :type virtualnetworks_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualnetworks, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualnetworks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + virtualnetworks_name: str, + virtualnetworks: "_models.Virtualnetworks", + **kwargs: Any + ) -> "_models.Virtualnetworks": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualnetworks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualnetworks, 'Virtualnetworks') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + virtualnetworks_name: str, + virtualnetworks: "_models.Virtualnetworks", + **kwargs: Any + ) -> AsyncLROPoller["_models.Virtualnetworks"]: + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualnetworks_name: + :type virtualnetworks_name: str + :param virtualnetworks: + :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Virtualnetworks or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualnetworks"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + virtualnetworks=virtualnetworks, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + virtualnetworks_name: str, + **kwargs: Any + ) -> None: + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualnetworks_name: + :type virtualnetworks_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + virtualnetworks_name: str, + virtualnetworks: "_models.VirtualnetworksPatch", + **kwargs: Any + ) -> "_models.Virtualnetworks": + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualnetworks_name: + :type virtualnetworks_name: str + :param virtualnetworks: + :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualnetworks, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualnetworks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualnetworks, 'VirtualnetworksPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualnetworksListResult"]: + """list_by_resource_group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualnetworksListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.VirtualnetworksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualnetworksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualnetworksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.VirtualnetworksListResult"]: + """list_by_subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualnetworksListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.VirtualnetworksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualnetworksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("VirtualnetworksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualnetworks'} # 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..e4ffd6e4e9e81 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,89 +6,164 @@ # 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 ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable +from ._models_py3 import ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Galleryimages +from ._models_py3 import GalleryimagesExtendedLocation +from ._models_py3 import GalleryimagesListResult +from ._models_py3 import GalleryimagesPatch +from ._models_py3 import HardwareProfileUpdate +from ._models_py3 import IPPool +from ._models_py3 import IPPoolInfo +from ._models_py3 import InterfaceDNSSettings +from ._models_py3 import IpConfiguration +from ._models_py3 import IpConfigurationProperties +from ._models_py3 import IpConfigurationPropertiesSubnet +from ._models_py3 import MOCGalleryImageStatus +from ._models_py3 import MOCNetworkInterfaceStatus +from ._models_py3 import MOCVirtualHardDiskStatus +from ._models_py3 import MOCVirtualMachineStatus +from ._models_py3 import MOCVirtualNetworkStatus +from ._models_py3 import NetworkProfileUpdate +from ._models_py3 import NetworkProfileUpdateNetworkInterfacesItem +from ._models_py3 import Networkinterfaces +from ._models_py3 import NetworkinterfacesExtendedLocation +from ._models_py3 import NetworkinterfacesListResult +from ._models_py3 import NetworkinterfacesPatch +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import StorageProfileUpdate +from ._models_py3 import StorageProfileUpdateDataDisksItem +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import VirtualMachineUpdateProperties +from ._models_py3 import Virtualharddisks +from ._models_py3 import VirtualharddisksExtendedLocation +from ._models_py3 import VirtualharddisksListResult +from ._models_py3 import VirtualharddisksPatch +from ._models_py3 import Virtualmachines +from ._models_py3 import VirtualmachinesExtendedLocation +from ._models_py3 import VirtualmachinesListResult +from ._models_py3 import VirtualmachinesPatch +from ._models_py3 import VirtualmachinesPropertiesHardwareProfile +from ._models_py3 import VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig +from ._models_py3 import VirtualmachinesPropertiesNetworkProfile +from ._models_py3 import VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem +from ._models_py3 import VirtualmachinesPropertiesOsProfile +from ._models_py3 import VirtualmachinesPropertiesOsProfileLinuxConfiguration +from ._models_py3 import VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh +from ._models_py3 import VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem +from ._models_py3 import VirtualmachinesPropertiesOsProfileWindowsConfiguration +from ._models_py3 import VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh +from ._models_py3 import VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem +from ._models_py3 import VirtualmachinesPropertiesSecurityProfile +from ._models_py3 import VirtualmachinesPropertiesStorageProfile +from ._models_py3 import VirtualmachinesPropertiesStorageProfileDataDisksItem +from ._models_py3 import VirtualmachinesPropertiesStorageProfileImageReference +from ._models_py3 import Virtualnetworks +from ._models_py3 import VirtualnetworksExtendedLocation +from ._models_py3 import VirtualnetworksListResult +from ._models_py3 import VirtualnetworksPatch +from ._models_py3 import VirtualnetworksPropertiesSubnetsItem +from ._models_py3 import VirtualnetworksPropertiesSubnetsPropertiesItemsItem + from ._azure_stack_hci_client_enums import ( ActionType, - ArcSettingAggregateState, CreatedByType, - ExtensionAggregateState, - NodeArcState, - NodeExtensionState, + IPPoolTypeEnum, + IpAllocationMethodEnum, + NetworkTypeEnum, + OperatingSystemTypes, Origin, - ProvisioningState, - Status, + OsTypeEnum, + PowerStateEnum, + PrivateIPAllocationMethodEnum, + ProvisioningStateEnum, + VmSizeEnum, ) __all__ = [ - 'ArcSetting', - 'ArcSettingList', - 'Cluster', - 'ClusterList', - 'ClusterNode', - 'ClusterPatch', - 'ClusterReportedProperties', + 'ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable', + 'ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems', 'ErrorAdditionalInfo', 'ErrorDetail', 'ErrorResponse', - 'Extension', - 'ExtensionList', + 'Galleryimages', + 'GalleryimagesExtendedLocation', + 'GalleryimagesListResult', + 'GalleryimagesPatch', + 'HardwareProfileUpdate', + 'IPPool', + 'IPPoolInfo', + 'InterfaceDNSSettings', + 'IpConfiguration', + 'IpConfigurationProperties', + 'IpConfigurationPropertiesSubnet', + 'MOCGalleryImageStatus', + 'MOCNetworkInterfaceStatus', + 'MOCVirtualHardDiskStatus', + 'MOCVirtualMachineStatus', + 'MOCVirtualNetworkStatus', + 'NetworkProfileUpdate', + 'NetworkProfileUpdateNetworkInterfacesItem', + 'Networkinterfaces', + 'NetworkinterfacesExtendedLocation', + 'NetworkinterfacesListResult', + 'NetworkinterfacesPatch', 'Operation', 'OperationDisplay', 'OperationListResult', - 'PerNodeExtensionState', - 'PerNodeState', - 'ProxyResource', 'Resource', + 'StorageProfileUpdate', + 'StorageProfileUpdateDataDisksItem', + 'SystemData', 'TrackedResource', + 'VirtualMachineUpdateProperties', + 'Virtualharddisks', + 'VirtualharddisksExtendedLocation', + 'VirtualharddisksListResult', + 'VirtualharddisksPatch', + 'Virtualmachines', + 'VirtualmachinesExtendedLocation', + 'VirtualmachinesListResult', + 'VirtualmachinesPatch', + 'VirtualmachinesPropertiesHardwareProfile', + 'VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig', + 'VirtualmachinesPropertiesNetworkProfile', + 'VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem', + 'VirtualmachinesPropertiesOsProfile', + 'VirtualmachinesPropertiesOsProfileLinuxConfiguration', + 'VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh', + 'VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem', + 'VirtualmachinesPropertiesOsProfileWindowsConfiguration', + 'VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh', + 'VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem', + 'VirtualmachinesPropertiesSecurityProfile', + 'VirtualmachinesPropertiesStorageProfile', + 'VirtualmachinesPropertiesStorageProfileDataDisksItem', + 'VirtualmachinesPropertiesStorageProfileImageReference', + 'Virtualnetworks', + 'VirtualnetworksExtendedLocation', + 'VirtualnetworksListResult', + 'VirtualnetworksPatch', + 'VirtualnetworksPropertiesSubnetsItem', + 'VirtualnetworksPropertiesSubnetsPropertiesItemsItem', 'ActionType', - 'ArcSettingAggregateState', 'CreatedByType', - 'ExtensionAggregateState', - 'NodeArcState', - 'NodeExtensionState', + 'IPPoolTypeEnum', + 'IpAllocationMethodEnum', + 'NetworkTypeEnum', + 'OperatingSystemTypes', 'Origin', - 'ProvisioningState', - 'Status', + 'OsTypeEnum', + 'PowerStateEnum', + 'PrivateIPAllocationMethodEnum', + 'ProvisioningStateEnum', + 'VmSizeEnum', ] 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..87c13a6d17b84 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,53 +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)): - """Aggregate state of Arc agent across the nodes in this HCI cluster. - """ - - NOT_SPECIFIED = "NotSpecified" - ERROR = "Error" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - DELETED = "Deleted" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - MOVING = "Moving" - PARTIALLY_SUCCEEDED = "PartiallySucceeded" - 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,61 +26,43 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class ExtensionAggregateState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Aggregate state of Arc Extensions across the nodes in this HCI cluster. +class IpAllocationMethodEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', + 'Dynamic' """ - NOT_SPECIFIED = "NotSpecified" - ERROR = "Error" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - DELETED = "Deleted" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - MOVING = "Moving" - PARTIALLY_SUCCEEDED = "PartiallySucceeded" - PARTIALLY_CONNECTED = "PartiallyConnected" - IN_PROGRESS = "InProgress" + DYNAMIC = "Dynamic" + STATIC = "Static" -class NodeArcState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """State of Arc agent in this node. +class IPPoolTypeEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """ip pool type """ - NOT_SPECIFIED = "NotSpecified" - ERROR = "Error" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - DELETED = "Deleted" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - MOVING = "Moving" - -class NodeExtensionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """State of Arc Extension in this node. + VM = "vm" + VIPPOOL = "vippool" + +class NetworkTypeEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of the network """ - NOT_SPECIFIED = "NotSpecified" - ERROR = "Error" - SUCCEEDED = "Succeeded" - CANCELED = "Canceled" - FAILED = "Failed" - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - DELETED = "Deleted" - CREATING = "Creating" - UPDATING = "Updating" - DELETING = "Deleting" - MOVING = "Moving" - -class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + NAT = "NAT" + TRANSPARENT = "Transparent" + L2_BRIDGE = "L2Bridge" + L2_TUNNEL = "L2Tunnel" + ICS = "ICS" + PRIVATE = "Private" + OVERLAY = "Overlay" + INTERNAL = "Internal" + MIRRORED = "Mirrored" + +class OperatingSystemTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """operating system type that the gallery image uses. Expected to be linux or windows + """ + + WINDOWS = "Windows" + LINUX = "Linux" + +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,22 +71,63 @@ class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM = "system" USER_SYSTEM = "user,system" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Provisioning state of the ArcSetting proxy resource. +class OsTypeEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """OsType - string specifying whether the OS is Linux or Windows """ - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - ACCEPTED = "Accepted" - PROVISIONING = "Provisioning" + LINUX = "Linux" + WINDOWS = "Windows" + +class PowerStateEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """PowerState of the VM + """ + + DEALLOCATED = "Deallocated" + DEALLOCATING = "Deallocating" + RUNNING = "Running" + STARTING = "Starting" + STOPPED = "Stopped" + STOPPING = "Stopping" + UNKNOWN = "Unknown" + +class PrivateIPAllocationMethodEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """PrivateIPAllocationMethod - The private IP address allocation method. Possible values include: + 'Static', 'Dynamic' + """ + + DYNAMIC = "Dynamic" + STATIC = "Static" -class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """Status of the cluster agent. +class ProvisioningStateEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the gallery image. """ - NOT_YET_REGISTERED = "NotYetRegistered" - CONNECTED_RECENTLY = "ConnectedRecently" - NOT_CONNECTED_RECENTLY = "NotConnectedRecently" - DISCONNECTED = "Disconnected" - ERROR = "Error" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + IN_PROGRESS = "InProgress" + +class VmSizeEnum(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + DEFAULT = "Default" + STANDARD_A2_V2 = "Standard_A2_v2" + STANDARD_A4_V2 = "Standard_A4_v2" + STANDARD_D2_S_V3 = "Standard_D2s_v3" + STANDARD_D4_S_V3 = "Standard_D4s_v3" + STANDARD_D8_S_V3 = "Standard_D8s_v3" + STANDARD_D16_S_V3 = "Standard_D16s_v3" + STANDARD_D32_S_V3 = "Standard_D32s_v3" + STANDARD_DS2_V2 = "Standard_DS2_v2" + STANDARD_DS3_V2 = "Standard_DS3_v2" + STANDARD_DS4_V2 = "Standard_DS4_v2" + STANDARD_DS5_V2 = "Standard_DS5_v2" + STANDARD_DS13_V2 = "Standard_DS13_v2" + STANDARD_K8_S_V1 = "Standard_K8S_v1" + STANDARD_K8_S2_V1 = "Standard_K8S2_v1" + STANDARD_K8_S3_V1 = "Standard_K8S3_v1" + STANDARD_K8_S4_V1 = "Standard_K8S4_v1" + STANDARD_NK6 = "Standard_NK6" + STANDARD_NK12 = "Standard_NK12" + STANDARD_NV6 = "Standard_NV6" + STANDARD_NV12 = "Standard_NV12" + STANDARD_K8_S5_V1 = "Standard_K8S5_v1" + CUSTOM = "Custom" 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..7ff002edd5ce2 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 @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -15,197 +15,227 @@ from ._azure_stack_hci_client_enums import * -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. +class ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable(msrest.serialization.Model): + """RouteTable for the subnet. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Etag - Gets a unique read-only string that changes whenever the resource is updated. :vartype id: str - :ivar name: The name of the resource. + :ivar name: Name - READ-ONLY; Resource name. :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". + :ivar type: Type - READ-ONLY; Resource type. :vartype type: str + :ivar routes: Routes - Collection of routes contained within a route table. + :vartype routes: + list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsPropertiesItemsItem] """ - _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'}, + 'routes': {'key': 'properties.routes', 'type': '[VirtualnetworksPropertiesSubnetsPropertiesItemsItem]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + routes: Optional[List["VirtualnetworksPropertiesSubnetsPropertiesItemsItem"]] = None, + **kwargs + ): + """ + :keyword id: Etag - Gets a unique read-only string that changes whenever the resource is + updated. + :paramtype id: str + :keyword name: Name - READ-ONLY; Resource name. + :paramtype name: str + :keyword type: Type - READ-ONLY; Resource type. + :paramtype type: str + :keyword routes: Routes - Collection of routes contained within a route table. + :paramtype routes: + list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsPropertiesItemsItem] + """ + super(ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable, self).__init__(**kwargs) + self.id = id + self.name = name + self.type = type + self.routes = routes + + +class ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems(msrest.serialization.Model): + """IPConfigurationReference - Describes a IPConfiguration under the virtual network. + + :ivar id: Name of the Ip Configuration. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'ID', 'type': 'str'}, } def __init__( self, + *, + id: Optional[str] = None, **kwargs ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None + """ + :keyword id: Name of the Ip Configuration. + :paramtype id: str + """ + super(ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems, self).__init__(**kwargs) + self.id = id -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. +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 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". + :ivar type: The additional info type. :vartype type: str + :ivar info: The additional info. + :vartype info: any """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, 'type': {'readonly': True}, + 'info': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'object'}, } def __init__( self, **kwargs ): - super(ProxyResource, self).__init__(**kwargs) + """ + """ + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.type = None + self.info = None -class ArcSetting(ProxyResource): - """ArcSetting details. +class ErrorDetail(msrest.serialization.Model): + """The error detail. 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 + :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.mgmt.azurestackhci.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.azurestackhci.models.ErrorAdditionalInfo] """ _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}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'additional_info': {'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'}, + '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.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.azurestackhci.models.ErrorDetail + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorDetail'}, } def __init__( self, *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, + error: Optional["ErrorDetail"] = None, **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 = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.azurestackhci.models.ErrorDetail + """ + super(ErrorResponse, self).__init__(**kwargs) + self.error = error -class ArcSettingList(msrest.serialization.Model): - """List of ArcSetting proxy resources for the HCI cluster. +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 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 + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ArcSetting]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } def __init__( self, **kwargs ): - super(ArcSettingList, self).__init__(**kwargs) - self.value = None - self.next_link = None + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None class TrackedResource(Resource): @@ -223,16 +253,20 @@ 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'readonly': True}, 'location': {'required': True}, } @@ -240,6 +274,7 @@ class TrackedResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, } @@ -251,13 +286,19 @@ 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 -class Cluster(TrackedResource): - """Cluster details. +class Galleryimages(TrackedResource): + """The galleryimages resource definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -271,92 +312,53 @@ 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 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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar extended_location: The extendedLocation of the resource. + :vartype extended_location: ~azure.mgmt.azurestackhci.models.GalleryimagesExtendedLocation + :ivar container_name: Container Name for storage container. + :vartype container_name: str + :ivar image_path: location of the image the gallery image should be created from. + :vartype image_path: str + :ivar os_type: operating system type that the gallery image uses. Expected to be linux or + windows. Possible values include: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes + :ivar provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :ivar resource_name: name of the object to be used in moc. + :vartype resource_name: str + :ivar status: MOCGalleryImageStatus defines the desired state of MOCGalleryImage. + :vartype status: ~azure.mgmt.azurestackhci.models.MOCGalleryImageStatus """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'system_data': {'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'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'GalleryimagesExtendedLocation'}, + 'container_name': {'key': 'properties.containerName', 'type': 'str'}, + 'image_path': {'key': 'properties.imagePath', 'type': 'str'}, + 'os_type': {'key': 'properties.osType', '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'}, + 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'MOCGalleryImageStatus'}, } def __init__( @@ -364,45 +366,86 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - cloud_management_endpoint: Optional[str] = None, - aad_client_id: Optional[str] = None, - aad_tenant_id: Optional[str] = None, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, + extended_location: Optional["GalleryimagesExtendedLocation"] = None, + container_name: Optional[str] = None, + image_path: Optional[str] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + provisioning_state: Optional[Union[str, "ProvisioningStateEnum"]] = None, + resource_name: Optional[str] = None, + status: Optional["MOCGalleryImageStatus"] = None, **kwargs ): - super(Cluster, self).__init__(tags=tags, location=location, **kwargs) - self.provisioning_state = None - self.status = None - self.cloud_id = None - self.cloud_management_endpoint = cloud_management_endpoint - self.aad_client_id = aad_client_id - self.aad_tenant_id = aad_tenant_id - 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 = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword extended_location: The extendedLocation of the resource. + :paramtype extended_location: ~azure.mgmt.azurestackhci.models.GalleryimagesExtendedLocation + :keyword container_name: Container Name for storage container. + :paramtype container_name: str + :keyword image_path: location of the image the gallery image should be created from. + :paramtype image_path: str + :keyword os_type: operating system type that the gallery image uses. Expected to be linux or + windows. Possible values include: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.azurestackhci.models.OperatingSystemTypes + :keyword provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :paramtype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :keyword resource_name: name of the object to be used in moc. + :paramtype resource_name: str + :keyword status: MOCGalleryImageStatus defines the desired state of MOCGalleryImage. + :paramtype status: ~azure.mgmt.azurestackhci.models.MOCGalleryImageStatus + """ + super(Galleryimages, self).__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.container_name = container_name + self.image_path = image_path + self.os_type = os_type + self.provisioning_state = provisioning_state + self.resource_name = resource_name + self.status = status + + +class GalleryimagesExtendedLocation(msrest.serialization.Model): + """The extendedLocation of the resource. + + :ivar type: The extended location type. + :vartype type: str + :ivar name: The extended location name. + :vartype name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword type: The extended location type. + :paramtype type: str + :keyword name: The extended location name. + :paramtype name: str + """ + super(GalleryimagesExtendedLocation, self).__init__(**kwargs) + self.type = type + self.name = name -class ClusterList(msrest.serialization.Model): - """List of clusters. +class GalleryimagesListResult(msrest.serialization.Model): + """List of galleryimages. 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: + :vartype value: list[~azure.mgmt.azurestackhci.models.Galleryimages] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -412,258 +455,498 @@ class ClusterList(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[Cluster]'}, + 'value': {'key': 'value', 'type': '[Galleryimages]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: Optional[List["Cluster"]] = None, + value: Optional[List["Galleryimages"]] = None, **kwargs ): - super(ClusterList, self).__init__(**kwargs) + """ + :keyword value: + :paramtype value: list[~azure.mgmt.azurestackhci.models.Galleryimages] + """ + super(GalleryimagesListResult, self).__init__(**kwargs) self.value = value 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. +class GalleryimagesPatch(msrest.serialization.Model): + """The galleryimages resource patch definition. - :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 + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ - _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'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( self, + *, + tags: Optional[Dict[str, str]] = None, **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 + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(GalleryimagesPatch, self).__init__(**kwargs) + self.tags = tags + +class HardwareProfileUpdate(msrest.serialization.Model): + """HardwareProfile - Specifies the hardware settings for the virtual machine. + + :ivar vm_size: Possible values include: "Default", "Standard_A2_v2", "Standard_A4_v2", + "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", + "Standard_D32s_v3", "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", + "Standard_DS13_v2", "Standard_K8S_v1", "Standard_K8S2_v1", "Standard_K8S3_v1", + "Standard_K8S4_v1", "Standard_NK6", "Standard_NK12", "Standard_NV6", "Standard_NV12", + "Standard_K8S5_v1", "Custom". + :vartype vm_size: str or ~azure.mgmt.azurestackhci.models.VmSizeEnum + :ivar processors: number of processors for the virtual machine. + :vartype processors: int + :ivar memory_gb: RAM in gb for the virtual machine. + :vartype memory_gb: int + """ -class ClusterPatch(msrest.serialization.Model): - """Cluster details to update. + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'processors': {'key': 'processors', 'type': 'int'}, + 'memory_gb': {'key': 'memoryGB', 'type': 'int'}, + } - :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 + def __init__( + self, + *, + vm_size: Optional[Union[str, "VmSizeEnum"]] = None, + processors: Optional[int] = None, + memory_gb: Optional[int] = None, + **kwargs + ): + """ + :keyword vm_size: Possible values include: "Default", "Standard_A2_v2", "Standard_A4_v2", + "Standard_D2s_v3", "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", + "Standard_D32s_v3", "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", + "Standard_DS13_v2", "Standard_K8S_v1", "Standard_K8S2_v1", "Standard_K8S3_v1", + "Standard_K8S4_v1", "Standard_NK6", "Standard_NK12", "Standard_NV6", "Standard_NV12", + "Standard_K8S5_v1", "Custom". + :paramtype vm_size: str or ~azure.mgmt.azurestackhci.models.VmSizeEnum + :keyword processors: number of processors for the virtual machine. + :paramtype processors: int + :keyword memory_gb: RAM in gb for the virtual machine. + :paramtype memory_gb: int + """ + super(HardwareProfileUpdate, self).__init__(**kwargs) + self.vm_size = vm_size + self.processors = processors + self.memory_gb = memory_gb + + +class InterfaceDNSSettings(msrest.serialization.Model): + """InterfaceDNSSettings. + + :ivar dns_servers: List of DNS server IP Addresses for the interface. + :vartype dns_servers: list[str] """ _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'cloud_management_endpoint': {'key': 'properties.cloudManagementEndpoint', 'type': 'str'}, + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, - cloud_management_endpoint: Optional[str] = None, + dns_servers: Optional[List[str]] = None, **kwargs ): - super(ClusterPatch, self).__init__(**kwargs) - self.tags = tags - self.cloud_management_endpoint = cloud_management_endpoint + """ + :keyword dns_servers: List of DNS server IP Addresses for the interface. + :paramtype dns_servers: list[str] + """ + super(InterfaceDNSSettings, self).__init__(**kwargs) + self.dns_servers = dns_servers -class ClusterReportedProperties(msrest.serialization.Model): - """Properties reported by cluster agent. +class IpConfiguration(msrest.serialization.Model): + """InterfaceIPConfiguration iPConfiguration in a network interface. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar name: Name - The name of the resource that is unique within a resource group. This name + can be used to access the resource. + :vartype name: str + :ivar properties: InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + :vartype properties: ~azure.mgmt.azurestackhci.models.IpConfigurationProperties + """ - :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 + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IpConfigurationProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["IpConfigurationProperties"] = None, + **kwargs + ): + """ + :keyword name: Name - The name of the resource that is unique within a resource group. This + name can be used to access the resource. + :paramtype name: str + :keyword properties: InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + :paramtype properties: ~azure.mgmt.azurestackhci.models.IpConfigurationProperties + """ + super(IpConfiguration, self).__init__(**kwargs) + self.name = name + self.properties = properties + + +class IpConfigurationProperties(msrest.serialization.Model): + """InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + + :ivar gateway: Gateway for network interface. + :vartype gateway: str + :ivar prefix_length: prefixLength for network interface. + :vartype prefix_length: str + :ivar private_ip_address: PrivateIPAddress - Private IP address of the IP configuration. + :vartype private_ip_address: str + :ivar private_ip_allocation_method: PrivateIPAllocationMethod - The private IP address + allocation method. Possible values include: 'Static', 'Dynamic'. Possible values include: + "Dynamic", "Static". + :vartype private_ip_allocation_method: str or + ~azure.mgmt.azurestackhci.models.PrivateIPAllocationMethodEnum + :ivar subnet: Subnet - Name of Subnet bound to the IP configuration. + :vartype subnet: ~azure.mgmt.azurestackhci.models.IpConfigurationPropertiesSubnet """ - _validation = { - 'cluster_name': {'readonly': True}, - 'cluster_id': {'readonly': True}, - 'cluster_version': {'readonly': True}, - 'nodes': {'readonly': True}, - 'last_updated': {'readonly': True}, + _attribute_map = { + 'gateway': {'key': 'gateway', 'type': 'str'}, + 'prefix_length': {'key': 'prefixLength', 'type': 'str'}, + 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, + 'private_ip_allocation_method': {'key': 'privateIPAllocationMethod', 'type': 'str'}, + 'subnet': {'key': 'subnet', 'type': 'IpConfigurationPropertiesSubnet'}, } + def __init__( + self, + *, + gateway: Optional[str] = None, + prefix_length: Optional[str] = None, + private_ip_address: Optional[str] = None, + private_ip_allocation_method: Optional[Union[str, "PrivateIPAllocationMethodEnum"]] = None, + subnet: Optional["IpConfigurationPropertiesSubnet"] = None, + **kwargs + ): + """ + :keyword gateway: Gateway for network interface. + :paramtype gateway: str + :keyword prefix_length: prefixLength for network interface. + :paramtype prefix_length: str + :keyword private_ip_address: PrivateIPAddress - Private IP address of the IP configuration. + :paramtype private_ip_address: str + :keyword private_ip_allocation_method: PrivateIPAllocationMethod - The private IP address + allocation method. Possible values include: 'Static', 'Dynamic'. Possible values include: + "Dynamic", "Static". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.azurestackhci.models.PrivateIPAllocationMethodEnum + :keyword subnet: Subnet - Name of Subnet bound to the IP configuration. + :paramtype subnet: ~azure.mgmt.azurestackhci.models.IpConfigurationPropertiesSubnet + """ + super(IpConfigurationProperties, self).__init__(**kwargs) + self.gateway = gateway + self.prefix_length = prefix_length + self.private_ip_address = private_ip_address + self.private_ip_allocation_method = private_ip_allocation_method + self.subnet = subnet + + +class IpConfigurationPropertiesSubnet(msrest.serialization.Model): + """Subnet - Name of Subnet bound to the IP configuration. + + :ivar id: ID - The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :vartype id: str + """ + _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'}, + 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, + *, + id: Optional[str] = None, **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 + """ + :keyword id: ID - The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :paramtype id: str + """ + super(IpConfigurationPropertiesSubnet, self).__init__(**kwargs) + self.id = id + + +class IPPool(msrest.serialization.Model): + """IPPool. + + :ivar ip_pool_type: ip pool type. Possible values include: "vm", "vippool". + :vartype ip_pool_type: str or ~azure.mgmt.azurestackhci.models.IPPoolTypeEnum + :ivar start: First IP of the pool. + :vartype start: str + :ivar end: Last IP of the pool. + :vartype end: str + :ivar info: + :vartype info: ~azure.mgmt.azurestackhci.models.IPPoolInfo + """ + _attribute_map = { + 'ip_pool_type': {'key': 'ipPoolType', 'type': 'str'}, + 'start': {'key': 'start', 'type': 'str'}, + 'end': {'key': 'end', 'type': 'str'}, + 'info': {'key': 'info', 'type': 'IPPoolInfo'}, + } -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. + def __init__( + self, + *, + ip_pool_type: Optional[Union[str, "IPPoolTypeEnum"]] = None, + start: Optional[str] = None, + end: Optional[str] = None, + info: Optional["IPPoolInfo"] = None, + **kwargs + ): + """ + :keyword ip_pool_type: ip pool type. Possible values include: "vm", "vippool". + :paramtype ip_pool_type: str or ~azure.mgmt.azurestackhci.models.IPPoolTypeEnum + :keyword start: First IP of the pool. + :paramtype start: str + :keyword end: Last IP of the pool. + :paramtype end: str + :keyword info: + :paramtype info: ~azure.mgmt.azurestackhci.models.IPPoolInfo + """ + super(IPPool, self).__init__(**kwargs) + self.ip_pool_type = ip_pool_type + self.start = start + self.end = end + self.info = info + + +class IPPoolInfo(msrest.serialization.Model): + """IPPoolInfo. 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 + :ivar used: no. of ip addresses allocated from the ip pool. + :vartype used: str + :ivar available: no. of ip addresses available in the ip pool. + :vartype available: str """ _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, + 'used': {'readonly': True}, + 'available': {'readonly': True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, + 'used': {'key': 'used', 'type': 'str'}, + 'available': {'key': 'available', 'type': 'str'}, } def __init__( self, **kwargs ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None + """ + """ + super(IPPoolInfo, self).__init__(**kwargs) + self.used = None + self.available = None -class ErrorDetail(msrest.serialization.Model): - """The error detail. +class MOCGalleryImageStatus(msrest.serialization.Model): + """MOCGalleryImageStatus defines the desired state of MOCGalleryImage. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar error_code: GalleryImage provisioning error code. + :vartype error_code: str + :ivar error_message: Descriptive error message. + :vartype error_message: str + """ - :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] + _attribute_map = { + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__( + self, + *, + error_code: Optional[str] = None, + error_message: Optional[str] = None, + **kwargs + ): + """ + :keyword error_code: GalleryImage provisioning error code. + :paramtype error_code: str + :keyword error_message: Descriptive error message. + :paramtype error_message: str + """ + super(MOCGalleryImageStatus, self).__init__(**kwargs) + self.error_code = error_code + self.error_message = error_message + + +class MOCNetworkInterfaceStatus(msrest.serialization.Model): + """MOCNetworkInterfaceStatus defines the desired state of MOCNetworkInterface. + + :ivar error_code: NetworkInterface provisioning error code. + :vartype error_code: str + :ivar error_message: Descriptive error message. + :vartype error_message: str """ - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, + _attribute_map = { + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, } + def __init__( + self, + *, + error_code: Optional[str] = None, + error_message: Optional[str] = None, + **kwargs + ): + """ + :keyword error_code: NetworkInterface provisioning error code. + :paramtype error_code: str + :keyword error_message: Descriptive error message. + :paramtype error_message: str + """ + super(MOCNetworkInterfaceStatus, self).__init__(**kwargs) + self.error_code = error_code + self.error_message = error_message + + +class MOCVirtualHardDiskStatus(msrest.serialization.Model): + """MOCVirtualHardDiskStatus defines the desired state of MocVirtualHardDisk. + + :ivar error_code: NetworkInterface provisioning error code. + :vartype error_code: str + :ivar error_message: Descriptive error message. + :vartype error_message: str + """ + _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]'}, + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, } def __init__( self, + *, + error_code: Optional[str] = None, + error_message: Optional[str] = None, **kwargs ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - + """ + :keyword error_code: NetworkInterface provisioning error code. + :paramtype error_code: str + :keyword error_message: Descriptive error message. + :paramtype error_message: str + """ + super(MOCVirtualHardDiskStatus, self).__init__(**kwargs) + self.error_code = error_code + self.error_message = error_message + + +class MOCVirtualMachineStatus(msrest.serialization.Model): + """MOCVirtualMachineSpec defines the desired state of MOCVirtualMachine. + + :ivar power_state: PowerState of the VM. Possible values include: "Deallocated", + "Deallocating", "Running", "Starting", "Stopped", "Stopping", "Unknown". + :vartype power_state: str or ~azure.mgmt.azurestackhci.models.PowerStateEnum + :ivar error_code: VM provisioning error code. + :vartype error_code: str + :ivar error_message: Descriptive error message. + :vartype error_message: str + """ -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.). + _attribute_map = { + 'power_state': {'key': 'powerState', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } - :param error: The error object. - :type error: ~azure_stack_hci_client.models.ErrorDetail + def __init__( + self, + *, + power_state: Optional[Union[str, "PowerStateEnum"]] = None, + error_code: Optional[str] = None, + error_message: Optional[str] = None, + **kwargs + ): + """ + :keyword power_state: PowerState of the VM. Possible values include: "Deallocated", + "Deallocating", "Running", "Starting", "Stopped", "Stopping", "Unknown". + :paramtype power_state: str or ~azure.mgmt.azurestackhci.models.PowerStateEnum + :keyword error_code: VM provisioning error code. + :paramtype error_code: str + :keyword error_message: Descriptive error message. + :paramtype error_message: str + """ + super(MOCVirtualMachineStatus, self).__init__(**kwargs) + self.power_state = power_state + self.error_code = error_code + self.error_message = error_message + + +class MOCVirtualNetworkStatus(msrest.serialization.Model): + """MOCVirtualNetworkStatus defines the desired state of MOCVirtualNetwork. + + :ivar error_code: VirtualNetwork provisioning error code. + :vartype error_code: str + :ivar error_message: Descriptive error message. + :vartype error_message: str """ _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, + 'error_code': {'key': 'errorCode', 'type': 'str'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, } def __init__( self, *, - error: Optional["ErrorDetail"] = None, + error_code: Optional[str] = None, + error_message: Optional[str] = None, **kwargs ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = error + """ + :keyword error_code: VirtualNetwork provisioning error code. + :paramtype error_code: str + :keyword error_message: Descriptive error message. + :paramtype error_message: str + """ + super(MOCVirtualNetworkStatus, self).__init__(**kwargs) + self.error_code = error_code + self.error_message = error_message -class Extension(ProxyResource): - """Details of a particular extension in HCI Cluster. +class Networkinterfaces(TrackedResource): + """The networkinterfaces resource definition. Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. + :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str @@ -672,146 +955,243 @@ class Extension(ProxyResource): :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 + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar extended_location: + :vartype extended_location: ~azure.mgmt.azurestackhci.models.NetworkinterfacesExtendedLocation + :ivar ip_configurations: IPConfigurations - A list of IPConfigurations of the network + interface. + :vartype ip_configurations: list[~azure.mgmt.azurestackhci.models.IpConfiguration] + :ivar mac_address: MacAddress - The MAC address of the network interface. + :vartype mac_address: str + :ivar dns_settings: DNS Settings for the interface. + :vartype dns_settings: ~azure.mgmt.azurestackhci.models.InterfaceDNSSettings + :ivar provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :ivar resource_name: name of the object to be used in moc. + :vartype resource_name: str + :ivar status: MOCNetworkInterfaceStatus defines the desired state of MOCNetworkInterface. + :vartype status: ~azure.mgmt.azurestackhci.models.MOCNetworkInterfaceStatus """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'aggregate_state': {'readonly': True}, - 'per_node_extension_details': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'NetworkinterfacesExtendedLocation'}, + 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[IpConfiguration]'}, + 'mac_address': {'key': 'properties.macAddress', 'type': 'str'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'InterfaceDNSSettings'}, '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, - *, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type_properties_extension_parameters_type: Optional[str] = None, - type_handler_version: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[Any] = None, - protected_settings: Optional[Any] = None, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, + 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'MOCNetworkInterfaceStatus'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["NetworkinterfacesExtendedLocation"] = None, + ip_configurations: Optional[List["IpConfiguration"]] = None, + mac_address: Optional[str] = None, + dns_settings: Optional["InterfaceDNSSettings"] = None, + provisioning_state: Optional[Union[str, "ProvisioningStateEnum"]] = None, + resource_name: Optional[str] = None, + status: Optional["MOCNetworkInterfaceStatus"] = None, **kwargs ): - super(Extension, self).__init__(**kwargs) - self.provisioning_state = None - self.aggregate_state = None - self.per_node_extension_details = None - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type_properties_extension_parameters_type = type_properties_extension_parameters_type - self.type_handler_version = type_handler_version - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword extended_location: + :paramtype extended_location: + ~azure.mgmt.azurestackhci.models.NetworkinterfacesExtendedLocation + :keyword ip_configurations: IPConfigurations - A list of IPConfigurations of the network + interface. + :paramtype ip_configurations: list[~azure.mgmt.azurestackhci.models.IpConfiguration] + :keyword mac_address: MacAddress - The MAC address of the network interface. + :paramtype mac_address: str + :keyword dns_settings: DNS Settings for the interface. + :paramtype dns_settings: ~azure.mgmt.azurestackhci.models.InterfaceDNSSettings + :keyword provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :paramtype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :keyword resource_name: name of the object to be used in moc. + :paramtype resource_name: str + :keyword status: MOCNetworkInterfaceStatus defines the desired state of MOCNetworkInterface. + :paramtype status: ~azure.mgmt.azurestackhci.models.MOCNetworkInterfaceStatus + """ + super(Networkinterfaces, self).__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.ip_configurations = ip_configurations + self.mac_address = mac_address + self.dns_settings = dns_settings + self.provisioning_state = provisioning_state + self.resource_name = resource_name + self.status = status + + +class NetworkinterfacesExtendedLocation(msrest.serialization.Model): + """NetworkinterfacesExtendedLocation. + + :ivar type: The extended location type. + :vartype type: str + :ivar name: The extended location name. + :vartype name: str + """ + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } -class ExtensionList(msrest.serialization.Model): - """List of Extensions in HCI cluster. + def __init__( + self, + *, + type: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword type: The extended location type. + :paramtype type: str + :keyword name: The extended location name. + :paramtype name: str + """ + super(NetworkinterfacesExtendedLocation, self).__init__(**kwargs) + self.type = type + self.name = name + + +class NetworkinterfacesListResult(msrest.serialization.Model): + """NetworkinterfacesListResult. + + :ivar value: + :vartype value: list[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :ivar next_link: + :vartype next_link: str + """ - Variables are only populated by the server, and will be ignored when sending a request. + _attribute_map = { + 'value': {'key': 'value', 'type': '[Networkinterfaces]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } - :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 + def __init__( + self, + *, + value: Optional[List["Networkinterfaces"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :keyword next_link: + :paramtype next_link: str + """ + super(NetworkinterfacesListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NetworkinterfacesPatch(msrest.serialization.Model): + """The networkinterfaces resource patch definition. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, } + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(NetworkinterfacesPatch, self).__init__(**kwargs) + self.tags = tags + + +class NetworkProfileUpdate(msrest.serialization.Model): + """NetworkProfile - describes the network update configuration the virtual machine. + + :ivar network_interfaces: NetworkInterfaces - list of network interfaces to be attached to the + virtual machine. + :vartype network_interfaces: + list[~azure.mgmt.azurestackhci.models.NetworkProfileUpdateNetworkInterfacesItem] + """ + _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkProfileUpdateNetworkInterfacesItem]'}, + } + + def __init__( + self, + *, + network_interfaces: Optional[List["NetworkProfileUpdateNetworkInterfacesItem"]] = None, + **kwargs + ): + """ + :keyword network_interfaces: NetworkInterfaces - list of network interfaces to be attached to + the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.azurestackhci.models.NetworkProfileUpdateNetworkInterfacesItem] + """ + super(NetworkProfileUpdate, self).__init__(**kwargs) + self.network_interfaces = network_interfaces + + +class NetworkProfileUpdateNetworkInterfacesItem(msrest.serialization.Model): + """NetworkProfileUpdateNetworkInterfacesItem. + + :ivar id: Name of the network interface. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, } def __init__( self, + *, + id: Optional[str] = None, **kwargs ): - super(ExtensionList, self).__init__(**kwargs) - self.value = None - self.next_link = None + """ + :keyword id: Name of the network interface. + :paramtype id: str + """ + super(NetworkProfileUpdateNetworkInterfacesItem, self).__init__(**kwargs) + self.id = id class Operation(msrest.serialization.Model): @@ -825,15 +1205,15 @@ 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.mgmt.azurestackhci.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 + :vartype origin: str or ~azure.mgmt.azurestackhci.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 + :vartype action_type: str or ~azure.mgmt.azurestackhci.models.ActionType """ _validation = { @@ -857,6 +1237,10 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.azurestackhci.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = None self.is_data_action = None @@ -902,6 +1286,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -915,7 +1301,7 @@ class OperationListResult(msrest.serialization.Model): 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] + :vartype value: list[~azure.mgmt.azurestackhci.models.Operation] :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ @@ -934,80 +1320,1470 @@ 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. +class StorageProfileUpdate(msrest.serialization.Model): + """StorageProfileUpdate. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar data_disks: adds data disks to the virtual machine for the update call. + :vartype data_disks: list[~azure.mgmt.azurestackhci.models.StorageProfileUpdateDataDisksItem] + """ + + _attribute_map = { + 'data_disks': {'key': 'dataDisks', 'type': '[StorageProfileUpdateDataDisksItem]'}, + } + + def __init__( + self, + *, + data_disks: Optional[List["StorageProfileUpdateDataDisksItem"]] = None, + **kwargs + ): + """ + :keyword data_disks: adds data disks to the virtual machine for the update call. + :paramtype data_disks: list[~azure.mgmt.azurestackhci.models.StorageProfileUpdateDataDisksItem] + """ + super(StorageProfileUpdate, self).__init__(**kwargs) + self.data_disks = data_disks - :ivar name: Name of the node in HCI Cluster. + +class StorageProfileUpdateDataDisksItem(msrest.serialization.Model): + """StorageProfileUpdateDataDisksItem. + + :ivar name: :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'}, } + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: + :paramtype name: str + """ + super(StorageProfileUpdateDataDisksItem, self).__init__(**kwargs) + self.name = name + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.azurestackhci.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". + :vartype last_modified_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'extension': {'key': 'extension', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, } def __init__( self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, **kwargs ): - super(PerNodeExtensionState, self).__init__(**kwargs) - self.name = None - self.extension = None - self.state = None + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.azurestackhci.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at -class PerNodeState(msrest.serialization.Model): - """Status of Arc agent for a particular node in HCI Cluster. +class Virtualharddisks(TrackedResource): + """The virtualharddisks resource definition. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: Name of the Node in HCI Cluster. + 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 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 + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar extended_location: + :vartype extended_location: ~azure.mgmt.azurestackhci.models.VirtualharddisksExtendedLocation + :ivar block_size_bytes: + :vartype block_size_bytes: int + :ivar disk_size_bytes: diskSizeBytes - size of the disk in GB. + :vartype disk_size_bytes: long + :ivar dynamic: Boolean for enabling dynamic sizing on the virtual hard disk. + :vartype dynamic: bool + :ivar logical_sector_bytes: + :vartype logical_sector_bytes: int + :ivar physical_sector_bytes: + :vartype physical_sector_bytes: int + :ivar provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :ivar resource_name: name of the object to be used in moc. + :vartype resource_name: str + :ivar status: MOCVirtualHardDiskStatus defines the desired state of MocVirtualHardDisk. + :vartype status: ~azure.mgmt.azurestackhci.models.MOCVirtualHardDiskStatus """ _validation = { + 'id': {'readonly': True}, 'name': {'readonly': True}, - 'arc_instance': {'readonly': True}, - 'state': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'arc_instance': {'key': 'arcInstance', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'VirtualharddisksExtendedLocation'}, + 'block_size_bytes': {'key': 'properties.blockSizeBytes', 'type': 'int'}, + 'disk_size_bytes': {'key': 'properties.diskSizeBytes', 'type': 'long'}, + 'dynamic': {'key': 'properties.dynamic', 'type': 'bool'}, + 'logical_sector_bytes': {'key': 'properties.logicalSectorBytes', 'type': 'int'}, + 'physical_sector_bytes': {'key': 'properties.physicalSectorBytes', 'type': 'int'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'MOCVirtualHardDiskStatus'}, } def __init__( self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["VirtualharddisksExtendedLocation"] = None, + block_size_bytes: Optional[int] = None, + disk_size_bytes: Optional[int] = None, + dynamic: Optional[bool] = None, + logical_sector_bytes: Optional[int] = None, + physical_sector_bytes: Optional[int] = None, + provisioning_state: Optional[Union[str, "ProvisioningStateEnum"]] = None, + resource_name: Optional[str] = None, + status: Optional["MOCVirtualHardDiskStatus"] = None, **kwargs ): - super(PerNodeState, self).__init__(**kwargs) - self.name = None - self.arc_instance = None - self.state = None + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword extended_location: + :paramtype extended_location: ~azure.mgmt.azurestackhci.models.VirtualharddisksExtendedLocation + :keyword block_size_bytes: + :paramtype block_size_bytes: int + :keyword disk_size_bytes: diskSizeBytes - size of the disk in GB. + :paramtype disk_size_bytes: long + :keyword dynamic: Boolean for enabling dynamic sizing on the virtual hard disk. + :paramtype dynamic: bool + :keyword logical_sector_bytes: + :paramtype logical_sector_bytes: int + :keyword physical_sector_bytes: + :paramtype physical_sector_bytes: int + :keyword provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :paramtype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :keyword resource_name: name of the object to be used in moc. + :paramtype resource_name: str + :keyword status: MOCVirtualHardDiskStatus defines the desired state of MocVirtualHardDisk. + :paramtype status: ~azure.mgmt.azurestackhci.models.MOCVirtualHardDiskStatus + """ + super(Virtualharddisks, self).__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.block_size_bytes = block_size_bytes + self.disk_size_bytes = disk_size_bytes + self.dynamic = dynamic + self.logical_sector_bytes = logical_sector_bytes + self.physical_sector_bytes = physical_sector_bytes + self.provisioning_state = provisioning_state + self.resource_name = resource_name + self.status = status + + +class VirtualharddisksExtendedLocation(msrest.serialization.Model): + """VirtualharddisksExtendedLocation. + + :ivar type: The extended location type. + :vartype type: str + :ivar name: The extended location name. + :vartype name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword type: The extended location type. + :paramtype type: str + :keyword name: The extended location name. + :paramtype name: str + """ + super(VirtualharddisksExtendedLocation, self).__init__(**kwargs) + self.type = type + self.name = name + + +class VirtualharddisksListResult(msrest.serialization.Model): + """VirtualharddisksListResult. + + :ivar value: + :vartype value: list[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Virtualharddisks]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Virtualharddisks"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :keyword next_link: + :paramtype next_link: str + """ + super(VirtualharddisksListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualharddisksPatch(msrest.serialization.Model): + """The virtualharddisks resource patch definition. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(VirtualharddisksPatch, self).__init__(**kwargs) + self.tags = tags + + +class Virtualmachines(TrackedResource): + """The virtualmachines resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar extended_location: + :vartype extended_location: ~azure.mgmt.azurestackhci.models.VirtualmachinesExtendedLocation + :ivar hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual + machine. + :vartype hardware_profile: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfile + :ivar network_profile: NetworkProfile - describes the network configuration the virtual + machine. + :vartype network_profile: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfile + :ivar os_profile: OsProfile - describes the configuration of the operating system and sets + login data. + :vartype os_profile: ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfile + :ivar resource_name: name of the object to be used in moc. + :vartype resource_name: str + :ivar security_profile: SecurityProfile - Specifies the security settings for the virtual + machine. + :vartype security_profile: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfile + :ivar storage_profile: StorageProfile - contains information about the disks and storage + information for the virtual machine. + :vartype storage_profile: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfile + :ivar provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :ivar status: MOCVirtualMachineSpec defines the desired state of MOCVirtualMachine. + :vartype status: ~azure.mgmt.azurestackhci.models.MOCVirtualMachineStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'VirtualmachinesExtendedLocation'}, + 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'VirtualmachinesPropertiesHardwareProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'VirtualmachinesPropertiesNetworkProfile'}, + 'os_profile': {'key': 'properties.osProfile', 'type': 'VirtualmachinesPropertiesOsProfile'}, + 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'VirtualmachinesPropertiesSecurityProfile'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'VirtualmachinesPropertiesStorageProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'MOCVirtualMachineStatus'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["VirtualmachinesExtendedLocation"] = None, + hardware_profile: Optional["VirtualmachinesPropertiesHardwareProfile"] = None, + network_profile: Optional["VirtualmachinesPropertiesNetworkProfile"] = None, + os_profile: Optional["VirtualmachinesPropertiesOsProfile"] = None, + resource_name: Optional[str] = None, + security_profile: Optional["VirtualmachinesPropertiesSecurityProfile"] = None, + storage_profile: Optional["VirtualmachinesPropertiesStorageProfile"] = None, + provisioning_state: Optional[Union[str, "ProvisioningStateEnum"]] = None, + status: Optional["MOCVirtualMachineStatus"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword extended_location: + :paramtype extended_location: ~azure.mgmt.azurestackhci.models.VirtualmachinesExtendedLocation + :keyword hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual + machine. + :paramtype hardware_profile: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfile + :keyword network_profile: NetworkProfile - describes the network configuration the virtual + machine. + :paramtype network_profile: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfile + :keyword os_profile: OsProfile - describes the configuration of the operating system and sets + login data. + :paramtype os_profile: ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfile + :keyword resource_name: name of the object to be used in moc. + :paramtype resource_name: str + :keyword security_profile: SecurityProfile - Specifies the security settings for the virtual + machine. + :paramtype security_profile: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesSecurityProfile + :keyword storage_profile: StorageProfile - contains information about the disks and storage + information for the virtual machine. + :paramtype storage_profile: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfile + :keyword provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :paramtype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :keyword status: MOCVirtualMachineSpec defines the desired state of MOCVirtualMachine. + :paramtype status: ~azure.mgmt.azurestackhci.models.MOCVirtualMachineStatus + """ + super(Virtualmachines, self).__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.hardware_profile = hardware_profile + self.network_profile = network_profile + self.os_profile = os_profile + self.resource_name = resource_name + self.security_profile = security_profile + self.storage_profile = storage_profile + self.provisioning_state = provisioning_state + self.status = status + + +class VirtualmachinesExtendedLocation(msrest.serialization.Model): + """VirtualmachinesExtendedLocation. + + :ivar type: The extended location type. + :vartype type: str + :ivar name: The extended location name. + :vartype name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword type: The extended location type. + :paramtype type: str + :keyword name: The extended location name. + :paramtype name: str + """ + super(VirtualmachinesExtendedLocation, self).__init__(**kwargs) + self.type = type + self.name = name + + +class VirtualmachinesListResult(msrest.serialization.Model): + """VirtualmachinesListResult. + + :ivar value: + :vartype value: list[~azure.mgmt.azurestackhci.models.Virtualmachines] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Virtualmachines]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Virtualmachines"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.azurestackhci.models.Virtualmachines] + :keyword next_link: + :paramtype next_link: str + """ + super(VirtualmachinesListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualmachinesPatch(msrest.serialization.Model): + """The virtualmachines resource patch definition. + + :ivar properties: Defines the resource properties for the update. + :vartype properties: ~azure.mgmt.azurestackhci.models.VirtualMachineUpdateProperties + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'VirtualMachineUpdateProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + properties: Optional["VirtualMachineUpdateProperties"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword properties: Defines the resource properties for the update. + :paramtype properties: ~azure.mgmt.azurestackhci.models.VirtualMachineUpdateProperties + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(VirtualmachinesPatch, self).__init__(**kwargs) + self.properties = properties + self.tags = tags + + +class VirtualmachinesPropertiesHardwareProfile(msrest.serialization.Model): + """HardwareProfile - Specifies the hardware settings for the virtual machine. + + :ivar vm_size: + :vartype vm_size: str + :ivar processors: number of processors for the virtual machine. + :vartype processors: int + :ivar memory_gb: RAM in gb for the virtual machine. + :vartype memory_gb: int + :ivar dynamic_memory_config: + :vartype dynamic_memory_config: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig + """ + + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'processors': {'key': 'processors', 'type': 'int'}, + 'memory_gb': {'key': 'memoryGB', 'type': 'int'}, + 'dynamic_memory_config': {'key': 'dynamicMemoryConfig', 'type': 'VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig'}, + } + + def __init__( + self, + *, + vm_size: Optional[str] = None, + processors: Optional[int] = None, + memory_gb: Optional[int] = None, + dynamic_memory_config: Optional["VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig"] = None, + **kwargs + ): + """ + :keyword vm_size: + :paramtype vm_size: str + :keyword processors: number of processors for the virtual machine. + :paramtype processors: int + :keyword memory_gb: RAM in gb for the virtual machine. + :paramtype memory_gb: int + :keyword dynamic_memory_config: + :paramtype dynamic_memory_config: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig + """ + super(VirtualmachinesPropertiesHardwareProfile, self).__init__(**kwargs) + self.vm_size = vm_size + self.processors = processors + self.memory_gb = memory_gb + self.dynamic_memory_config = dynamic_memory_config + + +class VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig(msrest.serialization.Model): + """VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig. + + :ivar maximum_memory_gb: + :vartype maximum_memory_gb: long + :ivar minimum_memory_gb: + :vartype minimum_memory_gb: long + :ivar target_memory_buffer: + :vartype target_memory_buffer: int + """ + + _attribute_map = { + 'maximum_memory_gb': {'key': 'maximumMemoryGB', 'type': 'long'}, + 'minimum_memory_gb': {'key': 'minimumMemoryGB', 'type': 'long'}, + 'target_memory_buffer': {'key': 'targetMemoryBuffer', 'type': 'int'}, + } + + def __init__( + self, + *, + maximum_memory_gb: Optional[int] = None, + minimum_memory_gb: Optional[int] = None, + target_memory_buffer: Optional[int] = None, + **kwargs + ): + """ + :keyword maximum_memory_gb: + :paramtype maximum_memory_gb: long + :keyword minimum_memory_gb: + :paramtype minimum_memory_gb: long + :keyword target_memory_buffer: + :paramtype target_memory_buffer: int + """ + super(VirtualmachinesPropertiesHardwareProfileDynamicMemoryConfig, self).__init__(**kwargs) + self.maximum_memory_gb = maximum_memory_gb + self.minimum_memory_gb = minimum_memory_gb + self.target_memory_buffer = target_memory_buffer + + +class VirtualmachinesPropertiesNetworkProfile(msrest.serialization.Model): + """NetworkProfile - describes the network configuration the virtual machine. + + :ivar network_interfaces: NetworkInterfaces - list of network interfaces to be attached to the + virtual machine. + :vartype network_interfaces: + list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem] + """ + + _attribute_map = { + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem]'}, + } + + def __init__( + self, + *, + network_interfaces: Optional[List["VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem"]] = None, + **kwargs + ): + """ + :keyword network_interfaces: NetworkInterfaces - list of network interfaces to be attached to + the virtual machine. + :paramtype network_interfaces: + list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem] + """ + super(VirtualmachinesPropertiesNetworkProfile, self).__init__(**kwargs) + self.network_interfaces = network_interfaces + + +class VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem(msrest.serialization.Model): + """VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem. + + :ivar id: Name of the network interface. + :vartype id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + """ + :keyword id: Name of the network interface. + :paramtype id: str + """ + super(VirtualmachinesPropertiesNetworkProfileNetworkInterfacesItem, self).__init__(**kwargs) + self.id = id + + +class VirtualmachinesPropertiesOsProfile(msrest.serialization.Model): + """OsProfile - describes the configuration of the operating system and sets login data. + + :ivar admin_password: AdminPassword - admin password. + :vartype admin_password: str + :ivar admin_username: AdminUsername - admin username. + :vartype admin_username: str + :ivar computer_name: ComputerName - name of the compute. + :vartype computer_name: str + :ivar linux_configuration: LinuxConfiguration - linux specific configuration values for the + virtual machine. + :vartype linux_configuration: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfiguration + :ivar os_type: OsType - string specifying whether the OS is Linux or Windows. Possible values + include: "Linux", "Windows". + :vartype os_type: str or ~azure.mgmt.azurestackhci.models.OsTypeEnum + :ivar windows_configuration: Windows Configuration for the virtual machine. + :vartype windows_configuration: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfiguration + """ + + _attribute_map = { + 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'computer_name': {'key': 'computerName', 'type': 'str'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'VirtualmachinesPropertiesOsProfileLinuxConfiguration'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'VirtualmachinesPropertiesOsProfileWindowsConfiguration'}, + } + + def __init__( + self, + *, + admin_password: Optional[str] = None, + admin_username: Optional[str] = None, + computer_name: Optional[str] = None, + linux_configuration: Optional["VirtualmachinesPropertiesOsProfileLinuxConfiguration"] = None, + os_type: Optional[Union[str, "OsTypeEnum"]] = None, + windows_configuration: Optional["VirtualmachinesPropertiesOsProfileWindowsConfiguration"] = None, + **kwargs + ): + """ + :keyword admin_password: AdminPassword - admin password. + :paramtype admin_password: str + :keyword admin_username: AdminUsername - admin username. + :paramtype admin_username: str + :keyword computer_name: ComputerName - name of the compute. + :paramtype computer_name: str + :keyword linux_configuration: LinuxConfiguration - linux specific configuration values for the + virtual machine. + :paramtype linux_configuration: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfiguration + :keyword os_type: OsType - string specifying whether the OS is Linux or Windows. Possible + values include: "Linux", "Windows". + :paramtype os_type: str or ~azure.mgmt.azurestackhci.models.OsTypeEnum + :keyword windows_configuration: Windows Configuration for the virtual machine. + :paramtype windows_configuration: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfiguration + """ + super(VirtualmachinesPropertiesOsProfile, self).__init__(**kwargs) + self.admin_password = admin_password + self.admin_username = admin_username + self.computer_name = computer_name + self.linux_configuration = linux_configuration + self.os_type = os_type + self.windows_configuration = windows_configuration + + +class VirtualmachinesPropertiesOsProfileLinuxConfiguration(msrest.serialization.Model): + """LinuxConfiguration - linux specific configuration values for the virtual machine. + + :ivar disable_password_authentication: DisablePasswordAuthentication - whether password + authentication should be disabled. + :vartype disable_password_authentication: bool + :ivar ssh: SSH - contains settings related to ssh configuration. + :vartype ssh: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh + """ + + _attribute_map = { + 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, + 'ssh': {'key': 'ssh', 'type': 'VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh'}, + } + + def __init__( + self, + *, + disable_password_authentication: Optional[bool] = None, + ssh: Optional["VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh"] = None, + **kwargs + ): + """ + :keyword disable_password_authentication: DisablePasswordAuthentication - whether password + authentication should be disabled. + :paramtype disable_password_authentication: bool + :keyword ssh: SSH - contains settings related to ssh configuration. + :paramtype ssh: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh + """ + super(VirtualmachinesPropertiesOsProfileLinuxConfiguration, self).__init__(**kwargs) + self.disable_password_authentication = disable_password_authentication + self.ssh = ssh + + +class VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh(msrest.serialization.Model): + """SSH - contains settings related to ssh configuration. + + :ivar public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux + based VMs. + :vartype public_keys: + list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem] + """ + + _attribute_map = { + 'public_keys': {'key': 'publicKeys', 'type': '[VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem]'}, + } + + def __init__( + self, + *, + public_keys: Optional[List["VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem"]] = None, + **kwargs + ): + """ + :keyword public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux + based VMs. + :paramtype public_keys: + list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem] + """ + super(VirtualmachinesPropertiesOsProfileLinuxConfigurationSsh, self).__init__(**kwargs) + self.public_keys = public_keys + + +class VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem(msrest.serialization.Model): + """VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem. + + :ivar key_data: KeyData - SSH public key certificate used to authenticate with the VM through + ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For + creating ssh keys, see `Create SSH keys on Linux and Mac for Li nux VMs in Azure + `_. + :vartype key_data: str + :ivar path: Path - Specifies the full path on the created VM where ssh public key is stored. If + the file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :vartype path: str + """ + + _attribute_map = { + 'key_data': {'key': 'keyData', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__( + self, + *, + key_data: Optional[str] = None, + path: Optional[str] = None, + **kwargs + ): + """ + :keyword key_data: KeyData - SSH public key certificate used to authenticate with the VM + through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. + :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Li + nux VMs in Azure + `_. + :paramtype key_data: str + :keyword path: Path - Specifies the full path on the created VM where ssh public key is stored. + If the file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :paramtype path: str + """ + super(VirtualmachinesPropertiesOsProfileLinuxConfigurationSshPublicKeysItem, self).__init__(**kwargs) + self.key_data = key_data + self.path = path + + +class VirtualmachinesPropertiesOsProfileWindowsConfiguration(msrest.serialization.Model): + """Windows Configuration for the virtual machine. + + :ivar enable_automatic_updates: Whether to EnableAutomaticUpdates on the machine. + :vartype enable_automatic_updates: bool + :ivar ssh: SSH Configuration. + :vartype ssh: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh + :ivar time_zone: TimeZone for the virtual machine. + :vartype time_zone: str + """ + + _attribute_map = { + 'enable_automatic_updates': {'key': 'enableAutomaticUpdates', 'type': 'bool'}, + 'ssh': {'key': 'ssh', 'type': 'VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh'}, + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + } + + def __init__( + self, + *, + enable_automatic_updates: Optional[bool] = None, + ssh: Optional["VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh"] = None, + time_zone: Optional[str] = None, + **kwargs + ): + """ + :keyword enable_automatic_updates: Whether to EnableAutomaticUpdates on the machine. + :paramtype enable_automatic_updates: bool + :keyword ssh: SSH Configuration. + :paramtype ssh: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh + :keyword time_zone: TimeZone for the virtual machine. + :paramtype time_zone: str + """ + super(VirtualmachinesPropertiesOsProfileWindowsConfiguration, self).__init__(**kwargs) + self.enable_automatic_updates = enable_automatic_updates + self.ssh = ssh + self.time_zone = time_zone + + +class VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh(msrest.serialization.Model): + """SSH Configuration. + + :ivar public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux + based VMs. + :vartype public_keys: + list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem] + """ + + _attribute_map = { + 'public_keys': {'key': 'publicKeys', 'type': '[VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem]'}, + } + + def __init__( + self, + *, + public_keys: Optional[List["VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem"]] = None, + **kwargs + ): + """ + :keyword public_keys: PublicKeys - The list of SSH public keys used to authenticate with linux + based VMs. + :paramtype public_keys: + list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem] + """ + super(VirtualmachinesPropertiesOsProfileWindowsConfigurationSsh, self).__init__(**kwargs) + self.public_keys = public_keys + + +class VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem(msrest.serialization.Model): + """VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem. + + :ivar key_data: KeyData - SSH public key certificate used to authenticate with the VM through + ssh. The key needs to be at least 2048-bit and in ssh-rsa format. :code:`
`:code:`
` For + creating ssh keys, see `Create SSH keys on Linux and Mac for Li nux VMs in Azure + `_. + :vartype key_data: str + :ivar path: Path - Specifies the full path on the created VM where ssh public key is stored. If + the file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :vartype path: str + """ + + _attribute_map = { + 'key_data': {'key': 'keyData', 'type': 'str'}, + 'path': {'key': 'path', 'type': 'str'}, + } + + def __init__( + self, + *, + key_data: Optional[str] = None, + path: Optional[str] = None, + **kwargs + ): + """ + :keyword key_data: KeyData - SSH public key certificate used to authenticate with the VM + through ssh. The key needs to be at least 2048-bit and in ssh-rsa format. + :code:`
`:code:`
` For creating ssh keys, see `Create SSH keys on Linux and Mac for Li + nux VMs in Azure + `_. + :paramtype key_data: str + :keyword path: Path - Specifies the full path on the created VM where ssh public key is stored. + If the file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :paramtype path: str + """ + super(VirtualmachinesPropertiesOsProfileWindowsConfigurationSshPublicKeysItem, self).__init__(**kwargs) + self.key_data = key_data + self.path = path + + +class VirtualmachinesPropertiesSecurityProfile(msrest.serialization.Model): + """SecurityProfile - Specifies the security settings for the virtual machine. + + :ivar enable_tpm: + :vartype enable_tpm: bool + """ + + _attribute_map = { + 'enable_tpm': {'key': 'enableTPM', 'type': 'bool'}, + } + + def __init__( + self, + *, + enable_tpm: Optional[bool] = None, + **kwargs + ): + """ + :keyword enable_tpm: + :paramtype enable_tpm: bool + """ + super(VirtualmachinesPropertiesSecurityProfile, self).__init__(**kwargs) + self.enable_tpm = enable_tpm + + +class VirtualmachinesPropertiesStorageProfile(msrest.serialization.Model): + """StorageProfile - contains information about the disks and storage information for the virtual machine. + + :ivar data_disks: adds data disks to the virtual machine. + :vartype data_disks: + list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileDataDisksItem] + :ivar image_reference: Which Image to use for the virtual machine. + :vartype image_reference: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileImageReference + """ + + _attribute_map = { + 'data_disks': {'key': 'dataDisks', 'type': '[VirtualmachinesPropertiesStorageProfileDataDisksItem]'}, + 'image_reference': {'key': 'imageReference', 'type': 'VirtualmachinesPropertiesStorageProfileImageReference'}, + } + + def __init__( + self, + *, + data_disks: Optional[List["VirtualmachinesPropertiesStorageProfileDataDisksItem"]] = None, + image_reference: Optional["VirtualmachinesPropertiesStorageProfileImageReference"] = None, + **kwargs + ): + """ + :keyword data_disks: adds data disks to the virtual machine. + :paramtype data_disks: + list[~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileDataDisksItem] + :keyword image_reference: Which Image to use for the virtual machine. + :paramtype image_reference: + ~azure.mgmt.azurestackhci.models.VirtualmachinesPropertiesStorageProfileImageReference + """ + super(VirtualmachinesPropertiesStorageProfile, self).__init__(**kwargs) + self.data_disks = data_disks + self.image_reference = image_reference + + +class VirtualmachinesPropertiesStorageProfileDataDisksItem(msrest.serialization.Model): + """VirtualmachinesPropertiesStorageProfileDataDisksItem. + + :ivar name: + :vartype name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: + :paramtype name: str + """ + super(VirtualmachinesPropertiesStorageProfileDataDisksItem, self).__init__(**kwargs) + self.name = name + + +class VirtualmachinesPropertiesStorageProfileImageReference(msrest.serialization.Model): + """Which Image to use for the virtual machine. + + :ivar name: Name - Name of the image. + :vartype name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name - Name of the image. + :paramtype name: str + """ + super(VirtualmachinesPropertiesStorageProfileImageReference, self).__init__(**kwargs) + self.name = name + + +class VirtualMachineUpdateProperties(msrest.serialization.Model): + """Defines the resource properties for the update. + + :ivar hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual + machine. + :vartype hardware_profile: ~azure.mgmt.azurestackhci.models.HardwareProfileUpdate + :ivar storage_profile: + :vartype storage_profile: ~azure.mgmt.azurestackhci.models.StorageProfileUpdate + :ivar network_profile: NetworkProfile - describes the network update configuration the virtual + machine. + :vartype network_profile: ~azure.mgmt.azurestackhci.models.NetworkProfileUpdate + """ + + _attribute_map = { + 'hardware_profile': {'key': 'hardwareProfile', 'type': 'HardwareProfileUpdate'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfileUpdate'}, + 'network_profile': {'key': 'networkProfile', 'type': 'NetworkProfileUpdate'}, + } + + def __init__( + self, + *, + hardware_profile: Optional["HardwareProfileUpdate"] = None, + storage_profile: Optional["StorageProfileUpdate"] = None, + network_profile: Optional["NetworkProfileUpdate"] = None, + **kwargs + ): + """ + :keyword hardware_profile: HardwareProfile - Specifies the hardware settings for the virtual + machine. + :paramtype hardware_profile: ~azure.mgmt.azurestackhci.models.HardwareProfileUpdate + :keyword storage_profile: + :paramtype storage_profile: ~azure.mgmt.azurestackhci.models.StorageProfileUpdate + :keyword network_profile: NetworkProfile - describes the network update configuration the + virtual machine. + :paramtype network_profile: ~azure.mgmt.azurestackhci.models.NetworkProfileUpdate + """ + super(VirtualMachineUpdateProperties, self).__init__(**kwargs) + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.network_profile = network_profile + + +class Virtualnetworks(TrackedResource): + """The virtualnetworks resource definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.azurestackhci.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar extended_location: + :vartype extended_location: ~azure.mgmt.azurestackhci.models.VirtualnetworksExtendedLocation + :ivar network_type: Type of the network. Possible values include: "NAT", "Transparent", + "L2Bridge", "L2Tunnel", "ICS", "Private", "Overlay", "Internal", "Mirrored". + :vartype network_type: str or ~azure.mgmt.azurestackhci.models.NetworkTypeEnum + :ivar subnets: Subnet - list of subnets under the virtual network. + :vartype subnets: list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsItem] + :ivar provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :ivar resource_name: name of the object to be used in moc. + :vartype resource_name: str + :ivar status: MOCVirtualNetworkStatus defines the desired state of MOCVirtualNetwork. + :vartype status: ~azure.mgmt.azurestackhci.models.MOCVirtualNetworkStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'VirtualnetworksExtendedLocation'}, + 'network_type': {'key': 'properties.networkType', 'type': 'str'}, + 'subnets': {'key': 'properties.subnets', 'type': '[VirtualnetworksPropertiesSubnetsItem]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'resource_name': {'key': 'properties.resourceName', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'MOCVirtualNetworkStatus'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["VirtualnetworksExtendedLocation"] = None, + network_type: Optional[Union[str, "NetworkTypeEnum"]] = None, + subnets: Optional[List["VirtualnetworksPropertiesSubnetsItem"]] = None, + provisioning_state: Optional[Union[str, "ProvisioningStateEnum"]] = None, + resource_name: Optional[str] = None, + status: Optional["MOCVirtualNetworkStatus"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword extended_location: + :paramtype extended_location: ~azure.mgmt.azurestackhci.models.VirtualnetworksExtendedLocation + :keyword network_type: Type of the network. Possible values include: "NAT", "Transparent", + "L2Bridge", "L2Tunnel", "ICS", "Private", "Overlay", "Internal", "Mirrored". + :paramtype network_type: str or ~azure.mgmt.azurestackhci.models.NetworkTypeEnum + :keyword subnets: Subnet - list of subnets under the virtual network. + :paramtype subnets: list[~azure.mgmt.azurestackhci.models.VirtualnetworksPropertiesSubnetsItem] + :keyword provisioning_state: Provisioning state of the gallery image. Possible values include: + "Succeeded", "Failed", "InProgress". + :paramtype provisioning_state: str or ~azure.mgmt.azurestackhci.models.ProvisioningStateEnum + :keyword resource_name: name of the object to be used in moc. + :paramtype resource_name: str + :keyword status: MOCVirtualNetworkStatus defines the desired state of MOCVirtualNetwork. + :paramtype status: ~azure.mgmt.azurestackhci.models.MOCVirtualNetworkStatus + """ + super(Virtualnetworks, self).__init__(tags=tags, location=location, **kwargs) + self.extended_location = extended_location + self.network_type = network_type + self.subnets = subnets + self.provisioning_state = provisioning_state + self.resource_name = resource_name + self.status = status + + +class VirtualnetworksExtendedLocation(msrest.serialization.Model): + """VirtualnetworksExtendedLocation. + + :ivar type: The extended location type. + :vartype type: str + :ivar name: The extended location name. + :vartype name: str + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): + """ + :keyword type: The extended location type. + :paramtype type: str + :keyword name: The extended location name. + :paramtype name: str + """ + super(VirtualnetworksExtendedLocation, self).__init__(**kwargs) + self.type = type + self.name = name + + +class VirtualnetworksListResult(msrest.serialization.Model): + """VirtualnetworksListResult. + + :ivar value: + :vartype value: list[~azure.mgmt.azurestackhci.models.Virtualnetworks] + :ivar next_link: + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Virtualnetworks]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Virtualnetworks"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.azurestackhci.models.Virtualnetworks] + :keyword next_link: + :paramtype next_link: str + """ + super(VirtualnetworksListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualnetworksPatch(msrest.serialization.Model): + """The virtualnetworks resource patch definition. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(VirtualnetworksPatch, self).__init__(**kwargs) + self.tags = tags + + +class VirtualnetworksPropertiesSubnetsItem(msrest.serialization.Model): + """Subnet subnet in a virtual network resource. + + :ivar name: Name - The name of the resource that is unique within a resource group. This name + can be used to access the resource. + :vartype name: str + :ivar address_prefix: Cidr for this subnet - IPv4, IPv6. + :vartype address_prefix: str + :ivar address_prefixes: AddressPrefixes - List of address prefixes for the subnet. + :vartype address_prefixes: list[str] + :ivar ip_allocation_method: IPAllocationMethod - The IP address allocation method. Possible + values include: 'Static', 'Dynamic'. Possible values include: "Dynamic", "Static". + :vartype ip_allocation_method: str or ~azure.mgmt.azurestackhci.models.IpAllocationMethodEnum + :ivar ip_configuration_references: IPConfigurationReferences - list of + IPConfigurationReferences. + :vartype ip_configuration_references: + list[~azure.mgmt.azurestackhci.models.ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems] + :ivar route_table: RouteTable for the subnet. + :vartype route_table: + ~azure.mgmt.azurestackhci.models.ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable + :ivar ip_pools: network associated pool of IP Addresses. + :vartype ip_pools: list[~azure.mgmt.azurestackhci.models.IPPool] + :ivar vlan: Vlan to use for the subnet. + :vartype vlan: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, + 'address_prefixes': {'key': 'properties.addressPrefixes', 'type': '[str]'}, + 'ip_allocation_method': {'key': 'properties.ipAllocationMethod', 'type': 'str'}, + 'ip_configuration_references': {'key': 'properties.ipConfigurationReferences', 'type': '[ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems]'}, + 'route_table': {'key': 'properties.routeTable', 'type': 'ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable'}, + 'ip_pools': {'key': 'properties.ipPools', 'type': '[IPPool]'}, + 'vlan': {'key': 'properties.vlan', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + address_prefix: Optional[str] = None, + address_prefixes: Optional[List[str]] = None, + ip_allocation_method: Optional[Union[str, "IpAllocationMethodEnum"]] = None, + ip_configuration_references: Optional[List["ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems"]] = None, + route_table: Optional["ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable"] = None, + ip_pools: Optional[List["IPPool"]] = None, + vlan: Optional[int] = None, + **kwargs + ): + """ + :keyword name: Name - The name of the resource that is unique within a resource group. This + name can be used to access the resource. + :paramtype name: str + :keyword address_prefix: Cidr for this subnet - IPv4, IPv6. + :paramtype address_prefix: str + :keyword address_prefixes: AddressPrefixes - List of address prefixes for the subnet. + :paramtype address_prefixes: list[str] + :keyword ip_allocation_method: IPAllocationMethod - The IP address allocation method. Possible + values include: 'Static', 'Dynamic'. Possible values include: "Dynamic", "Static". + :paramtype ip_allocation_method: str or ~azure.mgmt.azurestackhci.models.IpAllocationMethodEnum + :keyword ip_configuration_references: IPConfigurationReferences - list of + IPConfigurationReferences. + :paramtype ip_configuration_references: + list[~azure.mgmt.azurestackhci.models.ComponentsVqks9HSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesIpconfigurationreferencesItems] + :keyword route_table: RouteTable for the subnet. + :paramtype route_table: + ~azure.mgmt.azurestackhci.models.ComponentsL15GkaSchemasVirtualnetworkspropertiesPropertiesSubnetsItemsPropertiesRoutetable + :keyword ip_pools: network associated pool of IP Addresses. + :paramtype ip_pools: list[~azure.mgmt.azurestackhci.models.IPPool] + :keyword vlan: Vlan to use for the subnet. + :paramtype vlan: int + """ + super(VirtualnetworksPropertiesSubnetsItem, self).__init__(**kwargs) + self.name = name + self.address_prefix = address_prefix + self.address_prefixes = address_prefixes + self.ip_allocation_method = ip_allocation_method + self.ip_configuration_references = ip_configuration_references + self.route_table = route_table + self.ip_pools = ip_pools + self.vlan = vlan + + +class VirtualnetworksPropertiesSubnetsPropertiesItemsItem(msrest.serialization.Model): + """Route is associated with a subnet. + + :ivar name: Name - name of the subnet. + :vartype name: str + :ivar address_prefix: AddressPrefix - The destination CIDR to which the route applies. + :vartype address_prefix: str + :ivar next_hop_ip_address: NextHopIPAddress - The IP address packets should be forwarded to. + Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + :vartype next_hop_ip_address: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'address_prefix': {'key': 'properties.addressPrefix', 'type': 'str'}, + 'next_hop_ip_address': {'key': 'properties.nextHopIpAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + address_prefix: Optional[str] = None, + next_hop_ip_address: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name - name of the subnet. + :paramtype name: str + :keyword address_prefix: AddressPrefix - The destination CIDR to which the route applies. + :paramtype address_prefix: str + :keyword next_hop_ip_address: NextHopIPAddress - The IP address packets should be forwarded to. + Next hop values are only allowed in routes where the next hop type is VirtualAppliance. + :paramtype next_hop_ip_address: str + """ + super(VirtualnetworksPropertiesSubnetsPropertiesItemsItem, self).__init__(**kwargs) + self.name = name + self.address_prefix = address_prefix + self.next_hop_ip_address = next_hop_ip_address diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py index d3211472e48c4..65984a9c92b97 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/__init__.py @@ -6,14 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._arc_settings_operations import ArcSettingsOperations -from ._clusters_operations import ClustersOperations -from ._extensions_operations import ExtensionsOperations +from ._galleryimages_operations import GalleryimagesOperations +from ._networkinterfaces_operations import NetworkinterfacesOperations +from ._virtualharddisks_operations import VirtualharddisksOperations +from ._virtualmachines_operations import VirtualmachinesOperations +from ._virtualnetworks_operations import VirtualnetworksOperations from ._operations import Operations __all__ = [ - 'ArcSettingsOperations', - 'ClustersOperations', - 'ExtensionsOperations', + 'GalleryimagesOperations', + 'NetworkinterfacesOperations', + 'VirtualharddisksOperations', + 'VirtualmachinesOperations', + 'VirtualnetworksOperations', 'Operations', ] 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 deleted file mode 100644 index f27601576940d..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py +++ /dev/null @@ -1,381 +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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ArcSettingsOperations(object): - """ArcSettingsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_stack_hci_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_cluster( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ArcSettingList"] - """Get ArcSetting resources of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ArcSettingList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_stack_hci_client.models.ArcSettingList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSettingList"] - error_map = { - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ArcSettingList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings'} # type: ignore - - def get( - self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ArcSetting" - """Get ArcSetting resource details of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArcSetting, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.ArcSetting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSetting"] - 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.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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ArcSetting', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore - - 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" - """Create ArcSetting for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param arc_setting: Parameters supplied to the Create ArcSetting resource for this HCI cluster. - :type arc_setting: ~azure_stack_hci_client.models.ArcSetting - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ArcSetting, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.ArcSetting - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSetting"] - 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.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ArcSetting', pipeline_response) - - if cls: - 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 - 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 = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - cluster_name, # type: str - arc_setting_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Delete ArcSetting resource details of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :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. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', 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) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 deleted file mode 100644 index 9e1231d58a238..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py +++ /dev/null @@ -1,439 +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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ClustersOperations(object): - """ClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_stack_hci_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_subscription( - self, - **kwargs # type: Any - ): - # type: (...) -> 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 - :return: An iterator like instance of either ClusterList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_stack_hci_client.models.ClusterList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] - error_map = { - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClusterList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_stack_hci_client.models.ClusterList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] - error_map = { - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore - - def get( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" - """Get HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cluster, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.Cluster - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] - 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.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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore - - def create( - self, - resource_group_name, # type: str - cluster_name, # type: str - cluster, # type: "_models.Cluster" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" - """Create an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param cluster: Details of the HCI cluster. - :type cluster: ~azure_stack_hci_client.models.Cluster - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cluster, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.Cluster - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] - 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.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore - - def update( - self, - resource_group_name, # type: str - cluster_name, # type: str - cluster, # type: "_models.ClusterPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" - """Update an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param cluster: Details of the HCI cluster. - :type cluster: ~azure_stack_hci_client.models.ClusterPatch - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Cluster, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.Cluster - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] - 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.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore - - def delete( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - """Delete an HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None, or the result of cls(response) - :rtype: None - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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.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 = 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) - 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 deleted file mode 100644 index 012182e3a12e2..0000000000000 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py +++ /dev/null @@ -1,612 +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 typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ExtensionsOperations(object): - """ExtensionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_stack_hci_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = _models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_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"] - """List all Extensions under ArcSetting resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_stack_hci_client.models.ExtensionList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionList"] - error_map = { - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ExtensionList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_by_arc_setting.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions'} # type: ignore - - 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" - """Get particular Arc Extension of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Extension, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.Extension - :raises: ~azure.core.exceptions.HttpResponseError - """ - 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" - 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 = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Extension', pipeline_response) - - if cls: - 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" - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - - if response.status_code == 200: - deserialized = self._deserialize('Extension', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Extension', pipeline_response) - - if cls: - 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 - - 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"] - """Create Extension for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. - :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. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure_stack_hci_client.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - extension=extension, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('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) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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" - 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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(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) - - deserialized = self._deserialize('Extension', pipeline_response) - - if cls: - 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 - - 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"] - """Update Extension for HCI cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. - :type extension_name: str - :param extension: Details of the Machine Extension to be created. - :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. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure_stack_hci_client.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - extension=extension, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('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) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_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 - 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 = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore - - 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] - """Delete particular Arc Extension of HCI Cluster. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - :type resource_group_name: str - :param cluster_name: The name of the cluster. - :type cluster_name: str - :param arc_setting_name: The name of the proxy resource holding details of HCI ArcSetting - information. - :type arc_setting_name: str - :param extension_name: The name of the machine extension. - :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. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - arc_setting_name=arc_setting_name, - extension_name=extension_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - if cls: - return cls(pipeline_response, None, {}) - - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', 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) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py new file mode 100644 index 0000000000000..e383f55f4e7e4 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_galleryimages_operations.py @@ -0,0 +1,688 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_retrieve_request( + subscription_id: str, + resource_group_name: str, + galleryimages_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}') + 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), + "galleryimagesName": _SERIALIZER.url("galleryimages_name", galleryimages_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + galleryimages_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}') + 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), + "galleryimagesName": _SERIALIZER.url("galleryimages_name", galleryimages_name, 'str', max_length=64, min_length=3), + } + + 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( + subscription_id: str, + resource_group_name: str, + galleryimages_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}') + 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), + "galleryimagesName": _SERIALIZER.url("galleryimages_name", galleryimages_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + galleryimages_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}') + 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), + "galleryimagesName": _SERIALIZER.url("galleryimages_name", galleryimages_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages') + 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_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryimages') + 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 + ) + +class GalleryimagesOperations(object): + """GalleryimagesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def retrieve( + self, + resource_group_name: str, + galleryimages_name: str, + **kwargs: Any + ) -> "_models.Galleryimages": + """Lists all galleryimages under the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param galleryimages_name: Name of the gallery image. + :type galleryimages_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Galleryimages, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Galleryimages"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Galleryimages', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + galleryimages_name: str, + galleryimages: "_models.Galleryimages", + **kwargs: Any + ) -> "_models.Galleryimages": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Galleryimages"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(galleryimages, 'Galleryimages') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Galleryimages', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Galleryimages', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + galleryimages_name: str, + galleryimages: "_models.Galleryimages", + **kwargs: Any + ) -> LROPoller["_models.Galleryimages"]: + """Create or update a galleryimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param galleryimages_name: Name of the gallery image. + :type galleryimages_name: str + :param galleryimages: + :type galleryimages: ~azure.mgmt.azurestackhci.models.Galleryimages + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Galleryimages or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Galleryimages] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Galleryimages"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + galleryimages=galleryimages, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Galleryimages', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + @distributed_trace + def delete( + self, + resource_group_name: str, + galleryimages_name: str, + **kwargs: Any + ) -> None: + """Delete a galleryimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param galleryimages_name: Name of the gallery image. + :type galleryimages_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + galleryimages_name: str, + galleryimages: "_models.GalleryimagesPatch", + **kwargs: Any + ) -> "_models.Galleryimages": + """Update a galleryimage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param galleryimages_name: Name of the gallery image. + :type galleryimages_name: str + :param galleryimages: + :type galleryimages: ~azure.mgmt.azurestackhci.models.GalleryimagesPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Galleryimages, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Galleryimages + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Galleryimages"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(galleryimages, 'GalleryimagesPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + galleryimages_name=galleryimages_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Galleryimages', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages/{galleryimagesName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.GalleryimagesListResult"]: + """Lists all galleryimages under the resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryimagesListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.GalleryimagesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryimagesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("GalleryimagesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryimages'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.GalleryimagesListResult"]: + """List all galleryimages under the subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either GalleryimagesListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.GalleryimagesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GalleryimagesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("GalleryimagesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryimages'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py new file mode 100644 index 0000000000000..fb804f0ef2d3e --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_networkinterfaces_operations.py @@ -0,0 +1,690 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_retrieve_request( + subscription_id: str, + resource_group_name: str, + networkinterfaces_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}') + 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), + "networkinterfacesName": _SERIALIZER.url("networkinterfaces_name", networkinterfaces_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + networkinterfaces_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}') + 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), + "networkinterfacesName": _SERIALIZER.url("networkinterfaces_name", networkinterfaces_name, 'str', max_length=64, min_length=3), + } + + 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( + subscription_id: str, + resource_group_name: str, + networkinterfaces_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}') + 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), + "networkinterfacesName": _SERIALIZER.url("networkinterfaces_name", networkinterfaces_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + networkinterfaces_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}') + 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), + "networkinterfacesName": _SERIALIZER.url("networkinterfaces_name", networkinterfaces_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces') + 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_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkinterfaces') + 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 + ) + +class NetworkinterfacesOperations(object): + """NetworkinterfacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def retrieve( + self, + resource_group_name: str, + networkinterfaces_name: str, + **kwargs: Any + ) -> "_models.Networkinterfaces": + """retrieve. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param networkinterfaces_name: + :type networkinterfaces_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Networkinterfaces, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Networkinterfaces"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + networkinterfaces_name: str, + networkinterfaces: "_models.Networkinterfaces", + **kwargs: Any + ) -> "_models.Networkinterfaces": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Networkinterfaces"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(networkinterfaces, 'Networkinterfaces') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + networkinterfaces_name: str, + networkinterfaces: "_models.Networkinterfaces", + **kwargs: Any + ) -> LROPoller["_models.Networkinterfaces"]: + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param networkinterfaces_name: + :type networkinterfaces_name: str + :param networkinterfaces: + :type networkinterfaces: ~azure.mgmt.azurestackhci.models.Networkinterfaces + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Networkinterfaces or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Networkinterfaces] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Networkinterfaces"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + networkinterfaces=networkinterfaces, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + @distributed_trace + def delete( + self, + resource_group_name: str, + networkinterfaces_name: str, + **kwargs: Any + ) -> None: + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param networkinterfaces_name: + :type networkinterfaces_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + networkinterfaces_name: str, + networkinterfaces: "_models.NetworkinterfacesPatch", + **kwargs: Any + ) -> "_models.Networkinterfaces": + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param networkinterfaces_name: + :type networkinterfaces_name: str + :param networkinterfaces: + :type networkinterfaces: ~azure.mgmt.azurestackhci.models.NetworkinterfacesPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Networkinterfaces, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Networkinterfaces + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Networkinterfaces"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(networkinterfaces, 'NetworkinterfacesPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + networkinterfaces_name=networkinterfaces_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Networkinterfaces', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces/{networkinterfacesName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NetworkinterfacesListResult"]: + """list_by_resource_group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkinterfacesListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.NetworkinterfacesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkinterfacesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("NetworkinterfacesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkinterfaces'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.NetworkinterfacesListResult"]: + """list_by_subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NetworkinterfacesListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.NetworkinterfacesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NetworkinterfacesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("NetworkinterfacesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkinterfaces'} # 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..a5f16f4593859 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 = "2021-07-01-preview" + 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. @@ -29,7 +56,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_stack_hci_client.models + :type models: ~azure.mgmt.azurestackhci.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -44,16 +71,16 @@ 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 :return: OperationListResult, or the result of cls(response) - :rtype: ~azure_stack_hci_client.models.OperationListResult + :rtype: ~azure.mgmt.azurestackhci.models.OperationListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -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 + diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py new file mode 100644 index 0000000000000..01a4e89919113 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualharddisks_operations.py @@ -0,0 +1,690 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_retrieve_request( + subscription_id: str, + resource_group_name: str, + virtualharddisks_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}') + 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), + "virtualharddisksName": _SERIALIZER.url("virtualharddisks_name", virtualharddisks_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + virtualharddisks_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}') + 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), + "virtualharddisksName": _SERIALIZER.url("virtualharddisks_name", virtualharddisks_name, 'str', max_length=64, min_length=3), + } + + 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( + subscription_id: str, + resource_group_name: str, + virtualharddisks_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}') + 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), + "virtualharddisksName": _SERIALIZER.url("virtualharddisks_name", virtualharddisks_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + virtualharddisks_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}') + 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), + "virtualharddisksName": _SERIALIZER.url("virtualharddisks_name", virtualharddisks_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks') + 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_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualharddisks') + 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 + ) + +class VirtualharddisksOperations(object): + """VirtualharddisksOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def retrieve( + self, + resource_group_name: str, + virtualharddisks_name: str, + **kwargs: Any + ) -> "_models.Virtualharddisks": + """retrieve. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualharddisks_name: + :type virtualharddisks_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualharddisks, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualharddisks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + virtualharddisks_name: str, + virtualharddisks: "_models.Virtualharddisks", + **kwargs: Any + ) -> "_models.Virtualharddisks": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualharddisks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualharddisks, 'Virtualharddisks') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtualharddisks_name: str, + virtualharddisks: "_models.Virtualharddisks", + **kwargs: Any + ) -> LROPoller["_models.Virtualharddisks"]: + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualharddisks_name: + :type virtualharddisks_name: str + :param virtualharddisks: + :type virtualharddisks: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Virtualharddisks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualharddisks] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualharddisks"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + virtualharddisks=virtualharddisks, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + @distributed_trace + def delete( + self, + resource_group_name: str, + virtualharddisks_name: str, + **kwargs: Any + ) -> None: + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualharddisks_name: + :type virtualharddisks_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + virtualharddisks_name: str, + virtualharddisks: "_models.VirtualharddisksPatch", + **kwargs: Any + ) -> "_models.Virtualharddisks": + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualharddisks_name: + :type virtualharddisks_name: str + :param virtualharddisks: + :type virtualharddisks: ~azure.mgmt.azurestackhci.models.VirtualharddisksPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualharddisks, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualharddisks + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualharddisks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualharddisks, 'VirtualharddisksPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualharddisks_name=virtualharddisks_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualharddisks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks/{virtualharddisksName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualharddisksListResult"]: + """list_by_resource_group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualharddisksListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.VirtualharddisksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualharddisksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualharddisksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualharddisks'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.VirtualharddisksListResult"]: + """list_by_subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualharddisksListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.VirtualharddisksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualharddisksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("VirtualharddisksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualharddisks'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py new file mode 100644 index 0000000000000..0e4ad89122dd3 --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualmachines_operations.py @@ -0,0 +1,1083 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_retrieve_request( + subscription_id: str, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}') + 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), + "virtualmachinesName": _SERIALIZER.url("virtualmachines_name", virtualmachines_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + virtualmachines_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}') + 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), + "virtualmachinesName": _SERIALIZER.url("virtualmachines_name", virtualmachines_name, 'str', max_length=64, min_length=3), + } + + 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( + subscription_id: str, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}') + 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), + "virtualmachinesName": _SERIALIZER.url("virtualmachines_name", virtualmachines_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + virtualmachines_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}') + 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), + "virtualmachinesName": _SERIALIZER.url("virtualmachines_name", virtualmachines_name, 'str', max_length=64, min_length=3), + } + + 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_start_request_initial( + subscription_id: str, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start') + 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), + "virtualmachinesName": _SERIALIZER.url("virtualmachines_name", virtualmachines_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop') + 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), + "virtualmachinesName": _SERIALIZER.url("virtualmachines_name", virtualmachines_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart') + 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), + "virtualmachinesName": _SERIALIZER.url("virtualmachines_name", virtualmachines_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines') + 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_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualmachines') + 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 + ) + +class VirtualmachinesOperations(object): + """VirtualmachinesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def retrieve( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> "_models.Virtualmachines": + """retrieve. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualmachines, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualmachines"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualmachines', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + virtualmachines_name: str, + virtualmachines: "_models.Virtualmachines", + **kwargs: Any + ) -> "_models.Virtualmachines": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualmachines"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualmachines, 'Virtualmachines') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Virtualmachines', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Virtualmachines', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtualmachines_name: str, + virtualmachines: "_models.Virtualmachines", + **kwargs: Any + ) -> LROPoller["_models.Virtualmachines"]: + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :param virtualmachines: + :type virtualmachines: ~azure.mgmt.azurestackhci.models.Virtualmachines + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Virtualmachines or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualmachines] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualmachines"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + virtualmachines=virtualmachines, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Virtualmachines', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + @distributed_trace + def delete( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> None: + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + virtualmachines_name: str, + virtualmachines: "_models.VirtualmachinesPatch", + **kwargs: Any + ) -> "_models.Virtualmachines": + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :param virtualmachines: + :type virtualmachines: ~azure.mgmt.azurestackhci.models.VirtualmachinesPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualmachines, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualmachines + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualmachines"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualmachines, 'VirtualmachinesPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualmachines', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}'} # type: ignore + + + def _start_initial( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start'} # type: ignore + + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """start. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/start'} # type: ignore + + def _stop_initial( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop'} # type: ignore + + + @distributed_trace + def begin_stop( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """stop. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/stop'} # type: ignore + + def _restart_initial( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart'} # type: ignore + + + @distributed_trace + def begin_restart( + self, + resource_group_name: str, + virtualmachines_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """restart. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualmachines_name: + :type virtualmachines_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + virtualmachines_name=virtualmachines_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines/{virtualmachinesName}/restart'} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualmachinesListResult"]: + """list_by_resource_group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualmachinesListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.VirtualmachinesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualmachinesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualmachinesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualmachines'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.VirtualmachinesListResult"]: + """list_by_subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualmachinesListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.VirtualmachinesListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualmachinesListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("VirtualmachinesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualmachines'} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py new file mode 100644 index 0000000000000..d0cf8405f74db --- /dev/null +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_virtualnetworks_operations.py @@ -0,0 +1,690 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_retrieve_request( + subscription_id: str, + resource_group_name: str, + virtualnetworks_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}') + 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), + "virtualnetworksName": _SERIALIZER.url("virtualnetworks_name", virtualnetworks_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + virtualnetworks_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}') + 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), + "virtualnetworksName": _SERIALIZER.url("virtualnetworks_name", virtualnetworks_name, 'str', max_length=64, min_length=3), + } + + 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( + subscription_id: str, + resource_group_name: str, + virtualnetworks_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}') + 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), + "virtualnetworksName": _SERIALIZER.url("virtualnetworks_name", virtualnetworks_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + virtualnetworks_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}') + 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), + "virtualnetworksName": _SERIALIZER.url("virtualnetworks_name", virtualnetworks_name, 'str', max_length=64, min_length=3), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks') + 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_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualnetworks') + 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 + ) + +class VirtualnetworksOperations(object): + """VirtualnetworksOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.azurestackhci.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def retrieve( + self, + resource_group_name: str, + virtualnetworks_name: str, + **kwargs: Any + ) -> "_models.Virtualnetworks": + """retrieve. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualnetworks_name: + :type virtualnetworks_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualnetworks, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualnetworks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_retrieve_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + template_url=self.retrieve.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + retrieve.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + virtualnetworks_name: str, + virtualnetworks: "_models.Virtualnetworks", + **kwargs: Any + ) -> "_models.Virtualnetworks": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualnetworks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualnetworks, 'Virtualnetworks') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + virtualnetworks_name: str, + virtualnetworks: "_models.Virtualnetworks", + **kwargs: Any + ) -> LROPoller["_models.Virtualnetworks"]: + """create_or_update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualnetworks_name: + :type virtualnetworks_name: str + :param virtualnetworks: + :type virtualnetworks: ~azure.mgmt.azurestackhci.models.Virtualnetworks + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Virtualnetworks or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Virtualnetworks] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualnetworks"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + virtualnetworks=virtualnetworks, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + @distributed_trace + def delete( + self, + resource_group_name: str, + virtualnetworks_name: str, + **kwargs: Any + ) -> None: + """delete. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualnetworks_name: + :type virtualnetworks_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + virtualnetworks_name: str, + virtualnetworks: "_models.VirtualnetworksPatch", + **kwargs: Any + ) -> "_models.Virtualnetworks": + """update. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param virtualnetworks_name: + :type virtualnetworks_name: str + :param virtualnetworks: + :type virtualnetworks: ~azure.mgmt.azurestackhci.models.VirtualnetworksPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Virtualnetworks, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.Virtualnetworks + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Virtualnetworks"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(virtualnetworks, 'VirtualnetworksPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + virtualnetworks_name=virtualnetworks_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Virtualnetworks', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks/{virtualnetworksName}'} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.VirtualnetworksListResult"]: + """list_by_resource_group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualnetworksListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.VirtualnetworksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualnetworksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualnetworksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualnetworks'} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.VirtualnetworksListResult"]: + """list_by_subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualnetworksListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.VirtualnetworksListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualnetworksListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_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: + + 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("VirtualnetworksListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualnetworks'} # type: ignore