diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json b/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json index 038016cda203..208e936f1de6 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.13.0", "@autorest/modelerfour@4.19.3" ], - "commit": "4042a47cff72c950d35dd72149895b044ed79713", + "commit": "4742065e8d48160292fbce6790710c6835f8dc4f", "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/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/azurestackhci/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.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/_azure_stack_hci_client.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py index f487b24bfe19..161335d74f44 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer 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 @@ -25,19 +26,22 @@ class AzureStackHCIClient: """Azure Stack HCI management service. :ivar arc_settings: ArcSettingsOperations operations - :vartype arc_settings: azure_stack_hci_client.operations.ArcSettingsOperations + :vartype arc_settings: azure.mgmt.azurestackhci.operations.ArcSettingsOperations :ivar clusters: ClustersOperations operations - :vartype clusters: azure_stack_hci_client.operations.ClustersOperations + :vartype clusters: azure.mgmt.azurestackhci.operations.ClustersOperations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure_stack_hci_client.operations.ExtensionsOperations + :vartype extensions: azure.mgmt.azurestackhci.operations.ExtensionsOperations :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 base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -64,7 +68,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. 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 f91f030c86b0..c063a3a50806 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class AzureStackHCIClientConfiguration(Configuration): +class AzureStackHCIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureStackHCIClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class AzureStackHCIClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(AzureStackHCIClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-azurestackhci/{}'.format(VERSION)) self._configure(**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 ee877386b9c7..868a6e7ffc95 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_metadata.json +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2022-01-01", - "total_api_version_list": ["2022-01-01"], + "chosen_version": "2022-05-01", + "total_api_version_list": ["2022-05-01"], "client": { "name": "AzureStackHCIClient", "filename": "_azure_stack_hci_client", @@ -10,8 +10,8 @@ "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\"]}}}", - "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\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureStackHCIClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"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\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"AzureStackHCIClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { 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 92453d8691d9..e5754a47ce68 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.0" +VERSION = "1.0.0b1" 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 496b23423324..59da69f60380 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 @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer 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 @@ -25,19 +26,22 @@ class AzureStackHCIClient: """Azure Stack HCI management service. :ivar arc_settings: ArcSettingsOperations operations - :vartype arc_settings: azure_stack_hci_client.aio.operations.ArcSettingsOperations + :vartype arc_settings: azure.mgmt.azurestackhci.aio.operations.ArcSettingsOperations :ivar clusters: ClustersOperations operations - :vartype clusters: azure_stack_hci_client.aio.operations.ClustersOperations + :vartype clusters: azure.mgmt.azurestackhci.aio.operations.ClustersOperations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure_stack_hci_client.aio.operations.ExtensionsOperations + :vartype extensions: azure.mgmt.azurestackhci.aio.operations.ExtensionsOperations :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 base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ 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 feb87a2cc13e..1031214509d8 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 @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class AzureStackHCIClientConfiguration(Configuration): +class AzureStackHCIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for AzureStackHCIClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class AzureStackHCIClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(AzureStackHCIClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2022-01-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-azurestackhci/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py index 854db0b3f1e7..ac576e68e1ee 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_arc_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -22,7 +21,7 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._arc_settings_operations import build_create_request, build_delete_request_initial, build_get_request, build_list_by_cluster_request +from ...operations._arc_settings_operations import build_create_identity_request_initial, build_create_request, build_delete_request_initial, build_generate_password_request, build_get_request, build_list_by_cluster_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +32,7 @@ class ArcSettingsOperations: 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. @@ -63,9 +62,12 @@ def list_by_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] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.ArcSettingList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSettingList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -78,6 +80,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.list_by_cluster.metadata['url'], ) request = _convert_request(request) @@ -89,6 +92,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -106,7 +110,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,7 +128,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings"} # type: ignore @distributed_trace_async async def get( @@ -141,7 +149,7 @@ async def get( :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 + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSetting"] @@ -150,18 +158,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -176,7 +191,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}"} # type: ignore @distributed_trace_async @@ -198,10 +213,10 @@ async def create( 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 + :type arc_setting: ~azure.mgmt.azurestackhci.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 + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSetting"] @@ -210,6 +225,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(arc_setting, 'ArcSetting') @@ -219,6 +235,7 @@ async def create( resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -226,7 +243,82 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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('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 + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + arc_setting: "_models.ArcSettingsPatch", + **kwargs: Any + ) -> "_models.ArcSetting": + """Update ArcSettings 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: ArcSettings parameters that needs to be updated. + :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSettingsPatch + :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.mgmt.azurestackhci.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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(arc_setting, 'ArcSettingsPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + 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( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -241,10 +333,10 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -257,18 +349,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -278,11 +377,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -310,7 +409,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -322,6 +422,7 @@ async def begin_delete( resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -342,7 +443,192 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + + @distributed_trace_async + async def generate_password( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any + ) -> "_models.PasswordCredential": + """Generate password for arc settings. + + :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: PasswordCredential, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.PasswordCredential + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PasswordCredential"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + + request = build_generate_password_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + template_url=self.generate_password.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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('PasswordCredential', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_password.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword"} # type: ignore + + + async def _create_identity_initial( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any + ) -> Optional["_models.ArcIdentityResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArcIdentityResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + + request = build_create_identity_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + template_url=self._create_identity_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArcIdentityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_identity_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity"} # type: ignore + + + @distributed_trace_async + async def begin_create_identity( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.ArcIdentityResponse"]: + """Create Aad identity for arc settings. + + :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 ArcIdentityResponse or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.ArcIdentityResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcIdentityResponse"] + 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_identity_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + 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('ArcIdentityResponse', 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 + ) + 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 + begin_create_identity.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity"} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py index 08a8fb907973..535d567700be 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union 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._clusters_operations import build_create_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request +from ...operations._clusters_operations import build_create_identity_request_initial, build_create_request, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request, build_upload_certificate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -31,7 +32,7 @@ class ClustersOperations: 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. @@ -55,9 +56,11 @@ def 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 ClusterList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_stack_hci_client.models.ClusterList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.ClusterList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -68,6 +71,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -77,6 +81,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,7 +99,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -108,7 +117,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters"} # type: ignore @distributed_trace def list_by_resource_group( @@ -122,9 +131,11 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_stack_hci_client.models.ClusterList] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.ClusterList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -136,6 +147,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -146,6 +158,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -163,7 +176,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,7 +194,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters"} # type: ignore @distributed_trace_async async def get( @@ -194,7 +211,7 @@ async def get( :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 + :rtype: ~azure.mgmt.azurestackhci.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] @@ -203,17 +220,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -228,7 +252,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}"} # type: ignore @distributed_trace_async @@ -246,10 +270,10 @@ async def create( :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 + :type cluster: ~azure.mgmt.azurestackhci.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 + :rtype: ~azure.mgmt.azurestackhci.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] @@ -258,6 +282,7 @@ async def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(cluster, 'Cluster') @@ -266,6 +291,7 @@ async def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -273,7 +299,11 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -288,7 +318,7 @@ async def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}"} # type: ignore @distributed_trace_async @@ -306,10 +336,10 @@ async def update( :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 + :type cluster: ~azure.mgmt.azurestackhci.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 + :rtype: ~azure.mgmt.azurestackhci.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] @@ -318,6 +348,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(cluster, 'ClusterPatch') @@ -326,6 +357,7 @@ async def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -333,7 +365,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -348,16 +384,58 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}"} # type: ignore - @distributed_trace_async - async def delete( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_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 = kwargs.pop('api_version', "2022-05-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: """Delete an HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -365,36 +443,280 @@ async def delete( :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 + :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 """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + 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, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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}"} # type: ignore + + async def _upload_certificate_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - request = build_delete_request( + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(upload_certificate_request, 'UploadCertificateRequest') + + request = build_upload_certificate_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, - template_url=self.delete.metadata['url'], + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._upload_certificate_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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202]: 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + _upload_certificate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate"} # type: ignore + + @distributed_trace_async + async def begin_upload_certificate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Upload certificate. + + :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 upload_certificate_request: Upload certificate request. + :type upload_certificate_request: ~azure.mgmt.azurestackhci.models.UploadCertificateRequest + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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._upload_certificate_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + upload_certificate_request=upload_certificate_request, + api_version=api_version, + content_type=content_type, + 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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_upload_certificate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate"} # type: ignore + + async def _create_identity_initial( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Optional["_models.ClusterIdentityResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ClusterIdentityResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + + request = build_create_identity_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self._create_identity_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ClusterIdentityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_identity_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity"} # type: ignore + + + @distributed_trace_async + async def begin_create_identity( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.ClusterIdentityResponse"]: + """Create cluster identity. + + :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 + :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 ClusterIdentityResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.ClusterIdentityResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterIdentityResponse"] + 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_identity_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + 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('ClusterIdentityResponse', 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 + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_identity.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity"} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py index 9ce4b9df0070..1682eeb68ad8 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -33,7 +32,7 @@ class ExtensionsOperations: 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. @@ -67,9 +66,11 @@ def list_by_arc_setting( :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] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.ExtensionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -83,6 +84,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, template_url=self.list_by_arc_setting.metadata['url'], ) request = _convert_request(request) @@ -95,6 +97,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -112,7 +115,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -126,7 +133,7 @@ async def get_next(next_link=None): 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 + list_by_arc_setting.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions"} # type: ignore @distributed_trace_async async def get( @@ -150,7 +157,7 @@ async def get( :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 + :rtype: ~azure.mgmt.azurestackhci.models.Extension :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] @@ -159,6 +166,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -166,12 +175,17 @@ async def get( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -186,7 +200,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore async def _create_initial( @@ -204,6 +218,7 @@ async def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension, 'Extension') @@ -214,6 +229,7 @@ async def _create_initial( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], @@ -221,7 +237,11 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -239,7 +259,7 @@ async def _create_initial( return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore @distributed_trace_async @@ -264,7 +284,7 @@ async def begin_create( :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 + :type extension: ~azure.mgmt.azurestackhci.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 @@ -275,11 +295,12 @@ async def begin_create( 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] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Extension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,6 +314,7 @@ async def begin_create( arc_setting_name=arc_setting_name, extension_name=extension_name, extension=extension, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -317,10 +339,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore async def _update_initial( self, @@ -330,13 +351,14 @@ async def _update_initial( extension_name: str, extension: "_models.Extension", **kwargs: Any - ) -> "_models.Extension": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + ) -> Optional["_models.Extension"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Extension"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension, 'Extension') @@ -347,6 +369,7 @@ async def _update_initial( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -354,21 +377,27 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [201]: + 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) - deserialized = self._deserialize('Extension', pipeline_response) + deserialized = None + if response.status_code == 200: + 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 + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore @distributed_trace_async @@ -393,7 +422,7 @@ async def begin_update( :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 + :type extension: ~azure.mgmt.azurestackhci.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 @@ -404,11 +433,12 @@ async def begin_update( 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] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.azurestackhci.models.Extension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -422,6 +452,7 @@ async def begin_update( arc_setting_name=arc_setting_name, extension_name=extension_name, extension=extension, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -446,12 +477,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -465,6 +495,8 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -472,12 +504,17 @@ async def _delete_initial( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -487,11 +524,11 @@ async def _delete_initial( 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 + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -522,7 +559,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -535,6 +573,7 @@ async def begin_delete( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -555,7 +594,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py index c9ae2251e5be..f95a4816045d 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # 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 typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -29,7 +28,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. @@ -53,7 +52,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"] @@ -62,14 +61,21 @@ async def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_list_request( + api_version=api_version, template_url=self.list.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) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -84,5 +90,5 @@ async def list( return deserialized - list.metadata = {'url': '/providers/Microsoft.AzureStackHCI/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AzureStackHCI/operations"} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py index 8427ffcef4ae..c740b3e65c1b 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,10 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import ArcConnectivityProperties +from ._models_py3 import ArcIdentityResponse from ._models_py3 import ArcSetting from ._models_py3 import ArcSettingList +from ._models_py3 import ArcSettingsPatch from ._models_py3 import Cluster from ._models_py3 import ClusterDesiredProperties +from ._models_py3 import ClusterIdentityResponse from ._models_py3 import ClusterList from ._models_py3 import ClusterNode from ._models_py3 import ClusterPatch @@ -22,11 +26,14 @@ from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult +from ._models_py3 import PasswordCredential from ._models_py3 import PerNodeExtensionState from ._models_py3 import PerNodeState from ._models_py3 import ProxyResource +from ._models_py3 import RawCertificateData from ._models_py3 import Resource from ._models_py3 import TrackedResource +from ._models_py3 import UploadCertificateRequest from ._azure_stack_hci_client_enums import ( @@ -45,10 +52,14 @@ ) __all__ = [ + 'ArcConnectivityProperties', + 'ArcIdentityResponse', 'ArcSetting', 'ArcSettingList', + 'ArcSettingsPatch', 'Cluster', 'ClusterDesiredProperties', + 'ClusterIdentityResponse', 'ClusterList', 'ClusterNode', 'ClusterPatch', @@ -61,11 +72,14 @@ 'Operation', 'OperationDisplay', 'OperationListResult', + 'PasswordCredential', 'PerNodeExtensionState', 'PerNodeState', 'ProxyResource', + 'RawCertificateData', 'Resource', 'TrackedResource', + 'UploadCertificateRequest', 'ActionType', 'ArcSettingAggregateState', 'CreatedByType', 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 5ecbb09293d3..5040015aaa93 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 @@ -15,6 +15,77 @@ from ._azure_stack_hci_client_enums import * +class ArcConnectivityProperties(msrest.serialization.Model): + """Connectivity related configuration required by arc server. + + :ivar enabled: True indicates ARC connectivity is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: True indicates ARC connectivity is enabled. + :paramtype enabled: bool + """ + super(ArcConnectivityProperties, self).__init__(**kwargs) + self.enabled = enabled + + +class ArcIdentityResponse(msrest.serialization.Model): + """ArcIdentity details. + + :ivar arc_application_client_id: + :vartype arc_application_client_id: str + :ivar arc_application_tenant_id: + :vartype arc_application_tenant_id: str + :ivar arc_service_principal_object_id: + :vartype arc_service_principal_object_id: str + :ivar arc_application_object_id: + :vartype arc_application_object_id: str + """ + + _attribute_map = { + 'arc_application_client_id': {'key': 'properties.arcApplicationClientId', 'type': 'str'}, + 'arc_application_tenant_id': {'key': 'properties.arcApplicationTenantId', 'type': 'str'}, + 'arc_service_principal_object_id': {'key': 'properties.arcServicePrincipalObjectId', 'type': 'str'}, + 'arc_application_object_id': {'key': 'properties.arcApplicationObjectId', 'type': 'str'}, + } + + def __init__( + self, + *, + arc_application_client_id: Optional[str] = None, + arc_application_tenant_id: Optional[str] = None, + arc_service_principal_object_id: Optional[str] = None, + arc_application_object_id: Optional[str] = None, + **kwargs + ): + """ + :keyword arc_application_client_id: + :paramtype arc_application_client_id: str + :keyword arc_application_tenant_id: + :paramtype arc_application_tenant_id: str + :keyword arc_service_principal_object_id: + :paramtype arc_service_principal_object_id: str + :keyword arc_application_object_id: + :paramtype arc_application_object_id: str + """ + super(ArcIdentityResponse, self).__init__(**kwargs) + self.arc_application_client_id = arc_application_client_id + self.arc_application_tenant_id = arc_application_tenant_id + self.arc_service_principal_object_id = arc_service_principal_object_id + self.arc_application_object_id = arc_application_object_id + + class Resource(msrest.serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. @@ -105,29 +176,39 @@ class ArcSetting(ProxyResource): :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 + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.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 arc_application_client_id: App id of arc AAD identity. + :vartype arc_application_client_id: str + :ivar arc_application_tenant_id: Tenant id of arc AAD identity. + :vartype arc_application_tenant_id: str + :ivar arc_service_principal_object_id: Object id of arc AAD service principal. + :vartype arc_service_principal_object_id: str + :ivar arc_application_object_id: Object id of arc AAD identity. + :vartype arc_application_object_id: 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 + :vartype aggregate_state: str or ~azure.mgmt.azurestackhci.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] + :vartype per_node_details: list[~azure.mgmt.azurestackhci.models.PerNodeState] + :ivar connectivity_properties: contains connectivity related configuration for ARC resources. + :vartype connectivity_properties: any :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :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_stack_hci_client.models.CreatedByType + :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 """ @@ -147,8 +228,13 @@ class ArcSetting(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'arc_instance_resource_group': {'key': 'properties.arcInstanceResourceGroup', 'type': 'str'}, + 'arc_application_client_id': {'key': 'properties.arcApplicationClientId', 'type': 'str'}, + 'arc_application_tenant_id': {'key': 'properties.arcApplicationTenantId', 'type': 'str'}, + 'arc_service_principal_object_id': {'key': 'properties.arcServicePrincipalObjectId', 'type': 'str'}, + 'arc_application_object_id': {'key': 'properties.arcApplicationObjectId', 'type': 'str'}, 'aggregate_state': {'key': 'properties.aggregateState', 'type': 'str'}, 'per_node_details': {'key': 'properties.perNodeDetails', 'type': '[PerNodeState]'}, + 'connectivity_properties': {'key': 'properties.connectivityProperties', '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'}, @@ -161,6 +247,11 @@ def __init__( self, *, arc_instance_resource_group: Optional[str] = None, + arc_application_client_id: Optional[str] = None, + arc_application_tenant_id: Optional[str] = None, + arc_service_principal_object_id: Optional[str] = None, + arc_application_object_id: Optional[str] = None, + connectivity_properties: Optional[Any] = None, created_by: Optional[str] = None, created_by_type: Optional[Union[str, "CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, @@ -173,26 +264,42 @@ def __init__( :keyword arc_instance_resource_group: The resource group that hosts the Arc agents, ie. Hybrid Compute Machine resources. :paramtype arc_instance_resource_group: str + :keyword arc_application_client_id: App id of arc AAD identity. + :paramtype arc_application_client_id: str + :keyword arc_application_tenant_id: Tenant id of arc AAD identity. + :paramtype arc_application_tenant_id: str + :keyword arc_service_principal_object_id: Object id of arc AAD service principal. + :paramtype arc_service_principal_object_id: str + :keyword arc_application_object_id: Object id of arc AAD identity. + :paramtype arc_application_object_id: str + :keyword connectivity_properties: contains connectivity related configuration for ARC + resources. + :paramtype connectivity_properties: any :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :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_stack_hci_client.models.CreatedByType + :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(ArcSetting, self).__init__(**kwargs) self.provisioning_state = None self.arc_instance_resource_group = arc_instance_resource_group + self.arc_application_client_id = arc_application_client_id + self.arc_application_tenant_id = arc_application_tenant_id + self.arc_service_principal_object_id = arc_service_principal_object_id + self.arc_application_object_id = arc_application_object_id self.aggregate_state = None self.per_node_details = None + self.connectivity_properties = connectivity_properties self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -207,7 +314,7 @@ class ArcSettingList(msrest.serialization.Model): 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] + :vartype value: list[~azure.mgmt.azurestackhci.models.ArcSetting] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -233,6 +340,39 @@ def __init__( self.next_link = None +class ArcSettingsPatch(msrest.serialization.Model): + """ArcSetting details to update. + + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar connectivity_properties: contains connectivity related configuration for ARC resources. + :vartype connectivity_properties: any + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'connectivity_properties': {'key': 'properties.connectivityProperties', 'type': 'object'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + connectivity_properties: Optional[Any] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword connectivity_properties: contains connectivity related configuration for ARC + resources. + :paramtype connectivity_properties: any + """ + super(ArcSettingsPatch, self).__init__(**kwargs) + self.tags = tags + self.connectivity_properties = connectivity_properties + + class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -308,10 +448,10 @@ class Cluster(TrackedResource): :vartype location: str :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", "Failed", "Canceled", "Accepted", "Provisioning". - :vartype provisioning_state: str or ~azure_stack_hci_client.models.ProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.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 + :vartype status: str or ~azure.mgmt.azurestackhci.models.Status :ivar cloud_id: Unique, immutable resource id. :vartype cloud_id: str :ivar cloud_management_endpoint: Endpoint configured for management from the Azure portal. @@ -320,10 +460,14 @@ class Cluster(TrackedResource): :vartype aad_client_id: str :ivar aad_tenant_id: Tenant id of cluster AAD identity. :vartype aad_tenant_id: str + :ivar aad_application_object_id: Object id of cluster AAD identity. + :vartype aad_application_object_id: str + :ivar aad_service_principal_object_id: Id of cluster identity service principal. + :vartype aad_service_principal_object_id: str :ivar desired_properties: Desired properties of the cluster. - :vartype desired_properties: ~azure_stack_hci_client.models.ClusterDesiredProperties + :vartype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties :ivar reported_properties: Properties reported by cluster agent. - :vartype reported_properties: ~azure_stack_hci_client.models.ClusterReportedProperties + :vartype reported_properties: ~azure.mgmt.azurestackhci.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. @@ -334,18 +478,20 @@ class Cluster(TrackedResource): :vartype last_sync_timestamp: ~datetime.datetime :ivar last_billing_timestamp: Most recent billing meter timestamp. :vartype last_billing_timestamp: ~datetime.datetime + :ivar service_endpoint: Region specific DataPath Endpoint of the cluster. + :vartype service_endpoint: str :ivar created_by: The identity that created the resource. :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :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_stack_hci_client.models.CreatedByType + :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 """ @@ -364,6 +510,7 @@ class Cluster(TrackedResource): 'registration_timestamp': {'readonly': True}, 'last_sync_timestamp': {'readonly': True}, 'last_billing_timestamp': {'readonly': True}, + 'service_endpoint': {'readonly': True}, } _attribute_map = { @@ -378,6 +525,8 @@ class Cluster(TrackedResource): 'cloud_management_endpoint': {'key': 'properties.cloudManagementEndpoint', 'type': 'str'}, 'aad_client_id': {'key': 'properties.aadClientId', 'type': 'str'}, 'aad_tenant_id': {'key': 'properties.aadTenantId', 'type': 'str'}, + 'aad_application_object_id': {'key': 'properties.aadApplicationObjectId', 'type': 'str'}, + 'aad_service_principal_object_id': {'key': 'properties.aadServicePrincipalObjectId', 'type': 'str'}, 'desired_properties': {'key': 'properties.desiredProperties', 'type': 'ClusterDesiredProperties'}, 'reported_properties': {'key': 'properties.reportedProperties', 'type': 'ClusterReportedProperties'}, 'trial_days_remaining': {'key': 'properties.trialDaysRemaining', 'type': 'float'}, @@ -385,6 +534,7 @@ class Cluster(TrackedResource): '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'}, + 'service_endpoint': {'key': 'properties.serviceEndpoint', 'type': 'str'}, 'created_by': {'key': 'systemData.createdBy', 'type': 'str'}, 'created_by_type': {'key': 'systemData.createdByType', 'type': 'str'}, 'created_at': {'key': 'systemData.createdAt', 'type': 'iso-8601'}, @@ -401,6 +551,8 @@ def __init__( cloud_management_endpoint: Optional[str] = None, aad_client_id: Optional[str] = None, aad_tenant_id: Optional[str] = None, + aad_application_object_id: Optional[str] = None, + aad_service_principal_object_id: Optional[str] = None, desired_properties: Optional["ClusterDesiredProperties"] = None, created_by: Optional[str] = None, created_by_type: Optional[Union[str, "CreatedByType"]] = None, @@ -421,20 +573,24 @@ def __init__( :paramtype aad_client_id: str :keyword aad_tenant_id: Tenant id of cluster AAD identity. :paramtype aad_tenant_id: str + :keyword aad_application_object_id: Object id of cluster AAD identity. + :paramtype aad_application_object_id: str + :keyword aad_service_principal_object_id: Id of cluster identity service principal. + :paramtype aad_service_principal_object_id: str :keyword desired_properties: Desired properties of the cluster. - :paramtype desired_properties: ~azure_stack_hci_client.models.ClusterDesiredProperties + :paramtype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties :keyword created_by: The identity that created the resource. :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :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_stack_hci_client.models.CreatedByType + :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 """ @@ -445,6 +601,8 @@ def __init__( self.cloud_management_endpoint = cloud_management_endpoint self.aad_client_id = aad_client_id self.aad_tenant_id = aad_tenant_id + self.aad_application_object_id = aad_application_object_id + self.aad_service_principal_object_id = aad_service_principal_object_id self.desired_properties = desired_properties self.reported_properties = None self.trial_days_remaining = None @@ -452,6 +610,7 @@ def __init__( self.registration_timestamp = None self.last_sync_timestamp = None self.last_billing_timestamp = None + self.service_endpoint = None self.created_by = created_by self.created_by_type = created_by_type self.created_at = created_at @@ -466,10 +625,10 @@ class ClusterDesiredProperties(msrest.serialization.Model): :ivar windows_server_subscription: Desired state of Windows Server Subscription. Possible values include: "Disabled", "Enabled". :vartype windows_server_subscription: str or - ~azure_stack_hci_client.models.WindowsServerSubscription + ~azure.mgmt.azurestackhci.models.WindowsServerSubscription :ivar diagnostic_level: Desired level of diagnostic data emitted by the cluster. Possible values include: "Off", "Basic", "Enhanced". - :vartype diagnostic_level: str or ~azure_stack_hci_client.models.DiagnosticLevel + :vartype diagnostic_level: str or ~azure.mgmt.azurestackhci.models.DiagnosticLevel """ _attribute_map = { @@ -488,23 +647,69 @@ def __init__( :keyword windows_server_subscription: Desired state of Windows Server Subscription. Possible values include: "Disabled", "Enabled". :paramtype windows_server_subscription: str or - ~azure_stack_hci_client.models.WindowsServerSubscription + ~azure.mgmt.azurestackhci.models.WindowsServerSubscription :keyword diagnostic_level: Desired level of diagnostic data emitted by the cluster. Possible values include: "Off", "Basic", "Enhanced". - :paramtype diagnostic_level: str or ~azure_stack_hci_client.models.DiagnosticLevel + :paramtype diagnostic_level: str or ~azure.mgmt.azurestackhci.models.DiagnosticLevel """ super(ClusterDesiredProperties, self).__init__(**kwargs) self.windows_server_subscription = windows_server_subscription self.diagnostic_level = diagnostic_level +class ClusterIdentityResponse(msrest.serialization.Model): + """Cluster Identity details. + + :ivar aad_client_id: + :vartype aad_client_id: str + :ivar aad_tenant_id: + :vartype aad_tenant_id: str + :ivar aad_service_principal_object_id: + :vartype aad_service_principal_object_id: str + :ivar aad_application_object_id: + :vartype aad_application_object_id: str + """ + + _attribute_map = { + 'aad_client_id': {'key': 'properties.aadClientId', 'type': 'str'}, + 'aad_tenant_id': {'key': 'properties.aadTenantId', 'type': 'str'}, + 'aad_service_principal_object_id': {'key': 'properties.aadServicePrincipalObjectId', 'type': 'str'}, + 'aad_application_object_id': {'key': 'properties.aadApplicationObjectId', 'type': 'str'}, + } + + def __init__( + self, + *, + aad_client_id: Optional[str] = None, + aad_tenant_id: Optional[str] = None, + aad_service_principal_object_id: Optional[str] = None, + aad_application_object_id: Optional[str] = None, + **kwargs + ): + """ + :keyword aad_client_id: + :paramtype aad_client_id: str + :keyword aad_tenant_id: + :paramtype aad_tenant_id: str + :keyword aad_service_principal_object_id: + :paramtype aad_service_principal_object_id: str + :keyword aad_application_object_id: + :paramtype aad_application_object_id: str + """ + super(ClusterIdentityResponse, self).__init__(**kwargs) + self.aad_client_id = aad_client_id + self.aad_tenant_id = aad_tenant_id + self.aad_service_principal_object_id = aad_service_principal_object_id + self.aad_application_object_id = aad_application_object_id + + class ClusterList(msrest.serialization.Model): """List of clusters. Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of clusters. - :vartype value: list[~azure_stack_hci_client.models.Cluster] + :vartype value: list[~azure.mgmt.azurestackhci.models.Cluster] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -526,7 +731,7 @@ def __init__( ): """ :keyword value: List of clusters. - :paramtype value: list[~azure_stack_hci_client.models.Cluster] + :paramtype value: list[~azure.mgmt.azurestackhci.models.Cluster] """ super(ClusterList, self).__init__(**kwargs) self.value = value @@ -545,7 +750,7 @@ class ClusterNode(msrest.serialization.Model): :ivar windows_server_subscription: State of Windows Server Subscription. Possible values include: "Disabled", "Enabled". :vartype windows_server_subscription: str or - ~azure_stack_hci_client.models.WindowsServerSubscription + ~azure.mgmt.azurestackhci.models.WindowsServerSubscription :ivar manufacturer: Manufacturer of the cluster node hardware. :vartype manufacturer: str :ivar model: Model name of the cluster node hardware. @@ -619,7 +824,7 @@ class ClusterPatch(msrest.serialization.Model): :ivar aad_tenant_id: Tenant id of cluster AAD identity. :vartype aad_tenant_id: str :ivar desired_properties: Desired properties of the cluster. - :vartype desired_properties: ~azure_stack_hci_client.models.ClusterDesiredProperties + :vartype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties """ _attribute_map = { @@ -650,7 +855,7 @@ def __init__( :keyword aad_tenant_id: Tenant id of cluster AAD identity. :paramtype aad_tenant_id: str :keyword desired_properties: Desired properties of the cluster. - :paramtype desired_properties: ~azure_stack_hci_client.models.ClusterDesiredProperties + :paramtype desired_properties: ~azure.mgmt.azurestackhci.models.ClusterDesiredProperties """ super(ClusterPatch, self).__init__(**kwargs) self.tags = tags @@ -672,15 +877,15 @@ class ClusterReportedProperties(msrest.serialization.Model): :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] + :vartype nodes: list[~azure.mgmt.azurestackhci.models.ClusterNode] :ivar last_updated: Last time the cluster reported the data. :vartype last_updated: ~datetime.datetime :ivar imds_attestation: IMDS attestation status of the cluster. Possible values include: "Disabled", "Enabled". - :vartype imds_attestation: str or ~azure_stack_hci_client.models.ImdsAttestation + :vartype imds_attestation: str or ~azure.mgmt.azurestackhci.models.ImdsAttestation :ivar diagnostic_level: Level of diagnostic data emitted by the cluster. Possible values include: "Off", "Basic", "Enhanced". - :vartype diagnostic_level: str or ~azure_stack_hci_client.models.DiagnosticLevel + :vartype diagnostic_level: str or ~azure.mgmt.azurestackhci.models.DiagnosticLevel """ _validation = { @@ -711,7 +916,7 @@ def __init__( """ :keyword diagnostic_level: Level of diagnostic data emitted by the cluster. Possible values include: "Off", "Basic", "Enhanced". - :paramtype diagnostic_level: str or ~azure_stack_hci_client.models.DiagnosticLevel + :paramtype diagnostic_level: str or ~azure.mgmt.azurestackhci.models.DiagnosticLevel """ super(ClusterReportedProperties, self).__init__(**kwargs) self.cluster_name = None @@ -767,9 +972,9 @@ class ErrorDetail(msrest.serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~azure_stack_hci_client.models.ErrorDetail] + :vartype details: list[~azure.mgmt.azurestackhci.models.ErrorDetail] :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure_stack_hci_client.models.ErrorAdditionalInfo] + :vartype additional_info: list[~azure.mgmt.azurestackhci.models.ErrorAdditionalInfo] """ _validation = { @@ -806,7 +1011,7 @@ 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_stack_hci_client.models.ErrorDetail + :vartype error: ~azure.mgmt.azurestackhci.models.ErrorDetail """ _attribute_map = { @@ -821,7 +1026,7 @@ def __init__( ): """ :keyword error: The error object. - :paramtype error: ~azure_stack_hci_client.models.ErrorDetail + :paramtype error: ~azure.mgmt.azurestackhci.models.ErrorDetail """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -842,14 +1047,15 @@ class Extension(ProxyResource): :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 + :vartype provisioning_state: str or ~azure.mgmt.azurestackhci.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 + :vartype aggregate_state: str or ~azure.mgmt.azurestackhci.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] + :vartype per_node_extension_details: + list[~azure.mgmt.azurestackhci.models.PerNodeExtensionState] :ivar force_update_tag: How the extension handler should be forced to update even if the extension configuration has not changed. :vartype force_update_tag: str @@ -872,14 +1078,14 @@ class Extension(ProxyResource): :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :vartype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :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_stack_hci_client.models.CreatedByType + :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 """ @@ -956,14 +1162,14 @@ def __init__( :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :paramtype created_by_type: str or ~azure_stack_hci_client.models.CreatedByType + :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_stack_hci_client.models.CreatedByType + :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 """ @@ -992,7 +1198,7 @@ class ExtensionList(msrest.serialization.Model): 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] + :vartype value: list[~azure.mgmt.azurestackhci.models.Extension] :ivar next_link: Link to the next set of results. :vartype next_link: str """ @@ -1030,14 +1236,14 @@ class Operation(msrest.serialization.Model): data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool :ivar display: Localized display information for this particular operation. - :vartype display: ~azure_stack_hci_client.models.OperationDisplay + :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 = { @@ -1063,7 +1269,7 @@ def __init__( ): """ :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure_stack_hci_client.models.OperationDisplay + :paramtype display: ~azure.mgmt.azurestackhci.models.OperationDisplay """ super(Operation, self).__init__(**kwargs) self.name = None @@ -1125,7 +1331,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 """ @@ -1151,6 +1357,52 @@ def __init__( self.next_link = None +class PasswordCredential(msrest.serialization.Model): + """PasswordCredential. + + :ivar secret_text: + :vartype secret_text: str + :ivar key_id: + :vartype key_id: str + :ivar start_date_time: + :vartype start_date_time: ~datetime.datetime + :ivar end_date_time: + :vartype end_date_time: ~datetime.datetime + """ + + _attribute_map = { + 'secret_text': {'key': 'secretText', 'type': 'str'}, + 'key_id': {'key': 'keyId', 'type': 'str'}, + 'start_date_time': {'key': 'startDateTime', 'type': 'iso-8601'}, + 'end_date_time': {'key': 'endDateTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + secret_text: Optional[str] = None, + key_id: Optional[str] = None, + start_date_time: Optional[datetime.datetime] = None, + end_date_time: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword secret_text: + :paramtype secret_text: str + :keyword key_id: + :paramtype key_id: str + :keyword start_date_time: + :paramtype start_date_time: ~datetime.datetime + :keyword end_date_time: + :paramtype end_date_time: ~datetime.datetime + """ + super(PasswordCredential, self).__init__(**kwargs) + self.secret_text = secret_text + self.key_id = key_id + self.start_date_time = start_date_time + self.end_date_time = end_date_time + + class PerNodeExtensionState(msrest.serialization.Model): """Status of Arc Extension for a particular node in HCI Cluster. @@ -1163,7 +1415,7 @@ class PerNodeExtensionState(msrest.serialization.Model): :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 + :vartype state: str or ~azure.mgmt.azurestackhci.models.NodeExtensionState """ _validation = { @@ -1202,7 +1454,7 @@ class PerNodeState(msrest.serialization.Model): :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 + :vartype state: str or ~azure.mgmt.azurestackhci.models.NodeArcState """ _validation = { @@ -1227,3 +1479,53 @@ def __init__( self.name = None self.arc_instance = None self.state = None + + +class RawCertificateData(msrest.serialization.Model): + """RawCertificateData. + + :ivar certificates: + :vartype certificates: list[str] + """ + + _attribute_map = { + 'certificates': {'key': 'certificates', 'type': '[str]'}, + } + + def __init__( + self, + *, + certificates: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword certificates: + :paramtype certificates: list[str] + """ + super(RawCertificateData, self).__init__(**kwargs) + self.certificates = certificates + + +class UploadCertificateRequest(msrest.serialization.Model): + """UploadCertificateRequest. + + :ivar properties: + :vartype properties: ~azure.mgmt.azurestackhci.models.RawCertificateData + """ + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'RawCertificateData'}, + } + + def __init__( + self, + *, + properties: Optional["RawCertificateData"] = None, + **kwargs + ): + """ + :keyword properties: + :paramtype properties: ~azure.mgmt.azurestackhci.models.RawCertificateData + """ + super(UploadCertificateRequest, self).__init__(**kwargs) + self.properties = properties diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py index 7ab5b3237a34..c259255872d1 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_arc_settings_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ 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 @@ -35,31 +35,32 @@ def build_list_by_cluster_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -71,10 +72,11 @@ def build_get_request( arc_setting_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}") # pylint: disable=line-too-long 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), @@ -82,21 +84,21 @@ def build_get_request( "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -111,12 +113,12 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-01-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}") # pylint: disable=line-too-long 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), @@ -124,23 +126,69 @@ def build_create_request( "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -154,10 +202,11 @@ def build_delete_request_initial( arc_setting_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}") # pylint: disable=line-too-long 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), @@ -165,21 +214,97 @@ def build_delete_request_initial( "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_generate_password_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_identity_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -190,7 +315,7 @@ class ArcSettingsOperations(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. @@ -220,9 +345,11 @@ def list_by_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] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.ArcSettingList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSettingList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -235,6 +362,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.list_by_cluster.metadata['url'], ) request = _convert_request(request) @@ -246,6 +374,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -263,7 +392,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -277,7 +410,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings"} # type: ignore @distributed_trace def get( @@ -298,7 +431,7 @@ def get( :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 + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSetting"] @@ -307,18 +440,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -333,7 +473,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}"} # type: ignore @distributed_trace @@ -355,10 +495,10 @@ def create( 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 + :type arc_setting: ~azure.mgmt.azurestackhci.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 + :rtype: ~azure.mgmt.azurestackhci.models.ArcSetting :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcSetting"] @@ -367,6 +507,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(arc_setting, 'ArcSetting') @@ -376,6 +517,7 @@ def create( resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -383,7 +525,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -398,10 +544,81 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}"} # type: ignore - def _delete_initial( + @distributed_trace + def update( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + arc_setting: "_models.ArcSettingsPatch", + **kwargs: Any + ) -> "_models.ArcSetting": + """Update ArcSettings 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: ArcSettings parameters that needs to be updated. + :type arc_setting: ~azure.mgmt.azurestackhci.models.ArcSettingsPatch + :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.mgmt.azurestackhci.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 = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(arc_setting, 'ArcSettingsPatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + 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( # pylint: disable=protected-access + 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('ArcSetting', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -414,18 +631,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -435,11 +659,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -467,7 +691,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -479,6 +704,7 @@ def begin_delete( resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -499,7 +725,191 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + + @distributed_trace + def generate_password( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any + ) -> "_models.PasswordCredential": + """Generate password for arc settings. + + :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: PasswordCredential, or the result of cls(response) + :rtype: ~azure.mgmt.azurestackhci.models.PasswordCredential + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PasswordCredential"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + + request = build_generate_password_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + template_url=self.generate_password.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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('PasswordCredential', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + generate_password.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/generatePassword"} # type: ignore + + + def _create_identity_initial( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any + ) -> Optional["_models.ArcIdentityResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ArcIdentityResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + + request = build_create_identity_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + template_url=self._create_identity_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ArcIdentityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_identity_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity"} # type: ignore + + + @distributed_trace + def begin_create_identity( + self, + resource_group_name: str, + cluster_name: str, + arc_setting_name: str, + **kwargs: Any + ) -> LROPoller["_models.ArcIdentityResponse"]: + """Create Aad identity for arc settings. + + :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 ArcIdentityResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.ArcIdentityResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ArcIdentityResponse"] + 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_identity_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + arc_setting_name=arc_setting_name, + api_version=api_version, + 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('ArcIdentityResponse', 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 + ) + 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 + begin_create_identity.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/createArcIdentity"} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py index 0f46242f198e..fbbd0d5b5154 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_clusters_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,19 @@ # 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 -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer 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 msrest import Serializer +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,29 +33,30 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters") path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -63,30 +66,31 @@ def build_list_by_resource_group_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters") # pylint: disable=line-too-long 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) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -97,31 +101,32 @@ def build_get_request( cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -135,35 +140,35 @@ def build_create_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-01-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -179,72 +184,153 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-01-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs ) -def build_delete_request( +def build_delete_request_initial( subscription_id: str, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}") # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_upload_certificate_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_identity_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -255,7 +341,7 @@ class ClustersOperations(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. @@ -279,9 +365,11 @@ def 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 ClusterList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_stack_hci_client.models.ClusterList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.ClusterList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -292,6 +380,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.list_by_subscription.metadata['url'], ) request = _convert_request(request) @@ -301,6 +390,7 @@ def prepare_request(next_link=None): request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -318,7 +408,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -332,7 +426,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/clusters"} # type: ignore @distributed_trace def list_by_resource_group( @@ -346,9 +440,11 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure_stack_hci_client.models.ClusterList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.ClusterList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -360,6 +456,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=self.list_by_resource_group.metadata['url'], ) request = _convert_request(request) @@ -370,6 +467,7 @@ def prepare_request(next_link=None): request = build_list_by_resource_group_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -387,7 +485,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -401,7 +503,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters"} # type: ignore @distributed_trace def get( @@ -418,7 +520,7 @@ def get( :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 + :rtype: ~azure.mgmt.azurestackhci.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] @@ -427,17 +529,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -452,7 +561,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}"} # type: ignore @distributed_trace @@ -470,10 +579,10 @@ def create( :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 + :type cluster: ~azure.mgmt.azurestackhci.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 + :rtype: ~azure.mgmt.azurestackhci.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] @@ -482,6 +591,7 @@ def create( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(cluster, 'Cluster') @@ -490,6 +600,7 @@ def create( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create.metadata['url'], @@ -497,7 +608,11 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -512,7 +627,7 @@ def create( return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}"} # type: ignore @distributed_trace @@ -530,10 +645,10 @@ def update( :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 + :type cluster: ~azure.mgmt.azurestackhci.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 + :rtype: ~azure.mgmt.azurestackhci.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] @@ -542,6 +657,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(cluster, 'ClusterPatch') @@ -550,6 +666,7 @@ def update( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -557,7 +674,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -572,16 +693,58 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}"} # type: ignore - @distributed_trace - def delete( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_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 = kwargs.pop('api_version', "2022-05-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete an HCI cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -589,36 +752,279 @@ def delete( :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 + :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 """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + 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, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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}"} # type: ignore + + def _upload_certificate_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - request = build_delete_request( + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(upload_certificate_request, 'UploadCertificateRequest') + + request = build_upload_certificate_request_initial( subscription_id=self._config.subscription_id, resource_group_name=resource_group_name, cluster_name=cluster_name, - template_url=self.delete.metadata['url'], + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._upload_certificate_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) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [200, 204]: + if response.status_code not in [202]: 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}'} # type: ignore + _upload_certificate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate"} # type: ignore + + + @distributed_trace + def begin_upload_certificate( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + cluster_name: str, + upload_certificate_request: "_models.UploadCertificateRequest", + **kwargs: Any + ) -> LROPoller[None]: + """Upload certificate. + + :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 upload_certificate_request: Upload certificate request. + :type upload_certificate_request: ~azure.mgmt.azurestackhci.models.UploadCertificateRequest + :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 + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + 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._upload_certificate_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + upload_certificate_request=upload_certificate_request, + api_version=api_version, + content_type=content_type, + 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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_upload_certificate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/uploadCertificate"} # type: ignore + def _create_identity_initial( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Optional["_models.ClusterIdentityResponse"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ClusterIdentityResponse"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + + + request = build_create_identity_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self._create_identity_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + 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) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ClusterIdentityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_identity_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity"} # type: ignore + + + @distributed_trace + def begin_create_identity( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller["_models.ClusterIdentityResponse"]: + """Create cluster identity. + + :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 + :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 ClusterIdentityResponse or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.ClusterIdentityResponse] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterIdentityResponse"] + 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_identity_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + 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('ClusterIdentityResponse', 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 + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_identity.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/createClusterIdentity"} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py index 253e196f81b0..36100fefe858 100644 --- a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py +++ b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -18,7 +19,6 @@ 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 @@ -36,10 +36,11 @@ def build_list_by_arc_setting_request( arc_setting_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions") # pylint: disable=line-too-long 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), @@ -47,21 +48,21 @@ def build_list_by_arc_setting_request( "arcSettingName": _SERIALIZER.url("arc_setting_name", arc_setting_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -74,10 +75,11 @@ def build_get_request( extension_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}") # pylint: disable=line-too-long 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), @@ -86,21 +88,21 @@ def build_get_request( "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,12 +118,12 @@ def build_create_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-01-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}") # pylint: disable=line-too-long 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), @@ -130,23 +132,23 @@ def build_create_request_initial( "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -164,12 +166,12 @@ def build_update_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2022-01-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}") # pylint: disable=line-too-long 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), @@ -178,23 +180,23 @@ def build_update_request_initial( "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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 = 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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -209,10 +211,11 @@ def build_delete_request_initial( extension_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}") # pylint: disable=line-too-long 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), @@ -221,21 +224,21 @@ def build_delete_request_initial( "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -246,7 +249,7 @@ class ExtensionsOperations(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. @@ -280,9 +283,11 @@ def list_by_arc_setting( :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] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.azurestackhci.models.ExtensionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -296,6 +301,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, template_url=self.list_by_arc_setting.metadata['url'], ) request = _convert_request(request) @@ -308,6 +314,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, cluster_name=cluster_name, arc_setting_name=arc_setting_name, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -325,7 +332,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -339,7 +350,7 @@ def get_next(next_link=None): 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 + list_by_arc_setting.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions"} # type: ignore @distributed_trace def get( @@ -363,7 +374,7 @@ def get( :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 + :rtype: ~azure.mgmt.azurestackhci.models.Extension :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] @@ -372,6 +383,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_get_request( subscription_id=self._config.subscription_id, @@ -379,12 +392,17 @@ def get( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -399,7 +417,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore def _create_initial( @@ -417,6 +435,7 @@ def _create_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension, 'Extension') @@ -427,6 +446,7 @@ def _create_initial( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._create_initial.metadata['url'], @@ -434,7 +454,11 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -452,7 +476,7 @@ def _create_initial( return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore @distributed_trace @@ -477,7 +501,7 @@ def begin_create( :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 + :type extension: ~azure.mgmt.azurestackhci.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 @@ -487,11 +511,12 @@ def begin_create( :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] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Extension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -505,6 +530,7 @@ def begin_create( arc_setting_name=arc_setting_name, extension_name=extension_name, extension=extension, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -529,10 +555,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore def _update_initial( self, @@ -542,13 +567,14 @@ def _update_initial( extension_name: str, extension: "_models.Extension", **kwargs: Any - ) -> "_models.Extension": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] + ) -> Optional["_models.Extension"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Extension"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(extension, 'Extension') @@ -559,6 +585,7 @@ def _update_initial( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], @@ -566,21 +593,27 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response - if response.status_code not in [201]: + 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) - deserialized = self._deserialize('Extension', pipeline_response) + deserialized = None + if response.status_code == 200: + 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 + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore @distributed_trace @@ -605,7 +638,7 @@ def begin_update( :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 + :type extension: ~azure.mgmt.azurestackhci.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 @@ -615,11 +648,12 @@ def begin_update( :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] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.azurestackhci.models.Extension] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-05-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -633,6 +667,7 @@ def begin_update( arc_setting_name=arc_setting_name, extension_name=extension_name, extension=extension, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -657,12 +692,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -676,6 +710,8 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_delete_request_initial( subscription_id=self._config.subscription_id, @@ -683,12 +719,17 @@ def _delete_initial( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -698,11 +739,11 @@ def _delete_initial( 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 + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -733,7 +774,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -746,6 +788,7 @@ def begin_delete( cluster_name=cluster_name, arc_setting_name=arc_setting_name, extension_name=extension_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -766,7 +809,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + 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 + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/clusters/{clusterName}/arcSettings/{arcSettingName}/extensions/{extensionName}"} # type: ignore diff --git a/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py b/sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/operations/_operations.py index e1fdc6e61f45..dc7a3d6362e3 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 @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # 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 typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ 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 from .._vendor import _convert_request @@ -28,24 +28,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2022-01-01" + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.AzureStackHCI/operations') + _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') + _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') + _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, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -56,7 +57,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~azure_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. @@ -80,7 +81,7 @@ 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"] @@ -89,14 +90,21 @@ def list( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2022-05-01") # type: str + request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,5 +119,5 @@ def list( return deserialized - list.metadata = {'url': '/providers/Microsoft.AzureStackHCI/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.AzureStackHCI/operations"} # type: ignore