diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/_meta.json b/sdk/hdinsight/azure-mgmt-hdinsight/_meta.json index 804c28c2fdc4..cef0b7c6448b 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/_meta.json +++ b/sdk/hdinsight/azure-mgmt-hdinsight/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.16.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "7326c66014c2180e83c52c30f150eea094613ca4", + "commit": "63f4e39c20223c20941614e776d33e699c3e2777", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/hdinsight/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/hdinsight/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/hdinsight/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/__init__.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/__init__.py index 14ab46d45b32..f3c224f9703e 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/__init__.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/__init__.py @@ -10,10 +10,14 @@ from ._version import VERSION __version__ = VERSION -__all__ = ['HDInsightManagementClient'] try: - from ._patch import patch_sdk # type: ignore - patch_sdk() + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import except ImportError: - pass + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['HDInsightManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_configuration.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_configuration.py index 9051ba4fbdb9..c3664993de45 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_configuration.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class HDInsightManagementClientConfiguration(Configuration): +class HDInsightManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for HDInsightManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,26 +27,31 @@ class HDInsightManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(HDInsightManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(HDInsightManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-hdinsight/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +71,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py index ab317c6ca195..9a473470b1f9 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py @@ -6,34 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import HDInsightManagementClientConfiguration -from .operations import ClustersOperations -from .operations import ApplicationsOperations -from .operations import LocationsOperations -from .operations import ConfigurationsOperations -from .operations import ExtensionsOperations -from .operations import ScriptActionsOperations -from .operations import ScriptExecutionHistoryOperations -from .operations import Operations -from .operations import VirtualMachinesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations from . import models +from ._configuration import HDInsightManagementClientConfiguration +from .operations import ApplicationsOperations, ClustersOperations, ConfigurationsOperations, ExtensionsOperations, LocationsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ScriptActionsOperations, ScriptExecutionHistoryOperations, VirtualMachinesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class HDInsightManagementClient(object): +class HDInsightManagementClient: # pylint: disable=too-many-instance-attributes """HDInsight Management Client. :ivar clusters: ClustersOperations operations @@ -49,81 +38,105 @@ class HDInsightManagementClient(object): :ivar script_actions: ScriptActionsOperations operations :vartype script_actions: azure.mgmt.hdinsight.operations.ScriptActionsOperations :ivar script_execution_history: ScriptExecutionHistoryOperations operations - :vartype script_execution_history: azure.mgmt.hdinsight.operations.ScriptExecutionHistoryOperations + :vartype script_execution_history: + azure.mgmt.hdinsight.operations.ScriptExecutionHistoryOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hdinsight.operations.Operations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.hdinsight.operations.VirtualMachinesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.hdinsight.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.hdinsight.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.hdinsight.operations.PrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-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. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = HDInsightManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = HDInsightManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - + self._serialize.client_side_validation = False self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.applications = ApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.configurations = ConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.script_actions = ScriptActionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.script_execution_history = ScriptExecutionHistoryOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.virtual_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) + - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_metadata.json b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_metadata.json deleted file mode 100644 index da780c65d7be..000000000000 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_metadata.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "chosen_version": "2021-06-01", - "total_api_version_list": ["2021-06-01"], - "client": { - "name": "HDInsightManagementClient", - "filename": "_hd_insight_management_client", - "description": "HDInsight Management Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HDInsightManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"HDInsightManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=None, # type: Optional[str]", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: Optional[str] = None,", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "clusters": "ClustersOperations", - "applications": "ApplicationsOperations", - "locations": "LocationsOperations", - "configurations": "ConfigurationsOperations", - "extensions": "ExtensionsOperations", - "script_actions": "ScriptActionsOperations", - "script_execution_history": "ScriptExecutionHistoryOperations", - "operations": "Operations", - "virtual_machines": "VirtualMachinesOperations", - "private_endpoint_connections": "PrivateEndpointConnectionsOperations", - "private_link_resources": "PrivateLinkResourcesOperations" - } -} \ No newline at end of file diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_patch.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_vendor.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_version.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_version.py index b77ac9246082..e5754a47ce68 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_version.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/__init__.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/__init__.py index b412b0650456..9eeb5e949170 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/__init__.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/__init__.py @@ -7,4 +7,14 @@ # -------------------------------------------------------------------------- from ._hd_insight_management_client import HDInsightManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['HDInsightManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_configuration.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_configuration.py index 292a4248952a..12388fc7cd35 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_configuration.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class HDInsightManagementClientConfiguration(Configuration): +class HDInsightManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for HDInsightManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,8 +27,12 @@ class HDInsightManagementClientConfiguration(Configuration): :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +41,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(HDInsightManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(HDInsightManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-hdinsight/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_hd_insight_management_client.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_hd_insight_management_client.py index 8a0f1cda64ab..b59301beaf91 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_hd_insight_management_client.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_hd_insight_management_client.py @@ -6,32 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import HDInsightManagementClientConfiguration -from .operations import ClustersOperations -from .operations import ApplicationsOperations -from .operations import LocationsOperations -from .operations import ConfigurationsOperations -from .operations import ExtensionsOperations -from .operations import ScriptActionsOperations -from .operations import ScriptExecutionHistoryOperations -from .operations import Operations -from .operations import VirtualMachinesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations from .. import models +from ._configuration import HDInsightManagementClientConfiguration +from .operations import ApplicationsOperations, ClustersOperations, ConfigurationsOperations, ExtensionsOperations, LocationsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ScriptActionsOperations, ScriptExecutionHistoryOperations, VirtualMachinesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class HDInsightManagementClient(object): +class HDInsightManagementClient: # pylint: disable=too-many-instance-attributes """HDInsight Management Client. :ivar clusters: ClustersOperations operations @@ -47,79 +38,106 @@ class HDInsightManagementClient(object): :ivar script_actions: ScriptActionsOperations operations :vartype script_actions: azure.mgmt.hdinsight.aio.operations.ScriptActionsOperations :ivar script_execution_history: ScriptExecutionHistoryOperations operations - :vartype script_execution_history: azure.mgmt.hdinsight.aio.operations.ScriptExecutionHistoryOperations + :vartype script_execution_history: + azure.mgmt.hdinsight.aio.operations.ScriptExecutionHistoryOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.hdinsight.aio.operations.Operations :ivar virtual_machines: VirtualMachinesOperations operations :vartype virtual_machines: azure.mgmt.hdinsight.aio.operations.VirtualMachinesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.hdinsight.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.hdinsight.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.hdinsight.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.hdinsight.aio.operations.PrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: The subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-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. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = HDInsightManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = HDInsightManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - + self._serialize.client_side_validation = False self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.applications = ApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.locations = LocationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.configurations = ConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.script_actions = ScriptActionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.script_execution_history = ScriptExecutionHistoryOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.virtual_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_patch.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/__init__.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/__init__.py index f6dc3dfa5a09..e0a942a98226 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/__init__.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/__init__.py @@ -18,6 +18,9 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ClustersOperations', 'ApplicationsOperations', @@ -31,3 +34,5 @@ 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_applications_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_applications_operations.py index 87804fba53ae..b6b4bb83d30b 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_applications_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,50 +6,53 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict 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._applications_operations import build_create_request_initial, build_delete_request_initial, build_get_azure_async_operation_status_request, build_get_request, build_list_by_cluster_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ApplicationsOperations: - """ApplicationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`applications` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list_by_cluster( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationListResult"]: + ) -> AsyncIterable[_models.ApplicationListResult]: """Lists all of the applications for the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -56,45 +60,55 @@ def list_by_cluster( :param cluster_name: The name of the cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.ApplicationListResult] + :return: An iterator like instance of either ApplicationListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.ApplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ApplicationListResult', pipeline_response) + deserialized = self._deserialize("ApplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,28 +117,34 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications"} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> "_models.Application": + ) -> _models.Application: """Gets properties of the specified application. :param resource_group_name: The name of the resource group. @@ -138,39 +158,41 @@ async def get( :rtype: ~azure.mgmt.hdinsight.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Application] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Application', pipeline_response) @@ -179,55 +201,57 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + async def _create_initial( self, resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.Application", + parameters: _models.Application, **kwargs: Any - ) -> "_models.Application": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + ) -> _models.Application: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Application') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Application] + + _json = self._serialize.body(parameters, 'Application') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Application', pipeline_response) @@ -235,16 +259,19 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace_async async def begin_create( self, resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.Application", + parameters: _models.Application, **kwargs: Any - ) -> AsyncLROPoller["_models.Application"]: + ) -> AsyncLROPoller[_models.Application]: """Creates applications for the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -257,50 +284,59 @@ async def begin_create( :type parameters: ~azure.mgmt.hdinsight.models.Application :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Application or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Application or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.Application] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Application] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('Application', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -309,58 +345,61 @@ 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) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -377,46 +416,53 @@ async def begin_delete( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -425,10 +471,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) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + @distributed_trace_async async def get_azure_async_operation_status( self, resource_group_name: str, @@ -436,7 +483,7 @@ async def get_azure_async_operation_status( application_name: str, operation_id: str, **kwargs: Any - ) -> "_models.AsyncOperationResult": + ) -> _models.AsyncOperationResult: """Gets the async operation status. :param resource_group_name: The name of the resource group. @@ -452,40 +499,42 @@ async def get_azure_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_azure_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_azure_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -494,4 +543,6 @@ async def get_azure_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}/azureasyncoperations/{operationId}'} # type: ignore + + get_azure_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}/azureasyncoperations/{operationId}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_clusters_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_clusters_operations.py index 6f42fe25ebd0..d4acafeeff17 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_clusters_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/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,89 +6,91 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict 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_initial, build_delete_request_initial, build_execute_script_actions_request_initial, build_get_azure_async_operation_status_request, build_get_gateway_settings_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_resize_request_initial, build_rotate_disk_encryption_key_request_initial, build_update_auto_scale_configuration_request_initial, build_update_gateway_settings_request_initial, build_update_identity_certificate_request_initial, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class ClustersOperations: - """ClustersOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + async def _create_initial( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ClusterCreateParametersExtended", + parameters: _models.ClusterCreateParametersExtended, **kwargs: Any - ) -> "_models.Cluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + ) -> _models.Cluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterCreateParametersExtended') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + _json = self._serialize.body(parameters, 'ClusterCreateParametersExtended') + + request = build_create_request_initial( + 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_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -95,15 +98,18 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + + + @distributed_trace_async async def begin_create( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ClusterCreateParametersExtended", + parameters: _models.ClusterCreateParametersExtended, **kwargs: Any - ) -> AsyncLROPoller["_models.Cluster"]: + ) -> AsyncLROPoller[_models.Cluster]: """Creates a new HDInsight cluster with the specified parameters. :param resource_group_name: The name of the resource group. @@ -114,48 +120,58 @@ async def begin_create( :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateParametersExtended :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -164,17 +180,18 @@ 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) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ClusterPatchParameters", + parameters: _models.ClusterPatchParameters, **kwargs: Any - ) -> "_models.Cluster": + ) -> _models.Cluster: """Patch HDInsight cluster with the specified parameters. :param resource_group_name: The name of the resource group. @@ -188,43 +205,44 @@ async def update( :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterPatchParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + _json = self._serialize.body(parameters, 'ClusterPatchParameters') + + request = build_update_request( + 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'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -233,54 +251,59 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore - async def _delete_initial( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + + + 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 = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -294,44 +317,52 @@ async def begin_delete( :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. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -340,16 +371,17 @@ 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) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.Cluster": + ) -> _models.Cluster: """Gets the specified cluster. :param resource_group_name: The name of the resource group. @@ -361,38 +393,40 @@ async def get( :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + + 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'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -401,13 +435,16 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ClusterListResult"]: + ) -> AsyncIterable[_models.ClusterListResult]: """Lists the HDInsight clusters in a resource group. :param resource_group_name: The name of the resource group. @@ -417,40 +454,47 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) + deserialized = self._deserialize("ClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -459,80 +503,87 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters"} # type: ignore - async def _resize_initial( + async def _resize_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, role_name: Union[str, "_models.RoleName"], - parameters: "_models.ClusterResizeParameters", + parameters: _models.ClusterResizeParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._resize_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterResizeParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ClusterResizeParameters') + + request = build_resize_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + role_name=role_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._resize_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _resize_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize'} # type: ignore + _resize_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize"} # type: ignore + - async def begin_resize( + @distributed_trace_async + async def begin_resize( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, role_name: Union[str, "_models.RoleName"], - parameters: "_models.ClusterResizeParameters", + parameters: _models.ClusterResizeParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Resizes the specified HDInsight cluster to the specified size. @@ -547,47 +598,56 @@ async def begin_resize( :type parameters: ~azure.mgmt.hdinsight.models.ClusterResizeParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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._resize_initial( + raw_result = await self._resize_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -596,69 +656,71 @@ 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) - begin_resize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_resize.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize"} # type: ignore - async def _update_auto_scale_configuration_initial( + async def _update_auto_scale_configuration_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, role_name: Union[str, "_models.RoleName"], - parameters: "_models.AutoscaleConfigurationUpdateParameter", + parameters: _models.AutoscaleConfigurationUpdateParameter, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_auto_scale_configuration_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AutoscaleConfigurationUpdateParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'AutoscaleConfigurationUpdateParameter') + + request = build_update_auto_scale_configuration_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + role_name=role_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_auto_scale_configuration_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _update_auto_scale_configuration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale'} # type: ignore + _update_auto_scale_configuration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale"} # type: ignore - async def begin_update_auto_scale_configuration( + + @distributed_trace_async + async def begin_update_auto_scale_configuration( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, role_name: Union[str, "_models.RoleName"], - parameters: "_models.AutoscaleConfigurationUpdateParameter", + parameters: _models.AutoscaleConfigurationUpdateParameter, **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the Autoscale Configuration for HDInsight cluster. @@ -673,47 +735,56 @@ async def begin_update_auto_scale_configuration( :type parameters: ~azure.mgmt.hdinsight.models.AutoscaleConfigurationUpdateParameter :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_auto_scale_configuration_initial( + raw_result = await self._update_auto_scale_configuration_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -722,14 +793,15 @@ 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) - begin_update_auto_scale_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_auto_scale_configuration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale"} # type: ignore + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.ClusterListResult"]: + ) -> AsyncIterable[_models.ClusterListResult]: """Lists all the HDInsight clusters under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -737,39 +809,45 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) + deserialized = self._deserialize("ClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -778,77 +856,84 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters"} # type: ignore - async def _rotate_disk_encryption_key_initial( + async def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.ClusterDiskEncryptionParameters", + parameters: _models.ClusterDiskEncryptionParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._rotate_disk_encryption_key_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterDiskEncryptionParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ClusterDiskEncryptionParameters') + + request = build_rotate_disk_encryption_key_request_initial( + 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._rotate_disk_encryption_key_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _rotate_disk_encryption_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey'} # type: ignore + _rotate_disk_encryption_key_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey"} # type: ignore - async def begin_rotate_disk_encryption_key( + + @distributed_trace_async + async def begin_rotate_disk_encryption_key( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.ClusterDiskEncryptionParameters", + parameters: _models.ClusterDiskEncryptionParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Rotate disk encryption key of the specified HDInsight cluster. @@ -861,45 +946,55 @@ async def begin_rotate_disk_encryption_key( :type parameters: ~azure.mgmt.hdinsight.models.ClusterDiskEncryptionParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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._rotate_disk_encryption_key_initial( + raw_result = await self._rotate_disk_encryption_key_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -908,16 +1003,17 @@ 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) - begin_rotate_disk_encryption_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_rotate_disk_encryption_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey"} # type: ignore + @distributed_trace_async async def get_gateway_settings( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.GatewaySettings": + ) -> _models.GatewaySettings: """Gets the gateway settings for the specified cluster. :param resource_group_name: The name of the resource group. @@ -929,38 +1025,40 @@ async def get_gateway_settings( :rtype: ~azure.mgmt.hdinsight.models.GatewaySettings :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewaySettings"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_gateway_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.GatewaySettings] + + + request = build_get_gateway_settings_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_gateway_settings.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GatewaySettings', pipeline_response) @@ -969,64 +1067,68 @@ async def get_gateway_settings( return cls(pipeline_response, deserialized, {}) return deserialized - get_gateway_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings'} # type: ignore - async def _update_gateway_settings_initial( + get_gateway_settings.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings"} # type: ignore + + + async def _update_gateway_settings_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.UpdateGatewaySettingsParameters", + parameters: _models.UpdateGatewaySettingsParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_gateway_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UpdateGatewaySettingsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'UpdateGatewaySettingsParameters') + + request = build_update_gateway_settings_request_initial( + 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_gateway_settings_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _update_gateway_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings'} # type: ignore + _update_gateway_settings_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings"} # type: ignore + - async def begin_update_gateway_settings( + @distributed_trace_async + async def begin_update_gateway_settings( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.UpdateGatewaySettingsParameters", + parameters: _models.UpdateGatewaySettingsParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Configures the gateway settings on the specified cluster. @@ -1039,45 +1141,55 @@ async def begin_update_gateway_settings( :type parameters: ~azure.mgmt.hdinsight.models.UpdateGatewaySettingsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_gateway_settings_initial( + raw_result = await self._update_gateway_settings_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1086,17 +1198,18 @@ 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) - begin_update_gateway_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_gateway_settings.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings"} # type: ignore + @distributed_trace_async async def get_azure_async_operation_status( self, resource_group_name: str, cluster_name: str, operation_id: str, **kwargs: Any - ) -> "_models.AsyncOperationResult": + ) -> _models.AsyncOperationResult: """The the async operation status. :param resource_group_name: The name of the resource group. @@ -1110,39 +1223,41 @@ async def get_azure_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_azure_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_azure_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -1151,64 +1266,68 @@ async def get_azure_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/azureasyncoperations/{operationId}'} # type: ignore - async def _update_identity_certificate_initial( + get_azure_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/azureasyncoperations/{operationId}"} # type: ignore + + + async def _update_identity_certificate_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.UpdateClusterIdentityCertificateParameters", + parameters: _models.UpdateClusterIdentityCertificateParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_identity_certificate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UpdateClusterIdentityCertificateParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'UpdateClusterIdentityCertificateParameters') + + request = build_update_identity_certificate_request_initial( + 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_identity_certificate_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _update_identity_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate'} # type: ignore + _update_identity_certificate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate"} # type: ignore + - async def begin_update_identity_certificate( + @distributed_trace_async + async def begin_update_identity_certificate( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.UpdateClusterIdentityCertificateParameters", + parameters: _models.UpdateClusterIdentityCertificateParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Updates the cluster identity certificate. @@ -1221,45 +1340,55 @@ async def begin_update_identity_certificate( :type parameters: ~azure.mgmt.hdinsight.models.UpdateClusterIdentityCertificateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_identity_certificate_initial( + raw_result = await self._update_identity_certificate_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1268,66 +1397,68 @@ 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) - begin_update_identity_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _execute_script_actions_initial( + begin_update_identity_certificate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate"} # type: ignore + + async def _execute_script_actions_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.ExecuteScriptActionParameters", + parameters: _models.ExecuteScriptActionParameters, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._execute_script_actions_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExecuteScriptActionParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ExecuteScriptActionParameters') + + request = build_execute_script_actions_request_initial( + 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._execute_script_actions_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _execute_script_actions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions'} # type: ignore + _execute_script_actions_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions"} # type: ignore + - async def begin_execute_script_actions( + @distributed_trace_async + async def begin_execute_script_actions( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.ExecuteScriptActionParameters", + parameters: _models.ExecuteScriptActionParameters, **kwargs: Any ) -> AsyncLROPoller[None]: """Executes script actions on the specified HDInsight cluster. @@ -1340,45 +1471,55 @@ async def begin_execute_script_actions( :type parameters: ~azure.mgmt.hdinsight.models.ExecuteScriptActionParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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._execute_script_actions_initial( + raw_result = await self._execute_script_actions_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -1387,6 +1528,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) - begin_execute_script_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_execute_script_actions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions"} # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_configurations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_configurations_operations.py index 156f9cf6d24d..a9eea6f28502 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_configurations_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_configurations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,49 +6,51 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict 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._configurations_operations import build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ConfigurationsOperations: - """ConfigurationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def list( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ClusterConfigurations": + ) -> _models.ClusterConfigurations: """Gets all configuration information for an HDI cluster. :param resource_group_name: The name of the resource group. @@ -59,38 +62,40 @@ async def list( :rtype: ~azure.mgmt.hdinsight.models.ClusterConfigurations :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterConfigurations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterConfigurations] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterConfigurations', pipeline_response) @@ -99,9 +104,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations'} # type: ignore - async def _update_initial( + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations"} # type: ignore + + + async def _update_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -109,52 +116,54 @@ async def _update_initial( parameters: Dict[str, str], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '{str}') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, '{str}') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + configuration_name=configuration_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}"} # type: ignore + - async def begin_update( + @distributed_trace_async + async def begin_update( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -175,47 +184,56 @@ async def begin_update( :type parameters: dict[str, str] :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, configuration_name=configuration_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -224,10 +242,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) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}"} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -249,39 +268,41 @@ async def get( :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + configuration_name=configuration_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('{str}', pipeline_response) @@ -290,4 +311,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_extensions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_extensions_operations.py index a94fc6e3e06f..a38ce2c59600 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_extensions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/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,99 +6,102 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._extensions_operations import build_create_request_initial, build_delete_request_initial, build_disable_azure_monitor_request_initial, build_disable_monitoring_request_initial, build_enable_azure_monitor_request_initial, build_enable_monitoring_request_initial, build_get_azure_async_operation_status_request, build_get_azure_monitor_status_request, build_get_monitoring_status_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ExtensionsOperations: - """ExtensionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`extensions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - async def _enable_monitoring_initial( + + async def _enable_monitoring_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.ClusterMonitoringRequest", + parameters: _models.ClusterMonitoringRequest, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._enable_monitoring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterMonitoringRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ClusterMonitoringRequest') + + request = build_enable_monitoring_request_initial( + 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._enable_monitoring_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _enable_monitoring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore + _enable_monitoring_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore - async def begin_enable_monitoring( + + @distributed_trace_async + async def begin_enable_monitoring( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.ClusterMonitoringRequest", + parameters: _models.ClusterMonitoringRequest, **kwargs: Any ) -> AsyncLROPoller[None]: """Enables the Operations Management Suite (OMS) on the HDInsight cluster. @@ -110,45 +114,55 @@ async def begin_enable_monitoring( :type parameters: ~azure.mgmt.hdinsight.models.ClusterMonitoringRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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._enable_monitoring_initial( + raw_result = await self._enable_monitoring_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -157,16 +171,17 @@ 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) - begin_enable_monitoring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_enable_monitoring.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore + @distributed_trace_async async def get_monitoring_status( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ClusterMonitoringResponse": + ) -> _models.ClusterMonitoringResponse: """Gets the status of Operations Management Suite (OMS) on the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -178,38 +193,40 @@ async def get_monitoring_status( :rtype: ~azure.mgmt.hdinsight.models.ClusterMonitoringResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterMonitoringResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_monitoring_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterMonitoringResponse] + + + request = build_get_monitoring_status_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_monitoring_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterMonitoringResponse', pipeline_response) @@ -218,54 +235,59 @@ async def get_monitoring_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_monitoring_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore - async def _disable_monitoring_initial( + get_monitoring_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore + + + async def _disable_monitoring_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 = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._disable_monitoring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_monitoring_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._disable_monitoring_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _disable_monitoring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore + _disable_monitoring_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore + - async def begin_disable_monitoring( + @distributed_trace_async + async def begin_disable_monitoring( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -279,44 +301,52 @@ async def begin_disable_monitoring( :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. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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._disable_monitoring_initial( + raw_result = await self._disable_monitoring_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -325,66 +355,68 @@ 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) - begin_disable_monitoring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_disable_monitoring.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore - async def _enable_azure_monitor_initial( + async def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.AzureMonitorRequest", + parameters: _models.AzureMonitorRequest, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._enable_azure_monitor_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AzureMonitorRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'AzureMonitorRequest') + + request = build_enable_azure_monitor_request_initial( + 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._enable_azure_monitor_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _enable_azure_monitor_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore + _enable_azure_monitor_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore + - async def begin_enable_azure_monitor( + @distributed_trace_async + async def begin_enable_azure_monitor( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, - parameters: "_models.AzureMonitorRequest", + parameters: _models.AzureMonitorRequest, **kwargs: Any ) -> AsyncLROPoller[None]: """Enables the Azure Monitor on the HDInsight cluster. @@ -397,45 +429,55 @@ async def begin_enable_azure_monitor( :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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._enable_azure_monitor_initial( + raw_result = await self._enable_azure_monitor_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -444,16 +486,17 @@ 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) - begin_enable_azure_monitor.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_enable_azure_monitor.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore + @distributed_trace_async async def get_azure_monitor_status( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.AzureMonitorResponse": + ) -> _models.AzureMonitorResponse: """Gets the status of Azure Monitor on the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -465,38 +508,40 @@ async def get_azure_monitor_status( :rtype: ~azure.mgmt.hdinsight.models.AzureMonitorResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_monitor_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AzureMonitorResponse] + + + request = build_get_azure_monitor_status_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_azure_monitor_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AzureMonitorResponse', pipeline_response) @@ -505,54 +550,59 @@ async def get_azure_monitor_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_monitor_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore - async def _disable_azure_monitor_initial( + get_azure_monitor_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore + + + async def _disable_azure_monitor_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 = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._disable_azure_monitor_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_disable_azure_monitor_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._disable_azure_monitor_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _disable_azure_monitor_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore + _disable_azure_monitor_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore + - async def begin_disable_azure_monitor( + @distributed_trace_async + async def begin_disable_azure_monitor( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -566,44 +616,52 @@ async def begin_disable_azure_monitor( :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. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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._disable_azure_monitor_initial( + raw_result = await self._disable_azure_monitor_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -612,69 +670,71 @@ 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) - begin_disable_azure_monitor.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_disable_azure_monitor.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore - async def _create_initial( + async def _create_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, extension_name: str, - parameters: "_models.Extension", + parameters: _models.Extension, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + extension_name=extension_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore + - async def begin_create( + @distributed_trace_async + async def begin_create( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, extension_name: str, - parameters: "_models.Extension", + parameters: _models.Extension, **kwargs: Any ) -> AsyncLROPoller[None]: """Creates an HDInsight cluster extension. @@ -689,47 +749,56 @@ async def begin_create( :type parameters: ~azure.mgmt.hdinsight.models.Extension :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_initial( + raw_result = await self._create_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -738,17 +807,18 @@ 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) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, extension_name: str, **kwargs: Any - ) -> "_models.ClusterMonitoringResponse": + ) -> _models.ClusterMonitoringResponse: """Gets the extension properties for the specified HDInsight cluster extension. :param resource_group_name: The name of the resource group. @@ -762,39 +832,41 @@ async def get( :rtype: ~azure.mgmt.hdinsight.models.ClusterMonitoringResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterMonitoringResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterMonitoringResponse] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + extension_name=extension_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterMonitoringResponse', pipeline_response) @@ -803,56 +875,61 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore - async def _delete_initial( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, extension_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + extension_name=extension_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -869,46 +946,53 @@ async def begin_delete( :type extension_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -917,10 +1001,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) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore + + @distributed_trace_async async def get_azure_async_operation_status( self, resource_group_name: str, @@ -928,7 +1013,7 @@ async def get_azure_async_operation_status( extension_name: str, operation_id: str, **kwargs: Any - ) -> "_models.AsyncOperationResult": + ) -> _models.AsyncOperationResult: """Gets the async operation status. :param resource_group_name: The name of the resource group. @@ -944,40 +1029,42 @@ async def get_azure_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_azure_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_azure_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -986,4 +1073,6 @@ async def get_azure_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}/azureAsyncOperations/{operationId}'} # type: ignore + + get_azure_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}/azureAsyncOperations/{operationId}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_locations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_locations_operations.py index 78a7cc05efbc..aa3485a71646 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_locations_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_locations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,46 +6,48 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, 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 -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._locations_operations import build_check_name_availability_request, build_get_azure_async_operation_status_request, build_get_capabilities_request, build_list_billing_specs_request, build_list_usages_request, build_validate_cluster_create_request_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class LocationsOperations: - """LocationsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`locations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def get_capabilities( self, location: str, **kwargs: Any - ) -> "_models.CapabilitiesResult": + ) -> _models.CapabilitiesResult: """Gets the capabilities for the specified location. :param location: The Azure location (region) for which to make the request. @@ -54,37 +57,39 @@ async def get_capabilities( :rtype: ~azure.mgmt.hdinsight.models.CapabilitiesResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilitiesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_capabilities.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CapabilitiesResult] + + + request = build_get_capabilities_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=self.get_capabilities.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CapabilitiesResult', pipeline_response) @@ -93,13 +98,16 @@ async def get_capabilities( return cls(pipeline_response, deserialized, {}) return deserialized - get_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities'} # type: ignore + get_capabilities.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities"} # type: ignore + + + @distributed_trace_async async def list_usages( self, location: str, **kwargs: Any - ) -> "_models.UsagesListResult": + ) -> _models.UsagesListResult: """Lists the usages for the specified location. :param location: The Azure location (region) for which to make the request. @@ -109,37 +117,39 @@ async def list_usages( :rtype: ~azure.mgmt.hdinsight.models.UsagesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.UsagesListResult] + + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UsagesListResult', pipeline_response) @@ -148,13 +158,16 @@ async def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages'} # type: ignore + list_usages.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages"} # type: ignore + + + @distributed_trace_async async def list_billing_specs( self, location: str, **kwargs: Any - ) -> "_models.BillingResponseListResult": + ) -> _models.BillingResponseListResult: """Lists the billingSpecs for the specified subscription and location. :param location: The Azure location (region) for which to make the request. @@ -164,37 +177,39 @@ async def list_billing_specs( :rtype: ~azure.mgmt.hdinsight.models.BillingResponseListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BillingResponseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_billing_specs.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BillingResponseListResult] + + + request = build_list_billing_specs_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=self.list_billing_specs.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BillingResponseListResult', pipeline_response) @@ -203,14 +218,17 @@ async def list_billing_specs( return cls(pipeline_response, deserialized, {}) return deserialized - list_billing_specs.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs'} # type: ignore + list_billing_specs.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs"} # type: ignore + + + @distributed_trace_async async def get_azure_async_operation_status( self, location: str, operation_id: str, **kwargs: Any - ) -> "_models.AsyncOperationResult": + ) -> _models.AsyncOperationResult: """Get the async operation status. :param location: The Azure location (region) for which to make the request. @@ -222,38 +240,40 @@ async def get_azure_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_azure_async_operation_status_request( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_azure_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -262,14 +282,17 @@ async def get_azure_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/azureasyncoperations/{operationId}'} # type: ignore + get_azure_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/azureasyncoperations/{operationId}"} # type: ignore + + + @distributed_trace_async async def check_name_availability( self, location: str, - parameters: "_models.NameAvailabilityCheckRequestParameters", + parameters: _models.NameAvailabilityCheckRequestParameters, **kwargs: Any - ) -> "_models.NameAvailabilityCheckResult": + ) -> _models.NameAvailabilityCheckResult: """Check the cluster name is available or not. :param location: The Azure location (region) for which to make the request. @@ -281,42 +304,43 @@ async def check_name_availability( :rtype: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityCheckResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NameAvailabilityCheckRequestParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityCheckResult] + + _json = self._serialize.body(parameters, 'NameAvailabilityCheckRequestParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NameAvailabilityCheckResult', pipeline_response) @@ -325,14 +349,17 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace_async async def validate_cluster_create_request( self, location: str, - parameters: "_models.ClusterCreateRequestValidationParameters", + parameters: _models.ClusterCreateRequestValidationParameters, **kwargs: Any - ) -> "_models.ClusterCreateValidationResult": + ) -> _models.ClusterCreateValidationResult: """Validate the cluster create request spec is valid or not. :param location: The Azure location (region) for which to make the request. @@ -344,42 +371,43 @@ async def validate_cluster_create_request( :rtype: ~azure.mgmt.hdinsight.models.ClusterCreateValidationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCreateValidationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_cluster_create_request.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterCreateRequestValidationParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCreateValidationResult] + + _json = self._serialize.body(parameters, 'ClusterCreateRequestValidationParameters') + + request = build_validate_cluster_create_request_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_cluster_create_request.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCreateValidationResult', pipeline_response) @@ -388,4 +416,6 @@ async def validate_cluster_create_request( return cls(pipeline_response, deserialized, {}) return deserialized - validate_cluster_create_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest'} # type: ignore + + validate_cluster_create_request.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_operations.py index b5277c2677cb..d3ec4bd8a13f 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,82 +6,93 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available HDInsight REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -89,17 +101,22 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.HDInsight/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.HDInsight/operations"} # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_patch.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_endpoint_connections_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_endpoint_connections_operations.py index 86e8bda4e5ee..dc6a032cf91c 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_endpoint_connections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,50 +6,53 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict 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._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_cluster_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list_by_cluster( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: """Lists the private endpoint connections for a HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -56,45 +60,55 @@ def list_by_cluster( :param cluster_name: The name of the cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,68 +117,73 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections"} # type: ignore async def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + ) -> _models.PrivateEndpointConnection: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -176,16 +195,19 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, - parameters: "_models.PrivateEndpointConnection", + parameters: _models.PrivateEndpointConnection, **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Approve or reject a private endpoint connection manually. :param resource_group_name: The name of the resource group. @@ -198,50 +220,60 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -250,17 +282,18 @@ 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) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specific private endpoint connection. :param resource_group_name: The name of the resource group. @@ -274,39 +307,41 @@ async def get( :rtype: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -315,56 +350,61 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - async def _delete_initial( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -381,46 +421,53 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] 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( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -429,6 +476,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) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_link_resources_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_link_resources_operations.py index 4d6e798ec6dc..ae69ec6c41ae 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_link_resources_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_private_link_resources_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,47 +6,49 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import 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 -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_get_request, build_list_by_cluster_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def list_by_cluster( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Lists the private link resources in a HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -57,38 +60,40 @@ async def list_by_cluster( :rtype: ~azure.mgmt.hdinsight.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + + + request = build_list_by_cluster_request( + 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'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) @@ -97,15 +102,18 @@ async def list_by_cluster( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources"} # type: ignore + + + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, private_link_resource_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResource": + ) -> _models.PrivateLinkResource: """Gets the specific private link resource. :param resource_group_name: The name of the resource group. @@ -119,39 +127,41 @@ async def get( :rtype: ~azure.mgmt.hdinsight.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_link_resource_name=private_link_resource_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -160,4 +170,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_actions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_actions_operations.py index e2aa1d1e338c..4c34511a7dd8 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_actions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_actions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,43 +6,46 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._script_actions_operations import build_delete_request, build_get_execution_async_operation_status_request, build_get_execution_detail_request, build_list_by_cluster_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ScriptActionsOperations: - """ScriptActionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`script_actions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + - async def delete( + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -61,52 +65,56 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + script_name=script_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}"} # type: ignore + + @distributed_trace def list_by_cluster( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ScriptActionsList"]: + ) -> AsyncIterable[_models.ScriptActionsList]: """Lists all the persisted script actions for the specified cluster. :param resource_group_name: The name of the resource group. @@ -118,41 +126,49 @@ def list_by_cluster( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.ScriptActionsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptActionsList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ScriptActionsList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptActionsList', pipeline_response) + deserialized = self._deserialize("ScriptActionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -161,28 +177,34 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions"} # type: ignore + @distributed_trace_async async def get_execution_detail( self, resource_group_name: str, cluster_name: str, script_execution_id: str, **kwargs: Any - ) -> "_models.RuntimeScriptActionDetail": + ) -> _models.RuntimeScriptActionDetail: """Gets the script execution detail for the given script execution ID. :param resource_group_name: The name of the resource group. @@ -196,39 +218,41 @@ async def get_execution_detail( :rtype: ~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuntimeScriptActionDetail"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_execution_detail.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'scriptExecutionId': self._serialize.url("script_execution_id", script_execution_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RuntimeScriptActionDetail] + + + request = build_get_execution_detail_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + script_execution_id=script_execution_id, + api_version=api_version, + template_url=self.get_execution_detail.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RuntimeScriptActionDetail', pipeline_response) @@ -237,15 +261,18 @@ async def get_execution_detail( return cls(pipeline_response, deserialized, {}) return deserialized - get_execution_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}'} # type: ignore + get_execution_detail.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}"} # type: ignore + + + @distributed_trace_async async def get_execution_async_operation_status( self, resource_group_name: str, cluster_name: str, operation_id: str, **kwargs: Any - ) -> "_models.AsyncOperationResult": + ) -> _models.AsyncOperationResult: """Gets the async operation status of execution operation. :param resource_group_name: The name of the resource group. @@ -259,39 +286,41 @@ async def get_execution_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_execution_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_execution_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_execution_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -300,4 +329,6 @@ async def get_execution_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_execution_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions/azureasyncoperations/{operationId}'} # type: ignore + + get_execution_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions/azureasyncoperations/{operationId}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_execution_history_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_execution_history_operations.py index 7b0937b844ed..928b0815741d 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_execution_history_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_script_execution_history_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,48 +6,51 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._script_execution_history_operations import build_list_by_cluster_request, build_promote_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ScriptExecutionHistoryOperations: - """ScriptExecutionHistoryOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`script_execution_history` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list_by_cluster( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ScriptActionExecutionHistoryList"]: + ) -> AsyncIterable[_models.ScriptActionExecutionHistoryList]: """Lists all scripts' execution history for the specified cluster. :param resource_group_name: The name of the resource group. @@ -54,45 +58,55 @@ def list_by_cluster( :param cluster_name: The name of the cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ScriptActionExecutionHistoryList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.ScriptActionExecutionHistoryList] + :return: An iterator like instance of either ScriptActionExecutionHistoryList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hdinsight.models.ScriptActionExecutionHistoryList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptActionExecutionHistoryList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ScriptActionExecutionHistoryList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptActionExecutionHistoryList', pipeline_response) + deserialized = self._deserialize("ScriptActionExecutionHistoryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,22 +115,28 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory"} # type: ignore - async def promote( + @distributed_trace_async + async def promote( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -136,42 +156,45 @@ async def promote( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.promote.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'scriptExecutionId': self._serialize.url("script_execution_id", script_execution_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_promote_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + script_execution_id=script_execution_id, + api_version=api_version, + template_url=self.promote.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - promote.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote'} # type: ignore + promote.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_virtual_machines_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_virtual_machines_operations.py index ace7a43786ee..9dd8f2906ae7 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_virtual_machines_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/aio/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,49 +6,51 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict 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._virtual_machines_operations import build_get_async_operation_status_request, build_list_hosts_request, build_restart_hosts_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class VirtualMachinesOperations: - """VirtualMachinesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.aio.HDInsightManagementClient`'s + :attr:`virtual_machines` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def list_hosts( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> List["_models.HostInfo"]: + ) -> List[_models.HostInfo]: """Lists the HDInsight clusters hosts. :param resource_group_name: The name of the resource group. @@ -59,38 +62,40 @@ async def list_hosts( :rtype: list[~azure.mgmt.hdinsight.models.HostInfo] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[List["_models.HostInfo"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_hosts.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[List[_models.HostInfo]] + + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_hosts.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[HostInfo]', pipeline_response) @@ -99,60 +104,64 @@ async def list_hosts( return cls(pipeline_response, deserialized, {}) return deserialized - list_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts'} # type: ignore - async def _restart_hosts_initial( + list_hosts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts"} # type: ignore + + + async def _restart_hosts_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, hosts: List[str], **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restart_hosts_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(hosts, '[str]') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(hosts, '[str]') + + request = build_restart_hosts_request_initial( + 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._restart_hosts_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _restart_hosts_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts'} # type: ignore + _restart_hosts_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts"} # type: ignore + - async def begin_restart_hosts( + @distributed_trace_async + async def begin_restart_hosts( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -169,45 +178,55 @@ async def begin_restart_hosts( :type hosts: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._restart_hosts_initial( + raw_result = await self._restart_hosts_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, hosts=hosts, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -216,17 +235,18 @@ 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) - begin_restart_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart_hosts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts"} # type: ignore + @distributed_trace_async async def get_async_operation_status( self, resource_group_name: str, cluster_name: str, operation_id: str, **kwargs: Any - ) -> "_models.AsyncOperationResult": + ) -> _models.AsyncOperationResult: """Gets the async operation status. :param resource_group_name: The name of the resource group. @@ -240,39 +260,41 @@ async def get_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -281,4 +303,6 @@ async def get_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts/azureasyncoperations/{operationId}'} # type: ignore + + get_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts/azureasyncoperations/{operationId}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py index bf995f40d2f4..0dd79dc5ecf6 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py @@ -6,226 +6,116 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AaddsResourceDetails - from ._models_py3 import Application - from ._models_py3 import ApplicationGetEndpoint - from ._models_py3 import ApplicationGetHttpsEndpoint - from ._models_py3 import ApplicationListResult - from ._models_py3 import ApplicationProperties - from ._models_py3 import AsyncOperationResult - from ._models_py3 import Autoscale - from ._models_py3 import AutoscaleCapacity - from ._models_py3 import AutoscaleConfigurationUpdateParameter - from ._models_py3 import AutoscaleRecurrence - from ._models_py3 import AutoscaleSchedule - from ._models_py3 import AutoscaleTimeAndCapacity - from ._models_py3 import AzureMonitorRequest - from ._models_py3 import AzureMonitorResponse - from ._models_py3 import AzureMonitorSelectedConfigurations - from ._models_py3 import AzureMonitorTableConfiguration - from ._models_py3 import BillingMeters - from ._models_py3 import BillingResources - from ._models_py3 import BillingResponseListResult - from ._models_py3 import CapabilitiesResult - from ._models_py3 import ClientGroupInfo - from ._models_py3 import Cluster - from ._models_py3 import ClusterConfigurations - from ._models_py3 import ClusterCreateParametersExtended - from ._models_py3 import ClusterCreateProperties - from ._models_py3 import ClusterCreateRequestValidationParameters - from ._models_py3 import ClusterCreateValidationResult - from ._models_py3 import ClusterDefinition - from ._models_py3 import ClusterDiskEncryptionParameters - from ._models_py3 import ClusterGetProperties - from ._models_py3 import ClusterIdentity - from ._models_py3 import ClusterListPersistedScriptActionsResult - from ._models_py3 import ClusterListResult - from ._models_py3 import ClusterMonitoringRequest - from ._models_py3 import ClusterMonitoringResponse - from ._models_py3 import ClusterPatchParameters - from ._models_py3 import ClusterResizeParameters - from ._models_py3 import ComputeIsolationProperties - from ._models_py3 import ComputeProfile - from ._models_py3 import ConnectivityEndpoint - from ._models_py3 import DataDisksGroups - from ._models_py3 import Dimension - from ._models_py3 import DiskBillingMeters - from ._models_py3 import DiskEncryptionProperties - from ._models_py3 import EncryptionInTransitProperties - from ._models_py3 import ErrorResponse - from ._models_py3 import Errors - from ._models_py3 import ExcludedServicesConfig - from ._models_py3 import ExecuteScriptActionParameters - from ._models_py3 import Extension - from ._models_py3 import GatewaySettings - from ._models_py3 import HardwareProfile - from ._models_py3 import HostInfo - from ._models_py3 import IPConfiguration - from ._models_py3 import KafkaRestProperties - from ._models_py3 import LinuxOperatingSystemProfile - from ._models_py3 import LocalizedName - from ._models_py3 import MetricSpecifications - from ._models_py3 import NameAvailabilityCheckRequestParameters - from ._models_py3 import NameAvailabilityCheckResult - from ._models_py3 import NetworkProperties - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import OperationProperties - from ._models_py3 import OsProfile - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkConfiguration - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProxyResource - from ._models_py3 import QuotaCapability - from ._models_py3 import QuotaInfo - from ._models_py3 import RegionalQuotaCapability - from ._models_py3 import RegionsCapability - from ._models_py3 import Resource - from ._models_py3 import ResourceAutoGenerated - from ._models_py3 import ResourceId - from ._models_py3 import Role - from ._models_py3 import RuntimeScriptAction - from ._models_py3 import RuntimeScriptActionDetail - from ._models_py3 import ScriptAction - from ._models_py3 import ScriptActionExecutionHistoryList - from ._models_py3 import ScriptActionExecutionSummary - from ._models_py3 import ScriptActionPersistedGetResponseSpec - from ._models_py3 import ScriptActionsList - from ._models_py3 import SecurityProfile - from ._models_py3 import ServiceSpecification - from ._models_py3 import SshProfile - from ._models_py3 import SshPublicKey - from ._models_py3 import StorageAccount - from ._models_py3 import StorageProfile - from ._models_py3 import SystemData - from ._models_py3 import TrackedResource - from ._models_py3 import UpdateClusterIdentityCertificateParameters - from ._models_py3 import UpdateGatewaySettingsParameters - from ._models_py3 import Usage - from ._models_py3 import UsagesListResult - from ._models_py3 import UserAssignedIdentity - from ._models_py3 import ValidationErrorInfo - from ._models_py3 import VersionSpec - from ._models_py3 import VersionsCapability - from ._models_py3 import VirtualNetworkProfile - from ._models_py3 import VmSizeCompatibilityFilterV2 - from ._models_py3 import VmSizeProperty -except (SyntaxError, ImportError): - from ._models import AaddsResourceDetails # type: ignore - from ._models import Application # type: ignore - from ._models import ApplicationGetEndpoint # type: ignore - from ._models import ApplicationGetHttpsEndpoint # type: ignore - from ._models import ApplicationListResult # type: ignore - from ._models import ApplicationProperties # type: ignore - from ._models import AsyncOperationResult # type: ignore - from ._models import Autoscale # type: ignore - from ._models import AutoscaleCapacity # type: ignore - from ._models import AutoscaleConfigurationUpdateParameter # type: ignore - from ._models import AutoscaleRecurrence # type: ignore - from ._models import AutoscaleSchedule # type: ignore - from ._models import AutoscaleTimeAndCapacity # type: ignore - from ._models import AzureMonitorRequest # type: ignore - from ._models import AzureMonitorResponse # type: ignore - from ._models import AzureMonitorSelectedConfigurations # type: ignore - from ._models import AzureMonitorTableConfiguration # type: ignore - from ._models import BillingMeters # type: ignore - from ._models import BillingResources # type: ignore - from ._models import BillingResponseListResult # type: ignore - from ._models import CapabilitiesResult # type: ignore - from ._models import ClientGroupInfo # type: ignore - from ._models import Cluster # type: ignore - from ._models import ClusterConfigurations # type: ignore - from ._models import ClusterCreateParametersExtended # type: ignore - from ._models import ClusterCreateProperties # type: ignore - from ._models import ClusterCreateRequestValidationParameters # type: ignore - from ._models import ClusterCreateValidationResult # type: ignore - from ._models import ClusterDefinition # type: ignore - from ._models import ClusterDiskEncryptionParameters # type: ignore - from ._models import ClusterGetProperties # type: ignore - from ._models import ClusterIdentity # type: ignore - from ._models import ClusterListPersistedScriptActionsResult # type: ignore - from ._models import ClusterListResult # type: ignore - from ._models import ClusterMonitoringRequest # type: ignore - from ._models import ClusterMonitoringResponse # type: ignore - from ._models import ClusterPatchParameters # type: ignore - from ._models import ClusterResizeParameters # type: ignore - from ._models import ComputeIsolationProperties # type: ignore - from ._models import ComputeProfile # type: ignore - from ._models import ConnectivityEndpoint # type: ignore - from ._models import DataDisksGroups # type: ignore - from ._models import Dimension # type: ignore - from ._models import DiskBillingMeters # type: ignore - from ._models import DiskEncryptionProperties # type: ignore - from ._models import EncryptionInTransitProperties # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Errors # type: ignore - from ._models import ExcludedServicesConfig # type: ignore - from ._models import ExecuteScriptActionParameters # type: ignore - from ._models import Extension # type: ignore - from ._models import GatewaySettings # type: ignore - from ._models import HardwareProfile # type: ignore - from ._models import HostInfo # type: ignore - from ._models import IPConfiguration # type: ignore - from ._models import KafkaRestProperties # type: ignore - from ._models import LinuxOperatingSystemProfile # type: ignore - from ._models import LocalizedName # type: ignore - from ._models import MetricSpecifications # type: ignore - from ._models import NameAvailabilityCheckRequestParameters # type: ignore - from ._models import NameAvailabilityCheckResult # type: ignore - from ._models import NetworkProperties # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import OsProfile # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkConfiguration # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QuotaCapability # type: ignore - from ._models import QuotaInfo # type: ignore - from ._models import RegionalQuotaCapability # type: ignore - from ._models import RegionsCapability # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceAutoGenerated # type: ignore - from ._models import ResourceId # type: ignore - from ._models import Role # type: ignore - from ._models import RuntimeScriptAction # type: ignore - from ._models import RuntimeScriptActionDetail # type: ignore - from ._models import ScriptAction # type: ignore - from ._models import ScriptActionExecutionHistoryList # type: ignore - from ._models import ScriptActionExecutionSummary # type: ignore - from ._models import ScriptActionPersistedGetResponseSpec # type: ignore - from ._models import ScriptActionsList # type: ignore - from ._models import SecurityProfile # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import SshProfile # type: ignore - from ._models import SshPublicKey # type: ignore - from ._models import StorageAccount # type: ignore - from ._models import StorageProfile # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpdateClusterIdentityCertificateParameters # type: ignore - from ._models import UpdateGatewaySettingsParameters # type: ignore - from ._models import Usage # type: ignore - from ._models import UsagesListResult # type: ignore - from ._models import UserAssignedIdentity # type: ignore - from ._models import ValidationErrorInfo # type: ignore - from ._models import VersionSpec # type: ignore - from ._models import VersionsCapability # type: ignore - from ._models import VirtualNetworkProfile # type: ignore - from ._models import VmSizeCompatibilityFilterV2 # type: ignore - from ._models import VmSizeProperty # type: ignore +from ._models_py3 import AaddsResourceDetails +from ._models_py3 import Application +from ._models_py3 import ApplicationGetEndpoint +from ._models_py3 import ApplicationGetHttpsEndpoint +from ._models_py3 import ApplicationListResult +from ._models_py3 import ApplicationProperties +from ._models_py3 import AsyncOperationResult +from ._models_py3 import Autoscale +from ._models_py3 import AutoscaleCapacity +from ._models_py3 import AutoscaleConfigurationUpdateParameter +from ._models_py3 import AutoscaleRecurrence +from ._models_py3 import AutoscaleSchedule +from ._models_py3 import AutoscaleTimeAndCapacity +from ._models_py3 import AzureMonitorRequest +from ._models_py3 import AzureMonitorResponse +from ._models_py3 import AzureMonitorSelectedConfigurations +from ._models_py3 import AzureMonitorTableConfiguration +from ._models_py3 import BillingMeters +from ._models_py3 import BillingResources +from ._models_py3 import BillingResponseListResult +from ._models_py3 import CapabilitiesResult +from ._models_py3 import ClientGroupInfo +from ._models_py3 import Cluster +from ._models_py3 import ClusterConfigurations +from ._models_py3 import ClusterCreateParametersExtended +from ._models_py3 import ClusterCreateProperties +from ._models_py3 import ClusterCreateRequestValidationParameters +from ._models_py3 import ClusterCreateValidationResult +from ._models_py3 import ClusterDefinition +from ._models_py3 import ClusterDiskEncryptionParameters +from ._models_py3 import ClusterGetProperties +from ._models_py3 import ClusterIdentity +from ._models_py3 import ClusterListPersistedScriptActionsResult +from ._models_py3 import ClusterListResult +from ._models_py3 import ClusterMonitoringRequest +from ._models_py3 import ClusterMonitoringResponse +from ._models_py3 import ClusterPatchParameters +from ._models_py3 import ClusterResizeParameters +from ._models_py3 import ComputeIsolationProperties +from ._models_py3 import ComputeProfile +from ._models_py3 import ConnectivityEndpoint +from ._models_py3 import DataDisksGroups +from ._models_py3 import Dimension +from ._models_py3 import DiskBillingMeters +from ._models_py3 import DiskEncryptionProperties +from ._models_py3 import EncryptionInTransitProperties +from ._models_py3 import ErrorResponse +from ._models_py3 import Errors +from ._models_py3 import ExcludedServicesConfig +from ._models_py3 import ExecuteScriptActionParameters +from ._models_py3 import Extension +from ._models_py3 import GatewaySettings +from ._models_py3 import HardwareProfile +from ._models_py3 import HostInfo +from ._models_py3 import IPConfiguration +from ._models_py3 import KafkaRestProperties +from ._models_py3 import LinuxOperatingSystemProfile +from ._models_py3 import LocalizedName +from ._models_py3 import MetricSpecifications +from ._models_py3 import NameAvailabilityCheckRequestParameters +from ._models_py3 import NameAvailabilityCheckResult +from ._models_py3 import NetworkProperties +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationProperties +from ._models_py3 import OsProfile +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkConfiguration +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyResource +from ._models_py3 import QuotaCapability +from ._models_py3 import QuotaInfo +from ._models_py3 import RegionalQuotaCapability +from ._models_py3 import RegionsCapability +from ._models_py3 import Resource +from ._models_py3 import ResourceAutoGenerated +from ._models_py3 import ResourceId +from ._models_py3 import Role +from ._models_py3 import RuntimeScriptAction +from ._models_py3 import RuntimeScriptActionDetail +from ._models_py3 import ScriptAction +from ._models_py3 import ScriptActionExecutionHistoryList +from ._models_py3 import ScriptActionExecutionSummary +from ._models_py3 import ScriptActionPersistedGetResponseSpec +from ._models_py3 import ScriptActionsList +from ._models_py3 import SecurityProfile +from ._models_py3 import ServiceSpecification +from ._models_py3 import SshProfile +from ._models_py3 import SshPublicKey +from ._models_py3 import StorageAccount +from ._models_py3 import StorageProfile +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UpdateClusterIdentityCertificateParameters +from ._models_py3 import UpdateGatewaySettingsParameters +from ._models_py3 import Usage +from ._models_py3 import UsagesListResult +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import ValidationErrorInfo +from ._models_py3 import VersionSpec +from ._models_py3 import VersionsCapability +from ._models_py3 import VirtualNetworkProfile +from ._models_py3 import VmSizeCompatibilityFilterV2 +from ._models_py3 import VmSizeProperty + from ._hd_insight_management_client_enums import ( AsyncOperationState, @@ -246,7 +136,9 @@ RoleName, Tier, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AaddsResourceDetails', 'Application', @@ -375,3 +267,5 @@ 'RoleName', 'Tier', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_hd_insight_management_client_enums.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_hd_insight_management_client_enums.py index ad598a6ab5c9..052d752a47c6 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_hd_insight_management_client_enums.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_hd_insight_management_client_enums.py @@ -6,27 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AsyncOperationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AsyncOperationState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The async operation state. """ @@ -34,7 +18,7 @@ class AsyncOperationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUCCEEDED = "Succeeded" FAILED = "Failed" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity that created the resource. """ @@ -43,7 +27,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DaysOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DaysOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): MONDAY = "Monday" TUESDAY = "Tuesday" @@ -53,13 +37,13 @@ class DaysOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SATURDAY = "Saturday" SUNDAY = "Sunday" -class DirectoryType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DirectoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The directory type. """ ACTIVE_DIRECTORY = "ActiveDirectory" -class FilterMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FilterMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The filtering mode. Effectively this can enabling or disabling the VM sizes in a particular set. """ @@ -69,7 +53,7 @@ class FilterMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOMMEND = "Recommend" DEFAULT = "Default" -class HDInsightClusterProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HDInsightClusterProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state, which only appears in the response. """ @@ -79,7 +63,7 @@ class HDInsightClusterProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, CANCELED = "Canceled" DELETING = "Deleting" -class JsonWebKeyEncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyEncryptionAlgorithm(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Algorithm identifier for encryption, default RSA-OAEP. """ @@ -87,14 +71,14 @@ class JsonWebKeyEncryptionAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str RSA_OAEP256 = "RSA-OAEP-256" RSA1_5 = "RSA1_5" -class OSType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OSType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of operating system. """ WINDOWS = "Windows" LINUX = "Linux" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state, which only appears in the response. """ @@ -105,21 +89,21 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive CANCELED = "Canceled" DELETING = "Deleting" -class PrivateIPAllocationMethod(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateIPAllocationMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The method that private IP address is allocated. """ DYNAMIC = "dynamic" STATIC = "static" -class PrivateLink(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateLink(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether or not private link is enabled. """ DISABLED = "Disabled" ENABLED = "Enabled" -class PrivateLinkConfigurationProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateLinkConfigurationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private link configuration provisioning state, which only appears in the response. """ @@ -129,7 +113,7 @@ class PrivateLinkConfigurationProvisioningState(with_metaclass(_CaseInsensitiveE CANCELED = "Canceled" DELETING = "Deleting" -class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The concrete private link service connection. """ @@ -138,7 +122,7 @@ class PrivateLinkServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta PENDING = "Pending" REMOVED = "Removed" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity used for the cluster. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user assigned identities. """ @@ -148,18 +132,18 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" NONE = "None" -class ResourceProviderConnection(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceProviderConnection(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The direction for the resource provider connection. """ INBOUND = "Inbound" OUTBOUND = "Outbound" -class RoleName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RoleName(str, Enum, metaclass=CaseInsensitiveEnumMeta): WORKERNODE = "workernode" -class Tier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Tier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The cluster tier. """ diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models.py deleted file mode 100644 index 51e412c8eed2..000000000000 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models.py +++ /dev/null @@ -1,3665 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AaddsResourceDetails(msrest.serialization.Model): - """The Azure active directory domain service resource details. - - :param domain_name: The Azure active directory domain service name. - :type domain_name: str - :param initial_sync_complete: This indicates whether initial sync complete or not. - :type initial_sync_complete: bool - :param ldaps_enabled: This indicates whether enable ldaps or not. - :type ldaps_enabled: bool - :param ldaps_public_certificate_in_base64: The base 64 format string of public ldap - certificate. - :type ldaps_public_certificate_in_base64: str - :param resource_id: The resource id of azure active directory domain service. - :type resource_id: str - :param subnet_id: The subnet resource id. - :type subnet_id: str - :param tenant_id: The tenant id of azure active directory domain service . - :type tenant_id: str - """ - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'initial_sync_complete': {'key': 'initialSyncComplete', 'type': 'bool'}, - 'ldaps_enabled': {'key': 'ldapsEnabled', 'type': 'bool'}, - 'ldaps_public_certificate_in_base64': {'key': 'ldapsPublicCertificateInBase64', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AaddsResourceDetails, self).__init__(**kwargs) - self.domain_name = kwargs.get('domain_name', None) - self.initial_sync_complete = kwargs.get('initial_sync_complete', None) - self.ldaps_enabled = kwargs.get('ldaps_enabled', None) - self.ldaps_public_certificate_in_base64 = kwargs.get('ldaps_public_certificate_in_base64', None) - self.resource_id = kwargs.get('resource_id', None) - self.subnet_id = kwargs.get('subnet_id', None) - self.tenant_id = kwargs.get('tenant_id', None) - - -class ResourceAutoGenerated(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceAutoGenerated, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(ResourceAutoGenerated): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class Application(ProxyResource): - """The HDInsight cluster application. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param etag: The ETag for the application. - :type etag: str - :param tags: A set of tags. The tags for the application. - :type tags: dict[str, str] - :param properties: The properties of the application. - :type properties: ~azure.mgmt.hdinsight.models.ApplicationProperties - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.hdinsight.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'ApplicationProperties'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Application, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) - self.system_data = None - - -class ApplicationGetEndpoint(msrest.serialization.Model): - """Gets the application SSH endpoint. - - :param location: The location of the endpoint. - :type location: str - :param destination_port: The destination port to connect to. - :type destination_port: int - :param public_port: The public port to connect to. - :type public_port: int - :param private_ip_address: The private ip address of the endpoint. - :type private_ip_address: str - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'destination_port': {'key': 'destinationPort', 'type': 'int'}, - 'public_port': {'key': 'publicPort', 'type': 'int'}, - 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationGetEndpoint, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.destination_port = kwargs.get('destination_port', None) - self.public_port = kwargs.get('public_port', None) - self.private_ip_address = kwargs.get('private_ip_address', None) - - -class ApplicationGetHttpsEndpoint(msrest.serialization.Model): - """Gets the application HTTP endpoints. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param access_modes: The list of access modes for the application. - :type access_modes: list[str] - :ivar location: The location of the endpoint. - :vartype location: str - :param destination_port: The destination port to connect to. - :type destination_port: int - :ivar public_port: The public port to connect to. - :vartype public_port: int - :param private_ip_address: The private ip address of the endpoint. - :type private_ip_address: str - :param sub_domain_suffix: The subdomain suffix of the application. - :type sub_domain_suffix: str - :param disable_gateway_auth: The value indicates whether to disable GatewayAuth. - :type disable_gateway_auth: bool - """ - - _validation = { - 'location': {'readonly': True}, - 'public_port': {'readonly': True}, - } - - _attribute_map = { - 'access_modes': {'key': 'accessModes', 'type': '[str]'}, - 'location': {'key': 'location', 'type': 'str'}, - 'destination_port': {'key': 'destinationPort', 'type': 'int'}, - 'public_port': {'key': 'publicPort', 'type': 'int'}, - 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, - 'sub_domain_suffix': {'key': 'subDomainSuffix', 'type': 'str'}, - 'disable_gateway_auth': {'key': 'disableGatewayAuth', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationGetHttpsEndpoint, self).__init__(**kwargs) - self.access_modes = kwargs.get('access_modes', None) - self.location = None - self.destination_port = kwargs.get('destination_port', None) - self.public_port = None - self.private_ip_address = kwargs.get('private_ip_address', None) - self.sub_domain_suffix = kwargs.get('sub_domain_suffix', None) - self.disable_gateway_auth = kwargs.get('disable_gateway_auth', None) - - -class ApplicationListResult(msrest.serialization.Model): - """Result of the request to list cluster Applications. It contains a list of operations and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: The list of HDInsight applications installed on HDInsight cluster. - :type value: list[~azure.mgmt.hdinsight.models.Application] - :ivar next_link: The URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Application]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ApplicationProperties(msrest.serialization.Model): - """The HDInsight cluster application GET response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param compute_profile: The list of roles in the cluster. - :type compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile - :param install_script_actions: The list of install script actions. - :type install_script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] - :param uninstall_script_actions: The list of uninstall script actions. - :type uninstall_script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] - :param https_endpoints: The list of application HTTPS endpoints. - :type https_endpoints: list[~azure.mgmt.hdinsight.models.ApplicationGetHttpsEndpoint] - :param ssh_endpoints: The list of application SSH endpoints. - :type ssh_endpoints: list[~azure.mgmt.hdinsight.models.ApplicationGetEndpoint] - :ivar provisioning_state: The provisioning state of the application. - :vartype provisioning_state: str - :param application_type: The application type. - :type application_type: str - :ivar application_state: The application state. - :vartype application_state: str - :param errors: The list of errors. - :type errors: list[~azure.mgmt.hdinsight.models.Errors] - :ivar created_date: The application create date time. - :vartype created_date: str - :ivar marketplace_identifier: The marketplace identifier. - :vartype marketplace_identifier: str - :param private_link_configurations: The private link configurations. - :type private_link_configurations: list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'application_state': {'readonly': True}, - 'created_date': {'readonly': True}, - 'marketplace_identifier': {'readonly': True}, - } - - _attribute_map = { - 'compute_profile': {'key': 'computeProfile', 'type': 'ComputeProfile'}, - 'install_script_actions': {'key': 'installScriptActions', 'type': '[RuntimeScriptAction]'}, - 'uninstall_script_actions': {'key': 'uninstallScriptActions', 'type': '[RuntimeScriptAction]'}, - 'https_endpoints': {'key': 'httpsEndpoints', 'type': '[ApplicationGetHttpsEndpoint]'}, - 'ssh_endpoints': {'key': 'sshEndpoints', 'type': '[ApplicationGetEndpoint]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'application_type': {'key': 'applicationType', 'type': 'str'}, - 'application_state': {'key': 'applicationState', 'type': 'str'}, - 'errors': {'key': 'errors', 'type': '[Errors]'}, - 'created_date': {'key': 'createdDate', 'type': 'str'}, - 'marketplace_identifier': {'key': 'marketplaceIdentifier', 'type': 'str'}, - 'private_link_configurations': {'key': 'privateLinkConfigurations', 'type': '[PrivateLinkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationProperties, self).__init__(**kwargs) - self.compute_profile = kwargs.get('compute_profile', None) - self.install_script_actions = kwargs.get('install_script_actions', None) - self.uninstall_script_actions = kwargs.get('uninstall_script_actions', None) - self.https_endpoints = kwargs.get('https_endpoints', None) - self.ssh_endpoints = kwargs.get('ssh_endpoints', None) - self.provisioning_state = None - self.application_type = kwargs.get('application_type', None) - self.application_state = None - self.errors = kwargs.get('errors', None) - self.created_date = None - self.marketplace_identifier = None - self.private_link_configurations = kwargs.get('private_link_configurations', None) - - -class AsyncOperationResult(msrest.serialization.Model): - """The azure async operation response. - - :param status: The async operation state. Possible values include: "InProgress", "Succeeded", - "Failed". - :type status: str or ~azure.mgmt.hdinsight.models.AsyncOperationState - :param error: The operation error information. - :type error: ~azure.mgmt.hdinsight.models.Errors - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'Errors'}, - } - - def __init__( - self, - **kwargs - ): - super(AsyncOperationResult, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.error = kwargs.get('error', None) - - -class Autoscale(msrest.serialization.Model): - """The autoscale request parameters. - - :param capacity: Parameters for load-based autoscale. - :type capacity: ~azure.mgmt.hdinsight.models.AutoscaleCapacity - :param recurrence: Parameters for schedule-based autoscale. - :type recurrence: ~azure.mgmt.hdinsight.models.AutoscaleRecurrence - """ - - _attribute_map = { - 'capacity': {'key': 'capacity', 'type': 'AutoscaleCapacity'}, - 'recurrence': {'key': 'recurrence', 'type': 'AutoscaleRecurrence'}, - } - - def __init__( - self, - **kwargs - ): - super(Autoscale, self).__init__(**kwargs) - self.capacity = kwargs.get('capacity', None) - self.recurrence = kwargs.get('recurrence', None) - - -class AutoscaleCapacity(msrest.serialization.Model): - """The load-based autoscale request parameters. - - :param min_instance_count: The minimum instance count of the cluster. - :type min_instance_count: int - :param max_instance_count: The maximum instance count of the cluster. - :type max_instance_count: int - """ - - _attribute_map = { - 'min_instance_count': {'key': 'minInstanceCount', 'type': 'int'}, - 'max_instance_count': {'key': 'maxInstanceCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoscaleCapacity, self).__init__(**kwargs) - self.min_instance_count = kwargs.get('min_instance_count', None) - self.max_instance_count = kwargs.get('max_instance_count', None) - - -class AutoscaleConfigurationUpdateParameter(msrest.serialization.Model): - """The autoscale configuration update parameter. - - :param autoscale: The autoscale configuration. - :type autoscale: ~azure.mgmt.hdinsight.models.Autoscale - """ - - _attribute_map = { - 'autoscale': {'key': 'autoscale', 'type': 'Autoscale'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoscaleConfigurationUpdateParameter, self).__init__(**kwargs) - self.autoscale = kwargs.get('autoscale', None) - - -class AutoscaleRecurrence(msrest.serialization.Model): - """Schedule-based autoscale request parameters. - - :param time_zone: The time zone for the autoscale schedule times. - :type time_zone: str - :param schedule: Array of schedule-based autoscale rules. - :type schedule: list[~azure.mgmt.hdinsight.models.AutoscaleSchedule] - """ - - _attribute_map = { - 'time_zone': {'key': 'timeZone', 'type': 'str'}, - 'schedule': {'key': 'schedule', 'type': '[AutoscaleSchedule]'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoscaleRecurrence, self).__init__(**kwargs) - self.time_zone = kwargs.get('time_zone', None) - self.schedule = kwargs.get('schedule', None) - - -class AutoscaleSchedule(msrest.serialization.Model): - """Parameters for a schedule-based autoscale rule, consisting of an array of days + a time and capacity. - - :param days: Days of the week for a schedule-based autoscale rule. - :type days: list[str or ~azure.mgmt.hdinsight.models.DaysOfWeek] - :param time_and_capacity: Time and capacity for a schedule-based autoscale rule. - :type time_and_capacity: ~azure.mgmt.hdinsight.models.AutoscaleTimeAndCapacity - """ - - _attribute_map = { - 'days': {'key': 'days', 'type': '[str]'}, - 'time_and_capacity': {'key': 'timeAndCapacity', 'type': 'AutoscaleTimeAndCapacity'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoscaleSchedule, self).__init__(**kwargs) - self.days = kwargs.get('days', None) - self.time_and_capacity = kwargs.get('time_and_capacity', None) - - -class AutoscaleTimeAndCapacity(msrest.serialization.Model): - """Time and capacity request parameters. - - :param time: 24-hour time in the form xx:xx. - :type time: str - :param min_instance_count: The minimum instance count of the cluster. - :type min_instance_count: int - :param max_instance_count: The maximum instance count of the cluster. - :type max_instance_count: int - """ - - _attribute_map = { - 'time': {'key': 'time', 'type': 'str'}, - 'min_instance_count': {'key': 'minInstanceCount', 'type': 'int'}, - 'max_instance_count': {'key': 'maxInstanceCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoscaleTimeAndCapacity, self).__init__(**kwargs) - self.time = kwargs.get('time', None) - self.min_instance_count = kwargs.get('min_instance_count', None) - self.max_instance_count = kwargs.get('max_instance_count', None) - - -class AzureMonitorRequest(msrest.serialization.Model): - """The azure monitor parameters. - - :param workspace_id: The Log Analytics workspace ID. - :type workspace_id: str - :param primary_key: The Log Analytics workspace key. - :type primary_key: str - :param selected_configurations: The selected configurations. - :type selected_configurations: ~azure.mgmt.hdinsight.models.AzureMonitorSelectedConfigurations - """ - - _attribute_map = { - 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - 'selected_configurations': {'key': 'selectedConfigurations', 'type': 'AzureMonitorSelectedConfigurations'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureMonitorRequest, self).__init__(**kwargs) - self.workspace_id = kwargs.get('workspace_id', None) - self.primary_key = kwargs.get('primary_key', None) - self.selected_configurations = kwargs.get('selected_configurations', None) - - -class AzureMonitorResponse(msrest.serialization.Model): - """The azure monitor status response. - - :param cluster_monitoring_enabled: The status of the monitor on the HDInsight cluster. - :type cluster_monitoring_enabled: bool - :param workspace_id: The workspace ID of the monitor on the HDInsight cluster. - :type workspace_id: str - :param selected_configurations: The selected configurations. - :type selected_configurations: ~azure.mgmt.hdinsight.models.AzureMonitorSelectedConfigurations - """ - - _attribute_map = { - 'cluster_monitoring_enabled': {'key': 'clusterMonitoringEnabled', 'type': 'bool'}, - 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, - 'selected_configurations': {'key': 'selectedConfigurations', 'type': 'AzureMonitorSelectedConfigurations'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureMonitorResponse, self).__init__(**kwargs) - self.cluster_monitoring_enabled = kwargs.get('cluster_monitoring_enabled', None) - self.workspace_id = kwargs.get('workspace_id', None) - self.selected_configurations = kwargs.get('selected_configurations', None) - - -class AzureMonitorSelectedConfigurations(msrest.serialization.Model): - """The selected configurations for azure monitor. - - :param configuration_version: The configuration version. - :type configuration_version: str - :param global_configurations: The global configurations of selected configurations. - :type global_configurations: dict[str, str] - :param table_list: The table list. - :type table_list: list[~azure.mgmt.hdinsight.models.AzureMonitorTableConfiguration] - """ - - _attribute_map = { - 'configuration_version': {'key': 'configurationVersion', 'type': 'str'}, - 'global_configurations': {'key': 'globalConfigurations', 'type': '{str}'}, - 'table_list': {'key': 'tableList', 'type': '[AzureMonitorTableConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureMonitorSelectedConfigurations, self).__init__(**kwargs) - self.configuration_version = kwargs.get('configuration_version', None) - self.global_configurations = kwargs.get('global_configurations', None) - self.table_list = kwargs.get('table_list', None) - - -class AzureMonitorTableConfiguration(msrest.serialization.Model): - """The table configuration for the Log Analytics integration. - - :param name: The name. - :type name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureMonitorTableConfiguration, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - - -class BillingMeters(msrest.serialization.Model): - """The billing meters. - - :param meter_parameter: The virtual machine sizes. - :type meter_parameter: str - :param meter: The HDInsight meter guid. - :type meter: str - :param unit: The unit of meter, VMHours or CoreHours. - :type unit: str - """ - - _attribute_map = { - 'meter_parameter': {'key': 'meterParameter', 'type': 'str'}, - 'meter': {'key': 'meter', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BillingMeters, self).__init__(**kwargs) - self.meter_parameter = kwargs.get('meter_parameter', None) - self.meter = kwargs.get('meter', None) - self.unit = kwargs.get('unit', None) - - -class BillingResources(msrest.serialization.Model): - """The billing resources. - - :param region: The region or location. - :type region: str - :param billing_meters: The billing meter information. - :type billing_meters: list[~azure.mgmt.hdinsight.models.BillingMeters] - :param disk_billing_meters: The managed disk billing information. - :type disk_billing_meters: list[~azure.mgmt.hdinsight.models.DiskBillingMeters] - """ - - _attribute_map = { - 'region': {'key': 'region', 'type': 'str'}, - 'billing_meters': {'key': 'billingMeters', 'type': '[BillingMeters]'}, - 'disk_billing_meters': {'key': 'diskBillingMeters', 'type': '[DiskBillingMeters]'}, - } - - def __init__( - self, - **kwargs - ): - super(BillingResources, self).__init__(**kwargs) - self.region = kwargs.get('region', None) - self.billing_meters = kwargs.get('billing_meters', None) - self.disk_billing_meters = kwargs.get('disk_billing_meters', None) - - -class BillingResponseListResult(msrest.serialization.Model): - """The response for the operation to get regional billingSpecs for a subscription. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param vm_sizes: The virtual machine sizes to include or exclude. - :type vm_sizes: list[str] - :param vm_sizes_with_encryption_at_host: The vm sizes which enable encryption at host. - :type vm_sizes_with_encryption_at_host: list[str] - :param vm_size_filters: The virtual machine filtering mode. Effectively this can enabling or - disabling the virtual machine sizes in a particular set. - :type vm_size_filters: list[~azure.mgmt.hdinsight.models.VmSizeCompatibilityFilterV2] - :ivar vm_size_properties: The vm size properties. - :vartype vm_size_properties: list[~azure.mgmt.hdinsight.models.VmSizeProperty] - :param billing_resources: The billing and managed disk billing resources for a region. - :type billing_resources: list[~azure.mgmt.hdinsight.models.BillingResources] - """ - - _validation = { - 'vm_size_properties': {'readonly': True}, - } - - _attribute_map = { - 'vm_sizes': {'key': 'vmSizes', 'type': '[str]'}, - 'vm_sizes_with_encryption_at_host': {'key': 'vmSizesWithEncryptionAtHost', 'type': '[str]'}, - 'vm_size_filters': {'key': 'vmSizeFilters', 'type': '[VmSizeCompatibilityFilterV2]'}, - 'vm_size_properties': {'key': 'vmSizeProperties', 'type': '[VmSizeProperty]'}, - 'billing_resources': {'key': 'billingResources', 'type': '[BillingResources]'}, - } - - def __init__( - self, - **kwargs - ): - super(BillingResponseListResult, self).__init__(**kwargs) - self.vm_sizes = kwargs.get('vm_sizes', None) - self.vm_sizes_with_encryption_at_host = kwargs.get('vm_sizes_with_encryption_at_host', None) - self.vm_size_filters = kwargs.get('vm_size_filters', None) - self.vm_size_properties = None - self.billing_resources = kwargs.get('billing_resources', None) - - -class CapabilitiesResult(msrest.serialization.Model): - """The Get Capabilities operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param versions: The version capability. - :type versions: dict[str, ~azure.mgmt.hdinsight.models.VersionsCapability] - :param regions: The virtual machine size compatibility features. - :type regions: dict[str, ~azure.mgmt.hdinsight.models.RegionsCapability] - :param features: The capability features. - :type features: list[str] - :ivar quota: The quota capability. - :vartype quota: ~azure.mgmt.hdinsight.models.QuotaCapability - """ - - _validation = { - 'quota': {'readonly': True}, - } - - _attribute_map = { - 'versions': {'key': 'versions', 'type': '{VersionsCapability}'}, - 'regions': {'key': 'regions', 'type': '{RegionsCapability}'}, - 'features': {'key': 'features', 'type': '[str]'}, - 'quota': {'key': 'quota', 'type': 'QuotaCapability'}, - } - - def __init__( - self, - **kwargs - ): - super(CapabilitiesResult, self).__init__(**kwargs) - self.versions = kwargs.get('versions', None) - self.regions = kwargs.get('regions', None) - self.features = kwargs.get('features', None) - self.quota = None - - -class ClientGroupInfo(msrest.serialization.Model): - """The information of AAD security group. - - :param group_name: The AAD security group name. - :type group_name: str - :param group_id: The AAD security group id. - :type group_id: str - """ - - _attribute_map = { - 'group_name': {'key': 'groupName', 'type': 'str'}, - 'group_id': {'key': 'groupId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientGroupInfo, self).__init__(**kwargs) - self.group_name = kwargs.get('group_name', None) - self.group_id = kwargs.get('group_id', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class Cluster(TrackedResource): - """The HDInsight cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param etag: The ETag for the resource. - :type etag: str - :param zones: The availability zones. - :type zones: list[str] - :param properties: The properties of the cluster. - :type properties: ~azure.mgmt.hdinsight.models.ClusterGetProperties - :param identity: The identity of the cluster, if configured. - :type identity: ~azure.mgmt.hdinsight.models.ClusterIdentity - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.hdinsight.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'properties': {'key': 'properties', 'type': 'ClusterGetProperties'}, - 'identity': {'key': 'identity', 'type': 'ClusterIdentity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Cluster, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.zones = kwargs.get('zones', None) - self.properties = kwargs.get('properties', None) - self.identity = kwargs.get('identity', None) - self.system_data = None - - -class ClusterConfigurations(msrest.serialization.Model): - """The configuration object for the specified cluster. - - :param configurations: The configuration object for the specified configuration for the - specified cluster. - :type configurations: dict[str, dict[str, str]] - """ - - _attribute_map = { - 'configurations': {'key': 'configurations', 'type': '{{str}}'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterConfigurations, self).__init__(**kwargs) - self.configurations = kwargs.get('configurations', None) - - -class ClusterCreateParametersExtended(msrest.serialization.Model): - """The CreateCluster request parameters. - - :param location: The location of the cluster. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param zones: The availability zones. - :type zones: list[str] - :param properties: The cluster create parameters. - :type properties: ~azure.mgmt.hdinsight.models.ClusterCreateProperties - :param identity: The identity of the cluster, if configured. - :type identity: ~azure.mgmt.hdinsight.models.ClusterIdentity - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'properties': {'key': 'properties', 'type': 'ClusterCreateProperties'}, - 'identity': {'key': 'identity', 'type': 'ClusterIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterCreateParametersExtended, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.zones = kwargs.get('zones', None) - self.properties = kwargs.get('properties', None) - self.identity = kwargs.get('identity', None) - - -class ClusterCreateProperties(msrest.serialization.Model): - """The cluster create parameters. - - :param cluster_version: The version of the cluster. - :type cluster_version: str - :param os_type: The type of operating system. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.hdinsight.models.OSType - :param tier: The cluster tier. Possible values include: "Standard", "Premium". - :type tier: str or ~azure.mgmt.hdinsight.models.Tier - :param cluster_definition: The cluster definition. - :type cluster_definition: ~azure.mgmt.hdinsight.models.ClusterDefinition - :param kafka_rest_properties: The cluster kafka rest proxy configuration. - :type kafka_rest_properties: ~azure.mgmt.hdinsight.models.KafkaRestProperties - :param security_profile: The security profile. - :type security_profile: ~azure.mgmt.hdinsight.models.SecurityProfile - :param compute_profile: The compute profile. - :type compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile - :param storage_profile: The storage profile. - :type storage_profile: ~azure.mgmt.hdinsight.models.StorageProfile - :param disk_encryption_properties: The disk encryption properties. - :type disk_encryption_properties: ~azure.mgmt.hdinsight.models.DiskEncryptionProperties - :param encryption_in_transit_properties: The encryption-in-transit properties. - :type encryption_in_transit_properties: - ~azure.mgmt.hdinsight.models.EncryptionInTransitProperties - :param min_supported_tls_version: The minimal supported tls version. - :type min_supported_tls_version: str - :param network_properties: The network properties. - :type network_properties: ~azure.mgmt.hdinsight.models.NetworkProperties - :param compute_isolation_properties: The compute isolation properties. - :type compute_isolation_properties: ~azure.mgmt.hdinsight.models.ComputeIsolationProperties - :param private_link_configurations: The private link configurations. - :type private_link_configurations: list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] - """ - - _attribute_map = { - 'cluster_version': {'key': 'clusterVersion', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'cluster_definition': {'key': 'clusterDefinition', 'type': 'ClusterDefinition'}, - 'kafka_rest_properties': {'key': 'kafkaRestProperties', 'type': 'KafkaRestProperties'}, - 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, - 'compute_profile': {'key': 'computeProfile', 'type': 'ComputeProfile'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfile'}, - 'disk_encryption_properties': {'key': 'diskEncryptionProperties', 'type': 'DiskEncryptionProperties'}, - 'encryption_in_transit_properties': {'key': 'encryptionInTransitProperties', 'type': 'EncryptionInTransitProperties'}, - 'min_supported_tls_version': {'key': 'minSupportedTlsVersion', 'type': 'str'}, - 'network_properties': {'key': 'networkProperties', 'type': 'NetworkProperties'}, - 'compute_isolation_properties': {'key': 'computeIsolationProperties', 'type': 'ComputeIsolationProperties'}, - 'private_link_configurations': {'key': 'privateLinkConfigurations', 'type': '[PrivateLinkConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterCreateProperties, self).__init__(**kwargs) - self.cluster_version = kwargs.get('cluster_version', None) - self.os_type = kwargs.get('os_type', None) - self.tier = kwargs.get('tier', None) - self.cluster_definition = kwargs.get('cluster_definition', None) - self.kafka_rest_properties = kwargs.get('kafka_rest_properties', None) - self.security_profile = kwargs.get('security_profile', None) - self.compute_profile = kwargs.get('compute_profile', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.disk_encryption_properties = kwargs.get('disk_encryption_properties', None) - self.encryption_in_transit_properties = kwargs.get('encryption_in_transit_properties', None) - self.min_supported_tls_version = kwargs.get('min_supported_tls_version', None) - self.network_properties = kwargs.get('network_properties', None) - self.compute_isolation_properties = kwargs.get('compute_isolation_properties', None) - self.private_link_configurations = kwargs.get('private_link_configurations', None) - - -class ClusterCreateRequestValidationParameters(ClusterCreateParametersExtended): - """The cluster create request specification. - - :param location: The location of the cluster. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param zones: The availability zones. - :type zones: list[str] - :param properties: The cluster create parameters. - :type properties: ~azure.mgmt.hdinsight.models.ClusterCreateProperties - :param identity: The identity of the cluster, if configured. - :type identity: ~azure.mgmt.hdinsight.models.ClusterIdentity - :param name: The cluster name. - :type name: str - :param type: The resource type. - :type type: str - :param tenant_id: The tenant id. - :type tenant_id: str - :param fetch_aadds_resource: This indicates whether fetch Aadds resource or not. - :type fetch_aadds_resource: bool - """ - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'properties': {'key': 'properties', 'type': 'ClusterCreateProperties'}, - 'identity': {'key': 'identity', 'type': 'ClusterIdentity'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'fetch_aadds_resource': {'key': 'fetchAaddsResource', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterCreateRequestValidationParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.fetch_aadds_resource = kwargs.get('fetch_aadds_resource', None) - - -class ClusterCreateValidationResult(msrest.serialization.Model): - """The response of cluster create request validation. - - :param validation_errors: The validation errors. - :type validation_errors: list[~azure.mgmt.hdinsight.models.ValidationErrorInfo] - :param validation_warnings: The validation warnings. - :type validation_warnings: list[~azure.mgmt.hdinsight.models.ValidationErrorInfo] - :param estimated_creation_duration: The estimated creation duration. - :type estimated_creation_duration: ~datetime.timedelta - :param aadds_resources_details: The Azure active directory domain service resource details. - :type aadds_resources_details: list[~azure.mgmt.hdinsight.models.AaddsResourceDetails] - """ - - _attribute_map = { - 'validation_errors': {'key': 'validationErrors', 'type': '[ValidationErrorInfo]'}, - 'validation_warnings': {'key': 'validationWarnings', 'type': '[ValidationErrorInfo]'}, - 'estimated_creation_duration': {'key': 'estimatedCreationDuration', 'type': 'duration'}, - 'aadds_resources_details': {'key': 'aaddsResourcesDetails', 'type': '[AaddsResourceDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterCreateValidationResult, self).__init__(**kwargs) - self.validation_errors = kwargs.get('validation_errors', None) - self.validation_warnings = kwargs.get('validation_warnings', None) - self.estimated_creation_duration = kwargs.get('estimated_creation_duration', None) - self.aadds_resources_details = kwargs.get('aadds_resources_details', None) - - -class ClusterDefinition(msrest.serialization.Model): - """The cluster definition. - - :param blueprint: The link to the blueprint. - :type blueprint: str - :param kind: The type of cluster. - :type kind: str - :param component_version: The versions of different services in the cluster. - :type component_version: dict[str, str] - :param configurations: The cluster configurations. - :type configurations: any - """ - - _attribute_map = { - 'blueprint': {'key': 'blueprint', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'component_version': {'key': 'componentVersion', 'type': '{str}'}, - 'configurations': {'key': 'configurations', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterDefinition, self).__init__(**kwargs) - self.blueprint = kwargs.get('blueprint', None) - self.kind = kwargs.get('kind', None) - self.component_version = kwargs.get('component_version', None) - self.configurations = kwargs.get('configurations', None) - - -class ClusterDiskEncryptionParameters(msrest.serialization.Model): - """The Disk Encryption Cluster request parameters. - - :param vault_uri: Base key vault URI where the customers key is located eg. - https://myvault.vault.azure.net. - :type vault_uri: str - :param key_name: Key name that is used for enabling disk encryption. - :type key_name: str - :param key_version: Specific key version that is used for enabling disk encryption. - :type key_version: str - """ - - _attribute_map = { - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterDiskEncryptionParameters, self).__init__(**kwargs) - self.vault_uri = kwargs.get('vault_uri', None) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - - -class ClusterGetProperties(msrest.serialization.Model): - """The properties of cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param cluster_version: The version of the cluster. - :type cluster_version: str - :param cluster_hdp_version: The hdp version of the cluster. - :type cluster_hdp_version: str - :param os_type: The type of operating system. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.hdinsight.models.OSType - :param tier: The cluster tier. Possible values include: "Standard", "Premium". - :type tier: str or ~azure.mgmt.hdinsight.models.Tier - :param cluster_id: The cluster id. - :type cluster_id: str - :param cluster_definition: Required. The cluster definition. - :type cluster_definition: ~azure.mgmt.hdinsight.models.ClusterDefinition - :param kafka_rest_properties: The cluster kafka rest proxy configuration. - :type kafka_rest_properties: ~azure.mgmt.hdinsight.models.KafkaRestProperties - :param security_profile: The security profile. - :type security_profile: ~azure.mgmt.hdinsight.models.SecurityProfile - :param compute_profile: The compute profile. - :type compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile - :param provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "InProgress", "Failed", "Succeeded", "Canceled", "Deleting". - :type provisioning_state: str or ~azure.mgmt.hdinsight.models.HDInsightClusterProvisioningState - :param created_date: The date on which the cluster was created. - :type created_date: str - :param cluster_state: The state of the cluster. - :type cluster_state: str - :param quota_info: The quota information. - :type quota_info: ~azure.mgmt.hdinsight.models.QuotaInfo - :param errors: The list of errors. - :type errors: list[~azure.mgmt.hdinsight.models.Errors] - :param connectivity_endpoints: The list of connectivity endpoints. - :type connectivity_endpoints: list[~azure.mgmt.hdinsight.models.ConnectivityEndpoint] - :param disk_encryption_properties: The disk encryption properties. - :type disk_encryption_properties: ~azure.mgmt.hdinsight.models.DiskEncryptionProperties - :param encryption_in_transit_properties: The encryption-in-transit properties. - :type encryption_in_transit_properties: - ~azure.mgmt.hdinsight.models.EncryptionInTransitProperties - :param storage_profile: The storage profile. - :type storage_profile: ~azure.mgmt.hdinsight.models.StorageProfile - :param min_supported_tls_version: The minimal supported tls version. - :type min_supported_tls_version: str - :param excluded_services_config: The excluded services config. - :type excluded_services_config: ~azure.mgmt.hdinsight.models.ExcludedServicesConfig - :param network_properties: The network properties. - :type network_properties: ~azure.mgmt.hdinsight.models.NetworkProperties - :param compute_isolation_properties: The compute isolation properties. - :type compute_isolation_properties: ~azure.mgmt.hdinsight.models.ComputeIsolationProperties - :param private_link_configurations: The private link configurations. - :type private_link_configurations: list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] - :ivar private_endpoint_connections: The list of private endpoint connections. - :vartype private_endpoint_connections: - list[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] - """ - - _validation = { - 'cluster_definition': {'required': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'cluster_version': {'key': 'clusterVersion', 'type': 'str'}, - 'cluster_hdp_version': {'key': 'clusterHdpVersion', 'type': 'str'}, - 'os_type': {'key': 'osType', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'cluster_id': {'key': 'clusterId', 'type': 'str'}, - 'cluster_definition': {'key': 'clusterDefinition', 'type': 'ClusterDefinition'}, - 'kafka_rest_properties': {'key': 'kafkaRestProperties', 'type': 'KafkaRestProperties'}, - 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, - 'compute_profile': {'key': 'computeProfile', 'type': 'ComputeProfile'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'created_date': {'key': 'createdDate', 'type': 'str'}, - 'cluster_state': {'key': 'clusterState', 'type': 'str'}, - 'quota_info': {'key': 'quotaInfo', 'type': 'QuotaInfo'}, - 'errors': {'key': 'errors', 'type': '[Errors]'}, - 'connectivity_endpoints': {'key': 'connectivityEndpoints', 'type': '[ConnectivityEndpoint]'}, - 'disk_encryption_properties': {'key': 'diskEncryptionProperties', 'type': 'DiskEncryptionProperties'}, - 'encryption_in_transit_properties': {'key': 'encryptionInTransitProperties', 'type': 'EncryptionInTransitProperties'}, - 'storage_profile': {'key': 'storageProfile', 'type': 'StorageProfile'}, - 'min_supported_tls_version': {'key': 'minSupportedTlsVersion', 'type': 'str'}, - 'excluded_services_config': {'key': 'excludedServicesConfig', 'type': 'ExcludedServicesConfig'}, - 'network_properties': {'key': 'networkProperties', 'type': 'NetworkProperties'}, - 'compute_isolation_properties': {'key': 'computeIsolationProperties', 'type': 'ComputeIsolationProperties'}, - 'private_link_configurations': {'key': 'privateLinkConfigurations', 'type': '[PrivateLinkConfiguration]'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterGetProperties, self).__init__(**kwargs) - self.cluster_version = kwargs.get('cluster_version', None) - self.cluster_hdp_version = kwargs.get('cluster_hdp_version', None) - self.os_type = kwargs.get('os_type', None) - self.tier = kwargs.get('tier', None) - self.cluster_id = kwargs.get('cluster_id', None) - self.cluster_definition = kwargs['cluster_definition'] - self.kafka_rest_properties = kwargs.get('kafka_rest_properties', None) - self.security_profile = kwargs.get('security_profile', None) - self.compute_profile = kwargs.get('compute_profile', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.created_date = kwargs.get('created_date', None) - self.cluster_state = kwargs.get('cluster_state', None) - self.quota_info = kwargs.get('quota_info', None) - self.errors = kwargs.get('errors', None) - self.connectivity_endpoints = kwargs.get('connectivity_endpoints', None) - self.disk_encryption_properties = kwargs.get('disk_encryption_properties', None) - self.encryption_in_transit_properties = kwargs.get('encryption_in_transit_properties', None) - self.storage_profile = kwargs.get('storage_profile', None) - self.min_supported_tls_version = kwargs.get('min_supported_tls_version', None) - self.excluded_services_config = kwargs.get('excluded_services_config', None) - self.network_properties = kwargs.get('network_properties', None) - self.compute_isolation_properties = kwargs.get('compute_isolation_properties', None) - self.private_link_configurations = kwargs.get('private_link_configurations', None) - self.private_endpoint_connections = None - - -class ClusterIdentity(msrest.serialization.Model): - """Identity for the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of cluster identity. This property will only be provided - for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id associated with the cluster. This property will only be provided - for a system assigned identity. - :vartype tenant_id: str - :param type: The type of identity used for the cluster. The type 'SystemAssigned, UserAssigned' - includes both an implicitly created identity and a set of user assigned identities. Possible - values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.hdinsight.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the cluster. The - user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, ~azure.mgmt.hdinsight.models.UserAssignedIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ClusterListPersistedScriptActionsResult(msrest.serialization.Model): - """The ListPersistedScriptActions operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: The list of Persisted Script Actions. - :type value: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RuntimeScriptAction]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterListPersistedScriptActionsResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ClusterListResult(msrest.serialization.Model): - """The List Cluster operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: The list of Clusters. - :type value: list[~azure.mgmt.hdinsight.models.Cluster] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Cluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ClusterMonitoringRequest(msrest.serialization.Model): - """The cluster monitor parameters. - - :param workspace_id: The cluster monitor workspace ID. - :type workspace_id: str - :param primary_key: The cluster monitor workspace key. - :type primary_key: str - """ - - _attribute_map = { - 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterMonitoringRequest, self).__init__(**kwargs) - self.workspace_id = kwargs.get('workspace_id', None) - self.primary_key = kwargs.get('primary_key', None) - - -class ClusterMonitoringResponse(msrest.serialization.Model): - """The cluster monitoring status response. - - :param cluster_monitoring_enabled: The status of the monitor on the HDInsight cluster. - :type cluster_monitoring_enabled: bool - :param workspace_id: The workspace ID of the monitor on the HDInsight cluster. - :type workspace_id: str - """ - - _attribute_map = { - 'cluster_monitoring_enabled': {'key': 'clusterMonitoringEnabled', 'type': 'bool'}, - 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterMonitoringResponse, self).__init__(**kwargs) - self.cluster_monitoring_enabled = kwargs.get('cluster_monitoring_enabled', None) - self.workspace_id = kwargs.get('workspace_id', None) - - -class ClusterPatchParameters(msrest.serialization.Model): - """The PatchCluster request parameters. - - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterPatchParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class ClusterResizeParameters(msrest.serialization.Model): - """The Resize Cluster request parameters. - - :param target_instance_count: The target instance count for the operation. - :type target_instance_count: int - """ - - _attribute_map = { - 'target_instance_count': {'key': 'targetInstanceCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterResizeParameters, self).__init__(**kwargs) - self.target_instance_count = kwargs.get('target_instance_count', None) - - -class ComputeIsolationProperties(msrest.serialization.Model): - """The compute isolation properties. - - :param enable_compute_isolation: The flag indicates whether enable compute isolation or not. - :type enable_compute_isolation: bool - :param host_sku: The host sku. - :type host_sku: str - """ - - _attribute_map = { - 'enable_compute_isolation': {'key': 'enableComputeIsolation', 'type': 'bool'}, - 'host_sku': {'key': 'hostSku', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeIsolationProperties, self).__init__(**kwargs) - self.enable_compute_isolation = kwargs.get('enable_compute_isolation', False) - self.host_sku = kwargs.get('host_sku', None) - - -class ComputeProfile(msrest.serialization.Model): - """Describes the compute profile. - - :param roles: The list of roles in the cluster. - :type roles: list[~azure.mgmt.hdinsight.models.Role] - """ - - _attribute_map = { - 'roles': {'key': 'roles', 'type': '[Role]'}, - } - - def __init__( - self, - **kwargs - ): - super(ComputeProfile, self).__init__(**kwargs) - self.roles = kwargs.get('roles', None) - - -class ConnectivityEndpoint(msrest.serialization.Model): - """The connectivity properties. - - :param name: The name of the endpoint. - :type name: str - :param protocol: The protocol of the endpoint. - :type protocol: str - :param location: The location of the endpoint. - :type location: str - :param port: The port to connect to. - :type port: int - :param private_ip_address: The private ip address of the endpoint. - :type private_ip_address: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'protocol': {'key': 'protocol', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'port': {'key': 'port', 'type': 'int'}, - 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConnectivityEndpoint, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.protocol = kwargs.get('protocol', None) - self.location = kwargs.get('location', None) - self.port = kwargs.get('port', None) - self.private_ip_address = kwargs.get('private_ip_address', None) - - -class DataDisksGroups(msrest.serialization.Model): - """The data disks groups for the role. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param disks_per_node: The number of disks per node. - :type disks_per_node: int - :ivar storage_account_type: ReadOnly. The storage account type. Do not set this value. - :vartype storage_account_type: str - :ivar disk_size_gb: ReadOnly. The DiskSize in GB. Do not set this value. - :vartype disk_size_gb: int - """ - - _validation = { - 'storage_account_type': {'readonly': True}, - 'disk_size_gb': {'readonly': True}, - } - - _attribute_map = { - 'disks_per_node': {'key': 'disksPerNode', 'type': 'int'}, - 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, - 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataDisksGroups, self).__init__(**kwargs) - self.disks_per_node = kwargs.get('disks_per_node', None) - self.storage_account_type = None - self.disk_size_gb = None - - -class Dimension(msrest.serialization.Model): - """The definition of Dimension. - - :param name: The name of the dimension. - :type name: str - :param display_name: The display name of the dimension. - :type display_name: str - :param internal_name: The display name of the dimension. - :type internal_name: str - :param to_be_exported_for_shoebox: The flag indicates whether the metric will be exported for - shoebox or not. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'internal_name': {'key': 'internalName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.internal_name = kwargs.get('internal_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class DiskBillingMeters(msrest.serialization.Model): - """The disk billing meters. - - :param disk_rp_meter: The managed disk meter guid. - :type disk_rp_meter: str - :param sku: The managed disk billing sku, P30 or S30. - :type sku: str - :param tier: The managed disk billing tier, Standard or Premium. Possible values include: - "Standard", "Premium". - :type tier: str or ~azure.mgmt.hdinsight.models.Tier - """ - - _attribute_map = { - 'disk_rp_meter': {'key': 'diskRpMeter', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskBillingMeters, self).__init__(**kwargs) - self.disk_rp_meter = kwargs.get('disk_rp_meter', None) - self.sku = kwargs.get('sku', None) - self.tier = kwargs.get('tier', None) - - -class DiskEncryptionProperties(msrest.serialization.Model): - """The disk encryption properties. - - :param vault_uri: Base key vault URI where the customers key is located eg. - https://myvault.vault.azure.net. - :type vault_uri: str - :param key_name: Key name that is used for enabling disk encryption. - :type key_name: str - :param key_version: Specific key version that is used for enabling disk encryption. - :type key_version: str - :param encryption_algorithm: Algorithm identifier for encryption, default RSA-OAEP. Possible - values include: "RSA-OAEP", "RSA-OAEP-256", "RSA1_5". - :type encryption_algorithm: str or ~azure.mgmt.hdinsight.models.JsonWebKeyEncryptionAlgorithm - :param msi_resource_id: Resource ID of Managed Identity that is used to access the key vault. - :type msi_resource_id: str - :param encryption_at_host: Indicates whether or not resource disk encryption is enabled. - :type encryption_at_host: bool - """ - - _attribute_map = { - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - 'encryption_algorithm': {'key': 'encryptionAlgorithm', 'type': 'str'}, - 'msi_resource_id': {'key': 'msiResourceId', 'type': 'str'}, - 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DiskEncryptionProperties, self).__init__(**kwargs) - self.vault_uri = kwargs.get('vault_uri', None) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.encryption_algorithm = kwargs.get('encryption_algorithm', None) - self.msi_resource_id = kwargs.get('msi_resource_id', None) - self.encryption_at_host = kwargs.get('encryption_at_host', False) - - -class EncryptionInTransitProperties(msrest.serialization.Model): - """The encryption-in-transit properties. - - :param is_encryption_in_transit_enabled: Indicates whether or not inter cluster node - communication is encrypted in transit. - :type is_encryption_in_transit_enabled: bool - """ - - _attribute_map = { - 'is_encryption_in_transit_enabled': {'key': 'isEncryptionInTransitEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionInTransitProperties, self).__init__(**kwargs) - self.is_encryption_in_transit_enabled = kwargs.get('is_encryption_in_transit_enabled', False) - - -class ErrorResponse(msrest.serialization.Model): - """Describes the format of Error response. - - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class Errors(msrest.serialization.Model): - """The error message associated with the cluster creation. - - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Errors, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ExcludedServicesConfig(msrest.serialization.Model): - """The configuration that services will be excluded when creating cluster. - - :param excluded_services_config_id: The config id of excluded services. - :type excluded_services_config_id: str - :param excluded_services_list: The list of excluded services. - :type excluded_services_list: str - """ - - _attribute_map = { - 'excluded_services_config_id': {'key': 'excludedServicesConfigId', 'type': 'str'}, - 'excluded_services_list': {'key': 'excludedServicesList', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExcludedServicesConfig, self).__init__(**kwargs) - self.excluded_services_config_id = kwargs.get('excluded_services_config_id', None) - self.excluded_services_list = kwargs.get('excluded_services_list', None) - - -class ExecuteScriptActionParameters(msrest.serialization.Model): - """The parameters for the script actions to execute on a running cluster. - - All required parameters must be populated in order to send to Azure. - - :param script_actions: The list of run time script actions. - :type script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] - :param persist_on_success: Required. Gets or sets if the scripts needs to be persisted. - :type persist_on_success: bool - """ - - _validation = { - 'persist_on_success': {'required': True}, - } - - _attribute_map = { - 'script_actions': {'key': 'scriptActions', 'type': '[RuntimeScriptAction]'}, - 'persist_on_success': {'key': 'persistOnSuccess', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ExecuteScriptActionParameters, self).__init__(**kwargs) - self.script_actions = kwargs.get('script_actions', None) - self.persist_on_success = kwargs['persist_on_success'] - - -class Extension(msrest.serialization.Model): - """Cluster monitoring extensions. - - :param workspace_id: The workspace ID for the cluster monitoring extension. - :type workspace_id: str - :param primary_key: The certificate for the cluster monitoring extensions. - :type primary_key: str - """ - - _attribute_map = { - 'workspace_id': {'key': 'workspaceId', 'type': 'str'}, - 'primary_key': {'key': 'primaryKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.workspace_id = kwargs.get('workspace_id', None) - self.primary_key = kwargs.get('primary_key', None) - - -class GatewaySettings(msrest.serialization.Model): - """Gateway settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar is_credential_enabled: Indicates whether or not the gateway settings based authorization - is enabled. - :vartype is_credential_enabled: str - :ivar user_name: The gateway settings user name. - :vartype user_name: str - :ivar password: The gateway settings user password. - :vartype password: str - """ - - _validation = { - 'is_credential_enabled': {'readonly': True}, - 'user_name': {'readonly': True}, - 'password': {'readonly': True}, - } - - _attribute_map = { - 'is_credential_enabled': {'key': 'restAuthCredential\\.isEnabled', 'type': 'str'}, - 'user_name': {'key': 'restAuthCredential\\.username', 'type': 'str'}, - 'password': {'key': 'restAuthCredential\\.password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GatewaySettings, self).__init__(**kwargs) - self.is_credential_enabled = None - self.user_name = None - self.password = None - - -class HardwareProfile(msrest.serialization.Model): - """The hardware profile. - - :param vm_size: The size of the VM. - :type vm_size: str - """ - - _attribute_map = { - 'vm_size': {'key': 'vmSize', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HardwareProfile, self).__init__(**kwargs) - self.vm_size = kwargs.get('vm_size', None) - - -class HostInfo(msrest.serialization.Model): - """The cluster host information. - - :param name: The host name. - :type name: str - :param fqdn: The Fully Qualified Domain Name of host. - :type fqdn: str - :param effective_disk_encryption_key_url: The effective disk encryption key URL used by the - host. - :type effective_disk_encryption_key_url: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'fqdn': {'key': 'fqdn', 'type': 'str'}, - 'effective_disk_encryption_key_url': {'key': 'effectiveDiskEncryptionKeyUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HostInfo, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.fqdn = kwargs.get('fqdn', None) - self.effective_disk_encryption_key_url = kwargs.get('effective_disk_encryption_key_url', None) - - -class IPConfiguration(msrest.serialization.Model): - """The ip configurations for the private link service. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The private link IP configuration id. - :vartype id: str - :param name: Required. The name of private link IP configuration. - :type name: str - :ivar type: The type of the private link IP configuration. - :vartype type: str - :ivar provisioning_state: The private link configuration provisioning state, which only appears - in the response. Possible values include: "InProgress", "Failed", "Succeeded", "Canceled", - "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.hdinsight.models.PrivateLinkConfigurationProvisioningState - :param primary: Indicates whether this IP configuration is primary for the corresponding NIC. - :type primary: bool - :param private_ip_address: The IP address. - :type private_ip_address: str - :param private_ip_allocation_method: The method that private IP address is allocated. Possible - values include: "dynamic", "static". - :type private_ip_allocation_method: str or - ~azure.mgmt.hdinsight.models.PrivateIPAllocationMethod - :param subnet: The subnet resource id. - :type subnet: ~azure.mgmt.hdinsight.models.ResourceId - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'required': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'primary': {'key': 'properties.primary', 'type': 'bool'}, - 'private_ip_address': {'key': 'properties.privateIPAddress', 'type': 'str'}, - 'private_ip_allocation_method': {'key': 'properties.privateIPAllocationMethod', 'type': 'str'}, - 'subnet': {'key': 'properties.subnet', 'type': 'ResourceId'}, - } - - def __init__( - self, - **kwargs - ): - super(IPConfiguration, self).__init__(**kwargs) - self.id = None - self.name = kwargs['name'] - self.type = None - self.provisioning_state = None - self.primary = kwargs.get('primary', None) - self.private_ip_address = kwargs.get('private_ip_address', None) - self.private_ip_allocation_method = kwargs.get('private_ip_allocation_method', None) - self.subnet = kwargs.get('subnet', None) - - -class KafkaRestProperties(msrest.serialization.Model): - """The kafka rest proxy configuration which contains AAD security group information. - - :param client_group_info: The information of AAD security group. - :type client_group_info: ~azure.mgmt.hdinsight.models.ClientGroupInfo - :param configuration_override: The configurations that need to be overriden. - :type configuration_override: dict[str, str] - """ - - _attribute_map = { - 'client_group_info': {'key': 'clientGroupInfo', 'type': 'ClientGroupInfo'}, - 'configuration_override': {'key': 'configurationOverride', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(KafkaRestProperties, self).__init__(**kwargs) - self.client_group_info = kwargs.get('client_group_info', None) - self.configuration_override = kwargs.get('configuration_override', None) - - -class LinuxOperatingSystemProfile(msrest.serialization.Model): - """The ssh username, password, and ssh public key. - - :param username: The username. - :type username: str - :param password: The password. - :type password: str - :param ssh_profile: The SSH profile. - :type ssh_profile: ~azure.mgmt.hdinsight.models.SshProfile - """ - - _attribute_map = { - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'ssh_profile': {'key': 'sshProfile', 'type': 'SshProfile'}, - } - - def __init__( - self, - **kwargs - ): - super(LinuxOperatingSystemProfile, self).__init__(**kwargs) - self.username = kwargs.get('username', None) - self.password = kwargs.get('password', None) - self.ssh_profile = kwargs.get('ssh_profile', None) - - -class LocalizedName(msrest.serialization.Model): - """The details about the localizable name of a type of usage. - - :param value: The name of the used resource. - :type value: str - :param localized_value: The localized name of the used resource. - :type localized_value: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LocalizedName, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.localized_value = kwargs.get('localized_value', None) - - -class MetricSpecifications(msrest.serialization.Model): - """The details of metric specifications. - - :param name: The name of the metric specification. - :type name: str - :param display_name: The display name of the metric specification. - :type display_name: str - :param display_description: The display description of the metric specification. - :type display_description: str - :param unit: The unit of the metric specification. - :type unit: str - :param aggregation_type: The aggregation type of the metric specification. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types of the metric - specification. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types of the metric specification. - :type supported_time_grain_types: list[str] - :param enable_regional_mdm_account: The flag indicates whether enable regional mdm account or - not. - :type enable_regional_mdm_account: bool - :param source_mdm_account: The source mdm account. - :type source_mdm_account: str - :param source_mdm_namespace: The source mdm namespace. - :type source_mdm_namespace: str - :param metric_filter_pattern: The metric filter pattern. - :type metric_filter_pattern: str - :param fill_gap_with_zero: The flag indicates whether filling gap with zero. - :type fill_gap_with_zero: bool - :param category: The category of the metric. - :type category: str - :param resource_id_dimension_name_override: The override name of resource id dimension name. - :type resource_id_dimension_name_override: str - :param is_internal: The flag indicates whether the metric is internal or not. - :type is_internal: bool - :param delegate_metric_name_override: The override name of delegate metric. - :type delegate_metric_name_override: str - :param dimensions: The dimensions of the metric specification. - :type dimensions: list[~azure.mgmt.hdinsight.models.Dimension] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'bool'}, - 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'is_internal': {'key': 'isInternal', 'type': 'bool'}, - 'delegate_metric_name_override': {'key': 'delegateMetricNameOverride', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecifications, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) - self.source_mdm_account = kwargs.get('source_mdm_account', None) - self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) - self.metric_filter_pattern = kwargs.get('metric_filter_pattern', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.is_internal = kwargs.get('is_internal', None) - self.delegate_metric_name_override = kwargs.get('delegate_metric_name_override', None) - self.dimensions = kwargs.get('dimensions', None) - - -class NameAvailabilityCheckRequestParameters(msrest.serialization.Model): - """The request spec of checking name availability. - - :param name: The resource name. - :type name: str - :param type: The resource type. - :type type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameAvailabilityCheckRequestParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class NameAvailabilityCheckResult(msrest.serialization.Model): - """The response spec of checking name availability. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name_available: This indicates whether the name is available. - :type name_available: bool - :ivar reason: The reason of the result. - :vartype reason: str - :ivar message: The related message. - :vartype message: str - """ - - _validation = { - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameAvailabilityCheckResult, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = None - self.message = None - - -class NetworkProperties(msrest.serialization.Model): - """The network properties. - - :param resource_provider_connection: The direction for the resource provider connection. - Possible values include: "Inbound", "Outbound". - :type resource_provider_connection: str or - ~azure.mgmt.hdinsight.models.ResourceProviderConnection - :param private_link: Indicates whether or not private link is enabled. Possible values include: - "Disabled", "Enabled". - :type private_link: str or ~azure.mgmt.hdinsight.models.PrivateLink - """ - - _attribute_map = { - 'resource_provider_connection': {'key': 'resourceProviderConnection', 'type': 'str'}, - 'private_link': {'key': 'privateLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkProperties, self).__init__(**kwargs) - self.resource_provider_connection = kwargs.get('resource_provider_connection', None) - self.private_link = kwargs.get('private_link', None) - - -class Operation(msrest.serialization.Model): - """The HDInsight REST API operation. - - :param name: The operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display of operation. - :type display: ~azure.mgmt.hdinsight.models.OperationDisplay - :param properties: The operation properties. - :type properties: ~azure.mgmt.hdinsight.models.OperationProperties - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.properties = kwargs.get('properties', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - :param provider: The service provider: Microsoft.HDInsight. - :type provider: str - :param resource: The resource on which the operation is performed: Cluster, Applications, etc. - :type resource: str - :param operation: The operation type: read, write, delete, etc. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list HDInsight operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: The list of HDInsight operations supported by the HDInsight resource provider. - :type value: list[~azure.mgmt.hdinsight.models.Operation] - :param next_link: The URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationProperties(msrest.serialization.Model): - """The details of operation. - - :param service_specification: The specification of the service. - :type service_specification: ~azure.mgmt.hdinsight.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = kwargs.get('service_specification', None) - - -class OsProfile(msrest.serialization.Model): - """The Linux operation systems profile. - - :param linux_operating_system_profile: The Linux OS profile. - :type linux_operating_system_profile: ~azure.mgmt.hdinsight.models.LinuxOperatingSystemProfile - """ - - _attribute_map = { - 'linux_operating_system_profile': {'key': 'linuxOperatingSystemProfile', 'type': 'LinuxOperatingSystemProfile'}, - } - - def __init__( - self, - **kwargs - ): - super(OsProfile, self).__init__(**kwargs) - self.linux_operating_system_profile = kwargs.get('linux_operating_system_profile', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The private endpoint. - - :param id: The private endpoint id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class PrivateEndpointConnection(ResourceAutoGenerated): - """The private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.hdinsight.models.SystemData - :ivar private_endpoint: The private endpoint of the private endpoint connection. - :vartype private_endpoint: ~azure.mgmt.hdinsight.models.PrivateEndpoint - :param private_link_service_connection_state: Required. The private link service connection - state. - :type private_link_service_connection_state: - ~azure.mgmt.hdinsight.models.PrivateLinkServiceConnectionState - :ivar link_identifier: The link identifier. - :vartype link_identifier: str - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "InProgress", "Updating", "Failed", "Succeeded", "Canceled", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.hdinsight.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'private_endpoint': {'readonly': True}, - 'private_link_service_connection_state': {'required': True}, - 'link_identifier': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'link_identifier': {'key': 'properties.linkIdentifier', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.system_data = None - self.private_endpoint = None - self.private_link_service_connection_state = kwargs['private_link_service_connection_state'] - self.link_identifier = None - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """The list private endpoint connections response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: The list of private endpoint connections. - :type value: list[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class PrivateLinkConfiguration(msrest.serialization.Model): - """The private link configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The private link configuration id. - :vartype id: str - :param name: Required. The name of private link configuration. - :type name: str - :ivar type: The type of the private link configuration. - :vartype type: str - :param group_id: Required. The HDInsight private linkable sub-resource name to apply the - private link configuration to. For example, 'headnode', 'gateway', 'edgenode'. - :type group_id: str - :ivar provisioning_state: The private link configuration provisioning state, which only appears - in the response. Possible values include: "InProgress", "Failed", "Succeeded", "Canceled", - "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.hdinsight.models.PrivateLinkConfigurationProvisioningState - :param ip_configurations: Required. The IP configurations for the private link service. - :type ip_configurations: list[~azure.mgmt.hdinsight.models.IPConfiguration] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'required': True}, - 'type': {'readonly': True}, - 'group_id': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'ip_configurations': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[IPConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkConfiguration, self).__init__(**kwargs) - self.id = None - self.name = kwargs['name'] - self.type = None - self.group_id = kwargs['group_id'] - self.provisioning_state = None - self.ip_configurations = kwargs['ip_configurations'] - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.hdinsight.models.SystemData - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.system_data = None - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.hdinsight.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """The private link service connection state. - - All required parameters must be populated in order to send to Azure. - - :param status: Required. The concrete private link service connection. Possible values include: - "Approved", "Rejected", "Pending", "Removed". - :type status: str or ~azure.mgmt.hdinsight.models.PrivateLinkServiceConnectionStatus - :param description: The optional description of the status. - :type description: str - :param actions_required: Whether there is further actions. - :type actions_required: str - """ - - _validation = { - 'status': {'required': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs['status'] - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class QuotaCapability(msrest.serialization.Model): - """The regional quota capability. - - :param cores_used: The number of cores used in the subscription. - :type cores_used: long - :param max_cores_allowed: The number of cores that the subscription allowed. - :type max_cores_allowed: long - :param regional_quotas: The list of region quota capabilities. - :type regional_quotas: list[~azure.mgmt.hdinsight.models.RegionalQuotaCapability] - """ - - _attribute_map = { - 'cores_used': {'key': 'coresUsed', 'type': 'long'}, - 'max_cores_allowed': {'key': 'maxCoresAllowed', 'type': 'long'}, - 'regional_quotas': {'key': 'regionalQuotas', 'type': '[RegionalQuotaCapability]'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaCapability, self).__init__(**kwargs) - self.cores_used = kwargs.get('cores_used', None) - self.max_cores_allowed = kwargs.get('max_cores_allowed', None) - self.regional_quotas = kwargs.get('regional_quotas', None) - - -class QuotaInfo(msrest.serialization.Model): - """The quota properties for the cluster. - - :param cores_used: The cores used by the cluster. - :type cores_used: int - """ - - _attribute_map = { - 'cores_used': {'key': 'coresUsed', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaInfo, self).__init__(**kwargs) - self.cores_used = kwargs.get('cores_used', None) - - -class RegionalQuotaCapability(msrest.serialization.Model): - """The regional quota capacity. - - :param region_name: The region name. - :type region_name: str - :param cores_used: The number of cores used in the region. - :type cores_used: long - :param cores_available: The number of cores available in the region. - :type cores_available: long - """ - - _attribute_map = { - 'region_name': {'key': 'regionName', 'type': 'str'}, - 'cores_used': {'key': 'coresUsed', 'type': 'long'}, - 'cores_available': {'key': 'coresAvailable', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(RegionalQuotaCapability, self).__init__(**kwargs) - self.region_name = kwargs.get('region_name', None) - self.cores_used = kwargs.get('cores_used', None) - self.cores_available = kwargs.get('cores_available', None) - - -class RegionsCapability(msrest.serialization.Model): - """The regions capability. - - :param available: The list of region capabilities. - :type available: list[str] - """ - - _attribute_map = { - 'available': {'key': 'available', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(RegionsCapability, self).__init__(**kwargs) - self.available = kwargs.get('available', None) - - -class ResourceId(msrest.serialization.Model): - """The azure resource id. - - :param id: The azure resource id. - :type id: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceId, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class Role(msrest.serialization.Model): - """Describes a role on the cluster. - - :param name: The name of the role. - :type name: str - :param min_instance_count: The minimum instance count of the cluster. - :type min_instance_count: int - :param target_instance_count: The instance count of the cluster. - :type target_instance_count: int - :param vm_group_name: The name of the virtual machine group. - :type vm_group_name: str - :param autoscale_configuration: The autoscale configurations. - :type autoscale_configuration: ~azure.mgmt.hdinsight.models.Autoscale - :param hardware_profile: The hardware profile. - :type hardware_profile: ~azure.mgmt.hdinsight.models.HardwareProfile - :param os_profile: The operating system profile. - :type os_profile: ~azure.mgmt.hdinsight.models.OsProfile - :param virtual_network_profile: The virtual network profile. - :type virtual_network_profile: ~azure.mgmt.hdinsight.models.VirtualNetworkProfile - :param data_disks_groups: The data disks groups for the role. - :type data_disks_groups: list[~azure.mgmt.hdinsight.models.DataDisksGroups] - :param script_actions: The list of script actions on the role. - :type script_actions: list[~azure.mgmt.hdinsight.models.ScriptAction] - :param encrypt_data_disks: Indicates whether encrypt the data disks. - :type encrypt_data_disks: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'min_instance_count': {'key': 'minInstanceCount', 'type': 'int'}, - 'target_instance_count': {'key': 'targetInstanceCount', 'type': 'int'}, - 'vm_group_name': {'key': 'VMGroupName', 'type': 'str'}, - 'autoscale_configuration': {'key': 'autoscale', 'type': 'Autoscale'}, - 'hardware_profile': {'key': 'hardwareProfile', 'type': 'HardwareProfile'}, - 'os_profile': {'key': 'osProfile', 'type': 'OsProfile'}, - 'virtual_network_profile': {'key': 'virtualNetworkProfile', 'type': 'VirtualNetworkProfile'}, - 'data_disks_groups': {'key': 'dataDisksGroups', 'type': '[DataDisksGroups]'}, - 'script_actions': {'key': 'scriptActions', 'type': '[ScriptAction]'}, - 'encrypt_data_disks': {'key': 'encryptDataDisks', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Role, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.min_instance_count = kwargs.get('min_instance_count', None) - self.target_instance_count = kwargs.get('target_instance_count', None) - self.vm_group_name = kwargs.get('vm_group_name', None) - self.autoscale_configuration = kwargs.get('autoscale_configuration', None) - self.hardware_profile = kwargs.get('hardware_profile', None) - self.os_profile = kwargs.get('os_profile', None) - self.virtual_network_profile = kwargs.get('virtual_network_profile', None) - self.data_disks_groups = kwargs.get('data_disks_groups', None) - self.script_actions = kwargs.get('script_actions', None) - self.encrypt_data_disks = kwargs.get('encrypt_data_disks', False) - - -class RuntimeScriptAction(msrest.serialization.Model): - """Describes a script action on a running cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the script action. - :type name: str - :param uri: Required. The URI to the script. - :type uri: str - :param parameters: The parameters for the script. - :type parameters: str - :param roles: Required. The list of roles where script will be executed. - :type roles: list[str] - :ivar application_name: The application name of the script action, if any. - :vartype application_name: str - """ - - _validation = { - 'name': {'required': True}, - 'uri': {'required': True}, - 'roles': {'required': True}, - 'application_name': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - 'roles': {'key': 'roles', 'type': '[str]'}, - 'application_name': {'key': 'applicationName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuntimeScriptAction, self).__init__(**kwargs) - self.name = kwargs['name'] - self.uri = kwargs['uri'] - self.parameters = kwargs.get('parameters', None) - self.roles = kwargs['roles'] - self.application_name = None - - -class RuntimeScriptActionDetail(RuntimeScriptAction): - """The execution details of a script action. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the script action. - :type name: str - :param uri: Required. The URI to the script. - :type uri: str - :param parameters: The parameters for the script. - :type parameters: str - :param roles: Required. The list of roles where script will be executed. - :type roles: list[str] - :ivar application_name: The application name of the script action, if any. - :vartype application_name: str - :ivar script_execution_id: The execution id of the script action. - :vartype script_execution_id: long - :ivar start_time: The start time of script action execution. - :vartype start_time: str - :ivar end_time: The end time of script action execution. - :vartype end_time: str - :ivar status: The current execution status of the script action. - :vartype status: str - :ivar operation: The reason why the script action was executed. - :vartype operation: str - :ivar execution_summary: The summary of script action execution result. - :vartype execution_summary: list[~azure.mgmt.hdinsight.models.ScriptActionExecutionSummary] - :ivar debug_information: The script action execution debug information. - :vartype debug_information: str - """ - - _validation = { - 'name': {'required': True}, - 'uri': {'required': True}, - 'roles': {'required': True}, - 'application_name': {'readonly': True}, - 'script_execution_id': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'status': {'readonly': True}, - 'operation': {'readonly': True}, - 'execution_summary': {'readonly': True}, - 'debug_information': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - 'roles': {'key': 'roles', 'type': '[str]'}, - 'application_name': {'key': 'applicationName', 'type': 'str'}, - 'script_execution_id': {'key': 'scriptExecutionId', 'type': 'long'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'end_time': {'key': 'endTime', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'execution_summary': {'key': 'executionSummary', 'type': '[ScriptActionExecutionSummary]'}, - 'debug_information': {'key': 'debugInformation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RuntimeScriptActionDetail, self).__init__(**kwargs) - self.script_execution_id = None - self.start_time = None - self.end_time = None - self.status = None - self.operation = None - self.execution_summary = None - self.debug_information = None - - -class ScriptAction(msrest.serialization.Model): - """Describes a script action on role on the cluster. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the script action. - :type name: str - :param uri: Required. The URI to the script. - :type uri: str - :param parameters: Required. The parameters for the script provided. - :type parameters: str - """ - - _validation = { - 'name': {'required': True}, - 'uri': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptAction, self).__init__(**kwargs) - self.name = kwargs['name'] - self.uri = kwargs['uri'] - self.parameters = kwargs['parameters'] - - -class ScriptActionExecutionHistoryList(msrest.serialization.Model): - """The list script execution history response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of persisted script action details for the cluster. - :vartype value: list[~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RuntimeScriptActionDetail]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptActionExecutionHistoryList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ScriptActionExecutionSummary(msrest.serialization.Model): - """The execution summary of a script action. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of script action execution. - :vartype status: str - :ivar instance_count: The instance count for a given script action execution status. - :vartype instance_count: int - """ - - _validation = { - 'status': {'readonly': True}, - 'instance_count': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptActionExecutionSummary, self).__init__(**kwargs) - self.status = None - self.instance_count = None - - -class ScriptActionPersistedGetResponseSpec(msrest.serialization.Model): - """The persisted script action for cluster. - - :param name: The name of script action. - :type name: str - :param uri: The URI to the script. - :type uri: str - :param parameters: The parameters for the script provided. - :type parameters: str - :param roles: The list of roles where script will be executed. - :type roles: list[str] - :param application_name: The application name for the script action. - :type application_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'uri': {'key': 'uri', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': 'str'}, - 'roles': {'key': 'roles', 'type': '[str]'}, - 'application_name': {'key': 'applicationName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptActionPersistedGetResponseSpec, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.uri = kwargs.get('uri', None) - self.parameters = kwargs.get('parameters', None) - self.roles = kwargs.get('roles', None) - self.application_name = kwargs.get('application_name', None) - - -class ScriptActionsList(msrest.serialization.Model): - """The persisted script action for the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: The list of persisted script action details for the cluster. - :type value: list[~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail] - :ivar next_link: The link (url) to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RuntimeScriptActionDetail]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptActionsList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class SecurityProfile(msrest.serialization.Model): - """The security profile which contains Ssh public key for the HDInsight cluster. - - :param directory_type: The directory type. Possible values include: "ActiveDirectory". - :type directory_type: str or ~azure.mgmt.hdinsight.models.DirectoryType - :param domain: The organization's active directory domain. - :type domain: str - :param organizational_unit_dn: The organizational unit within the Active Directory to place the - cluster and service accounts. - :type organizational_unit_dn: str - :param ldaps_urls: The LDAPS protocol URLs to communicate with the Active Directory. - :type ldaps_urls: list[str] - :param domain_username: The domain user account that will have admin privileges on the cluster. - :type domain_username: str - :param domain_user_password: The domain admin password. - :type domain_user_password: str - :param cluster_users_group_d_ns: Optional. The Distinguished Names for cluster user groups. - :type cluster_users_group_d_ns: list[str] - :param aadds_resource_id: The resource ID of the user's Azure Active Directory Domain Service. - :type aadds_resource_id: str - :param msi_resource_id: User assigned identity that has permissions to read and create - cluster-related artifacts in the user's AADDS. - :type msi_resource_id: str - """ - - _attribute_map = { - 'directory_type': {'key': 'directoryType', 'type': 'str'}, - 'domain': {'key': 'domain', 'type': 'str'}, - 'organizational_unit_dn': {'key': 'organizationalUnitDN', 'type': 'str'}, - 'ldaps_urls': {'key': 'ldapsUrls', 'type': '[str]'}, - 'domain_username': {'key': 'domainUsername', 'type': 'str'}, - 'domain_user_password': {'key': 'domainUserPassword', 'type': 'str'}, - 'cluster_users_group_d_ns': {'key': 'clusterUsersGroupDNs', 'type': '[str]'}, - 'aadds_resource_id': {'key': 'aaddsResourceId', 'type': 'str'}, - 'msi_resource_id': {'key': 'msiResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecurityProfile, self).__init__(**kwargs) - self.directory_type = kwargs.get('directory_type', None) - self.domain = kwargs.get('domain', None) - self.organizational_unit_dn = kwargs.get('organizational_unit_dn', None) - self.ldaps_urls = kwargs.get('ldaps_urls', None) - self.domain_username = kwargs.get('domain_username', None) - self.domain_user_password = kwargs.get('domain_user_password', None) - self.cluster_users_group_d_ns = kwargs.get('cluster_users_group_d_ns', None) - self.aadds_resource_id = kwargs.get('aadds_resource_id', None) - self.msi_resource_id = kwargs.get('msi_resource_id', None) - - -class ServiceSpecification(msrest.serialization.Model): - """The specification of the service. - - :param metric_specifications: The metric specifications. - :type metric_specifications: list[~azure.mgmt.hdinsight.models.MetricSpecifications] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecifications]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class SshProfile(msrest.serialization.Model): - """The list of SSH public keys. - - :param public_keys: The list of SSH public keys. - :type public_keys: list[~azure.mgmt.hdinsight.models.SshPublicKey] - """ - - _attribute_map = { - 'public_keys': {'key': 'publicKeys', 'type': '[SshPublicKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(SshProfile, self).__init__(**kwargs) - self.public_keys = kwargs.get('public_keys', None) - - -class SshPublicKey(msrest.serialization.Model): - """The SSH public key for the cluster nodes. - - :param certificate_data: The certificate for SSH. - :type certificate_data: str - """ - - _attribute_map = { - 'certificate_data': {'key': 'certificateData', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SshPublicKey, self).__init__(**kwargs) - self.certificate_data = kwargs.get('certificate_data', None) - - -class StorageAccount(msrest.serialization.Model): - """The storage Account. - - :param name: The name of the storage account. - :type name: str - :param is_default: Whether or not the storage account is the default storage account. - :type is_default: bool - :param container: The container in the storage account, only to be specified for WASB storage - accounts. - :type container: str - :param file_system: The filesystem, only to be specified for Azure Data Lake Storage Gen 2. - :type file_system: str - :param key: The storage account access key. - :type key: str - :param resource_id: The resource ID of storage account, only to be specified for Azure Data - Lake Storage Gen 2. - :type resource_id: str - :param msi_resource_id: The managed identity (MSI) that is allowed to access the storage - account, only to be specified for Azure Data Lake Storage Gen 2. - :type msi_resource_id: str - :param saskey: The shared access signature key. - :type saskey: str - :param fileshare: The file share name. - :type fileshare: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'container': {'key': 'container', 'type': 'str'}, - 'file_system': {'key': 'fileSystem', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'msi_resource_id': {'key': 'msiResourceId', 'type': 'str'}, - 'saskey': {'key': 'saskey', 'type': 'str'}, - 'fileshare': {'key': 'fileshare', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageAccount, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_default = kwargs.get('is_default', None) - self.container = kwargs.get('container', None) - self.file_system = kwargs.get('file_system', None) - self.key = kwargs.get('key', None) - self.resource_id = kwargs.get('resource_id', None) - self.msi_resource_id = kwargs.get('msi_resource_id', None) - self.saskey = kwargs.get('saskey', None) - self.fileshare = kwargs.get('fileshare', None) - - -class StorageProfile(msrest.serialization.Model): - """The storage profile. - - :param storageaccounts: The list of storage accounts in the cluster. - :type storageaccounts: list[~azure.mgmt.hdinsight.models.StorageAccount] - """ - - _attribute_map = { - 'storageaccounts': {'key': 'storageaccounts', 'type': '[StorageAccount]'}, - } - - def __init__( - self, - **kwargs - ): - super(StorageProfile, self).__init__(**kwargs) - self.storageaccounts = kwargs.get('storageaccounts', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.hdinsight.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.hdinsight.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class UpdateClusterIdentityCertificateParameters(msrest.serialization.Model): - """The update cluster identity certificate request parameters. - - :param application_id: The application id. - :type application_id: str - :param certificate: The certificate in base64 encoded format. - :type certificate: str - :param certificate_password: The password of the certificate. - :type certificate_password: str - """ - - _attribute_map = { - 'application_id': {'key': 'applicationId', 'type': 'str'}, - 'certificate': {'key': 'certificate', 'type': 'str'}, - 'certificate_password': {'key': 'certificatePassword', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateClusterIdentityCertificateParameters, self).__init__(**kwargs) - self.application_id = kwargs.get('application_id', None) - self.certificate = kwargs.get('certificate', None) - self.certificate_password = kwargs.get('certificate_password', None) - - -class UpdateGatewaySettingsParameters(msrest.serialization.Model): - """The update gateway settings request parameters. - - :param is_credential_enabled: Indicates whether or not the gateway settings based authorization - is enabled. - :type is_credential_enabled: bool - :param user_name: The gateway settings user name. - :type user_name: str - :param password: The gateway settings user password. - :type password: str - """ - - _attribute_map = { - 'is_credential_enabled': {'key': 'restAuthCredential\\.isEnabled', 'type': 'bool'}, - 'user_name': {'key': 'restAuthCredential\\.username', 'type': 'str'}, - 'password': {'key': 'restAuthCredential\\.password', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateGatewaySettingsParameters, self).__init__(**kwargs) - self.is_credential_enabled = kwargs.get('is_credential_enabled', True) - self.user_name = kwargs.get('user_name', None) - self.password = kwargs.get('password', None) - - -class Usage(msrest.serialization.Model): - """The details about the usage of a particular limited resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param unit: The type of measurement for usage. - :type unit: str - :param current_value: The current usage. - :type current_value: long - :param limit: The maximum allowed usage. - :type limit: long - :ivar name: The details about the localizable name of the used resource. - :vartype name: ~azure.mgmt.hdinsight.models.LocalizedName - """ - - _validation = { - 'name': {'readonly': True}, - } - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'LocalizedName'}, - } - - def __init__( - self, - **kwargs - ): - super(Usage, self).__init__(**kwargs) - self.unit = kwargs.get('unit', None) - self.current_value = kwargs.get('current_value', None) - self.limit = kwargs.get('limit', None) - self.name = None - - -class UsagesListResult(msrest.serialization.Model): - """The response for the operation to get regional usages for a subscription. - - :param value: The list of usages. - :type value: list[~azure.mgmt.hdinsight.models.Usage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Usage]'}, - } - - def __init__( - self, - **kwargs - ): - super(UsagesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class UserAssignedIdentity(msrest.serialization.Model): - """The User Assigned Identity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str - :param tenant_id: The tenant id of user assigned identity. - :type tenant_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - self.tenant_id = kwargs.get('tenant_id', None) - - -class ValidationErrorInfo(msrest.serialization.Model): - """The validation error information. - - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param error_resource: The error resource. - :type error_resource: str - :param message_arguments: The message arguments. - :type message_arguments: list[str] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'error_resource': {'key': 'errorResource', 'type': 'str'}, - 'message_arguments': {'key': 'messageArguments', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ValidationErrorInfo, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.error_resource = kwargs.get('error_resource', None) - self.message_arguments = kwargs.get('message_arguments', None) - - -class VersionsCapability(msrest.serialization.Model): - """The version capability. - - :param available: The list of version capabilities. - :type available: list[~azure.mgmt.hdinsight.models.VersionSpec] - """ - - _attribute_map = { - 'available': {'key': 'available', 'type': '[VersionSpec]'}, - } - - def __init__( - self, - **kwargs - ): - super(VersionsCapability, self).__init__(**kwargs) - self.available = kwargs.get('available', None) - - -class VersionSpec(msrest.serialization.Model): - """The version properties. - - :param friendly_name: The friendly name. - :type friendly_name: str - :param display_name: The display name. - :type display_name: str - :param is_default: Whether or not the version is the default version. - :type is_default: bool - :param component_versions: The component version property. - :type component_versions: dict[str, str] - """ - - _attribute_map = { - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'component_versions': {'key': 'componentVersions', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(VersionSpec, self).__init__(**kwargs) - self.friendly_name = kwargs.get('friendly_name', None) - self.display_name = kwargs.get('display_name', None) - self.is_default = kwargs.get('is_default', None) - self.component_versions = kwargs.get('component_versions', None) - - -class VirtualNetworkProfile(msrest.serialization.Model): - """The virtual network properties. - - :param id: The ID of the virtual network. - :type id: str - :param subnet: The name of the subnet. - :type subnet: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkProfile, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.subnet = kwargs.get('subnet', None) - - -class VmSizeCompatibilityFilterV2(msrest.serialization.Model): - """This class represent a single filter object that defines a multidimensional set. The dimensions of this set are Regions, ClusterFlavors, NodeTypes and ClusterVersions. The constraint should be defined based on the following: FilterMode (Exclude vs Include), VMSizes (the vm sizes in affect of exclusion/inclusion) and the ordering of the Filters. Later filters override previous settings if conflicted. - - :param filter_mode: The filtering mode. Effectively this can enabling or disabling the VM sizes - in a particular set. Possible values include: "Exclude", "Include", "Recommend", "Default". - :type filter_mode: str or ~azure.mgmt.hdinsight.models.FilterMode - :param regions: The list of regions under the effect of the filter. - :type regions: list[str] - :param cluster_flavors: The list of cluster flavors under the effect of the filter. - :type cluster_flavors: list[str] - :param node_types: The list of node types affected by the filter. - :type node_types: list[str] - :param cluster_versions: The list of cluster versions affected in Major.Minor format. - :type cluster_versions: list[str] - :param os_type: The OSType affected, Windows or Linux. - :type os_type: list[str or ~azure.mgmt.hdinsight.models.OSType] - :param vm_sizes: The list of virtual machine sizes to include or exclude. - :type vm_sizes: list[str] - :param esp_applied: Whether apply for ESP cluster. 'true' means only for ESP, 'false' means - only for non-ESP, null or empty string or others mean for both. - :type esp_applied: str - :param compute_isolation_supported: Whether support compute isolation. 'true' means only for - ComputeIsolationEnabled, 'false' means only for regular cluster. - :type compute_isolation_supported: str - """ - - _attribute_map = { - 'filter_mode': {'key': 'filterMode', 'type': 'str'}, - 'regions': {'key': 'regions', 'type': '[str]'}, - 'cluster_flavors': {'key': 'clusterFlavors', 'type': '[str]'}, - 'node_types': {'key': 'nodeTypes', 'type': '[str]'}, - 'cluster_versions': {'key': 'clusterVersions', 'type': '[str]'}, - 'os_type': {'key': 'osType', 'type': '[str]'}, - 'vm_sizes': {'key': 'vmSizes', 'type': '[str]'}, - 'esp_applied': {'key': 'espApplied', 'type': 'str'}, - 'compute_isolation_supported': {'key': 'computeIsolationSupported', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VmSizeCompatibilityFilterV2, self).__init__(**kwargs) - self.filter_mode = kwargs.get('filter_mode', None) - self.regions = kwargs.get('regions', None) - self.cluster_flavors = kwargs.get('cluster_flavors', None) - self.node_types = kwargs.get('node_types', None) - self.cluster_versions = kwargs.get('cluster_versions', None) - self.os_type = kwargs.get('os_type', None) - self.vm_sizes = kwargs.get('vm_sizes', None) - self.esp_applied = kwargs.get('esp_applied', None) - self.compute_isolation_supported = kwargs.get('compute_isolation_supported', None) - - -class VmSizeProperty(msrest.serialization.Model): - """The vm size property. - - :param name: The vm size name. - :type name: str - :param cores: The number of cores that the vm size has. - :type cores: int - :param data_disk_storage_tier: The data disk storage tier of the vm size. - :type data_disk_storage_tier: str - :param label: The label of the vm size. - :type label: str - :param max_data_disk_count: The max data disk count of the vm size. - :type max_data_disk_count: long - :param memory_in_mb: The memory whose unit is MB of the vm size. - :type memory_in_mb: long - :param supported_by_virtual_machines: This indicates this vm size is supported by virtual - machines or not. - :type supported_by_virtual_machines: bool - :param supported_by_web_worker_roles: The indicates this vm size is supported by web worker - roles or not. - :type supported_by_web_worker_roles: bool - :param virtual_machine_resource_disk_size_in_mb: The virtual machine resource disk size whose - unit is MB of the vm size. - :type virtual_machine_resource_disk_size_in_mb: long - :param web_worker_resource_disk_size_in_mb: The web worker resource disk size whose unit is MB - of the vm size. - :type web_worker_resource_disk_size_in_mb: long - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'cores': {'key': 'cores', 'type': 'int'}, - 'data_disk_storage_tier': {'key': 'dataDiskStorageTier', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'max_data_disk_count': {'key': 'maxDataDiskCount', 'type': 'long'}, - 'memory_in_mb': {'key': 'memoryInMb', 'type': 'long'}, - 'supported_by_virtual_machines': {'key': 'supportedByVirtualMachines', 'type': 'bool'}, - 'supported_by_web_worker_roles': {'key': 'supportedByWebWorkerRoles', 'type': 'bool'}, - 'virtual_machine_resource_disk_size_in_mb': {'key': 'virtualMachineResourceDiskSizeInMb', 'type': 'long'}, - 'web_worker_resource_disk_size_in_mb': {'key': 'webWorkerResourceDiskSizeInMb', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(VmSizeProperty, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.cores = kwargs.get('cores', None) - self.data_disk_storage_tier = kwargs.get('data_disk_storage_tier', None) - self.label = kwargs.get('label', None) - self.max_data_disk_count = kwargs.get('max_data_disk_count', None) - self.memory_in_mb = kwargs.get('memory_in_mb', None) - self.supported_by_virtual_machines = kwargs.get('supported_by_virtual_machines', None) - self.supported_by_web_worker_roles = kwargs.get('supported_by_web_worker_roles', None) - self.virtual_machine_resource_disk_size_in_mb = kwargs.get('virtual_machine_resource_disk_size_in_mb', None) - self.web_worker_resource_disk_size_in_mb = kwargs.get('web_worker_resource_disk_size_in_mb', None) diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models_py3.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models_py3.py index 26cf728993f5..090ea38e56e9 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models_py3.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models_py3.py @@ -7,32 +7,33 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._hd_insight_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AaddsResourceDetails(msrest.serialization.Model): """The Azure active directory domain service resource details. - :param domain_name: The Azure active directory domain service name. - :type domain_name: str - :param initial_sync_complete: This indicates whether initial sync complete or not. - :type initial_sync_complete: bool - :param ldaps_enabled: This indicates whether enable ldaps or not. - :type ldaps_enabled: bool - :param ldaps_public_certificate_in_base64: The base 64 format string of public ldap - certificate. - :type ldaps_public_certificate_in_base64: str - :param resource_id: The resource id of azure active directory domain service. - :type resource_id: str - :param subnet_id: The subnet resource id. - :type subnet_id: str - :param tenant_id: The tenant id of azure active directory domain service . - :type tenant_id: str + :ivar domain_name: The Azure active directory domain service name. + :vartype domain_name: str + :ivar initial_sync_complete: This indicates whether initial sync complete or not. + :vartype initial_sync_complete: bool + :ivar ldaps_enabled: This indicates whether enable ldaps or not. + :vartype ldaps_enabled: bool + :ivar ldaps_public_certificate_in_base64: The base 64 format string of public ldap certificate. + :vartype ldaps_public_certificate_in_base64: str + :ivar resource_id: The resource id of azure active directory domain service. + :vartype resource_id: str + :ivar subnet_id: The subnet resource id. + :vartype subnet_id: str + :ivar tenant_id: The tenant id of azure active directory domain service . + :vartype tenant_id: str """ _attribute_map = { @@ -57,6 +58,23 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword domain_name: The Azure active directory domain service name. + :paramtype domain_name: str + :keyword initial_sync_complete: This indicates whether initial sync complete or not. + :paramtype initial_sync_complete: bool + :keyword ldaps_enabled: This indicates whether enable ldaps or not. + :paramtype ldaps_enabled: bool + :keyword ldaps_public_certificate_in_base64: The base 64 format string of public ldap + certificate. + :paramtype ldaps_public_certificate_in_base64: str + :keyword resource_id: The resource id of azure active directory domain service. + :paramtype resource_id: str + :keyword subnet_id: The subnet resource id. + :paramtype subnet_id: str + :keyword tenant_id: The tenant id of azure active directory domain service . + :paramtype tenant_id: str + """ super(AaddsResourceDetails, self).__init__(**kwargs) self.domain_name = domain_name self.initial_sync_complete = initial_sync_complete @@ -98,6 +116,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceAutoGenerated, self).__init__(**kwargs) self.id = None self.name = None @@ -135,6 +155,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -151,12 +173,12 @@ class Application(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param etag: The ETag for the application. - :type etag: str - :param tags: A set of tags. The tags for the application. - :type tags: dict[str, str] - :param properties: The properties of the application. - :type properties: ~azure.mgmt.hdinsight.models.ApplicationProperties + :ivar etag: The ETag for the application. + :vartype etag: str + :ivar tags: A set of tags. The tags for the application. + :vartype tags: dict[str, str] + :ivar properties: The properties of the application. + :vartype properties: ~azure.mgmt.hdinsight.models.ApplicationProperties :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.hdinsight.models.SystemData """ @@ -183,9 +205,17 @@ def __init__( *, etag: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - properties: Optional["ApplicationProperties"] = None, + properties: Optional["_models.ApplicationProperties"] = None, **kwargs ): + """ + :keyword etag: The ETag for the application. + :paramtype etag: str + :keyword tags: A set of tags. The tags for the application. + :paramtype tags: dict[str, str] + :keyword properties: The properties of the application. + :paramtype properties: ~azure.mgmt.hdinsight.models.ApplicationProperties + """ super(Application, self).__init__(**kwargs) self.etag = etag self.tags = tags @@ -196,14 +226,14 @@ def __init__( class ApplicationGetEndpoint(msrest.serialization.Model): """Gets the application SSH endpoint. - :param location: The location of the endpoint. - :type location: str - :param destination_port: The destination port to connect to. - :type destination_port: int - :param public_port: The public port to connect to. - :type public_port: int - :param private_ip_address: The private ip address of the endpoint. - :type private_ip_address: str + :ivar location: The location of the endpoint. + :vartype location: str + :ivar destination_port: The destination port to connect to. + :vartype destination_port: int + :ivar public_port: The public port to connect to. + :vartype public_port: int + :ivar private_ip_address: The private ip address of the endpoint. + :vartype private_ip_address: str """ _attribute_map = { @@ -222,6 +252,16 @@ def __init__( private_ip_address: Optional[str] = None, **kwargs ): + """ + :keyword location: The location of the endpoint. + :paramtype location: str + :keyword destination_port: The destination port to connect to. + :paramtype destination_port: int + :keyword public_port: The public port to connect to. + :paramtype public_port: int + :keyword private_ip_address: The private ip address of the endpoint. + :paramtype private_ip_address: str + """ super(ApplicationGetEndpoint, self).__init__(**kwargs) self.location = location self.destination_port = destination_port @@ -234,20 +274,20 @@ class ApplicationGetHttpsEndpoint(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param access_modes: The list of access modes for the application. - :type access_modes: list[str] + :ivar access_modes: The list of access modes for the application. + :vartype access_modes: list[str] :ivar location: The location of the endpoint. :vartype location: str - :param destination_port: The destination port to connect to. - :type destination_port: int + :ivar destination_port: The destination port to connect to. + :vartype destination_port: int :ivar public_port: The public port to connect to. :vartype public_port: int - :param private_ip_address: The private ip address of the endpoint. - :type private_ip_address: str - :param sub_domain_suffix: The subdomain suffix of the application. - :type sub_domain_suffix: str - :param disable_gateway_auth: The value indicates whether to disable GatewayAuth. - :type disable_gateway_auth: bool + :ivar private_ip_address: The private ip address of the endpoint. + :vartype private_ip_address: str + :ivar sub_domain_suffix: The subdomain suffix of the application. + :vartype sub_domain_suffix: str + :ivar disable_gateway_auth: The value indicates whether to disable GatewayAuth. + :vartype disable_gateway_auth: bool """ _validation = { @@ -275,6 +315,18 @@ def __init__( disable_gateway_auth: Optional[bool] = None, **kwargs ): + """ + :keyword access_modes: The list of access modes for the application. + :paramtype access_modes: list[str] + :keyword destination_port: The destination port to connect to. + :paramtype destination_port: int + :keyword private_ip_address: The private ip address of the endpoint. + :paramtype private_ip_address: str + :keyword sub_domain_suffix: The subdomain suffix of the application. + :paramtype sub_domain_suffix: str + :keyword disable_gateway_auth: The value indicates whether to disable GatewayAuth. + :paramtype disable_gateway_auth: bool + """ super(ApplicationGetHttpsEndpoint, self).__init__(**kwargs) self.access_modes = access_modes self.location = None @@ -290,8 +342,8 @@ class ApplicationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: The list of HDInsight applications installed on HDInsight cluster. - :type value: list[~azure.mgmt.hdinsight.models.Application] + :ivar value: The list of HDInsight applications installed on HDInsight cluster. + :vartype value: list[~azure.mgmt.hdinsight.models.Application] :ivar next_link: The URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -308,9 +360,13 @@ class ApplicationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Application"]] = None, + value: Optional[List["_models.Application"]] = None, **kwargs ): + """ + :keyword value: The list of HDInsight applications installed on HDInsight cluster. + :paramtype value: list[~azure.mgmt.hdinsight.models.Application] + """ super(ApplicationListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -321,30 +377,31 @@ class ApplicationProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param compute_profile: The list of roles in the cluster. - :type compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile - :param install_script_actions: The list of install script actions. - :type install_script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] - :param uninstall_script_actions: The list of uninstall script actions. - :type uninstall_script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] - :param https_endpoints: The list of application HTTPS endpoints. - :type https_endpoints: list[~azure.mgmt.hdinsight.models.ApplicationGetHttpsEndpoint] - :param ssh_endpoints: The list of application SSH endpoints. - :type ssh_endpoints: list[~azure.mgmt.hdinsight.models.ApplicationGetEndpoint] + :ivar compute_profile: The list of roles in the cluster. + :vartype compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile + :ivar install_script_actions: The list of install script actions. + :vartype install_script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] + :ivar uninstall_script_actions: The list of uninstall script actions. + :vartype uninstall_script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] + :ivar https_endpoints: The list of application HTTPS endpoints. + :vartype https_endpoints: list[~azure.mgmt.hdinsight.models.ApplicationGetHttpsEndpoint] + :ivar ssh_endpoints: The list of application SSH endpoints. + :vartype ssh_endpoints: list[~azure.mgmt.hdinsight.models.ApplicationGetEndpoint] :ivar provisioning_state: The provisioning state of the application. :vartype provisioning_state: str - :param application_type: The application type. - :type application_type: str + :ivar application_type: The application type. + :vartype application_type: str :ivar application_state: The application state. :vartype application_state: str - :param errors: The list of errors. - :type errors: list[~azure.mgmt.hdinsight.models.Errors] + :ivar errors: The list of errors. + :vartype errors: list[~azure.mgmt.hdinsight.models.Errors] :ivar created_date: The application create date time. :vartype created_date: str :ivar marketplace_identifier: The marketplace identifier. :vartype marketplace_identifier: str - :param private_link_configurations: The private link configurations. - :type private_link_configurations: list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] + :ivar private_link_configurations: The private link configurations. + :vartype private_link_configurations: + list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] """ _validation = { @@ -372,16 +429,35 @@ class ApplicationProperties(msrest.serialization.Model): def __init__( self, *, - compute_profile: Optional["ComputeProfile"] = None, - install_script_actions: Optional[List["RuntimeScriptAction"]] = None, - uninstall_script_actions: Optional[List["RuntimeScriptAction"]] = None, - https_endpoints: Optional[List["ApplicationGetHttpsEndpoint"]] = None, - ssh_endpoints: Optional[List["ApplicationGetEndpoint"]] = None, + compute_profile: Optional["_models.ComputeProfile"] = None, + install_script_actions: Optional[List["_models.RuntimeScriptAction"]] = None, + uninstall_script_actions: Optional[List["_models.RuntimeScriptAction"]] = None, + https_endpoints: Optional[List["_models.ApplicationGetHttpsEndpoint"]] = None, + ssh_endpoints: Optional[List["_models.ApplicationGetEndpoint"]] = None, application_type: Optional[str] = None, - errors: Optional[List["Errors"]] = None, - private_link_configurations: Optional[List["PrivateLinkConfiguration"]] = None, + errors: Optional[List["_models.Errors"]] = None, + private_link_configurations: Optional[List["_models.PrivateLinkConfiguration"]] = None, **kwargs ): + """ + :keyword compute_profile: The list of roles in the cluster. + :paramtype compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile + :keyword install_script_actions: The list of install script actions. + :paramtype install_script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] + :keyword uninstall_script_actions: The list of uninstall script actions. + :paramtype uninstall_script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] + :keyword https_endpoints: The list of application HTTPS endpoints. + :paramtype https_endpoints: list[~azure.mgmt.hdinsight.models.ApplicationGetHttpsEndpoint] + :keyword ssh_endpoints: The list of application SSH endpoints. + :paramtype ssh_endpoints: list[~azure.mgmt.hdinsight.models.ApplicationGetEndpoint] + :keyword application_type: The application type. + :paramtype application_type: str + :keyword errors: The list of errors. + :paramtype errors: list[~azure.mgmt.hdinsight.models.Errors] + :keyword private_link_configurations: The private link configurations. + :paramtype private_link_configurations: + list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] + """ super(ApplicationProperties, self).__init__(**kwargs) self.compute_profile = compute_profile self.install_script_actions = install_script_actions @@ -400,11 +476,10 @@ def __init__( class AsyncOperationResult(msrest.serialization.Model): """The azure async operation response. - :param status: The async operation state. Possible values include: "InProgress", "Succeeded", - "Failed". - :type status: str or ~azure.mgmt.hdinsight.models.AsyncOperationState - :param error: The operation error information. - :type error: ~azure.mgmt.hdinsight.models.Errors + :ivar status: The async operation state. Known values are: "InProgress", "Succeeded", "Failed". + :vartype status: str or ~azure.mgmt.hdinsight.models.AsyncOperationState + :ivar error: The operation error information. + :vartype error: ~azure.mgmt.hdinsight.models.Errors """ _attribute_map = { @@ -415,10 +490,17 @@ class AsyncOperationResult(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "AsyncOperationState"]] = None, - error: Optional["Errors"] = None, + status: Optional[Union[str, "_models.AsyncOperationState"]] = None, + error: Optional["_models.Errors"] = None, **kwargs ): + """ + :keyword status: The async operation state. Known values are: "InProgress", "Succeeded", + "Failed". + :paramtype status: str or ~azure.mgmt.hdinsight.models.AsyncOperationState + :keyword error: The operation error information. + :paramtype error: ~azure.mgmt.hdinsight.models.Errors + """ super(AsyncOperationResult, self).__init__(**kwargs) self.status = status self.error = error @@ -427,10 +509,10 @@ def __init__( class Autoscale(msrest.serialization.Model): """The autoscale request parameters. - :param capacity: Parameters for load-based autoscale. - :type capacity: ~azure.mgmt.hdinsight.models.AutoscaleCapacity - :param recurrence: Parameters for schedule-based autoscale. - :type recurrence: ~azure.mgmt.hdinsight.models.AutoscaleRecurrence + :ivar capacity: Parameters for load-based autoscale. + :vartype capacity: ~azure.mgmt.hdinsight.models.AutoscaleCapacity + :ivar recurrence: Parameters for schedule-based autoscale. + :vartype recurrence: ~azure.mgmt.hdinsight.models.AutoscaleRecurrence """ _attribute_map = { @@ -441,10 +523,16 @@ class Autoscale(msrest.serialization.Model): def __init__( self, *, - capacity: Optional["AutoscaleCapacity"] = None, - recurrence: Optional["AutoscaleRecurrence"] = None, + capacity: Optional["_models.AutoscaleCapacity"] = None, + recurrence: Optional["_models.AutoscaleRecurrence"] = None, **kwargs ): + """ + :keyword capacity: Parameters for load-based autoscale. + :paramtype capacity: ~azure.mgmt.hdinsight.models.AutoscaleCapacity + :keyword recurrence: Parameters for schedule-based autoscale. + :paramtype recurrence: ~azure.mgmt.hdinsight.models.AutoscaleRecurrence + """ super(Autoscale, self).__init__(**kwargs) self.capacity = capacity self.recurrence = recurrence @@ -453,10 +541,10 @@ def __init__( class AutoscaleCapacity(msrest.serialization.Model): """The load-based autoscale request parameters. - :param min_instance_count: The minimum instance count of the cluster. - :type min_instance_count: int - :param max_instance_count: The maximum instance count of the cluster. - :type max_instance_count: int + :ivar min_instance_count: The minimum instance count of the cluster. + :vartype min_instance_count: int + :ivar max_instance_count: The maximum instance count of the cluster. + :vartype max_instance_count: int """ _attribute_map = { @@ -471,6 +559,12 @@ def __init__( max_instance_count: Optional[int] = None, **kwargs ): + """ + :keyword min_instance_count: The minimum instance count of the cluster. + :paramtype min_instance_count: int + :keyword max_instance_count: The maximum instance count of the cluster. + :paramtype max_instance_count: int + """ super(AutoscaleCapacity, self).__init__(**kwargs) self.min_instance_count = min_instance_count self.max_instance_count = max_instance_count @@ -479,8 +573,8 @@ def __init__( class AutoscaleConfigurationUpdateParameter(msrest.serialization.Model): """The autoscale configuration update parameter. - :param autoscale: The autoscale configuration. - :type autoscale: ~azure.mgmt.hdinsight.models.Autoscale + :ivar autoscale: The autoscale configuration. + :vartype autoscale: ~azure.mgmt.hdinsight.models.Autoscale """ _attribute_map = { @@ -490,9 +584,13 @@ class AutoscaleConfigurationUpdateParameter(msrest.serialization.Model): def __init__( self, *, - autoscale: Optional["Autoscale"] = None, + autoscale: Optional["_models.Autoscale"] = None, **kwargs ): + """ + :keyword autoscale: The autoscale configuration. + :paramtype autoscale: ~azure.mgmt.hdinsight.models.Autoscale + """ super(AutoscaleConfigurationUpdateParameter, self).__init__(**kwargs) self.autoscale = autoscale @@ -500,10 +598,10 @@ def __init__( class AutoscaleRecurrence(msrest.serialization.Model): """Schedule-based autoscale request parameters. - :param time_zone: The time zone for the autoscale schedule times. - :type time_zone: str - :param schedule: Array of schedule-based autoscale rules. - :type schedule: list[~azure.mgmt.hdinsight.models.AutoscaleSchedule] + :ivar time_zone: The time zone for the autoscale schedule times. + :vartype time_zone: str + :ivar schedule: Array of schedule-based autoscale rules. + :vartype schedule: list[~azure.mgmt.hdinsight.models.AutoscaleSchedule] """ _attribute_map = { @@ -515,9 +613,15 @@ def __init__( self, *, time_zone: Optional[str] = None, - schedule: Optional[List["AutoscaleSchedule"]] = None, + schedule: Optional[List["_models.AutoscaleSchedule"]] = None, **kwargs ): + """ + :keyword time_zone: The time zone for the autoscale schedule times. + :paramtype time_zone: str + :keyword schedule: Array of schedule-based autoscale rules. + :paramtype schedule: list[~azure.mgmt.hdinsight.models.AutoscaleSchedule] + """ super(AutoscaleRecurrence, self).__init__(**kwargs) self.time_zone = time_zone self.schedule = schedule @@ -526,10 +630,10 @@ def __init__( class AutoscaleSchedule(msrest.serialization.Model): """Parameters for a schedule-based autoscale rule, consisting of an array of days + a time and capacity. - :param days: Days of the week for a schedule-based autoscale rule. - :type days: list[str or ~azure.mgmt.hdinsight.models.DaysOfWeek] - :param time_and_capacity: Time and capacity for a schedule-based autoscale rule. - :type time_and_capacity: ~azure.mgmt.hdinsight.models.AutoscaleTimeAndCapacity + :ivar days: Days of the week for a schedule-based autoscale rule. + :vartype days: list[str or ~azure.mgmt.hdinsight.models.DaysOfWeek] + :ivar time_and_capacity: Time and capacity for a schedule-based autoscale rule. + :vartype time_and_capacity: ~azure.mgmt.hdinsight.models.AutoscaleTimeAndCapacity """ _attribute_map = { @@ -540,10 +644,16 @@ class AutoscaleSchedule(msrest.serialization.Model): def __init__( self, *, - days: Optional[List[Union[str, "DaysOfWeek"]]] = None, - time_and_capacity: Optional["AutoscaleTimeAndCapacity"] = None, + days: Optional[List[Union[str, "_models.DaysOfWeek"]]] = None, + time_and_capacity: Optional["_models.AutoscaleTimeAndCapacity"] = None, **kwargs ): + """ + :keyword days: Days of the week for a schedule-based autoscale rule. + :paramtype days: list[str or ~azure.mgmt.hdinsight.models.DaysOfWeek] + :keyword time_and_capacity: Time and capacity for a schedule-based autoscale rule. + :paramtype time_and_capacity: ~azure.mgmt.hdinsight.models.AutoscaleTimeAndCapacity + """ super(AutoscaleSchedule, self).__init__(**kwargs) self.days = days self.time_and_capacity = time_and_capacity @@ -552,12 +662,12 @@ def __init__( class AutoscaleTimeAndCapacity(msrest.serialization.Model): """Time and capacity request parameters. - :param time: 24-hour time in the form xx:xx. - :type time: str - :param min_instance_count: The minimum instance count of the cluster. - :type min_instance_count: int - :param max_instance_count: The maximum instance count of the cluster. - :type max_instance_count: int + :ivar time: 24-hour time in the form xx:xx. + :vartype time: str + :ivar min_instance_count: The minimum instance count of the cluster. + :vartype min_instance_count: int + :ivar max_instance_count: The maximum instance count of the cluster. + :vartype max_instance_count: int """ _attribute_map = { @@ -574,6 +684,14 @@ def __init__( max_instance_count: Optional[int] = None, **kwargs ): + """ + :keyword time: 24-hour time in the form xx:xx. + :paramtype time: str + :keyword min_instance_count: The minimum instance count of the cluster. + :paramtype min_instance_count: int + :keyword max_instance_count: The maximum instance count of the cluster. + :paramtype max_instance_count: int + """ super(AutoscaleTimeAndCapacity, self).__init__(**kwargs) self.time = time self.min_instance_count = min_instance_count @@ -583,12 +701,13 @@ def __init__( class AzureMonitorRequest(msrest.serialization.Model): """The azure monitor parameters. - :param workspace_id: The Log Analytics workspace ID. - :type workspace_id: str - :param primary_key: The Log Analytics workspace key. - :type primary_key: str - :param selected_configurations: The selected configurations. - :type selected_configurations: ~azure.mgmt.hdinsight.models.AzureMonitorSelectedConfigurations + :ivar workspace_id: The Log Analytics workspace ID. + :vartype workspace_id: str + :ivar primary_key: The Log Analytics workspace key. + :vartype primary_key: str + :ivar selected_configurations: The selected configurations. + :vartype selected_configurations: + ~azure.mgmt.hdinsight.models.AzureMonitorSelectedConfigurations """ _attribute_map = { @@ -602,9 +721,18 @@ def __init__( *, workspace_id: Optional[str] = None, primary_key: Optional[str] = None, - selected_configurations: Optional["AzureMonitorSelectedConfigurations"] = None, + selected_configurations: Optional["_models.AzureMonitorSelectedConfigurations"] = None, **kwargs ): + """ + :keyword workspace_id: The Log Analytics workspace ID. + :paramtype workspace_id: str + :keyword primary_key: The Log Analytics workspace key. + :paramtype primary_key: str + :keyword selected_configurations: The selected configurations. + :paramtype selected_configurations: + ~azure.mgmt.hdinsight.models.AzureMonitorSelectedConfigurations + """ super(AzureMonitorRequest, self).__init__(**kwargs) self.workspace_id = workspace_id self.primary_key = primary_key @@ -614,12 +742,13 @@ def __init__( class AzureMonitorResponse(msrest.serialization.Model): """The azure monitor status response. - :param cluster_monitoring_enabled: The status of the monitor on the HDInsight cluster. - :type cluster_monitoring_enabled: bool - :param workspace_id: The workspace ID of the monitor on the HDInsight cluster. - :type workspace_id: str - :param selected_configurations: The selected configurations. - :type selected_configurations: ~azure.mgmt.hdinsight.models.AzureMonitorSelectedConfigurations + :ivar cluster_monitoring_enabled: The status of the monitor on the HDInsight cluster. + :vartype cluster_monitoring_enabled: bool + :ivar workspace_id: The workspace ID of the monitor on the HDInsight cluster. + :vartype workspace_id: str + :ivar selected_configurations: The selected configurations. + :vartype selected_configurations: + ~azure.mgmt.hdinsight.models.AzureMonitorSelectedConfigurations """ _attribute_map = { @@ -633,9 +762,18 @@ def __init__( *, cluster_monitoring_enabled: Optional[bool] = None, workspace_id: Optional[str] = None, - selected_configurations: Optional["AzureMonitorSelectedConfigurations"] = None, + selected_configurations: Optional["_models.AzureMonitorSelectedConfigurations"] = None, **kwargs ): + """ + :keyword cluster_monitoring_enabled: The status of the monitor on the HDInsight cluster. + :paramtype cluster_monitoring_enabled: bool + :keyword workspace_id: The workspace ID of the monitor on the HDInsight cluster. + :paramtype workspace_id: str + :keyword selected_configurations: The selected configurations. + :paramtype selected_configurations: + ~azure.mgmt.hdinsight.models.AzureMonitorSelectedConfigurations + """ super(AzureMonitorResponse, self).__init__(**kwargs) self.cluster_monitoring_enabled = cluster_monitoring_enabled self.workspace_id = workspace_id @@ -645,12 +783,12 @@ def __init__( class AzureMonitorSelectedConfigurations(msrest.serialization.Model): """The selected configurations for azure monitor. - :param configuration_version: The configuration version. - :type configuration_version: str - :param global_configurations: The global configurations of selected configurations. - :type global_configurations: dict[str, str] - :param table_list: The table list. - :type table_list: list[~azure.mgmt.hdinsight.models.AzureMonitorTableConfiguration] + :ivar configuration_version: The configuration version. + :vartype configuration_version: str + :ivar global_configurations: The global configurations of selected configurations. + :vartype global_configurations: dict[str, str] + :ivar table_list: The table list. + :vartype table_list: list[~azure.mgmt.hdinsight.models.AzureMonitorTableConfiguration] """ _attribute_map = { @@ -664,9 +802,17 @@ def __init__( *, configuration_version: Optional[str] = None, global_configurations: Optional[Dict[str, str]] = None, - table_list: Optional[List["AzureMonitorTableConfiguration"]] = None, + table_list: Optional[List["_models.AzureMonitorTableConfiguration"]] = None, **kwargs ): + """ + :keyword configuration_version: The configuration version. + :paramtype configuration_version: str + :keyword global_configurations: The global configurations of selected configurations. + :paramtype global_configurations: dict[str, str] + :keyword table_list: The table list. + :paramtype table_list: list[~azure.mgmt.hdinsight.models.AzureMonitorTableConfiguration] + """ super(AzureMonitorSelectedConfigurations, self).__init__(**kwargs) self.configuration_version = configuration_version self.global_configurations = global_configurations @@ -676,8 +822,8 @@ def __init__( class AzureMonitorTableConfiguration(msrest.serialization.Model): """The table configuration for the Log Analytics integration. - :param name: The name. - :type name: str + :ivar name: The name. + :vartype name: str """ _attribute_map = { @@ -690,6 +836,10 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword name: The name. + :paramtype name: str + """ super(AzureMonitorTableConfiguration, self).__init__(**kwargs) self.name = name @@ -697,12 +847,12 @@ def __init__( class BillingMeters(msrest.serialization.Model): """The billing meters. - :param meter_parameter: The virtual machine sizes. - :type meter_parameter: str - :param meter: The HDInsight meter guid. - :type meter: str - :param unit: The unit of meter, VMHours or CoreHours. - :type unit: str + :ivar meter_parameter: The virtual machine sizes. + :vartype meter_parameter: str + :ivar meter: The HDInsight meter guid. + :vartype meter: str + :ivar unit: The unit of meter, VMHours or CoreHours. + :vartype unit: str """ _attribute_map = { @@ -719,6 +869,14 @@ def __init__( unit: Optional[str] = None, **kwargs ): + """ + :keyword meter_parameter: The virtual machine sizes. + :paramtype meter_parameter: str + :keyword meter: The HDInsight meter guid. + :paramtype meter: str + :keyword unit: The unit of meter, VMHours or CoreHours. + :paramtype unit: str + """ super(BillingMeters, self).__init__(**kwargs) self.meter_parameter = meter_parameter self.meter = meter @@ -728,12 +886,12 @@ def __init__( class BillingResources(msrest.serialization.Model): """The billing resources. - :param region: The region or location. - :type region: str - :param billing_meters: The billing meter information. - :type billing_meters: list[~azure.mgmt.hdinsight.models.BillingMeters] - :param disk_billing_meters: The managed disk billing information. - :type disk_billing_meters: list[~azure.mgmt.hdinsight.models.DiskBillingMeters] + :ivar region: The region or location. + :vartype region: str + :ivar billing_meters: The billing meter information. + :vartype billing_meters: list[~azure.mgmt.hdinsight.models.BillingMeters] + :ivar disk_billing_meters: The managed disk billing information. + :vartype disk_billing_meters: list[~azure.mgmt.hdinsight.models.DiskBillingMeters] """ _attribute_map = { @@ -746,10 +904,18 @@ def __init__( self, *, region: Optional[str] = None, - billing_meters: Optional[List["BillingMeters"]] = None, - disk_billing_meters: Optional[List["DiskBillingMeters"]] = None, + billing_meters: Optional[List["_models.BillingMeters"]] = None, + disk_billing_meters: Optional[List["_models.DiskBillingMeters"]] = None, **kwargs ): + """ + :keyword region: The region or location. + :paramtype region: str + :keyword billing_meters: The billing meter information. + :paramtype billing_meters: list[~azure.mgmt.hdinsight.models.BillingMeters] + :keyword disk_billing_meters: The managed disk billing information. + :paramtype disk_billing_meters: list[~azure.mgmt.hdinsight.models.DiskBillingMeters] + """ super(BillingResources, self).__init__(**kwargs) self.region = region self.billing_meters = billing_meters @@ -761,17 +927,17 @@ class BillingResponseListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param vm_sizes: The virtual machine sizes to include or exclude. - :type vm_sizes: list[str] - :param vm_sizes_with_encryption_at_host: The vm sizes which enable encryption at host. - :type vm_sizes_with_encryption_at_host: list[str] - :param vm_size_filters: The virtual machine filtering mode. Effectively this can enabling or + :ivar vm_sizes: The virtual machine sizes to include or exclude. + :vartype vm_sizes: list[str] + :ivar vm_sizes_with_encryption_at_host: The vm sizes which enable encryption at host. + :vartype vm_sizes_with_encryption_at_host: list[str] + :ivar vm_size_filters: The virtual machine filtering mode. Effectively this can enabling or disabling the virtual machine sizes in a particular set. - :type vm_size_filters: list[~azure.mgmt.hdinsight.models.VmSizeCompatibilityFilterV2] + :vartype vm_size_filters: list[~azure.mgmt.hdinsight.models.VmSizeCompatibilityFilterV2] :ivar vm_size_properties: The vm size properties. :vartype vm_size_properties: list[~azure.mgmt.hdinsight.models.VmSizeProperty] - :param billing_resources: The billing and managed disk billing resources for a region. - :type billing_resources: list[~azure.mgmt.hdinsight.models.BillingResources] + :ivar billing_resources: The billing and managed disk billing resources for a region. + :vartype billing_resources: list[~azure.mgmt.hdinsight.models.BillingResources] """ _validation = { @@ -791,10 +957,21 @@ def __init__( *, vm_sizes: Optional[List[str]] = None, vm_sizes_with_encryption_at_host: Optional[List[str]] = None, - vm_size_filters: Optional[List["VmSizeCompatibilityFilterV2"]] = None, - billing_resources: Optional[List["BillingResources"]] = None, + vm_size_filters: Optional[List["_models.VmSizeCompatibilityFilterV2"]] = None, + billing_resources: Optional[List["_models.BillingResources"]] = None, **kwargs ): + """ + :keyword vm_sizes: The virtual machine sizes to include or exclude. + :paramtype vm_sizes: list[str] + :keyword vm_sizes_with_encryption_at_host: The vm sizes which enable encryption at host. + :paramtype vm_sizes_with_encryption_at_host: list[str] + :keyword vm_size_filters: The virtual machine filtering mode. Effectively this can enabling or + disabling the virtual machine sizes in a particular set. + :paramtype vm_size_filters: list[~azure.mgmt.hdinsight.models.VmSizeCompatibilityFilterV2] + :keyword billing_resources: The billing and managed disk billing resources for a region. + :paramtype billing_resources: list[~azure.mgmt.hdinsight.models.BillingResources] + """ super(BillingResponseListResult, self).__init__(**kwargs) self.vm_sizes = vm_sizes self.vm_sizes_with_encryption_at_host = vm_sizes_with_encryption_at_host @@ -808,12 +985,12 @@ class CapabilitiesResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param versions: The version capability. - :type versions: dict[str, ~azure.mgmt.hdinsight.models.VersionsCapability] - :param regions: The virtual machine size compatibility features. - :type regions: dict[str, ~azure.mgmt.hdinsight.models.RegionsCapability] - :param features: The capability features. - :type features: list[str] + :ivar versions: The version capability. + :vartype versions: dict[str, ~azure.mgmt.hdinsight.models.VersionsCapability] + :ivar regions: The virtual machine size compatibility features. + :vartype regions: dict[str, ~azure.mgmt.hdinsight.models.RegionsCapability] + :ivar features: The capability features. + :vartype features: list[str] :ivar quota: The quota capability. :vartype quota: ~azure.mgmt.hdinsight.models.QuotaCapability """ @@ -832,11 +1009,19 @@ class CapabilitiesResult(msrest.serialization.Model): def __init__( self, *, - versions: Optional[Dict[str, "VersionsCapability"]] = None, - regions: Optional[Dict[str, "RegionsCapability"]] = None, + versions: Optional[Dict[str, "_models.VersionsCapability"]] = None, + regions: Optional[Dict[str, "_models.RegionsCapability"]] = None, features: Optional[List[str]] = None, **kwargs ): + """ + :keyword versions: The version capability. + :paramtype versions: dict[str, ~azure.mgmt.hdinsight.models.VersionsCapability] + :keyword regions: The virtual machine size compatibility features. + :paramtype regions: dict[str, ~azure.mgmt.hdinsight.models.RegionsCapability] + :keyword features: The capability features. + :paramtype features: list[str] + """ super(CapabilitiesResult, self).__init__(**kwargs) self.versions = versions self.regions = regions @@ -847,10 +1032,10 @@ def __init__( class ClientGroupInfo(msrest.serialization.Model): """The information of AAD security group. - :param group_name: The AAD security group name. - :type group_name: str - :param group_id: The AAD security group id. - :type group_id: str + :ivar group_name: The AAD security group name. + :vartype group_name: str + :ivar group_id: The AAD security group id. + :vartype group_id: str """ _attribute_map = { @@ -865,6 +1050,12 @@ def __init__( group_id: Optional[str] = None, **kwargs ): + """ + :keyword group_name: The AAD security group name. + :paramtype group_name: str + :keyword group_id: The AAD security group id. + :paramtype group_id: str + """ super(ClientGroupInfo, self).__init__(**kwargs) self.group_name = group_name self.group_id = group_id @@ -901,6 +1092,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -922,10 +1115,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -950,6 +1143,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -970,18 +1169,18 @@ class Cluster(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param etag: The ETag for the resource. - :type etag: str - :param zones: The availability zones. - :type zones: list[str] - :param properties: The properties of the cluster. - :type properties: ~azure.mgmt.hdinsight.models.ClusterGetProperties - :param identity: The identity of the cluster, if configured. - :type identity: ~azure.mgmt.hdinsight.models.ClusterIdentity + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar etag: The ETag for the resource. + :vartype etag: str + :ivar zones: The availability zones. + :vartype zones: list[str] + :ivar properties: The properties of the cluster. + :vartype properties: ~azure.mgmt.hdinsight.models.ClusterGetProperties + :ivar identity: The identity of the cluster, if configured. + :vartype identity: ~azure.mgmt.hdinsight.models.ClusterIdentity :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.hdinsight.models.SystemData """ @@ -1014,10 +1213,24 @@ def __init__( tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, zones: Optional[List[str]] = None, - properties: Optional["ClusterGetProperties"] = None, - identity: Optional["ClusterIdentity"] = None, + properties: Optional["_models.ClusterGetProperties"] = None, + identity: Optional["_models.ClusterIdentity"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword etag: The ETag for the resource. + :paramtype etag: str + :keyword zones: The availability zones. + :paramtype zones: list[str] + :keyword properties: The properties of the cluster. + :paramtype properties: ~azure.mgmt.hdinsight.models.ClusterGetProperties + :keyword identity: The identity of the cluster, if configured. + :paramtype identity: ~azure.mgmt.hdinsight.models.ClusterIdentity + """ super(Cluster, self).__init__(tags=tags, location=location, **kwargs) self.etag = etag self.zones = zones @@ -1029,9 +1242,9 @@ def __init__( class ClusterConfigurations(msrest.serialization.Model): """The configuration object for the specified cluster. - :param configurations: The configuration object for the specified configuration for the + :ivar configurations: The configuration object for the specified configuration for the specified cluster. - :type configurations: dict[str, dict[str, str]] + :vartype configurations: dict[str, dict[str, str]] """ _attribute_map = { @@ -1044,6 +1257,11 @@ def __init__( configurations: Optional[Dict[str, Dict[str, str]]] = None, **kwargs ): + """ + :keyword configurations: The configuration object for the specified configuration for the + specified cluster. + :paramtype configurations: dict[str, dict[str, str]] + """ super(ClusterConfigurations, self).__init__(**kwargs) self.configurations = configurations @@ -1051,16 +1269,16 @@ def __init__( class ClusterCreateParametersExtended(msrest.serialization.Model): """The CreateCluster request parameters. - :param location: The location of the cluster. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param zones: The availability zones. - :type zones: list[str] - :param properties: The cluster create parameters. - :type properties: ~azure.mgmt.hdinsight.models.ClusterCreateProperties - :param identity: The identity of the cluster, if configured. - :type identity: ~azure.mgmt.hdinsight.models.ClusterIdentity + :ivar location: The location of the cluster. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar zones: The availability zones. + :vartype zones: list[str] + :ivar properties: The cluster create parameters. + :vartype properties: ~azure.mgmt.hdinsight.models.ClusterCreateProperties + :ivar identity: The identity of the cluster, if configured. + :vartype identity: ~azure.mgmt.hdinsight.models.ClusterIdentity """ _attribute_map = { @@ -1077,10 +1295,22 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, zones: Optional[List[str]] = None, - properties: Optional["ClusterCreateProperties"] = None, - identity: Optional["ClusterIdentity"] = None, + properties: Optional["_models.ClusterCreateProperties"] = None, + identity: Optional["_models.ClusterIdentity"] = None, **kwargs ): + """ + :keyword location: The location of the cluster. + :paramtype location: str + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword zones: The availability zones. + :paramtype zones: list[str] + :keyword properties: The cluster create parameters. + :paramtype properties: ~azure.mgmt.hdinsight.models.ClusterCreateProperties + :keyword identity: The identity of the cluster, if configured. + :paramtype identity: ~azure.mgmt.hdinsight.models.ClusterIdentity + """ super(ClusterCreateParametersExtended, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1092,35 +1322,36 @@ def __init__( class ClusterCreateProperties(msrest.serialization.Model): """The cluster create parameters. - :param cluster_version: The version of the cluster. - :type cluster_version: str - :param os_type: The type of operating system. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.hdinsight.models.OSType - :param tier: The cluster tier. Possible values include: "Standard", "Premium". - :type tier: str or ~azure.mgmt.hdinsight.models.Tier - :param cluster_definition: The cluster definition. - :type cluster_definition: ~azure.mgmt.hdinsight.models.ClusterDefinition - :param kafka_rest_properties: The cluster kafka rest proxy configuration. - :type kafka_rest_properties: ~azure.mgmt.hdinsight.models.KafkaRestProperties - :param security_profile: The security profile. - :type security_profile: ~azure.mgmt.hdinsight.models.SecurityProfile - :param compute_profile: The compute profile. - :type compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile - :param storage_profile: The storage profile. - :type storage_profile: ~azure.mgmt.hdinsight.models.StorageProfile - :param disk_encryption_properties: The disk encryption properties. - :type disk_encryption_properties: ~azure.mgmt.hdinsight.models.DiskEncryptionProperties - :param encryption_in_transit_properties: The encryption-in-transit properties. - :type encryption_in_transit_properties: + :ivar cluster_version: The version of the cluster. + :vartype cluster_version: str + :ivar os_type: The type of operating system. Known values are: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.hdinsight.models.OSType + :ivar tier: The cluster tier. Known values are: "Standard", "Premium". + :vartype tier: str or ~azure.mgmt.hdinsight.models.Tier + :ivar cluster_definition: The cluster definition. + :vartype cluster_definition: ~azure.mgmt.hdinsight.models.ClusterDefinition + :ivar kafka_rest_properties: The cluster kafka rest proxy configuration. + :vartype kafka_rest_properties: ~azure.mgmt.hdinsight.models.KafkaRestProperties + :ivar security_profile: The security profile. + :vartype security_profile: ~azure.mgmt.hdinsight.models.SecurityProfile + :ivar compute_profile: The compute profile. + :vartype compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile + :ivar storage_profile: The storage profile. + :vartype storage_profile: ~azure.mgmt.hdinsight.models.StorageProfile + :ivar disk_encryption_properties: The disk encryption properties. + :vartype disk_encryption_properties: ~azure.mgmt.hdinsight.models.DiskEncryptionProperties + :ivar encryption_in_transit_properties: The encryption-in-transit properties. + :vartype encryption_in_transit_properties: ~azure.mgmt.hdinsight.models.EncryptionInTransitProperties - :param min_supported_tls_version: The minimal supported tls version. - :type min_supported_tls_version: str - :param network_properties: The network properties. - :type network_properties: ~azure.mgmt.hdinsight.models.NetworkProperties - :param compute_isolation_properties: The compute isolation properties. - :type compute_isolation_properties: ~azure.mgmt.hdinsight.models.ComputeIsolationProperties - :param private_link_configurations: The private link configurations. - :type private_link_configurations: list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] + :ivar min_supported_tls_version: The minimal supported tls version. + :vartype min_supported_tls_version: str + :ivar network_properties: The network properties. + :vartype network_properties: ~azure.mgmt.hdinsight.models.NetworkProperties + :ivar compute_isolation_properties: The compute isolation properties. + :vartype compute_isolation_properties: ~azure.mgmt.hdinsight.models.ComputeIsolationProperties + :ivar private_link_configurations: The private link configurations. + :vartype private_link_configurations: + list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] """ _attribute_map = { @@ -1144,21 +1375,54 @@ def __init__( self, *, cluster_version: Optional[str] = None, - os_type: Optional[Union[str, "OSType"]] = None, - tier: Optional[Union[str, "Tier"]] = None, - cluster_definition: Optional["ClusterDefinition"] = None, - kafka_rest_properties: Optional["KafkaRestProperties"] = None, - security_profile: Optional["SecurityProfile"] = None, - compute_profile: Optional["ComputeProfile"] = None, - storage_profile: Optional["StorageProfile"] = None, - disk_encryption_properties: Optional["DiskEncryptionProperties"] = None, - encryption_in_transit_properties: Optional["EncryptionInTransitProperties"] = None, + os_type: Optional[Union[str, "_models.OSType"]] = None, + tier: Optional[Union[str, "_models.Tier"]] = None, + cluster_definition: Optional["_models.ClusterDefinition"] = None, + kafka_rest_properties: Optional["_models.KafkaRestProperties"] = None, + security_profile: Optional["_models.SecurityProfile"] = None, + compute_profile: Optional["_models.ComputeProfile"] = None, + storage_profile: Optional["_models.StorageProfile"] = None, + disk_encryption_properties: Optional["_models.DiskEncryptionProperties"] = None, + encryption_in_transit_properties: Optional["_models.EncryptionInTransitProperties"] = None, min_supported_tls_version: Optional[str] = None, - network_properties: Optional["NetworkProperties"] = None, - compute_isolation_properties: Optional["ComputeIsolationProperties"] = None, - private_link_configurations: Optional[List["PrivateLinkConfiguration"]] = None, + network_properties: Optional["_models.NetworkProperties"] = None, + compute_isolation_properties: Optional["_models.ComputeIsolationProperties"] = None, + private_link_configurations: Optional[List["_models.PrivateLinkConfiguration"]] = None, **kwargs ): + """ + :keyword cluster_version: The version of the cluster. + :paramtype cluster_version: str + :keyword os_type: The type of operating system. Known values are: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.hdinsight.models.OSType + :keyword tier: The cluster tier. Known values are: "Standard", "Premium". + :paramtype tier: str or ~azure.mgmt.hdinsight.models.Tier + :keyword cluster_definition: The cluster definition. + :paramtype cluster_definition: ~azure.mgmt.hdinsight.models.ClusterDefinition + :keyword kafka_rest_properties: The cluster kafka rest proxy configuration. + :paramtype kafka_rest_properties: ~azure.mgmt.hdinsight.models.KafkaRestProperties + :keyword security_profile: The security profile. + :paramtype security_profile: ~azure.mgmt.hdinsight.models.SecurityProfile + :keyword compute_profile: The compute profile. + :paramtype compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile + :keyword storage_profile: The storage profile. + :paramtype storage_profile: ~azure.mgmt.hdinsight.models.StorageProfile + :keyword disk_encryption_properties: The disk encryption properties. + :paramtype disk_encryption_properties: ~azure.mgmt.hdinsight.models.DiskEncryptionProperties + :keyword encryption_in_transit_properties: The encryption-in-transit properties. + :paramtype encryption_in_transit_properties: + ~azure.mgmt.hdinsight.models.EncryptionInTransitProperties + :keyword min_supported_tls_version: The minimal supported tls version. + :paramtype min_supported_tls_version: str + :keyword network_properties: The network properties. + :paramtype network_properties: ~azure.mgmt.hdinsight.models.NetworkProperties + :keyword compute_isolation_properties: The compute isolation properties. + :paramtype compute_isolation_properties: + ~azure.mgmt.hdinsight.models.ComputeIsolationProperties + :keyword private_link_configurations: The private link configurations. + :paramtype private_link_configurations: + list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] + """ super(ClusterCreateProperties, self).__init__(**kwargs) self.cluster_version = cluster_version self.os_type = os_type @@ -1179,24 +1443,24 @@ def __init__( class ClusterCreateRequestValidationParameters(ClusterCreateParametersExtended): """The cluster create request specification. - :param location: The location of the cluster. - :type location: str - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] - :param zones: The availability zones. - :type zones: list[str] - :param properties: The cluster create parameters. - :type properties: ~azure.mgmt.hdinsight.models.ClusterCreateProperties - :param identity: The identity of the cluster, if configured. - :type identity: ~azure.mgmt.hdinsight.models.ClusterIdentity - :param name: The cluster name. - :type name: str - :param type: The resource type. - :type type: str - :param tenant_id: The tenant id. - :type tenant_id: str - :param fetch_aadds_resource: This indicates whether fetch Aadds resource or not. - :type fetch_aadds_resource: bool + :ivar location: The location of the cluster. + :vartype location: str + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] + :ivar zones: The availability zones. + :vartype zones: list[str] + :ivar properties: The cluster create parameters. + :vartype properties: ~azure.mgmt.hdinsight.models.ClusterCreateProperties + :ivar identity: The identity of the cluster, if configured. + :vartype identity: ~azure.mgmt.hdinsight.models.ClusterIdentity + :ivar name: The cluster name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + :ivar tenant_id: The tenant id. + :vartype tenant_id: str + :ivar fetch_aadds_resource: This indicates whether fetch Aadds resource or not. + :vartype fetch_aadds_resource: bool """ _attribute_map = { @@ -1217,14 +1481,34 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, zones: Optional[List[str]] = None, - properties: Optional["ClusterCreateProperties"] = None, - identity: Optional["ClusterIdentity"] = None, + properties: Optional["_models.ClusterCreateProperties"] = None, + identity: Optional["_models.ClusterIdentity"] = None, name: Optional[str] = None, type: Optional[str] = None, tenant_id: Optional[str] = None, fetch_aadds_resource: Optional[bool] = None, **kwargs ): + """ + :keyword location: The location of the cluster. + :paramtype location: str + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + :keyword zones: The availability zones. + :paramtype zones: list[str] + :keyword properties: The cluster create parameters. + :paramtype properties: ~azure.mgmt.hdinsight.models.ClusterCreateProperties + :keyword identity: The identity of the cluster, if configured. + :paramtype identity: ~azure.mgmt.hdinsight.models.ClusterIdentity + :keyword name: The cluster name. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str + :keyword tenant_id: The tenant id. + :paramtype tenant_id: str + :keyword fetch_aadds_resource: This indicates whether fetch Aadds resource or not. + :paramtype fetch_aadds_resource: bool + """ super(ClusterCreateRequestValidationParameters, self).__init__(location=location, tags=tags, zones=zones, properties=properties, identity=identity, **kwargs) self.name = name self.type = type @@ -1235,14 +1519,14 @@ def __init__( class ClusterCreateValidationResult(msrest.serialization.Model): """The response of cluster create request validation. - :param validation_errors: The validation errors. - :type validation_errors: list[~azure.mgmt.hdinsight.models.ValidationErrorInfo] - :param validation_warnings: The validation warnings. - :type validation_warnings: list[~azure.mgmt.hdinsight.models.ValidationErrorInfo] - :param estimated_creation_duration: The estimated creation duration. - :type estimated_creation_duration: ~datetime.timedelta - :param aadds_resources_details: The Azure active directory domain service resource details. - :type aadds_resources_details: list[~azure.mgmt.hdinsight.models.AaddsResourceDetails] + :ivar validation_errors: The validation errors. + :vartype validation_errors: list[~azure.mgmt.hdinsight.models.ValidationErrorInfo] + :ivar validation_warnings: The validation warnings. + :vartype validation_warnings: list[~azure.mgmt.hdinsight.models.ValidationErrorInfo] + :ivar estimated_creation_duration: The estimated creation duration. + :vartype estimated_creation_duration: ~datetime.timedelta + :ivar aadds_resources_details: The Azure active directory domain service resource details. + :vartype aadds_resources_details: list[~azure.mgmt.hdinsight.models.AaddsResourceDetails] """ _attribute_map = { @@ -1255,12 +1539,22 @@ class ClusterCreateValidationResult(msrest.serialization.Model): def __init__( self, *, - validation_errors: Optional[List["ValidationErrorInfo"]] = None, - validation_warnings: Optional[List["ValidationErrorInfo"]] = None, + validation_errors: Optional[List["_models.ValidationErrorInfo"]] = None, + validation_warnings: Optional[List["_models.ValidationErrorInfo"]] = None, estimated_creation_duration: Optional[datetime.timedelta] = None, - aadds_resources_details: Optional[List["AaddsResourceDetails"]] = None, + aadds_resources_details: Optional[List["_models.AaddsResourceDetails"]] = None, **kwargs ): + """ + :keyword validation_errors: The validation errors. + :paramtype validation_errors: list[~azure.mgmt.hdinsight.models.ValidationErrorInfo] + :keyword validation_warnings: The validation warnings. + :paramtype validation_warnings: list[~azure.mgmt.hdinsight.models.ValidationErrorInfo] + :keyword estimated_creation_duration: The estimated creation duration. + :paramtype estimated_creation_duration: ~datetime.timedelta + :keyword aadds_resources_details: The Azure active directory domain service resource details. + :paramtype aadds_resources_details: list[~azure.mgmt.hdinsight.models.AaddsResourceDetails] + """ super(ClusterCreateValidationResult, self).__init__(**kwargs) self.validation_errors = validation_errors self.validation_warnings = validation_warnings @@ -1271,14 +1565,14 @@ def __init__( class ClusterDefinition(msrest.serialization.Model): """The cluster definition. - :param blueprint: The link to the blueprint. - :type blueprint: str - :param kind: The type of cluster. - :type kind: str - :param component_version: The versions of different services in the cluster. - :type component_version: dict[str, str] - :param configurations: The cluster configurations. - :type configurations: any + :ivar blueprint: The link to the blueprint. + :vartype blueprint: str + :ivar kind: The type of cluster. + :vartype kind: str + :ivar component_version: The versions of different services in the cluster. + :vartype component_version: dict[str, str] + :ivar configurations: The cluster configurations. + :vartype configurations: any """ _attribute_map = { @@ -1297,6 +1591,16 @@ def __init__( configurations: Optional[Any] = None, **kwargs ): + """ + :keyword blueprint: The link to the blueprint. + :paramtype blueprint: str + :keyword kind: The type of cluster. + :paramtype kind: str + :keyword component_version: The versions of different services in the cluster. + :paramtype component_version: dict[str, str] + :keyword configurations: The cluster configurations. + :paramtype configurations: any + """ super(ClusterDefinition, self).__init__(**kwargs) self.blueprint = blueprint self.kind = kind @@ -1307,13 +1611,13 @@ def __init__( class ClusterDiskEncryptionParameters(msrest.serialization.Model): """The Disk Encryption Cluster request parameters. - :param vault_uri: Base key vault URI where the customers key is located eg. + :ivar vault_uri: Base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. - :type vault_uri: str - :param key_name: Key name that is used for enabling disk encryption. - :type key_name: str - :param key_version: Specific key version that is used for enabling disk encryption. - :type key_version: str + :vartype vault_uri: str + :ivar key_name: Key name that is used for enabling disk encryption. + :vartype key_name: str + :ivar key_version: Specific key version that is used for enabling disk encryption. + :vartype key_version: str """ _attribute_map = { @@ -1330,6 +1634,15 @@ def __init__( key_version: Optional[str] = None, **kwargs ): + """ + :keyword vault_uri: Base key vault URI where the customers key is located eg. + https://myvault.vault.azure.net. + :paramtype vault_uri: str + :keyword key_name: Key name that is used for enabling disk encryption. + :paramtype key_name: str + :keyword key_version: Specific key version that is used for enabling disk encryption. + :paramtype key_version: str + """ super(ClusterDiskEncryptionParameters, self).__init__(**kwargs) self.vault_uri = vault_uri self.key_name = key_name @@ -1343,54 +1656,56 @@ class ClusterGetProperties(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param cluster_version: The version of the cluster. - :type cluster_version: str - :param cluster_hdp_version: The hdp version of the cluster. - :type cluster_hdp_version: str - :param os_type: The type of operating system. Possible values include: "Windows", "Linux". - :type os_type: str or ~azure.mgmt.hdinsight.models.OSType - :param tier: The cluster tier. Possible values include: "Standard", "Premium". - :type tier: str or ~azure.mgmt.hdinsight.models.Tier - :param cluster_id: The cluster id. - :type cluster_id: str - :param cluster_definition: Required. The cluster definition. - :type cluster_definition: ~azure.mgmt.hdinsight.models.ClusterDefinition - :param kafka_rest_properties: The cluster kafka rest proxy configuration. - :type kafka_rest_properties: ~azure.mgmt.hdinsight.models.KafkaRestProperties - :param security_profile: The security profile. - :type security_profile: ~azure.mgmt.hdinsight.models.SecurityProfile - :param compute_profile: The compute profile. - :type compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile - :param provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "InProgress", "Failed", "Succeeded", "Canceled", "Deleting". - :type provisioning_state: str or ~azure.mgmt.hdinsight.models.HDInsightClusterProvisioningState - :param created_date: The date on which the cluster was created. - :type created_date: str - :param cluster_state: The state of the cluster. - :type cluster_state: str - :param quota_info: The quota information. - :type quota_info: ~azure.mgmt.hdinsight.models.QuotaInfo - :param errors: The list of errors. - :type errors: list[~azure.mgmt.hdinsight.models.Errors] - :param connectivity_endpoints: The list of connectivity endpoints. - :type connectivity_endpoints: list[~azure.mgmt.hdinsight.models.ConnectivityEndpoint] - :param disk_encryption_properties: The disk encryption properties. - :type disk_encryption_properties: ~azure.mgmt.hdinsight.models.DiskEncryptionProperties - :param encryption_in_transit_properties: The encryption-in-transit properties. - :type encryption_in_transit_properties: + :ivar cluster_version: The version of the cluster. + :vartype cluster_version: str + :ivar cluster_hdp_version: The hdp version of the cluster. + :vartype cluster_hdp_version: str + :ivar os_type: The type of operating system. Known values are: "Windows", "Linux". + :vartype os_type: str or ~azure.mgmt.hdinsight.models.OSType + :ivar tier: The cluster tier. Known values are: "Standard", "Premium". + :vartype tier: str or ~azure.mgmt.hdinsight.models.Tier + :ivar cluster_id: The cluster id. + :vartype cluster_id: str + :ivar cluster_definition: Required. The cluster definition. + :vartype cluster_definition: ~azure.mgmt.hdinsight.models.ClusterDefinition + :ivar kafka_rest_properties: The cluster kafka rest proxy configuration. + :vartype kafka_rest_properties: ~azure.mgmt.hdinsight.models.KafkaRestProperties + :ivar security_profile: The security profile. + :vartype security_profile: ~azure.mgmt.hdinsight.models.SecurityProfile + :ivar compute_profile: The compute profile. + :vartype compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "InProgress", "Failed", "Succeeded", "Canceled", "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.hdinsight.models.HDInsightClusterProvisioningState + :ivar created_date: The date on which the cluster was created. + :vartype created_date: str + :ivar cluster_state: The state of the cluster. + :vartype cluster_state: str + :ivar quota_info: The quota information. + :vartype quota_info: ~azure.mgmt.hdinsight.models.QuotaInfo + :ivar errors: The list of errors. + :vartype errors: list[~azure.mgmt.hdinsight.models.Errors] + :ivar connectivity_endpoints: The list of connectivity endpoints. + :vartype connectivity_endpoints: list[~azure.mgmt.hdinsight.models.ConnectivityEndpoint] + :ivar disk_encryption_properties: The disk encryption properties. + :vartype disk_encryption_properties: ~azure.mgmt.hdinsight.models.DiskEncryptionProperties + :ivar encryption_in_transit_properties: The encryption-in-transit properties. + :vartype encryption_in_transit_properties: ~azure.mgmt.hdinsight.models.EncryptionInTransitProperties - :param storage_profile: The storage profile. - :type storage_profile: ~azure.mgmt.hdinsight.models.StorageProfile - :param min_supported_tls_version: The minimal supported tls version. - :type min_supported_tls_version: str - :param excluded_services_config: The excluded services config. - :type excluded_services_config: ~azure.mgmt.hdinsight.models.ExcludedServicesConfig - :param network_properties: The network properties. - :type network_properties: ~azure.mgmt.hdinsight.models.NetworkProperties - :param compute_isolation_properties: The compute isolation properties. - :type compute_isolation_properties: ~azure.mgmt.hdinsight.models.ComputeIsolationProperties - :param private_link_configurations: The private link configurations. - :type private_link_configurations: list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] + :ivar storage_profile: The storage profile. + :vartype storage_profile: ~azure.mgmt.hdinsight.models.StorageProfile + :ivar min_supported_tls_version: The minimal supported tls version. + :vartype min_supported_tls_version: str + :ivar excluded_services_config: The excluded services config. + :vartype excluded_services_config: ~azure.mgmt.hdinsight.models.ExcludedServicesConfig + :ivar network_properties: The network properties. + :vartype network_properties: ~azure.mgmt.hdinsight.models.NetworkProperties + :ivar compute_isolation_properties: The compute isolation properties. + :vartype compute_isolation_properties: ~azure.mgmt.hdinsight.models.ComputeIsolationProperties + :ivar private_link_configurations: The private link configurations. + :vartype private_link_configurations: + list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] :ivar private_endpoint_connections: The list of private endpoint connections. :vartype private_endpoint_connections: list[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] @@ -1431,31 +1746,84 @@ class ClusterGetProperties(msrest.serialization.Model): def __init__( self, *, - cluster_definition: "ClusterDefinition", + cluster_definition: "_models.ClusterDefinition", cluster_version: Optional[str] = None, cluster_hdp_version: Optional[str] = None, - os_type: Optional[Union[str, "OSType"]] = None, - tier: Optional[Union[str, "Tier"]] = None, + os_type: Optional[Union[str, "_models.OSType"]] = None, + tier: Optional[Union[str, "_models.Tier"]] = None, cluster_id: Optional[str] = None, - kafka_rest_properties: Optional["KafkaRestProperties"] = None, - security_profile: Optional["SecurityProfile"] = None, - compute_profile: Optional["ComputeProfile"] = None, - provisioning_state: Optional[Union[str, "HDInsightClusterProvisioningState"]] = None, + kafka_rest_properties: Optional["_models.KafkaRestProperties"] = None, + security_profile: Optional["_models.SecurityProfile"] = None, + compute_profile: Optional["_models.ComputeProfile"] = None, + provisioning_state: Optional[Union[str, "_models.HDInsightClusterProvisioningState"]] = None, created_date: Optional[str] = None, cluster_state: Optional[str] = None, - quota_info: Optional["QuotaInfo"] = None, - errors: Optional[List["Errors"]] = None, - connectivity_endpoints: Optional[List["ConnectivityEndpoint"]] = None, - disk_encryption_properties: Optional["DiskEncryptionProperties"] = None, - encryption_in_transit_properties: Optional["EncryptionInTransitProperties"] = None, - storage_profile: Optional["StorageProfile"] = None, + quota_info: Optional["_models.QuotaInfo"] = None, + errors: Optional[List["_models.Errors"]] = None, + connectivity_endpoints: Optional[List["_models.ConnectivityEndpoint"]] = None, + disk_encryption_properties: Optional["_models.DiskEncryptionProperties"] = None, + encryption_in_transit_properties: Optional["_models.EncryptionInTransitProperties"] = None, + storage_profile: Optional["_models.StorageProfile"] = None, min_supported_tls_version: Optional[str] = None, - excluded_services_config: Optional["ExcludedServicesConfig"] = None, - network_properties: Optional["NetworkProperties"] = None, - compute_isolation_properties: Optional["ComputeIsolationProperties"] = None, - private_link_configurations: Optional[List["PrivateLinkConfiguration"]] = None, + excluded_services_config: Optional["_models.ExcludedServicesConfig"] = None, + network_properties: Optional["_models.NetworkProperties"] = None, + compute_isolation_properties: Optional["_models.ComputeIsolationProperties"] = None, + private_link_configurations: Optional[List["_models.PrivateLinkConfiguration"]] = None, **kwargs ): + """ + :keyword cluster_version: The version of the cluster. + :paramtype cluster_version: str + :keyword cluster_hdp_version: The hdp version of the cluster. + :paramtype cluster_hdp_version: str + :keyword os_type: The type of operating system. Known values are: "Windows", "Linux". + :paramtype os_type: str or ~azure.mgmt.hdinsight.models.OSType + :keyword tier: The cluster tier. Known values are: "Standard", "Premium". + :paramtype tier: str or ~azure.mgmt.hdinsight.models.Tier + :keyword cluster_id: The cluster id. + :paramtype cluster_id: str + :keyword cluster_definition: Required. The cluster definition. + :paramtype cluster_definition: ~azure.mgmt.hdinsight.models.ClusterDefinition + :keyword kafka_rest_properties: The cluster kafka rest proxy configuration. + :paramtype kafka_rest_properties: ~azure.mgmt.hdinsight.models.KafkaRestProperties + :keyword security_profile: The security profile. + :paramtype security_profile: ~azure.mgmt.hdinsight.models.SecurityProfile + :keyword compute_profile: The compute profile. + :paramtype compute_profile: ~azure.mgmt.hdinsight.models.ComputeProfile + :keyword provisioning_state: The provisioning state, which only appears in the response. Known + values are: "InProgress", "Failed", "Succeeded", "Canceled", "Deleting". + :paramtype provisioning_state: str or + ~azure.mgmt.hdinsight.models.HDInsightClusterProvisioningState + :keyword created_date: The date on which the cluster was created. + :paramtype created_date: str + :keyword cluster_state: The state of the cluster. + :paramtype cluster_state: str + :keyword quota_info: The quota information. + :paramtype quota_info: ~azure.mgmt.hdinsight.models.QuotaInfo + :keyword errors: The list of errors. + :paramtype errors: list[~azure.mgmt.hdinsight.models.Errors] + :keyword connectivity_endpoints: The list of connectivity endpoints. + :paramtype connectivity_endpoints: list[~azure.mgmt.hdinsight.models.ConnectivityEndpoint] + :keyword disk_encryption_properties: The disk encryption properties. + :paramtype disk_encryption_properties: ~azure.mgmt.hdinsight.models.DiskEncryptionProperties + :keyword encryption_in_transit_properties: The encryption-in-transit properties. + :paramtype encryption_in_transit_properties: + ~azure.mgmt.hdinsight.models.EncryptionInTransitProperties + :keyword storage_profile: The storage profile. + :paramtype storage_profile: ~azure.mgmt.hdinsight.models.StorageProfile + :keyword min_supported_tls_version: The minimal supported tls version. + :paramtype min_supported_tls_version: str + :keyword excluded_services_config: The excluded services config. + :paramtype excluded_services_config: ~azure.mgmt.hdinsight.models.ExcludedServicesConfig + :keyword network_properties: The network properties. + :paramtype network_properties: ~azure.mgmt.hdinsight.models.NetworkProperties + :keyword compute_isolation_properties: The compute isolation properties. + :paramtype compute_isolation_properties: + ~azure.mgmt.hdinsight.models.ComputeIsolationProperties + :keyword private_link_configurations: The private link configurations. + :paramtype private_link_configurations: + list[~azure.mgmt.hdinsight.models.PrivateLinkConfiguration] + """ super(ClusterGetProperties, self).__init__(**kwargs) self.cluster_version = cluster_version self.cluster_hdp_version = cluster_hdp_version @@ -1494,14 +1862,14 @@ class ClusterIdentity(msrest.serialization.Model): :ivar tenant_id: The tenant id associated with the cluster. This property will only be provided for a system assigned identity. :vartype tenant_id: str - :param type: The type of identity used for the cluster. The type 'SystemAssigned, UserAssigned' - includes both an implicitly created identity and a set of user assigned identities. Possible - values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.hdinsight.models.ResourceIdentityType - :param user_assigned_identities: The list of user identities associated with the cluster. The + :ivar type: The type of identity used for the cluster. The type 'SystemAssigned, UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. Known + values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :vartype type: str or ~azure.mgmt.hdinsight.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the cluster. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, ~azure.mgmt.hdinsight.models.UserAssignedIdentity] + :vartype user_assigned_identities: dict[str, ~azure.mgmt.hdinsight.models.UserAssignedIdentity] """ _validation = { @@ -1519,10 +1887,22 @@ class ClusterIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ResourceIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type: The type of identity used for the cluster. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. Known values are: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", + "None". + :paramtype type: str or ~azure.mgmt.hdinsight.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the cluster. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.hdinsight.models.UserAssignedIdentity] + """ super(ClusterIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1535,8 +1915,8 @@ class ClusterListPersistedScriptActionsResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: The list of Persisted Script Actions. - :type value: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] + :ivar value: The list of Persisted Script Actions. + :vartype value: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -1553,9 +1933,13 @@ class ClusterListPersistedScriptActionsResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["RuntimeScriptAction"]] = None, + value: Optional[List["_models.RuntimeScriptAction"]] = None, **kwargs ): + """ + :keyword value: The list of Persisted Script Actions. + :paramtype value: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] + """ super(ClusterListPersistedScriptActionsResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1566,8 +1950,8 @@ class ClusterListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: The list of Clusters. - :type value: list[~azure.mgmt.hdinsight.models.Cluster] + :ivar value: The list of Clusters. + :vartype value: list[~azure.mgmt.hdinsight.models.Cluster] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -1584,9 +1968,13 @@ class ClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Cluster"]] = None, + value: Optional[List["_models.Cluster"]] = None, **kwargs ): + """ + :keyword value: The list of Clusters. + :paramtype value: list[~azure.mgmt.hdinsight.models.Cluster] + """ super(ClusterListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1595,10 +1983,10 @@ def __init__( class ClusterMonitoringRequest(msrest.serialization.Model): """The cluster monitor parameters. - :param workspace_id: The cluster monitor workspace ID. - :type workspace_id: str - :param primary_key: The cluster monitor workspace key. - :type primary_key: str + :ivar workspace_id: The cluster monitor workspace ID. + :vartype workspace_id: str + :ivar primary_key: The cluster monitor workspace key. + :vartype primary_key: str """ _attribute_map = { @@ -1613,6 +2001,12 @@ def __init__( primary_key: Optional[str] = None, **kwargs ): + """ + :keyword workspace_id: The cluster monitor workspace ID. + :paramtype workspace_id: str + :keyword primary_key: The cluster monitor workspace key. + :paramtype primary_key: str + """ super(ClusterMonitoringRequest, self).__init__(**kwargs) self.workspace_id = workspace_id self.primary_key = primary_key @@ -1621,10 +2015,10 @@ def __init__( class ClusterMonitoringResponse(msrest.serialization.Model): """The cluster monitoring status response. - :param cluster_monitoring_enabled: The status of the monitor on the HDInsight cluster. - :type cluster_monitoring_enabled: bool - :param workspace_id: The workspace ID of the monitor on the HDInsight cluster. - :type workspace_id: str + :ivar cluster_monitoring_enabled: The status of the monitor on the HDInsight cluster. + :vartype cluster_monitoring_enabled: bool + :ivar workspace_id: The workspace ID of the monitor on the HDInsight cluster. + :vartype workspace_id: str """ _attribute_map = { @@ -1639,6 +2033,12 @@ def __init__( workspace_id: Optional[str] = None, **kwargs ): + """ + :keyword cluster_monitoring_enabled: The status of the monitor on the HDInsight cluster. + :paramtype cluster_monitoring_enabled: bool + :keyword workspace_id: The workspace ID of the monitor on the HDInsight cluster. + :paramtype workspace_id: str + """ super(ClusterMonitoringResponse, self).__init__(**kwargs) self.cluster_monitoring_enabled = cluster_monitoring_enabled self.workspace_id = workspace_id @@ -1647,8 +2047,8 @@ def __init__( class ClusterPatchParameters(msrest.serialization.Model): """The PatchCluster request parameters. - :param tags: A set of tags. The resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. The resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1661,6 +2061,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The resource tags. + :paramtype tags: dict[str, str] + """ super(ClusterPatchParameters, self).__init__(**kwargs) self.tags = tags @@ -1668,8 +2072,8 @@ def __init__( class ClusterResizeParameters(msrest.serialization.Model): """The Resize Cluster request parameters. - :param target_instance_count: The target instance count for the operation. - :type target_instance_count: int + :ivar target_instance_count: The target instance count for the operation. + :vartype target_instance_count: int """ _attribute_map = { @@ -1682,6 +2086,10 @@ def __init__( target_instance_count: Optional[int] = None, **kwargs ): + """ + :keyword target_instance_count: The target instance count for the operation. + :paramtype target_instance_count: int + """ super(ClusterResizeParameters, self).__init__(**kwargs) self.target_instance_count = target_instance_count @@ -1689,10 +2097,10 @@ def __init__( class ComputeIsolationProperties(msrest.serialization.Model): """The compute isolation properties. - :param enable_compute_isolation: The flag indicates whether enable compute isolation or not. - :type enable_compute_isolation: bool - :param host_sku: The host sku. - :type host_sku: str + :ivar enable_compute_isolation: The flag indicates whether enable compute isolation or not. + :vartype enable_compute_isolation: bool + :ivar host_sku: The host sku. + :vartype host_sku: str """ _attribute_map = { @@ -1707,6 +2115,12 @@ def __init__( host_sku: Optional[str] = None, **kwargs ): + """ + :keyword enable_compute_isolation: The flag indicates whether enable compute isolation or not. + :paramtype enable_compute_isolation: bool + :keyword host_sku: The host sku. + :paramtype host_sku: str + """ super(ComputeIsolationProperties, self).__init__(**kwargs) self.enable_compute_isolation = enable_compute_isolation self.host_sku = host_sku @@ -1715,8 +2129,8 @@ def __init__( class ComputeProfile(msrest.serialization.Model): """Describes the compute profile. - :param roles: The list of roles in the cluster. - :type roles: list[~azure.mgmt.hdinsight.models.Role] + :ivar roles: The list of roles in the cluster. + :vartype roles: list[~azure.mgmt.hdinsight.models.Role] """ _attribute_map = { @@ -1726,9 +2140,13 @@ class ComputeProfile(msrest.serialization.Model): def __init__( self, *, - roles: Optional[List["Role"]] = None, + roles: Optional[List["_models.Role"]] = None, **kwargs ): + """ + :keyword roles: The list of roles in the cluster. + :paramtype roles: list[~azure.mgmt.hdinsight.models.Role] + """ super(ComputeProfile, self).__init__(**kwargs) self.roles = roles @@ -1736,16 +2154,16 @@ def __init__( class ConnectivityEndpoint(msrest.serialization.Model): """The connectivity properties. - :param name: The name of the endpoint. - :type name: str - :param protocol: The protocol of the endpoint. - :type protocol: str - :param location: The location of the endpoint. - :type location: str - :param port: The port to connect to. - :type port: int - :param private_ip_address: The private ip address of the endpoint. - :type private_ip_address: str + :ivar name: The name of the endpoint. + :vartype name: str + :ivar protocol: The protocol of the endpoint. + :vartype protocol: str + :ivar location: The location of the endpoint. + :vartype location: str + :ivar port: The port to connect to. + :vartype port: int + :ivar private_ip_address: The private ip address of the endpoint. + :vartype private_ip_address: str """ _attribute_map = { @@ -1766,6 +2184,18 @@ def __init__( private_ip_address: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the endpoint. + :paramtype name: str + :keyword protocol: The protocol of the endpoint. + :paramtype protocol: str + :keyword location: The location of the endpoint. + :paramtype location: str + :keyword port: The port to connect to. + :paramtype port: int + :keyword private_ip_address: The private ip address of the endpoint. + :paramtype private_ip_address: str + """ super(ConnectivityEndpoint, self).__init__(**kwargs) self.name = name self.protocol = protocol @@ -1779,8 +2209,8 @@ class DataDisksGroups(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param disks_per_node: The number of disks per node. - :type disks_per_node: int + :ivar disks_per_node: The number of disks per node. + :vartype disks_per_node: int :ivar storage_account_type: ReadOnly. The storage account type. Do not set this value. :vartype storage_account_type: str :ivar disk_size_gb: ReadOnly. The DiskSize in GB. Do not set this value. @@ -1804,6 +2234,10 @@ def __init__( disks_per_node: Optional[int] = None, **kwargs ): + """ + :keyword disks_per_node: The number of disks per node. + :paramtype disks_per_node: int + """ super(DataDisksGroups, self).__init__(**kwargs) self.disks_per_node = disks_per_node self.storage_account_type = None @@ -1813,15 +2247,15 @@ def __init__( class Dimension(msrest.serialization.Model): """The definition of Dimension. - :param name: The name of the dimension. - :type name: str - :param display_name: The display name of the dimension. - :type display_name: str - :param internal_name: The display name of the dimension. - :type internal_name: str - :param to_be_exported_for_shoebox: The flag indicates whether the metric will be exported for + :ivar name: The name of the dimension. + :vartype name: str + :ivar display_name: The display name of the dimension. + :vartype display_name: str + :ivar internal_name: The display name of the dimension. + :vartype internal_name: str + :ivar to_be_exported_for_shoebox: The flag indicates whether the metric will be exported for shoebox or not. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -1840,6 +2274,17 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: The name of the dimension. + :paramtype name: str + :keyword display_name: The display name of the dimension. + :paramtype display_name: str + :keyword internal_name: The display name of the dimension. + :paramtype internal_name: str + :keyword to_be_exported_for_shoebox: The flag indicates whether the metric will be exported for + shoebox or not. + :paramtype to_be_exported_for_shoebox: bool + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1850,13 +2295,13 @@ def __init__( class DiskBillingMeters(msrest.serialization.Model): """The disk billing meters. - :param disk_rp_meter: The managed disk meter guid. - :type disk_rp_meter: str - :param sku: The managed disk billing sku, P30 or S30. - :type sku: str - :param tier: The managed disk billing tier, Standard or Premium. Possible values include: - "Standard", "Premium". - :type tier: str or ~azure.mgmt.hdinsight.models.Tier + :ivar disk_rp_meter: The managed disk meter guid. + :vartype disk_rp_meter: str + :ivar sku: The managed disk billing sku, P30 or S30. + :vartype sku: str + :ivar tier: The managed disk billing tier, Standard or Premium. Known values are: "Standard", + "Premium". + :vartype tier: str or ~azure.mgmt.hdinsight.models.Tier """ _attribute_map = { @@ -1870,9 +2315,18 @@ def __init__( *, disk_rp_meter: Optional[str] = None, sku: Optional[str] = None, - tier: Optional[Union[str, "Tier"]] = None, + tier: Optional[Union[str, "_models.Tier"]] = None, **kwargs ): + """ + :keyword disk_rp_meter: The managed disk meter guid. + :paramtype disk_rp_meter: str + :keyword sku: The managed disk billing sku, P30 or S30. + :paramtype sku: str + :keyword tier: The managed disk billing tier, Standard or Premium. Known values are: + "Standard", "Premium". + :paramtype tier: str or ~azure.mgmt.hdinsight.models.Tier + """ super(DiskBillingMeters, self).__init__(**kwargs) self.disk_rp_meter = disk_rp_meter self.sku = sku @@ -1882,20 +2336,21 @@ def __init__( class DiskEncryptionProperties(msrest.serialization.Model): """The disk encryption properties. - :param vault_uri: Base key vault URI where the customers key is located eg. + :ivar vault_uri: Base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. - :type vault_uri: str - :param key_name: Key name that is used for enabling disk encryption. - :type key_name: str - :param key_version: Specific key version that is used for enabling disk encryption. - :type key_version: str - :param encryption_algorithm: Algorithm identifier for encryption, default RSA-OAEP. Possible - values include: "RSA-OAEP", "RSA-OAEP-256", "RSA1_5". - :type encryption_algorithm: str or ~azure.mgmt.hdinsight.models.JsonWebKeyEncryptionAlgorithm - :param msi_resource_id: Resource ID of Managed Identity that is used to access the key vault. - :type msi_resource_id: str - :param encryption_at_host: Indicates whether or not resource disk encryption is enabled. - :type encryption_at_host: bool + :vartype vault_uri: str + :ivar key_name: Key name that is used for enabling disk encryption. + :vartype key_name: str + :ivar key_version: Specific key version that is used for enabling disk encryption. + :vartype key_version: str + :ivar encryption_algorithm: Algorithm identifier for encryption, default RSA-OAEP. Known values + are: "RSA-OAEP", "RSA-OAEP-256", "RSA1_5". + :vartype encryption_algorithm: str or + ~azure.mgmt.hdinsight.models.JsonWebKeyEncryptionAlgorithm + :ivar msi_resource_id: Resource ID of Managed Identity that is used to access the key vault. + :vartype msi_resource_id: str + :ivar encryption_at_host: Indicates whether or not resource disk encryption is enabled. + :vartype encryption_at_host: bool """ _attribute_map = { @@ -1913,11 +2368,28 @@ def __init__( vault_uri: Optional[str] = None, key_name: Optional[str] = None, key_version: Optional[str] = None, - encryption_algorithm: Optional[Union[str, "JsonWebKeyEncryptionAlgorithm"]] = None, + encryption_algorithm: Optional[Union[str, "_models.JsonWebKeyEncryptionAlgorithm"]] = None, msi_resource_id: Optional[str] = None, encryption_at_host: Optional[bool] = False, **kwargs ): + """ + :keyword vault_uri: Base key vault URI where the customers key is located eg. + https://myvault.vault.azure.net. + :paramtype vault_uri: str + :keyword key_name: Key name that is used for enabling disk encryption. + :paramtype key_name: str + :keyword key_version: Specific key version that is used for enabling disk encryption. + :paramtype key_version: str + :keyword encryption_algorithm: Algorithm identifier for encryption, default RSA-OAEP. Known + values are: "RSA-OAEP", "RSA-OAEP-256", "RSA1_5". + :paramtype encryption_algorithm: str or + ~azure.mgmt.hdinsight.models.JsonWebKeyEncryptionAlgorithm + :keyword msi_resource_id: Resource ID of Managed Identity that is used to access the key vault. + :paramtype msi_resource_id: str + :keyword encryption_at_host: Indicates whether or not resource disk encryption is enabled. + :paramtype encryption_at_host: bool + """ super(DiskEncryptionProperties, self).__init__(**kwargs) self.vault_uri = vault_uri self.key_name = key_name @@ -1930,9 +2402,9 @@ def __init__( class EncryptionInTransitProperties(msrest.serialization.Model): """The encryption-in-transit properties. - :param is_encryption_in_transit_enabled: Indicates whether or not inter cluster node + :ivar is_encryption_in_transit_enabled: Indicates whether or not inter cluster node communication is encrypted in transit. - :type is_encryption_in_transit_enabled: bool + :vartype is_encryption_in_transit_enabled: bool """ _attribute_map = { @@ -1945,6 +2417,11 @@ def __init__( is_encryption_in_transit_enabled: Optional[bool] = False, **kwargs ): + """ + :keyword is_encryption_in_transit_enabled: Indicates whether or not inter cluster node + communication is encrypted in transit. + :paramtype is_encryption_in_transit_enabled: bool + """ super(EncryptionInTransitProperties, self).__init__(**kwargs) self.is_encryption_in_transit_enabled = is_encryption_in_transit_enabled @@ -1952,10 +2429,10 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Describes the format of Error response. - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str """ _attribute_map = { @@ -1970,6 +2447,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message indicating why the operation failed. + :paramtype message: str + """ super(ErrorResponse, self).__init__(**kwargs) self.code = code self.message = message @@ -1978,10 +2461,10 @@ def __init__( class Errors(msrest.serialization.Model): """The error message associated with the cluster creation. - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -1996,6 +2479,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + """ super(Errors, self).__init__(**kwargs) self.code = code self.message = message @@ -2004,10 +2493,10 @@ def __init__( class ExcludedServicesConfig(msrest.serialization.Model): """The configuration that services will be excluded when creating cluster. - :param excluded_services_config_id: The config id of excluded services. - :type excluded_services_config_id: str - :param excluded_services_list: The list of excluded services. - :type excluded_services_list: str + :ivar excluded_services_config_id: The config id of excluded services. + :vartype excluded_services_config_id: str + :ivar excluded_services_list: The list of excluded services. + :vartype excluded_services_list: str """ _attribute_map = { @@ -2022,6 +2511,12 @@ def __init__( excluded_services_list: Optional[str] = None, **kwargs ): + """ + :keyword excluded_services_config_id: The config id of excluded services. + :paramtype excluded_services_config_id: str + :keyword excluded_services_list: The list of excluded services. + :paramtype excluded_services_list: str + """ super(ExcludedServicesConfig, self).__init__(**kwargs) self.excluded_services_config_id = excluded_services_config_id self.excluded_services_list = excluded_services_list @@ -2032,10 +2527,10 @@ class ExecuteScriptActionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param script_actions: The list of run time script actions. - :type script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] - :param persist_on_success: Required. Gets or sets if the scripts needs to be persisted. - :type persist_on_success: bool + :ivar script_actions: The list of run time script actions. + :vartype script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] + :ivar persist_on_success: Required. Gets or sets if the scripts needs to be persisted. + :vartype persist_on_success: bool """ _validation = { @@ -2051,9 +2546,15 @@ def __init__( self, *, persist_on_success: bool, - script_actions: Optional[List["RuntimeScriptAction"]] = None, + script_actions: Optional[List["_models.RuntimeScriptAction"]] = None, **kwargs ): + """ + :keyword script_actions: The list of run time script actions. + :paramtype script_actions: list[~azure.mgmt.hdinsight.models.RuntimeScriptAction] + :keyword persist_on_success: Required. Gets or sets if the scripts needs to be persisted. + :paramtype persist_on_success: bool + """ super(ExecuteScriptActionParameters, self).__init__(**kwargs) self.script_actions = script_actions self.persist_on_success = persist_on_success @@ -2062,10 +2563,10 @@ def __init__( class Extension(msrest.serialization.Model): """Cluster monitoring extensions. - :param workspace_id: The workspace ID for the cluster monitoring extension. - :type workspace_id: str - :param primary_key: The certificate for the cluster monitoring extensions. - :type primary_key: str + :ivar workspace_id: The workspace ID for the cluster monitoring extension. + :vartype workspace_id: str + :ivar primary_key: The certificate for the cluster monitoring extensions. + :vartype primary_key: str """ _attribute_map = { @@ -2080,6 +2581,12 @@ def __init__( primary_key: Optional[str] = None, **kwargs ): + """ + :keyword workspace_id: The workspace ID for the cluster monitoring extension. + :paramtype workspace_id: str + :keyword primary_key: The certificate for the cluster monitoring extensions. + :paramtype primary_key: str + """ super(Extension, self).__init__(**kwargs) self.workspace_id = workspace_id self.primary_key = primary_key @@ -2115,6 +2622,8 @@ def __init__( self, **kwargs ): + """ + """ super(GatewaySettings, self).__init__(**kwargs) self.is_credential_enabled = None self.user_name = None @@ -2124,8 +2633,8 @@ def __init__( class HardwareProfile(msrest.serialization.Model): """The hardware profile. - :param vm_size: The size of the VM. - :type vm_size: str + :ivar vm_size: The size of the VM. + :vartype vm_size: str """ _attribute_map = { @@ -2138,6 +2647,10 @@ def __init__( vm_size: Optional[str] = None, **kwargs ): + """ + :keyword vm_size: The size of the VM. + :paramtype vm_size: str + """ super(HardwareProfile, self).__init__(**kwargs) self.vm_size = vm_size @@ -2145,13 +2658,13 @@ def __init__( class HostInfo(msrest.serialization.Model): """The cluster host information. - :param name: The host name. - :type name: str - :param fqdn: The Fully Qualified Domain Name of host. - :type fqdn: str - :param effective_disk_encryption_key_url: The effective disk encryption key URL used by the + :ivar name: The host name. + :vartype name: str + :ivar fqdn: The Fully Qualified Domain Name of host. + :vartype fqdn: str + :ivar effective_disk_encryption_key_url: The effective disk encryption key URL used by the host. - :type effective_disk_encryption_key_url: str + :vartype effective_disk_encryption_key_url: str """ _attribute_map = { @@ -2168,6 +2681,15 @@ def __init__( effective_disk_encryption_key_url: Optional[str] = None, **kwargs ): + """ + :keyword name: The host name. + :paramtype name: str + :keyword fqdn: The Fully Qualified Domain Name of host. + :paramtype fqdn: str + :keyword effective_disk_encryption_key_url: The effective disk encryption key URL used by the + host. + :paramtype effective_disk_encryption_key_url: str + """ super(HostInfo, self).__init__(**kwargs) self.name = name self.fqdn = fqdn @@ -2183,25 +2705,24 @@ class IPConfiguration(msrest.serialization.Model): :ivar id: The private link IP configuration id. :vartype id: str - :param name: Required. The name of private link IP configuration. - :type name: str + :ivar name: Required. The name of private link IP configuration. + :vartype name: str :ivar type: The type of the private link IP configuration. :vartype type: str :ivar provisioning_state: The private link configuration provisioning state, which only appears - in the response. Possible values include: "InProgress", "Failed", "Succeeded", "Canceled", - "Deleting". + in the response. Known values are: "InProgress", "Failed", "Succeeded", "Canceled", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.hdinsight.models.PrivateLinkConfigurationProvisioningState - :param primary: Indicates whether this IP configuration is primary for the corresponding NIC. - :type primary: bool - :param private_ip_address: The IP address. - :type private_ip_address: str - :param private_ip_allocation_method: The method that private IP address is allocated. Possible - values include: "dynamic", "static". - :type private_ip_allocation_method: str or + :ivar primary: Indicates whether this IP configuration is primary for the corresponding NIC. + :vartype primary: bool + :ivar private_ip_address: The IP address. + :vartype private_ip_address: str + :ivar private_ip_allocation_method: The method that private IP address is allocated. Known + values are: "dynamic", "static". + :vartype private_ip_allocation_method: str or ~azure.mgmt.hdinsight.models.PrivateIPAllocationMethod - :param subnet: The subnet resource id. - :type subnet: ~azure.mgmt.hdinsight.models.ResourceId + :ivar subnet: The subnet resource id. + :vartype subnet: ~azure.mgmt.hdinsight.models.ResourceId """ _validation = { @@ -2228,10 +2749,24 @@ def __init__( name: str, primary: Optional[bool] = None, private_ip_address: Optional[str] = None, - private_ip_allocation_method: Optional[Union[str, "PrivateIPAllocationMethod"]] = None, - subnet: Optional["ResourceId"] = None, + private_ip_allocation_method: Optional[Union[str, "_models.PrivateIPAllocationMethod"]] = None, + subnet: Optional["_models.ResourceId"] = None, **kwargs ): + """ + :keyword name: Required. The name of private link IP configuration. + :paramtype name: str + :keyword primary: Indicates whether this IP configuration is primary for the corresponding NIC. + :paramtype primary: bool + :keyword private_ip_address: The IP address. + :paramtype private_ip_address: str + :keyword private_ip_allocation_method: The method that private IP address is allocated. Known + values are: "dynamic", "static". + :paramtype private_ip_allocation_method: str or + ~azure.mgmt.hdinsight.models.PrivateIPAllocationMethod + :keyword subnet: The subnet resource id. + :paramtype subnet: ~azure.mgmt.hdinsight.models.ResourceId + """ super(IPConfiguration, self).__init__(**kwargs) self.id = None self.name = name @@ -2246,10 +2781,10 @@ def __init__( class KafkaRestProperties(msrest.serialization.Model): """The kafka rest proxy configuration which contains AAD security group information. - :param client_group_info: The information of AAD security group. - :type client_group_info: ~azure.mgmt.hdinsight.models.ClientGroupInfo - :param configuration_override: The configurations that need to be overriden. - :type configuration_override: dict[str, str] + :ivar client_group_info: The information of AAD security group. + :vartype client_group_info: ~azure.mgmt.hdinsight.models.ClientGroupInfo + :ivar configuration_override: The configurations that need to be overriden. + :vartype configuration_override: dict[str, str] """ _attribute_map = { @@ -2260,10 +2795,16 @@ class KafkaRestProperties(msrest.serialization.Model): def __init__( self, *, - client_group_info: Optional["ClientGroupInfo"] = None, + client_group_info: Optional["_models.ClientGroupInfo"] = None, configuration_override: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword client_group_info: The information of AAD security group. + :paramtype client_group_info: ~azure.mgmt.hdinsight.models.ClientGroupInfo + :keyword configuration_override: The configurations that need to be overriden. + :paramtype configuration_override: dict[str, str] + """ super(KafkaRestProperties, self).__init__(**kwargs) self.client_group_info = client_group_info self.configuration_override = configuration_override @@ -2272,12 +2813,12 @@ def __init__( class LinuxOperatingSystemProfile(msrest.serialization.Model): """The ssh username, password, and ssh public key. - :param username: The username. - :type username: str - :param password: The password. - :type password: str - :param ssh_profile: The SSH profile. - :type ssh_profile: ~azure.mgmt.hdinsight.models.SshProfile + :ivar username: The username. + :vartype username: str + :ivar password: The password. + :vartype password: str + :ivar ssh_profile: The SSH profile. + :vartype ssh_profile: ~azure.mgmt.hdinsight.models.SshProfile """ _attribute_map = { @@ -2291,9 +2832,17 @@ def __init__( *, username: Optional[str] = None, password: Optional[str] = None, - ssh_profile: Optional["SshProfile"] = None, + ssh_profile: Optional["_models.SshProfile"] = None, **kwargs ): + """ + :keyword username: The username. + :paramtype username: str + :keyword password: The password. + :paramtype password: str + :keyword ssh_profile: The SSH profile. + :paramtype ssh_profile: ~azure.mgmt.hdinsight.models.SshProfile + """ super(LinuxOperatingSystemProfile, self).__init__(**kwargs) self.username = username self.password = password @@ -2303,10 +2852,10 @@ def __init__( class LocalizedName(msrest.serialization.Model): """The details about the localizable name of a type of usage. - :param value: The name of the used resource. - :type value: str - :param localized_value: The localized name of the used resource. - :type localized_value: str + :ivar value: The name of the used resource. + :vartype value: str + :ivar localized_value: The localized name of the used resource. + :vartype localized_value: str """ _attribute_map = { @@ -2321,6 +2870,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: The name of the used resource. + :paramtype value: str + :keyword localized_value: The localized name of the used resource. + :paramtype localized_value: str + """ super(LocalizedName, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -2329,42 +2884,41 @@ def __init__( class MetricSpecifications(msrest.serialization.Model): """The details of metric specifications. - :param name: The name of the metric specification. - :type name: str - :param display_name: The display name of the metric specification. - :type display_name: str - :param display_description: The display description of the metric specification. - :type display_description: str - :param unit: The unit of the metric specification. - :type unit: str - :param aggregation_type: The aggregation type of the metric specification. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types of the metric - specification. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types of the metric specification. - :type supported_time_grain_types: list[str] - :param enable_regional_mdm_account: The flag indicates whether enable regional mdm account or + :ivar name: The name of the metric specification. + :vartype name: str + :ivar display_name: The display name of the metric specification. + :vartype display_name: str + :ivar display_description: The display description of the metric specification. + :vartype display_description: str + :ivar unit: The unit of the metric specification. + :vartype unit: str + :ivar aggregation_type: The aggregation type of the metric specification. + :vartype aggregation_type: str + :ivar supported_aggregation_types: The supported aggregation types of the metric specification. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: The supported time grain types of the metric specification. + :vartype supported_time_grain_types: list[str] + :ivar enable_regional_mdm_account: The flag indicates whether enable regional mdm account or not. - :type enable_regional_mdm_account: bool - :param source_mdm_account: The source mdm account. - :type source_mdm_account: str - :param source_mdm_namespace: The source mdm namespace. - :type source_mdm_namespace: str - :param metric_filter_pattern: The metric filter pattern. - :type metric_filter_pattern: str - :param fill_gap_with_zero: The flag indicates whether filling gap with zero. - :type fill_gap_with_zero: bool - :param category: The category of the metric. - :type category: str - :param resource_id_dimension_name_override: The override name of resource id dimension name. - :type resource_id_dimension_name_override: str - :param is_internal: The flag indicates whether the metric is internal or not. - :type is_internal: bool - :param delegate_metric_name_override: The override name of delegate metric. - :type delegate_metric_name_override: str - :param dimensions: The dimensions of the metric specification. - :type dimensions: list[~azure.mgmt.hdinsight.models.Dimension] + :vartype enable_regional_mdm_account: bool + :ivar source_mdm_account: The source mdm account. + :vartype source_mdm_account: str + :ivar source_mdm_namespace: The source mdm namespace. + :vartype source_mdm_namespace: str + :ivar metric_filter_pattern: The metric filter pattern. + :vartype metric_filter_pattern: str + :ivar fill_gap_with_zero: The flag indicates whether filling gap with zero. + :vartype fill_gap_with_zero: bool + :ivar category: The category of the metric. + :vartype category: str + :ivar resource_id_dimension_name_override: The override name of resource id dimension name. + :vartype resource_id_dimension_name_override: str + :ivar is_internal: The flag indicates whether the metric is internal or not. + :vartype is_internal: bool + :ivar delegate_metric_name_override: The override name of delegate metric. + :vartype delegate_metric_name_override: str + :ivar dimensions: The dimensions of the metric specification. + :vartype dimensions: list[~azure.mgmt.hdinsight.models.Dimension] """ _attribute_map = { @@ -2406,9 +2960,48 @@ def __init__( resource_id_dimension_name_override: Optional[str] = None, is_internal: Optional[bool] = None, delegate_metric_name_override: Optional[str] = None, - dimensions: Optional[List["Dimension"]] = None, + dimensions: Optional[List["_models.Dimension"]] = None, **kwargs ): + """ + :keyword name: The name of the metric specification. + :paramtype name: str + :keyword display_name: The display name of the metric specification. + :paramtype display_name: str + :keyword display_description: The display description of the metric specification. + :paramtype display_description: str + :keyword unit: The unit of the metric specification. + :paramtype unit: str + :keyword aggregation_type: The aggregation type of the metric specification. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: The supported aggregation types of the metric + specification. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: The supported time grain types of the metric + specification. + :paramtype supported_time_grain_types: list[str] + :keyword enable_regional_mdm_account: The flag indicates whether enable regional mdm account or + not. + :paramtype enable_regional_mdm_account: bool + :keyword source_mdm_account: The source mdm account. + :paramtype source_mdm_account: str + :keyword source_mdm_namespace: The source mdm namespace. + :paramtype source_mdm_namespace: str + :keyword metric_filter_pattern: The metric filter pattern. + :paramtype metric_filter_pattern: str + :keyword fill_gap_with_zero: The flag indicates whether filling gap with zero. + :paramtype fill_gap_with_zero: bool + :keyword category: The category of the metric. + :paramtype category: str + :keyword resource_id_dimension_name_override: The override name of resource id dimension name. + :paramtype resource_id_dimension_name_override: str + :keyword is_internal: The flag indicates whether the metric is internal or not. + :paramtype is_internal: bool + :keyword delegate_metric_name_override: The override name of delegate metric. + :paramtype delegate_metric_name_override: str + :keyword dimensions: The dimensions of the metric specification. + :paramtype dimensions: list[~azure.mgmt.hdinsight.models.Dimension] + """ super(MetricSpecifications, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -2432,10 +3025,10 @@ def __init__( class NameAvailabilityCheckRequestParameters(msrest.serialization.Model): """The request spec of checking name availability. - :param name: The resource name. - :type name: str - :param type: The resource type. - :type type: str + :ivar name: The resource name. + :vartype name: str + :ivar type: The resource type. + :vartype type: str """ _attribute_map = { @@ -2450,6 +3043,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword name: The resource name. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str + """ super(NameAvailabilityCheckRequestParameters, self).__init__(**kwargs) self.name = name self.type = type @@ -2460,8 +3059,8 @@ class NameAvailabilityCheckResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name_available: This indicates whether the name is available. - :type name_available: bool + :ivar name_available: This indicates whether the name is available. + :vartype name_available: bool :ivar reason: The reason of the result. :vartype reason: str :ivar message: The related message. @@ -2485,6 +3084,10 @@ def __init__( name_available: Optional[bool] = None, **kwargs ): + """ + :keyword name_available: This indicates whether the name is available. + :paramtype name_available: bool + """ super(NameAvailabilityCheckResult, self).__init__(**kwargs) self.name_available = name_available self.reason = None @@ -2494,13 +3097,13 @@ def __init__( class NetworkProperties(msrest.serialization.Model): """The network properties. - :param resource_provider_connection: The direction for the resource provider connection. - Possible values include: "Inbound", "Outbound". - :type resource_provider_connection: str or + :ivar resource_provider_connection: The direction for the resource provider connection. Known + values are: "Inbound", "Outbound". + :vartype resource_provider_connection: str or ~azure.mgmt.hdinsight.models.ResourceProviderConnection - :param private_link: Indicates whether or not private link is enabled. Possible values include: + :ivar private_link: Indicates whether or not private link is enabled. Known values are: "Disabled", "Enabled". - :type private_link: str or ~azure.mgmt.hdinsight.models.PrivateLink + :vartype private_link: str or ~azure.mgmt.hdinsight.models.PrivateLink """ _attribute_map = { @@ -2511,10 +3114,19 @@ class NetworkProperties(msrest.serialization.Model): def __init__( self, *, - resource_provider_connection: Optional[Union[str, "ResourceProviderConnection"]] = None, - private_link: Optional[Union[str, "PrivateLink"]] = None, + resource_provider_connection: Optional[Union[str, "_models.ResourceProviderConnection"]] = None, + private_link: Optional[Union[str, "_models.PrivateLink"]] = None, **kwargs ): + """ + :keyword resource_provider_connection: The direction for the resource provider connection. + Known values are: "Inbound", "Outbound". + :paramtype resource_provider_connection: str or + ~azure.mgmt.hdinsight.models.ResourceProviderConnection + :keyword private_link: Indicates whether or not private link is enabled. Known values are: + "Disabled", "Enabled". + :paramtype private_link: str or ~azure.mgmt.hdinsight.models.PrivateLink + """ super(NetworkProperties, self).__init__(**kwargs) self.resource_provider_connection = resource_provider_connection self.private_link = private_link @@ -2523,12 +3135,12 @@ def __init__( class Operation(msrest.serialization.Model): """The HDInsight REST API operation. - :param name: The operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The display of operation. - :type display: ~azure.mgmt.hdinsight.models.OperationDisplay - :param properties: The operation properties. - :type properties: ~azure.mgmt.hdinsight.models.OperationProperties + :ivar name: The operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The display of operation. + :vartype display: ~azure.mgmt.hdinsight.models.OperationDisplay + :ivar properties: The operation properties. + :vartype properties: ~azure.mgmt.hdinsight.models.OperationProperties """ _attribute_map = { @@ -2541,10 +3153,18 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, - properties: Optional["OperationProperties"] = None, + display: Optional["_models.OperationDisplay"] = None, + properties: Optional["_models.OperationProperties"] = None, **kwargs ): + """ + :keyword name: The operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The display of operation. + :paramtype display: ~azure.mgmt.hdinsight.models.OperationDisplay + :keyword properties: The operation properties. + :paramtype properties: ~azure.mgmt.hdinsight.models.OperationProperties + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -2554,14 +3174,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. - :param provider: The service provider: Microsoft.HDInsight. - :type provider: str - :param resource: The resource on which the operation is performed: Cluster, Applications, etc. - :type resource: str - :param operation: The operation type: read, write, delete, etc. - :type operation: str - :param description: Localized friendly description for the operation. - :type description: str + :ivar provider: The service provider: Microsoft.HDInsight. + :vartype provider: str + :ivar resource: The resource on which the operation is performed: Cluster, Applications, etc. + :vartype resource: str + :ivar operation: The operation type: read, write, delete, etc. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str """ _attribute_map = { @@ -2580,6 +3200,17 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The service provider: Microsoft.HDInsight. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed: Cluster, Applications, + etc. + :paramtype resource: str + :keyword operation: The operation type: read, write, delete, etc. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -2590,10 +3221,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list HDInsight operations. It contains a list of operations and a URL link to get the next set of results. - :param value: The list of HDInsight operations supported by the HDInsight resource provider. - :type value: list[~azure.mgmt.hdinsight.models.Operation] - :param next_link: The URL to get the next set of operation list results if there are any. - :type next_link: str + :ivar value: The list of HDInsight operations supported by the HDInsight resource provider. + :vartype value: list[~azure.mgmt.hdinsight.models.Operation] + :ivar next_link: The URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { @@ -2604,10 +3235,16 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of HDInsight operations supported by the HDInsight resource provider. + :paramtype value: list[~azure.mgmt.hdinsight.models.Operation] + :keyword next_link: The URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2616,8 +3253,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """The details of operation. - :param service_specification: The specification of the service. - :type service_specification: ~azure.mgmt.hdinsight.models.ServiceSpecification + :ivar service_specification: The specification of the service. + :vartype service_specification: ~azure.mgmt.hdinsight.models.ServiceSpecification """ _attribute_map = { @@ -2627,9 +3264,13 @@ class OperationProperties(msrest.serialization.Model): def __init__( self, *, - service_specification: Optional["ServiceSpecification"] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: The specification of the service. + :paramtype service_specification: ~azure.mgmt.hdinsight.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -2637,8 +3278,9 @@ def __init__( class OsProfile(msrest.serialization.Model): """The Linux operation systems profile. - :param linux_operating_system_profile: The Linux OS profile. - :type linux_operating_system_profile: ~azure.mgmt.hdinsight.models.LinuxOperatingSystemProfile + :ivar linux_operating_system_profile: The Linux OS profile. + :vartype linux_operating_system_profile: + ~azure.mgmt.hdinsight.models.LinuxOperatingSystemProfile """ _attribute_map = { @@ -2648,9 +3290,14 @@ class OsProfile(msrest.serialization.Model): def __init__( self, *, - linux_operating_system_profile: Optional["LinuxOperatingSystemProfile"] = None, + linux_operating_system_profile: Optional["_models.LinuxOperatingSystemProfile"] = None, **kwargs ): + """ + :keyword linux_operating_system_profile: The Linux OS profile. + :paramtype linux_operating_system_profile: + ~azure.mgmt.hdinsight.models.LinuxOperatingSystemProfile + """ super(OsProfile, self).__init__(**kwargs) self.linux_operating_system_profile = linux_operating_system_profile @@ -2658,8 +3305,8 @@ def __init__( class PrivateEndpoint(msrest.serialization.Model): """The private endpoint. - :param id: The private endpoint id. - :type id: str + :ivar id: The private endpoint id. + :vartype id: str """ _attribute_map = { @@ -2672,6 +3319,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The private endpoint id. + :paramtype id: str + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = id @@ -2695,14 +3346,14 @@ class PrivateEndpointConnection(ResourceAutoGenerated): :vartype system_data: ~azure.mgmt.hdinsight.models.SystemData :ivar private_endpoint: The private endpoint of the private endpoint connection. :vartype private_endpoint: ~azure.mgmt.hdinsight.models.PrivateEndpoint - :param private_link_service_connection_state: Required. The private link service connection + :ivar private_link_service_connection_state: Required. The private link service connection state. - :type private_link_service_connection_state: + :vartype private_link_service_connection_state: ~azure.mgmt.hdinsight.models.PrivateLinkServiceConnectionState :ivar link_identifier: The link identifier. :vartype link_identifier: str - :ivar provisioning_state: The provisioning state, which only appears in the response. Possible - values include: "InProgress", "Updating", "Failed", "Succeeded", "Canceled", "Deleting". + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "InProgress", "Updating", "Failed", "Succeeded", "Canceled", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.hdinsight.models.PrivateEndpointConnectionProvisioningState """ @@ -2732,9 +3383,15 @@ class PrivateEndpointConnection(ResourceAutoGenerated): def __init__( self, *, - private_link_service_connection_state: "PrivateLinkServiceConnectionState", + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", **kwargs ): + """ + :keyword private_link_service_connection_state: Required. The private link service connection + state. + :paramtype private_link_service_connection_state: + ~azure.mgmt.hdinsight.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.system_data = None self.private_endpoint = None @@ -2748,8 +3405,8 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: The list of private endpoint connections. - :type value: list[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] + :ivar value: The list of private endpoint connections. + :vartype value: list[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -2766,9 +3423,13 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: The list of private endpoint connections. + :paramtype value: list[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2783,20 +3444,19 @@ class PrivateLinkConfiguration(msrest.serialization.Model): :ivar id: The private link configuration id. :vartype id: str - :param name: Required. The name of private link configuration. - :type name: str + :ivar name: Required. The name of private link configuration. + :vartype name: str :ivar type: The type of the private link configuration. :vartype type: str - :param group_id: Required. The HDInsight private linkable sub-resource name to apply the - private link configuration to. For example, 'headnode', 'gateway', 'edgenode'. - :type group_id: str + :ivar group_id: Required. The HDInsight private linkable sub-resource name to apply the private + link configuration to. For example, 'headnode', 'gateway', 'edgenode'. + :vartype group_id: str :ivar provisioning_state: The private link configuration provisioning state, which only appears - in the response. Possible values include: "InProgress", "Failed", "Succeeded", "Canceled", - "Deleting". + in the response. Known values are: "InProgress", "Failed", "Succeeded", "Canceled", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.hdinsight.models.PrivateLinkConfigurationProvisioningState - :param ip_configurations: Required. The IP configurations for the private link service. - :type ip_configurations: list[~azure.mgmt.hdinsight.models.IPConfiguration] + :ivar ip_configurations: Required. The IP configurations for the private link service. + :vartype ip_configurations: list[~azure.mgmt.hdinsight.models.IPConfiguration] """ _validation = { @@ -2822,9 +3482,18 @@ def __init__( *, name: str, group_id: str, - ip_configurations: List["IPConfiguration"], + ip_configurations: List["_models.IPConfiguration"], **kwargs ): + """ + :keyword name: Required. The name of private link configuration. + :paramtype name: str + :keyword group_id: Required. The HDInsight private linkable sub-resource name to apply the + private link configuration to. For example, 'headnode', 'gateway', 'edgenode'. + :paramtype group_id: str + :keyword ip_configurations: Required. The IP configurations for the private link service. + :paramtype ip_configurations: list[~azure.mgmt.hdinsight.models.IPConfiguration] + """ super(PrivateLinkConfiguration, self).__init__(**kwargs) self.id = None self.name = name @@ -2853,8 +3522,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -2882,6 +3551,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.system_data = None self.group_id = None @@ -2892,8 +3565,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.hdinsight.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.hdinsight.models.PrivateLinkResource] """ _attribute_map = { @@ -2903,9 +3576,13 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.hdinsight.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -2915,13 +3592,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param status: Required. The concrete private link service connection. Possible values include: + :ivar status: Required. The concrete private link service connection. Known values are: "Approved", "Rejected", "Pending", "Removed". - :type status: str or ~azure.mgmt.hdinsight.models.PrivateLinkServiceConnectionStatus - :param description: The optional description of the status. - :type description: str - :param actions_required: Whether there is further actions. - :type actions_required: str + :vartype status: str or ~azure.mgmt.hdinsight.models.PrivateLinkServiceConnectionStatus + :ivar description: The optional description of the status. + :vartype description: str + :ivar actions_required: Whether there is further actions. + :vartype actions_required: str """ _validation = { @@ -2937,11 +3614,20 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Union[str, "PrivateLinkServiceConnectionStatus"], + status: Union[str, "_models.PrivateLinkServiceConnectionStatus"], description: Optional[str] = None, actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Required. The concrete private link service connection. Known values are: + "Approved", "Rejected", "Pending", "Removed". + :paramtype status: str or ~azure.mgmt.hdinsight.models.PrivateLinkServiceConnectionStatus + :keyword description: The optional description of the status. + :paramtype description: str + :keyword actions_required: Whether there is further actions. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -2951,12 +3637,12 @@ def __init__( class QuotaCapability(msrest.serialization.Model): """The regional quota capability. - :param cores_used: The number of cores used in the subscription. - :type cores_used: long - :param max_cores_allowed: The number of cores that the subscription allowed. - :type max_cores_allowed: long - :param regional_quotas: The list of region quota capabilities. - :type regional_quotas: list[~azure.mgmt.hdinsight.models.RegionalQuotaCapability] + :ivar cores_used: The number of cores used in the subscription. + :vartype cores_used: long + :ivar max_cores_allowed: The number of cores that the subscription allowed. + :vartype max_cores_allowed: long + :ivar regional_quotas: The list of region quota capabilities. + :vartype regional_quotas: list[~azure.mgmt.hdinsight.models.RegionalQuotaCapability] """ _attribute_map = { @@ -2970,9 +3656,17 @@ def __init__( *, cores_used: Optional[int] = None, max_cores_allowed: Optional[int] = None, - regional_quotas: Optional[List["RegionalQuotaCapability"]] = None, + regional_quotas: Optional[List["_models.RegionalQuotaCapability"]] = None, **kwargs ): + """ + :keyword cores_used: The number of cores used in the subscription. + :paramtype cores_used: long + :keyword max_cores_allowed: The number of cores that the subscription allowed. + :paramtype max_cores_allowed: long + :keyword regional_quotas: The list of region quota capabilities. + :paramtype regional_quotas: list[~azure.mgmt.hdinsight.models.RegionalQuotaCapability] + """ super(QuotaCapability, self).__init__(**kwargs) self.cores_used = cores_used self.max_cores_allowed = max_cores_allowed @@ -2982,8 +3676,8 @@ def __init__( class QuotaInfo(msrest.serialization.Model): """The quota properties for the cluster. - :param cores_used: The cores used by the cluster. - :type cores_used: int + :ivar cores_used: The cores used by the cluster. + :vartype cores_used: int """ _attribute_map = { @@ -2996,6 +3690,10 @@ def __init__( cores_used: Optional[int] = None, **kwargs ): + """ + :keyword cores_used: The cores used by the cluster. + :paramtype cores_used: int + """ super(QuotaInfo, self).__init__(**kwargs) self.cores_used = cores_used @@ -3003,12 +3701,12 @@ def __init__( class RegionalQuotaCapability(msrest.serialization.Model): """The regional quota capacity. - :param region_name: The region name. - :type region_name: str - :param cores_used: The number of cores used in the region. - :type cores_used: long - :param cores_available: The number of cores available in the region. - :type cores_available: long + :ivar region_name: The region name. + :vartype region_name: str + :ivar cores_used: The number of cores used in the region. + :vartype cores_used: long + :ivar cores_available: The number of cores available in the region. + :vartype cores_available: long """ _attribute_map = { @@ -3025,6 +3723,14 @@ def __init__( cores_available: Optional[int] = None, **kwargs ): + """ + :keyword region_name: The region name. + :paramtype region_name: str + :keyword cores_used: The number of cores used in the region. + :paramtype cores_used: long + :keyword cores_available: The number of cores available in the region. + :paramtype cores_available: long + """ super(RegionalQuotaCapability, self).__init__(**kwargs) self.region_name = region_name self.cores_used = cores_used @@ -3034,8 +3740,8 @@ def __init__( class RegionsCapability(msrest.serialization.Model): """The regions capability. - :param available: The list of region capabilities. - :type available: list[str] + :ivar available: The list of region capabilities. + :vartype available: list[str] """ _attribute_map = { @@ -3048,6 +3754,10 @@ def __init__( available: Optional[List[str]] = None, **kwargs ): + """ + :keyword available: The list of region capabilities. + :paramtype available: list[str] + """ super(RegionsCapability, self).__init__(**kwargs) self.available = available @@ -3055,8 +3765,8 @@ def __init__( class ResourceId(msrest.serialization.Model): """The azure resource id. - :param id: The azure resource id. - :type id: str + :ivar id: The azure resource id. + :vartype id: str """ _attribute_map = { @@ -3069,6 +3779,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: The azure resource id. + :paramtype id: str + """ super(ResourceId, self).__init__(**kwargs) self.id = id @@ -3076,28 +3790,28 @@ def __init__( class Role(msrest.serialization.Model): """Describes a role on the cluster. - :param name: The name of the role. - :type name: str - :param min_instance_count: The minimum instance count of the cluster. - :type min_instance_count: int - :param target_instance_count: The instance count of the cluster. - :type target_instance_count: int - :param vm_group_name: The name of the virtual machine group. - :type vm_group_name: str - :param autoscale_configuration: The autoscale configurations. - :type autoscale_configuration: ~azure.mgmt.hdinsight.models.Autoscale - :param hardware_profile: The hardware profile. - :type hardware_profile: ~azure.mgmt.hdinsight.models.HardwareProfile - :param os_profile: The operating system profile. - :type os_profile: ~azure.mgmt.hdinsight.models.OsProfile - :param virtual_network_profile: The virtual network profile. - :type virtual_network_profile: ~azure.mgmt.hdinsight.models.VirtualNetworkProfile - :param data_disks_groups: The data disks groups for the role. - :type data_disks_groups: list[~azure.mgmt.hdinsight.models.DataDisksGroups] - :param script_actions: The list of script actions on the role. - :type script_actions: list[~azure.mgmt.hdinsight.models.ScriptAction] - :param encrypt_data_disks: Indicates whether encrypt the data disks. - :type encrypt_data_disks: bool + :ivar name: The name of the role. + :vartype name: str + :ivar min_instance_count: The minimum instance count of the cluster. + :vartype min_instance_count: int + :ivar target_instance_count: The instance count of the cluster. + :vartype target_instance_count: int + :ivar vm_group_name: The name of the virtual machine group. + :vartype vm_group_name: str + :ivar autoscale_configuration: The autoscale configurations. + :vartype autoscale_configuration: ~azure.mgmt.hdinsight.models.Autoscale + :ivar hardware_profile: The hardware profile. + :vartype hardware_profile: ~azure.mgmt.hdinsight.models.HardwareProfile + :ivar os_profile: The operating system profile. + :vartype os_profile: ~azure.mgmt.hdinsight.models.OsProfile + :ivar virtual_network_profile: The virtual network profile. + :vartype virtual_network_profile: ~azure.mgmt.hdinsight.models.VirtualNetworkProfile + :ivar data_disks_groups: The data disks groups for the role. + :vartype data_disks_groups: list[~azure.mgmt.hdinsight.models.DataDisksGroups] + :ivar script_actions: The list of script actions on the role. + :vartype script_actions: list[~azure.mgmt.hdinsight.models.ScriptAction] + :ivar encrypt_data_disks: Indicates whether encrypt the data disks. + :vartype encrypt_data_disks: bool """ _attribute_map = { @@ -3121,15 +3835,39 @@ def __init__( min_instance_count: Optional[int] = None, target_instance_count: Optional[int] = None, vm_group_name: Optional[str] = None, - autoscale_configuration: Optional["Autoscale"] = None, - hardware_profile: Optional["HardwareProfile"] = None, - os_profile: Optional["OsProfile"] = None, - virtual_network_profile: Optional["VirtualNetworkProfile"] = None, - data_disks_groups: Optional[List["DataDisksGroups"]] = None, - script_actions: Optional[List["ScriptAction"]] = None, + autoscale_configuration: Optional["_models.Autoscale"] = None, + hardware_profile: Optional["_models.HardwareProfile"] = None, + os_profile: Optional["_models.OsProfile"] = None, + virtual_network_profile: Optional["_models.VirtualNetworkProfile"] = None, + data_disks_groups: Optional[List["_models.DataDisksGroups"]] = None, + script_actions: Optional[List["_models.ScriptAction"]] = None, encrypt_data_disks: Optional[bool] = False, **kwargs ): + """ + :keyword name: The name of the role. + :paramtype name: str + :keyword min_instance_count: The minimum instance count of the cluster. + :paramtype min_instance_count: int + :keyword target_instance_count: The instance count of the cluster. + :paramtype target_instance_count: int + :keyword vm_group_name: The name of the virtual machine group. + :paramtype vm_group_name: str + :keyword autoscale_configuration: The autoscale configurations. + :paramtype autoscale_configuration: ~azure.mgmt.hdinsight.models.Autoscale + :keyword hardware_profile: The hardware profile. + :paramtype hardware_profile: ~azure.mgmt.hdinsight.models.HardwareProfile + :keyword os_profile: The operating system profile. + :paramtype os_profile: ~azure.mgmt.hdinsight.models.OsProfile + :keyword virtual_network_profile: The virtual network profile. + :paramtype virtual_network_profile: ~azure.mgmt.hdinsight.models.VirtualNetworkProfile + :keyword data_disks_groups: The data disks groups for the role. + :paramtype data_disks_groups: list[~azure.mgmt.hdinsight.models.DataDisksGroups] + :keyword script_actions: The list of script actions on the role. + :paramtype script_actions: list[~azure.mgmt.hdinsight.models.ScriptAction] + :keyword encrypt_data_disks: Indicates whether encrypt the data disks. + :paramtype encrypt_data_disks: bool + """ super(Role, self).__init__(**kwargs) self.name = name self.min_instance_count = min_instance_count @@ -3151,14 +3889,14 @@ class RuntimeScriptAction(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the script action. - :type name: str - :param uri: Required. The URI to the script. - :type uri: str - :param parameters: The parameters for the script. - :type parameters: str - :param roles: Required. The list of roles where script will be executed. - :type roles: list[str] + :ivar name: Required. The name of the script action. + :vartype name: str + :ivar uri: Required. The URI to the script. + :vartype uri: str + :ivar parameters: The parameters for the script. + :vartype parameters: str + :ivar roles: Required. The list of roles where script will be executed. + :vartype roles: list[str] :ivar application_name: The application name of the script action, if any. :vartype application_name: str """ @@ -3187,6 +3925,16 @@ def __init__( parameters: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The name of the script action. + :paramtype name: str + :keyword uri: Required. The URI to the script. + :paramtype uri: str + :keyword parameters: The parameters for the script. + :paramtype parameters: str + :keyword roles: Required. The list of roles where script will be executed. + :paramtype roles: list[str] + """ super(RuntimeScriptAction, self).__init__(**kwargs) self.name = name self.uri = uri @@ -3202,14 +3950,14 @@ class RuntimeScriptActionDetail(RuntimeScriptAction): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the script action. - :type name: str - :param uri: Required. The URI to the script. - :type uri: str - :param parameters: The parameters for the script. - :type parameters: str - :param roles: Required. The list of roles where script will be executed. - :type roles: list[str] + :ivar name: Required. The name of the script action. + :vartype name: str + :ivar uri: Required. The URI to the script. + :vartype uri: str + :ivar parameters: The parameters for the script. + :vartype parameters: str + :ivar roles: Required. The list of roles where script will be executed. + :vartype roles: list[str] :ivar application_name: The application name of the script action, if any. :vartype application_name: str :ivar script_execution_id: The execution id of the script action. @@ -3266,6 +4014,16 @@ def __init__( parameters: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The name of the script action. + :paramtype name: str + :keyword uri: Required. The URI to the script. + :paramtype uri: str + :keyword parameters: The parameters for the script. + :paramtype parameters: str + :keyword roles: Required. The list of roles where script will be executed. + :paramtype roles: list[str] + """ super(RuntimeScriptActionDetail, self).__init__(name=name, uri=uri, parameters=parameters, roles=roles, **kwargs) self.script_execution_id = None self.start_time = None @@ -3281,12 +4039,12 @@ class ScriptAction(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the script action. - :type name: str - :param uri: Required. The URI to the script. - :type uri: str - :param parameters: Required. The parameters for the script provided. - :type parameters: str + :ivar name: Required. The name of the script action. + :vartype name: str + :ivar uri: Required. The URI to the script. + :vartype uri: str + :ivar parameters: Required. The parameters for the script provided. + :vartype parameters: str """ _validation = { @@ -3309,6 +4067,14 @@ def __init__( parameters: str, **kwargs ): + """ + :keyword name: Required. The name of the script action. + :paramtype name: str + :keyword uri: Required. The URI to the script. + :paramtype uri: str + :keyword parameters: Required. The parameters for the script provided. + :paramtype parameters: str + """ super(ScriptAction, self).__init__(**kwargs) self.name = name self.uri = uri @@ -3340,6 +4106,8 @@ def __init__( self, **kwargs ): + """ + """ super(ScriptActionExecutionHistoryList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3370,6 +4138,8 @@ def __init__( self, **kwargs ): + """ + """ super(ScriptActionExecutionSummary, self).__init__(**kwargs) self.status = None self.instance_count = None @@ -3378,16 +4148,16 @@ def __init__( class ScriptActionPersistedGetResponseSpec(msrest.serialization.Model): """The persisted script action for cluster. - :param name: The name of script action. - :type name: str - :param uri: The URI to the script. - :type uri: str - :param parameters: The parameters for the script provided. - :type parameters: str - :param roles: The list of roles where script will be executed. - :type roles: list[str] - :param application_name: The application name for the script action. - :type application_name: str + :ivar name: The name of script action. + :vartype name: str + :ivar uri: The URI to the script. + :vartype uri: str + :ivar parameters: The parameters for the script provided. + :vartype parameters: str + :ivar roles: The list of roles where script will be executed. + :vartype roles: list[str] + :ivar application_name: The application name for the script action. + :vartype application_name: str """ _attribute_map = { @@ -3408,6 +4178,18 @@ def __init__( application_name: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of script action. + :paramtype name: str + :keyword uri: The URI to the script. + :paramtype uri: str + :keyword parameters: The parameters for the script provided. + :paramtype parameters: str + :keyword roles: The list of roles where script will be executed. + :paramtype roles: list[str] + :keyword application_name: The application name for the script action. + :paramtype application_name: str + """ super(ScriptActionPersistedGetResponseSpec, self).__init__(**kwargs) self.name = name self.uri = uri @@ -3421,8 +4203,8 @@ class ScriptActionsList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: The list of persisted script action details for the cluster. - :type value: list[~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail] + :ivar value: The list of persisted script action details for the cluster. + :vartype value: list[~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail] :ivar next_link: The link (url) to the next page of results. :vartype next_link: str """ @@ -3439,9 +4221,13 @@ class ScriptActionsList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["RuntimeScriptActionDetail"]] = None, + value: Optional[List["_models.RuntimeScriptActionDetail"]] = None, **kwargs ): + """ + :keyword value: The list of persisted script action details for the cluster. + :paramtype value: list[~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail] + """ super(ScriptActionsList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -3450,26 +4236,26 @@ def __init__( class SecurityProfile(msrest.serialization.Model): """The security profile which contains Ssh public key for the HDInsight cluster. - :param directory_type: The directory type. Possible values include: "ActiveDirectory". - :type directory_type: str or ~azure.mgmt.hdinsight.models.DirectoryType - :param domain: The organization's active directory domain. - :type domain: str - :param organizational_unit_dn: The organizational unit within the Active Directory to place the + :ivar directory_type: The directory type. Known values are: "ActiveDirectory". + :vartype directory_type: str or ~azure.mgmt.hdinsight.models.DirectoryType + :ivar domain: The organization's active directory domain. + :vartype domain: str + :ivar organizational_unit_dn: The organizational unit within the Active Directory to place the cluster and service accounts. - :type organizational_unit_dn: str - :param ldaps_urls: The LDAPS protocol URLs to communicate with the Active Directory. - :type ldaps_urls: list[str] - :param domain_username: The domain user account that will have admin privileges on the cluster. - :type domain_username: str - :param domain_user_password: The domain admin password. - :type domain_user_password: str - :param cluster_users_group_d_ns: Optional. The Distinguished Names for cluster user groups. - :type cluster_users_group_d_ns: list[str] - :param aadds_resource_id: The resource ID of the user's Azure Active Directory Domain Service. - :type aadds_resource_id: str - :param msi_resource_id: User assigned identity that has permissions to read and create + :vartype organizational_unit_dn: str + :ivar ldaps_urls: The LDAPS protocol URLs to communicate with the Active Directory. + :vartype ldaps_urls: list[str] + :ivar domain_username: The domain user account that will have admin privileges on the cluster. + :vartype domain_username: str + :ivar domain_user_password: The domain admin password. + :vartype domain_user_password: str + :ivar cluster_users_group_d_ns: Optional. The Distinguished Names for cluster user groups. + :vartype cluster_users_group_d_ns: list[str] + :ivar aadds_resource_id: The resource ID of the user's Azure Active Directory Domain Service. + :vartype aadds_resource_id: str + :ivar msi_resource_id: User assigned identity that has permissions to read and create cluster-related artifacts in the user's AADDS. - :type msi_resource_id: str + :vartype msi_resource_id: str """ _attribute_map = { @@ -3487,7 +4273,7 @@ class SecurityProfile(msrest.serialization.Model): def __init__( self, *, - directory_type: Optional[Union[str, "DirectoryType"]] = None, + directory_type: Optional[Union[str, "_models.DirectoryType"]] = None, domain: Optional[str] = None, organizational_unit_dn: Optional[str] = None, ldaps_urls: Optional[List[str]] = None, @@ -3498,6 +4284,30 @@ def __init__( msi_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword directory_type: The directory type. Known values are: "ActiveDirectory". + :paramtype directory_type: str or ~azure.mgmt.hdinsight.models.DirectoryType + :keyword domain: The organization's active directory domain. + :paramtype domain: str + :keyword organizational_unit_dn: The organizational unit within the Active Directory to place + the cluster and service accounts. + :paramtype organizational_unit_dn: str + :keyword ldaps_urls: The LDAPS protocol URLs to communicate with the Active Directory. + :paramtype ldaps_urls: list[str] + :keyword domain_username: The domain user account that will have admin privileges on the + cluster. + :paramtype domain_username: str + :keyword domain_user_password: The domain admin password. + :paramtype domain_user_password: str + :keyword cluster_users_group_d_ns: Optional. The Distinguished Names for cluster user groups. + :paramtype cluster_users_group_d_ns: list[str] + :keyword aadds_resource_id: The resource ID of the user's Azure Active Directory Domain + Service. + :paramtype aadds_resource_id: str + :keyword msi_resource_id: User assigned identity that has permissions to read and create + cluster-related artifacts in the user's AADDS. + :paramtype msi_resource_id: str + """ super(SecurityProfile, self).__init__(**kwargs) self.directory_type = directory_type self.domain = domain @@ -3513,8 +4323,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """The specification of the service. - :param metric_specifications: The metric specifications. - :type metric_specifications: list[~azure.mgmt.hdinsight.models.MetricSpecifications] + :ivar metric_specifications: The metric specifications. + :vartype metric_specifications: list[~azure.mgmt.hdinsight.models.MetricSpecifications] """ _attribute_map = { @@ -3524,9 +4334,13 @@ class ServiceSpecification(msrest.serialization.Model): def __init__( self, *, - metric_specifications: Optional[List["MetricSpecifications"]] = None, + metric_specifications: Optional[List["_models.MetricSpecifications"]] = None, **kwargs ): + """ + :keyword metric_specifications: The metric specifications. + :paramtype metric_specifications: list[~azure.mgmt.hdinsight.models.MetricSpecifications] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications @@ -3534,8 +4348,8 @@ def __init__( class SshProfile(msrest.serialization.Model): """The list of SSH public keys. - :param public_keys: The list of SSH public keys. - :type public_keys: list[~azure.mgmt.hdinsight.models.SshPublicKey] + :ivar public_keys: The list of SSH public keys. + :vartype public_keys: list[~azure.mgmt.hdinsight.models.SshPublicKey] """ _attribute_map = { @@ -3545,9 +4359,13 @@ class SshProfile(msrest.serialization.Model): def __init__( self, *, - public_keys: Optional[List["SshPublicKey"]] = None, + public_keys: Optional[List["_models.SshPublicKey"]] = None, **kwargs ): + """ + :keyword public_keys: The list of SSH public keys. + :paramtype public_keys: list[~azure.mgmt.hdinsight.models.SshPublicKey] + """ super(SshProfile, self).__init__(**kwargs) self.public_keys = public_keys @@ -3555,8 +4373,8 @@ def __init__( class SshPublicKey(msrest.serialization.Model): """The SSH public key for the cluster nodes. - :param certificate_data: The certificate for SSH. - :type certificate_data: str + :ivar certificate_data: The certificate for SSH. + :vartype certificate_data: str """ _attribute_map = { @@ -3569,6 +4387,10 @@ def __init__( certificate_data: Optional[str] = None, **kwargs ): + """ + :keyword certificate_data: The certificate for SSH. + :paramtype certificate_data: str + """ super(SshPublicKey, self).__init__(**kwargs) self.certificate_data = certificate_data @@ -3576,27 +4398,27 @@ def __init__( class StorageAccount(msrest.serialization.Model): """The storage Account. - :param name: The name of the storage account. - :type name: str - :param is_default: Whether or not the storage account is the default storage account. - :type is_default: bool - :param container: The container in the storage account, only to be specified for WASB storage + :ivar name: The name of the storage account. + :vartype name: str + :ivar is_default: Whether or not the storage account is the default storage account. + :vartype is_default: bool + :ivar container: The container in the storage account, only to be specified for WASB storage accounts. - :type container: str - :param file_system: The filesystem, only to be specified for Azure Data Lake Storage Gen 2. - :type file_system: str - :param key: The storage account access key. - :type key: str - :param resource_id: The resource ID of storage account, only to be specified for Azure Data - Lake Storage Gen 2. - :type resource_id: str - :param msi_resource_id: The managed identity (MSI) that is allowed to access the storage + :vartype container: str + :ivar file_system: The filesystem, only to be specified for Azure Data Lake Storage Gen 2. + :vartype file_system: str + :ivar key: The storage account access key. + :vartype key: str + :ivar resource_id: The resource ID of storage account, only to be specified for Azure Data Lake + Storage Gen 2. + :vartype resource_id: str + :ivar msi_resource_id: The managed identity (MSI) that is allowed to access the storage account, only to be specified for Azure Data Lake Storage Gen 2. - :type msi_resource_id: str - :param saskey: The shared access signature key. - :type saskey: str - :param fileshare: The file share name. - :type fileshare: str + :vartype msi_resource_id: str + :ivar saskey: The shared access signature key. + :vartype saskey: str + :ivar fileshare: The file share name. + :vartype fileshare: str """ _attribute_map = { @@ -3625,6 +4447,29 @@ def __init__( fileshare: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the storage account. + :paramtype name: str + :keyword is_default: Whether or not the storage account is the default storage account. + :paramtype is_default: bool + :keyword container: The container in the storage account, only to be specified for WASB storage + accounts. + :paramtype container: str + :keyword file_system: The filesystem, only to be specified for Azure Data Lake Storage Gen 2. + :paramtype file_system: str + :keyword key: The storage account access key. + :paramtype key: str + :keyword resource_id: The resource ID of storage account, only to be specified for Azure Data + Lake Storage Gen 2. + :paramtype resource_id: str + :keyword msi_resource_id: The managed identity (MSI) that is allowed to access the storage + account, only to be specified for Azure Data Lake Storage Gen 2. + :paramtype msi_resource_id: str + :keyword saskey: The shared access signature key. + :paramtype saskey: str + :keyword fileshare: The file share name. + :paramtype fileshare: str + """ super(StorageAccount, self).__init__(**kwargs) self.name = name self.is_default = is_default @@ -3640,8 +4485,8 @@ def __init__( class StorageProfile(msrest.serialization.Model): """The storage profile. - :param storageaccounts: The list of storage accounts in the cluster. - :type storageaccounts: list[~azure.mgmt.hdinsight.models.StorageAccount] + :ivar storageaccounts: The list of storage accounts in the cluster. + :vartype storageaccounts: list[~azure.mgmt.hdinsight.models.StorageAccount] """ _attribute_map = { @@ -3651,9 +4496,13 @@ class StorageProfile(msrest.serialization.Model): def __init__( self, *, - storageaccounts: Optional[List["StorageAccount"]] = None, + storageaccounts: Optional[List["_models.StorageAccount"]] = None, **kwargs ): + """ + :keyword storageaccounts: The list of storage accounts in the cluster. + :paramtype storageaccounts: list[~azure.mgmt.hdinsight.models.StorageAccount] + """ super(StorageProfile, self).__init__(**kwargs) self.storageaccounts = storageaccounts @@ -3661,20 +4510,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.hdinsight.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.hdinsight.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :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. Known values are: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.hdinsight.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. Known values + are: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.hdinsight.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3690,13 +4539,29 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.hdinsight.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. Known + values are: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.hdinsight.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3709,12 +4574,12 @@ def __init__( class UpdateClusterIdentityCertificateParameters(msrest.serialization.Model): """The update cluster identity certificate request parameters. - :param application_id: The application id. - :type application_id: str - :param certificate: The certificate in base64 encoded format. - :type certificate: str - :param certificate_password: The password of the certificate. - :type certificate_password: str + :ivar application_id: The application id. + :vartype application_id: str + :ivar certificate: The certificate in base64 encoded format. + :vartype certificate: str + :ivar certificate_password: The password of the certificate. + :vartype certificate_password: str """ _attribute_map = { @@ -3731,6 +4596,14 @@ def __init__( certificate_password: Optional[str] = None, **kwargs ): + """ + :keyword application_id: The application id. + :paramtype application_id: str + :keyword certificate: The certificate in base64 encoded format. + :paramtype certificate: str + :keyword certificate_password: The password of the certificate. + :paramtype certificate_password: str + """ super(UpdateClusterIdentityCertificateParameters, self).__init__(**kwargs) self.application_id = application_id self.certificate = certificate @@ -3740,13 +4613,13 @@ def __init__( class UpdateGatewaySettingsParameters(msrest.serialization.Model): """The update gateway settings request parameters. - :param is_credential_enabled: Indicates whether or not the gateway settings based authorization + :ivar is_credential_enabled: Indicates whether or not the gateway settings based authorization is enabled. - :type is_credential_enabled: bool - :param user_name: The gateway settings user name. - :type user_name: str - :param password: The gateway settings user password. - :type password: str + :vartype is_credential_enabled: bool + :ivar user_name: The gateway settings user name. + :vartype user_name: str + :ivar password: The gateway settings user password. + :vartype password: str """ _attribute_map = { @@ -3763,6 +4636,15 @@ def __init__( password: Optional[str] = None, **kwargs ): + """ + :keyword is_credential_enabled: Indicates whether or not the gateway settings based + authorization is enabled. + :paramtype is_credential_enabled: bool + :keyword user_name: The gateway settings user name. + :paramtype user_name: str + :keyword password: The gateway settings user password. + :paramtype password: str + """ super(UpdateGatewaySettingsParameters, self).__init__(**kwargs) self.is_credential_enabled = is_credential_enabled self.user_name = user_name @@ -3774,12 +4656,12 @@ class Usage(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param unit: The type of measurement for usage. - :type unit: str - :param current_value: The current usage. - :type current_value: long - :param limit: The maximum allowed usage. - :type limit: long + :ivar unit: The type of measurement for usage. + :vartype unit: str + :ivar current_value: The current usage. + :vartype current_value: long + :ivar limit: The maximum allowed usage. + :vartype limit: long :ivar name: The details about the localizable name of the used resource. :vartype name: ~azure.mgmt.hdinsight.models.LocalizedName """ @@ -3803,6 +4685,14 @@ def __init__( limit: Optional[int] = None, **kwargs ): + """ + :keyword unit: The type of measurement for usage. + :paramtype unit: str + :keyword current_value: The current usage. + :paramtype current_value: long + :keyword limit: The maximum allowed usage. + :paramtype limit: long + """ super(Usage, self).__init__(**kwargs) self.unit = unit self.current_value = current_value @@ -3813,8 +4703,8 @@ def __init__( class UsagesListResult(msrest.serialization.Model): """The response for the operation to get regional usages for a subscription. - :param value: The list of usages. - :type value: list[~azure.mgmt.hdinsight.models.Usage] + :ivar value: The list of usages. + :vartype value: list[~azure.mgmt.hdinsight.models.Usage] """ _attribute_map = { @@ -3824,9 +4714,13 @@ class UsagesListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Usage"]] = None, + value: Optional[List["_models.Usage"]] = None, **kwargs ): + """ + :keyword value: The list of usages. + :paramtype value: list[~azure.mgmt.hdinsight.models.Usage] + """ super(UsagesListResult, self).__init__(**kwargs) self.value = value @@ -3840,8 +4734,8 @@ class UserAssignedIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar client_id: The client id of user assigned identity. :vartype client_id: str - :param tenant_id: The tenant id of user assigned identity. - :type tenant_id: str + :ivar tenant_id: The tenant id of user assigned identity. + :vartype tenant_id: str """ _validation = { @@ -3861,6 +4755,10 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: The tenant id of user assigned identity. + :paramtype tenant_id: str + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -3870,14 +4768,14 @@ def __init__( class ValidationErrorInfo(msrest.serialization.Model): """The validation error information. - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - :param error_resource: The error resource. - :type error_resource: str - :param message_arguments: The message arguments. - :type message_arguments: list[str] + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar error_resource: The error resource. + :vartype error_resource: str + :ivar message_arguments: The message arguments. + :vartype message_arguments: list[str] """ _attribute_map = { @@ -3896,6 +4794,16 @@ def __init__( message_arguments: Optional[List[str]] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + :keyword error_resource: The error resource. + :paramtype error_resource: str + :keyword message_arguments: The message arguments. + :paramtype message_arguments: list[str] + """ super(ValidationErrorInfo, self).__init__(**kwargs) self.code = code self.message = message @@ -3906,8 +4814,8 @@ def __init__( class VersionsCapability(msrest.serialization.Model): """The version capability. - :param available: The list of version capabilities. - :type available: list[~azure.mgmt.hdinsight.models.VersionSpec] + :ivar available: The list of version capabilities. + :vartype available: list[~azure.mgmt.hdinsight.models.VersionSpec] """ _attribute_map = { @@ -3917,9 +4825,13 @@ class VersionsCapability(msrest.serialization.Model): def __init__( self, *, - available: Optional[List["VersionSpec"]] = None, + available: Optional[List["_models.VersionSpec"]] = None, **kwargs ): + """ + :keyword available: The list of version capabilities. + :paramtype available: list[~azure.mgmt.hdinsight.models.VersionSpec] + """ super(VersionsCapability, self).__init__(**kwargs) self.available = available @@ -3927,14 +4839,14 @@ def __init__( class VersionSpec(msrest.serialization.Model): """The version properties. - :param friendly_name: The friendly name. - :type friendly_name: str - :param display_name: The display name. - :type display_name: str - :param is_default: Whether or not the version is the default version. - :type is_default: bool - :param component_versions: The component version property. - :type component_versions: dict[str, str] + :ivar friendly_name: The friendly name. + :vartype friendly_name: str + :ivar display_name: The display name. + :vartype display_name: str + :ivar is_default: Whether or not the version is the default version. + :vartype is_default: bool + :ivar component_versions: The component version property. + :vartype component_versions: dict[str, str] """ _attribute_map = { @@ -3953,6 +4865,16 @@ def __init__( component_versions: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword friendly_name: The friendly name. + :paramtype friendly_name: str + :keyword display_name: The display name. + :paramtype display_name: str + :keyword is_default: Whether or not the version is the default version. + :paramtype is_default: bool + :keyword component_versions: The component version property. + :paramtype component_versions: dict[str, str] + """ super(VersionSpec, self).__init__(**kwargs) self.friendly_name = friendly_name self.display_name = display_name @@ -3963,10 +4885,10 @@ def __init__( class VirtualNetworkProfile(msrest.serialization.Model): """The virtual network properties. - :param id: The ID of the virtual network. - :type id: str - :param subnet: The name of the subnet. - :type subnet: str + :ivar id: The ID of the virtual network. + :vartype id: str + :ivar subnet: The name of the subnet. + :vartype subnet: str """ _attribute_map = { @@ -3981,6 +4903,12 @@ def __init__( subnet: Optional[str] = None, **kwargs ): + """ + :keyword id: The ID of the virtual network. + :paramtype id: str + :keyword subnet: The name of the subnet. + :paramtype subnet: str + """ super(VirtualNetworkProfile, self).__init__(**kwargs) self.id = id self.subnet = subnet @@ -3989,27 +4917,27 @@ def __init__( class VmSizeCompatibilityFilterV2(msrest.serialization.Model): """This class represent a single filter object that defines a multidimensional set. The dimensions of this set are Regions, ClusterFlavors, NodeTypes and ClusterVersions. The constraint should be defined based on the following: FilterMode (Exclude vs Include), VMSizes (the vm sizes in affect of exclusion/inclusion) and the ordering of the Filters. Later filters override previous settings if conflicted. - :param filter_mode: The filtering mode. Effectively this can enabling or disabling the VM sizes - in a particular set. Possible values include: "Exclude", "Include", "Recommend", "Default". - :type filter_mode: str or ~azure.mgmt.hdinsight.models.FilterMode - :param regions: The list of regions under the effect of the filter. - :type regions: list[str] - :param cluster_flavors: The list of cluster flavors under the effect of the filter. - :type cluster_flavors: list[str] - :param node_types: The list of node types affected by the filter. - :type node_types: list[str] - :param cluster_versions: The list of cluster versions affected in Major.Minor format. - :type cluster_versions: list[str] - :param os_type: The OSType affected, Windows or Linux. - :type os_type: list[str or ~azure.mgmt.hdinsight.models.OSType] - :param vm_sizes: The list of virtual machine sizes to include or exclude. - :type vm_sizes: list[str] - :param esp_applied: Whether apply for ESP cluster. 'true' means only for ESP, 'false' means - only for non-ESP, null or empty string or others mean for both. - :type esp_applied: str - :param compute_isolation_supported: Whether support compute isolation. 'true' means only for + :ivar filter_mode: The filtering mode. Effectively this can enabling or disabling the VM sizes + in a particular set. Known values are: "Exclude", "Include", "Recommend", "Default". + :vartype filter_mode: str or ~azure.mgmt.hdinsight.models.FilterMode + :ivar regions: The list of regions under the effect of the filter. + :vartype regions: list[str] + :ivar cluster_flavors: The list of cluster flavors under the effect of the filter. + :vartype cluster_flavors: list[str] + :ivar node_types: The list of node types affected by the filter. + :vartype node_types: list[str] + :ivar cluster_versions: The list of cluster versions affected in Major.Minor format. + :vartype cluster_versions: list[str] + :ivar os_type: The OSType affected, Windows or Linux. + :vartype os_type: list[str or ~azure.mgmt.hdinsight.models.OSType] + :ivar vm_sizes: The list of virtual machine sizes to include or exclude. + :vartype vm_sizes: list[str] + :ivar esp_applied: Whether apply for ESP cluster. 'true' means only for ESP, 'false' means only + for non-ESP, null or empty string or others mean for both. + :vartype esp_applied: str + :ivar compute_isolation_supported: Whether support compute isolation. 'true' means only for ComputeIsolationEnabled, 'false' means only for regular cluster. - :type compute_isolation_supported: str + :vartype compute_isolation_supported: str """ _attribute_map = { @@ -4027,17 +4955,40 @@ class VmSizeCompatibilityFilterV2(msrest.serialization.Model): def __init__( self, *, - filter_mode: Optional[Union[str, "FilterMode"]] = None, + filter_mode: Optional[Union[str, "_models.FilterMode"]] = None, regions: Optional[List[str]] = None, cluster_flavors: Optional[List[str]] = None, node_types: Optional[List[str]] = None, cluster_versions: Optional[List[str]] = None, - os_type: Optional[List[Union[str, "OSType"]]] = None, + os_type: Optional[List[Union[str, "_models.OSType"]]] = None, vm_sizes: Optional[List[str]] = None, esp_applied: Optional[str] = None, compute_isolation_supported: Optional[str] = None, **kwargs ): + """ + :keyword filter_mode: The filtering mode. Effectively this can enabling or disabling the VM + sizes in a particular set. Known values are: "Exclude", "Include", "Recommend", "Default". + :paramtype filter_mode: str or ~azure.mgmt.hdinsight.models.FilterMode + :keyword regions: The list of regions under the effect of the filter. + :paramtype regions: list[str] + :keyword cluster_flavors: The list of cluster flavors under the effect of the filter. + :paramtype cluster_flavors: list[str] + :keyword node_types: The list of node types affected by the filter. + :paramtype node_types: list[str] + :keyword cluster_versions: The list of cluster versions affected in Major.Minor format. + :paramtype cluster_versions: list[str] + :keyword os_type: The OSType affected, Windows or Linux. + :paramtype os_type: list[str or ~azure.mgmt.hdinsight.models.OSType] + :keyword vm_sizes: The list of virtual machine sizes to include or exclude. + :paramtype vm_sizes: list[str] + :keyword esp_applied: Whether apply for ESP cluster. 'true' means only for ESP, 'false' means + only for non-ESP, null or empty string or others mean for both. + :paramtype esp_applied: str + :keyword compute_isolation_supported: Whether support compute isolation. 'true' means only for + ComputeIsolationEnabled, 'false' means only for regular cluster. + :paramtype compute_isolation_supported: str + """ super(VmSizeCompatibilityFilterV2, self).__init__(**kwargs) self.filter_mode = filter_mode self.regions = regions @@ -4053,30 +5004,30 @@ def __init__( class VmSizeProperty(msrest.serialization.Model): """The vm size property. - :param name: The vm size name. - :type name: str - :param cores: The number of cores that the vm size has. - :type cores: int - :param data_disk_storage_tier: The data disk storage tier of the vm size. - :type data_disk_storage_tier: str - :param label: The label of the vm size. - :type label: str - :param max_data_disk_count: The max data disk count of the vm size. - :type max_data_disk_count: long - :param memory_in_mb: The memory whose unit is MB of the vm size. - :type memory_in_mb: long - :param supported_by_virtual_machines: This indicates this vm size is supported by virtual + :ivar name: The vm size name. + :vartype name: str + :ivar cores: The number of cores that the vm size has. + :vartype cores: int + :ivar data_disk_storage_tier: The data disk storage tier of the vm size. + :vartype data_disk_storage_tier: str + :ivar label: The label of the vm size. + :vartype label: str + :ivar max_data_disk_count: The max data disk count of the vm size. + :vartype max_data_disk_count: long + :ivar memory_in_mb: The memory whose unit is MB of the vm size. + :vartype memory_in_mb: long + :ivar supported_by_virtual_machines: This indicates this vm size is supported by virtual machines or not. - :type supported_by_virtual_machines: bool - :param supported_by_web_worker_roles: The indicates this vm size is supported by web worker + :vartype supported_by_virtual_machines: bool + :ivar supported_by_web_worker_roles: The indicates this vm size is supported by web worker roles or not. - :type supported_by_web_worker_roles: bool - :param virtual_machine_resource_disk_size_in_mb: The virtual machine resource disk size whose + :vartype supported_by_web_worker_roles: bool + :ivar virtual_machine_resource_disk_size_in_mb: The virtual machine resource disk size whose unit is MB of the vm size. - :type virtual_machine_resource_disk_size_in_mb: long - :param web_worker_resource_disk_size_in_mb: The web worker resource disk size whose unit is MB + :vartype virtual_machine_resource_disk_size_in_mb: long + :ivar web_worker_resource_disk_size_in_mb: The web worker resource disk size whose unit is MB of the vm size. - :type web_worker_resource_disk_size_in_mb: long + :vartype web_worker_resource_disk_size_in_mb: long """ _attribute_map = { @@ -4107,6 +5058,32 @@ def __init__( web_worker_resource_disk_size_in_mb: Optional[int] = None, **kwargs ): + """ + :keyword name: The vm size name. + :paramtype name: str + :keyword cores: The number of cores that the vm size has. + :paramtype cores: int + :keyword data_disk_storage_tier: The data disk storage tier of the vm size. + :paramtype data_disk_storage_tier: str + :keyword label: The label of the vm size. + :paramtype label: str + :keyword max_data_disk_count: The max data disk count of the vm size. + :paramtype max_data_disk_count: long + :keyword memory_in_mb: The memory whose unit is MB of the vm size. + :paramtype memory_in_mb: long + :keyword supported_by_virtual_machines: This indicates this vm size is supported by virtual + machines or not. + :paramtype supported_by_virtual_machines: bool + :keyword supported_by_web_worker_roles: The indicates this vm size is supported by web worker + roles or not. + :paramtype supported_by_web_worker_roles: bool + :keyword virtual_machine_resource_disk_size_in_mb: The virtual machine resource disk size whose + unit is MB of the vm size. + :paramtype virtual_machine_resource_disk_size_in_mb: long + :keyword web_worker_resource_disk_size_in_mb: The web worker resource disk size whose unit is + MB of the vm size. + :paramtype web_worker_resource_disk_size_in_mb: long + """ super(VmSizeProperty, self).__init__(**kwargs) self.name = name self.cores = cores diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_patch.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/__init__.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/__init__.py index f6dc3dfa5a09..e0a942a98226 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/__init__.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/__init__.py @@ -18,6 +18,9 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ClustersOperations', 'ApplicationsOperations', @@ -31,3 +34,5 @@ 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_applications_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_applications_operations.py index 62339d31e665..71139e613b46 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_applications_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,55 +6,258 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_cluster_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + *, + json: Optional[_models.Application] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_azure_async_operation_status_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}/azureasyncoperations/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ApplicationsOperations(object): - """ApplicationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`applications` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list_by_cluster( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ApplicationListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable[_models.ApplicationListResult]: """Lists all of the applications for the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -61,45 +265,54 @@ def list_by_cluster( :param cluster_name: The name of the cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationListResult or the result of cls(response) + :return: An iterator like instance of either ApplicationListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.ApplicationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ApplicationListResult', pipeline_response) + deserialized = self._deserialize("ApplicationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,29 +321,34 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications"} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Application" + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> _models.Application: """Gets properties of the specified application. :param resource_group_name: The name of the resource group. @@ -144,39 +362,41 @@ def get( :rtype: ~azure.mgmt.hdinsight.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Application] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Application', pipeline_response) @@ -185,56 +405,57 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.Application" - **kwargs # type: Any - ): - # type: (...) -> "_models.Application" - cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.Application, + **kwargs: Any + ) -> _models.Application: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Application') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Application] + + _json = self._serialize.body(parameters, 'Application') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Application', pipeline_response) @@ -242,17 +463,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.Application" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Application"] + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.Application, + **kwargs: Any + ) -> LROPoller[_models.Application]: """Creates applications for the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -265,50 +488,59 @@ def begin_create( :type parameters: ~azure.mgmt.hdinsight.models.Application :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either Application or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Application or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.Application] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Application] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('Application', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -317,66 +549,67 @@ 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) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified application on the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -387,46 +620,53 @@ def begin_delete( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -435,19 +675,19 @@ 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) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + @distributed_trace def get_azure_async_operation_status( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AsyncOperationResult" + resource_group_name: str, + cluster_name: str, + application_name: str, + operation_id: str, + **kwargs: Any + ) -> _models.AsyncOperationResult: """Gets the async operation status. :param resource_group_name: The name of the resource group. @@ -463,40 +703,42 @@ def get_azure_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_azure_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_azure_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -505,4 +747,6 @@ def get_azure_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}/azureasyncoperations/{operationId}'} # type: ignore + + get_azure_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/applications/{applicationName}/azureasyncoperations/{operationId}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py index f712625c2d80..4e67cc35d121 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_clusters_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,94 +6,675 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[_models.ClusterCreateParametersExtended] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[_models.ClusterPatchParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_resize_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + role_name: Union[str, "_models.RoleName"], + *, + json: Optional[_models.ClusterResizeParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_update_auto_scale_configuration_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + role_name: Union[str, "_models.RoleName"], + *, + json: Optional[_models.AutoscaleConfigurationUpdateParameter] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "roleName": _SERIALIZER.url("role_name", role_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_rotate_disk_encryption_key_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[_models.ClusterDiskEncryptionParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_gateway_settings_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_gateway_settings_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[_models.UpdateGatewaySettingsParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_azure_async_operation_status_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/azureasyncoperations/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_identity_certificate_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[_models.UpdateClusterIdentityCertificateParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_execute_script_actions_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[_models.ExecuteScriptActionParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + +class ClustersOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ClustersOperations(object): - """ClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + def _create_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterCreateParametersExtended" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: _models.ClusterCreateParametersExtended, + **kwargs: Any + ) -> _models.Cluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterCreateParametersExtended') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + _json = self._serialize.body(parameters, 'ClusterCreateParametersExtended') + + request = build_create_request_initial( + 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_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -100,16 +682,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterCreateParametersExtended" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: _models.ClusterCreateParametersExtended, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: """Creates a new HDInsight cluster with the specified parameters. :param resource_group_name: The name of the resource group. @@ -120,48 +704,57 @@ def begin_create( :type parameters: ~azure.mgmt.hdinsight.models.ClusterCreateParametersExtended :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -170,18 +763,18 @@ 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) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + parameters: _models.ClusterPatchParameters, + **kwargs: Any + ) -> _models.Cluster: """Patch HDInsight cluster with the specified parameters. :param resource_group_name: The name of the resource group. @@ -195,43 +788,44 @@ def update( :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterPatchParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + _json = self._serialize.body(parameters, 'ClusterPatchParameters') + + request = build_update_request( + 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'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -240,61 +834,64 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore - def _delete_initial( + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -303,44 +900,52 @@ def begin_delete( :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. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -349,17 +954,17 @@ 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) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> _models.Cluster: """Gets the specified cluster. :param resource_group_name: The name of the resource group. @@ -371,38 +976,40 @@ def get( :rtype: ~azure.mgmt.hdinsight.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + + 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'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -411,14 +1018,16 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClusterListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable[_models.ClusterListResult]: """Lists the HDInsight clusters in a resource group. :param resource_group_name: The name of the resource group. @@ -428,40 +1037,47 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) + deserialized = self._deserialize("ClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -470,84 +1086,89 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters"} # type: ignore - def _resize_initial( + def _resize_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - role_name, # type: Union[str, "_models.RoleName"] - parameters, # type: "_models.ClusterResizeParameters" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + role_name: Union[str, "_models.RoleName"], + parameters: _models.ClusterResizeParameters, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._resize_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterResizeParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ClusterResizeParameters') + + request = build_resize_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + role_name=role_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._resize_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _resize_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize'} # type: ignore + _resize_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize"} # type: ignore + - def begin_resize( + @distributed_trace + def begin_resize( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - role_name, # type: Union[str, "_models.RoleName"] - parameters, # type: "_models.ClusterResizeParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + role_name: Union[str, "_models.RoleName"], + parameters: _models.ClusterResizeParameters, + **kwargs: Any + ) -> LROPoller[None]: """Resizes the specified HDInsight cluster to the specified size. :param resource_group_name: The name of the resource group. @@ -560,47 +1181,56 @@ def begin_resize( :type parameters: ~azure.mgmt.hdinsight.models.ClusterResizeParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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._resize_initial( + raw_result = self._resize_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -609,73 +1239,73 @@ 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) - begin_resize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _update_auto_scale_configuration_initial( + begin_resize.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/resize"} # type: ignore + + def _update_auto_scale_configuration_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - role_name, # type: Union[str, "_models.RoleName"] - parameters, # type: "_models.AutoscaleConfigurationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + role_name: Union[str, "_models.RoleName"], + parameters: _models.AutoscaleConfigurationUpdateParameter, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_auto_scale_configuration_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AutoscaleConfigurationUpdateParameter') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'AutoscaleConfigurationUpdateParameter') + + request = build_update_auto_scale_configuration_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + role_name=role_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_auto_scale_configuration_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _update_auto_scale_configuration_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale'} # type: ignore + _update_auto_scale_configuration_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale"} # type: ignore + - def begin_update_auto_scale_configuration( + @distributed_trace + def begin_update_auto_scale_configuration( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - role_name, # type: Union[str, "_models.RoleName"] - parameters, # type: "_models.AutoscaleConfigurationUpdateParameter" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + role_name: Union[str, "_models.RoleName"], + parameters: _models.AutoscaleConfigurationUpdateParameter, + **kwargs: Any + ) -> LROPoller[None]: """Updates the Autoscale Configuration for HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -688,47 +1318,56 @@ def begin_update_auto_scale_configuration( :type parameters: ~azure.mgmt.hdinsight.models.AutoscaleConfigurationUpdateParameter :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_auto_scale_configuration_initial( + raw_result = self._update_auto_scale_configuration_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, role_name=role_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'roleName': self._serialize.url("role_name", role_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -737,15 +1376,15 @@ 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) - begin_update_auto_scale_configuration.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_auto_scale_configuration.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/roles/{roleName}/autoscale"} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClusterListResult"] + **kwargs: Any + ) -> Iterable[_models.ClusterListResult]: """Lists all the HDInsight clusters under the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -753,39 +1392,45 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) + deserialized = self._deserialize("ClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -794,81 +1439,86 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters"} # type: ignore - def _rotate_disk_encryption_key_initial( + def _rotate_disk_encryption_key_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterDiskEncryptionParameters" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.ClusterDiskEncryptionParameters, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._rotate_disk_encryption_key_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterDiskEncryptionParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ClusterDiskEncryptionParameters') + + request = build_rotate_disk_encryption_key_request_initial( + 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._rotate_disk_encryption_key_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _rotate_disk_encryption_key_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey'} # type: ignore + _rotate_disk_encryption_key_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey"} # type: ignore + - def begin_rotate_disk_encryption_key( + @distributed_trace + def begin_rotate_disk_encryption_key( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterDiskEncryptionParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.ClusterDiskEncryptionParameters, + **kwargs: Any + ) -> LROPoller[None]: """Rotate disk encryption key of the specified HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -879,45 +1529,55 @@ def begin_rotate_disk_encryption_key( :type parameters: ~azure.mgmt.hdinsight.models.ClusterDiskEncryptionParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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._rotate_disk_encryption_key_initial( + raw_result = self._rotate_disk_encryption_key_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -926,17 +1586,17 @@ 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) - begin_rotate_disk_encryption_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_rotate_disk_encryption_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey"} # type: ignore + + @distributed_trace def get_gateway_settings( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.GatewaySettings" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> _models.GatewaySettings: """Gets the gateway settings for the specified cluster. :param resource_group_name: The name of the resource group. @@ -948,38 +1608,40 @@ def get_gateway_settings( :rtype: ~azure.mgmt.hdinsight.models.GatewaySettings :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.GatewaySettings"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_gateway_settings.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.GatewaySettings] + + + request = build_get_gateway_settings_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_gateway_settings.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GatewaySettings', pipeline_response) @@ -988,68 +1650,70 @@ def get_gateway_settings( return cls(pipeline_response, deserialized, {}) return deserialized - get_gateway_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings'} # type: ignore - def _update_gateway_settings_initial( + get_gateway_settings.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings"} # type: ignore + + + def _update_gateway_settings_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.UpdateGatewaySettingsParameters" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.UpdateGatewaySettingsParameters, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_gateway_settings_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UpdateGatewaySettingsParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'UpdateGatewaySettingsParameters') + + request = build_update_gateway_settings_request_initial( + 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_gateway_settings_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _update_gateway_settings_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings'} # type: ignore + _update_gateway_settings_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings"} # type: ignore - def begin_update_gateway_settings( + + @distributed_trace + def begin_update_gateway_settings( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.UpdateGatewaySettingsParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.UpdateGatewaySettingsParameters, + **kwargs: Any + ) -> LROPoller[None]: """Configures the gateway settings on the specified cluster. :param resource_group_name: The name of the resource group. @@ -1060,45 +1724,55 @@ def begin_update_gateway_settings( :type parameters: ~azure.mgmt.hdinsight.models.UpdateGatewaySettingsParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_gateway_settings_initial( + raw_result = self._update_gateway_settings_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1107,18 +1781,18 @@ 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) - begin_update_gateway_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_gateway_settings.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings"} # type: ignore + @distributed_trace def get_azure_async_operation_status( self, - resource_group_name, # type: str - cluster_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AsyncOperationResult" + resource_group_name: str, + cluster_name: str, + operation_id: str, + **kwargs: Any + ) -> _models.AsyncOperationResult: """The the async operation status. :param resource_group_name: The name of the resource group. @@ -1132,39 +1806,41 @@ def get_azure_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_azure_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_azure_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -1173,68 +1849,70 @@ def get_azure_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/azureasyncoperations/{operationId}'} # type: ignore - def _update_identity_certificate_initial( + get_azure_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/azureasyncoperations/{operationId}"} # type: ignore + + + def _update_identity_certificate_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.UpdateClusterIdentityCertificateParameters" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.UpdateClusterIdentityCertificateParameters, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_identity_certificate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'UpdateClusterIdentityCertificateParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'UpdateClusterIdentityCertificateParameters') + + request = build_update_identity_certificate_request_initial( + 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_identity_certificate_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _update_identity_certificate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate'} # type: ignore + _update_identity_certificate_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate"} # type: ignore + - def begin_update_identity_certificate( + @distributed_trace + def begin_update_identity_certificate( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.UpdateClusterIdentityCertificateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.UpdateClusterIdentityCertificateParameters, + **kwargs: Any + ) -> LROPoller[None]: """Updates the cluster identity certificate. :param resource_group_name: The name of the resource group. @@ -1245,45 +1923,55 @@ def begin_update_identity_certificate( :type parameters: ~azure.mgmt.hdinsight.models.UpdateClusterIdentityCertificateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_identity_certificate_initial( + raw_result = self._update_identity_certificate_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1292,70 +1980,70 @@ 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) - begin_update_identity_certificate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update_identity_certificate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateClusterIdentityCertificate"} # type: ignore - def _execute_script_actions_initial( + def _execute_script_actions_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ExecuteScriptActionParameters" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.ExecuteScriptActionParameters, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._execute_script_actions_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExecuteScriptActionParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ExecuteScriptActionParameters') + + request = build_execute_script_actions_request_initial( + 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._execute_script_actions_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _execute_script_actions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions'} # type: ignore + _execute_script_actions_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions"} # type: ignore - def begin_execute_script_actions( + + @distributed_trace + def begin_execute_script_actions( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ExecuteScriptActionParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.ExecuteScriptActionParameters, + **kwargs: Any + ) -> LROPoller[None]: """Executes script actions on the specified HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -1366,45 +2054,55 @@ def begin_execute_script_actions( :type parameters: ~azure.mgmt.hdinsight.models.ExecuteScriptActionParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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._execute_script_actions_initial( + raw_result = self._execute_script_actions_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1413,6 +2111,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) - begin_execute_script_actions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_execute_script_actions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions"} # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_configurations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_configurations_operations.py index 25305539c343..c70f4dfb5e09 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_configurations_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_configurations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,54 +6,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + configuration_name: str, + *, + json: Optional[Dict[str, str]] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + configuration_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "configurationName": _SERIALIZER.url("configuration_name", configuration_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ConfigurationsOperations(object): - """ConfigurationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`configurations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterConfigurations" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> _models.ClusterConfigurations: """Gets all configuration information for an HDI cluster. :param resource_group_name: The name of the resource group. @@ -64,38 +188,40 @@ def list( :rtype: ~azure.mgmt.hdinsight.models.ClusterConfigurations :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterConfigurations"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterConfigurations] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterConfigurations', pipeline_response) @@ -104,71 +230,73 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations'} # type: ignore - def _update_initial( + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations"} # type: ignore + + + def _update_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - configuration_name, # type: str - parameters, # type: Dict[str, str] - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + configuration_name: str, + parameters: Dict[str, str], + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, '{str}') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, '{str}') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + configuration_name=configuration_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}"} # type: ignore - def begin_update( + + @distributed_trace + def begin_update( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - configuration_name, # type: str - parameters, # type: Dict[str, str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + configuration_name: str, + parameters: Dict[str, str], + **kwargs: Any + ) -> LROPoller[None]: """Configures the HTTP settings on the specified cluster. This API is deprecated, please use UpdateGatewaySettings in cluster endpoint instead. @@ -182,47 +310,56 @@ def begin_update( :type parameters: dict[str, str] :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, configuration_name=configuration_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -231,18 +368,18 @@ 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) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}"} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Dict[str, str] + resource_group_name: str, + cluster_name: str, + configuration_name: str, + **kwargs: Any + ) -> Dict[str, str]: """The configuration object for the specified cluster. This API is not recommended and might be removed in the future. Please consider using List configurations API instead. @@ -257,39 +394,41 @@ def get( :rtype: dict[str, str] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'configurationName': self._serialize.url("configuration_name", configuration_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Dict[str, str]] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + configuration_name=configuration_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('{str}', pipeline_response) @@ -298,4 +437,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations/{configurationName}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_extensions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_extensions_operations.py index d7f3a489c441..395e68ce5cae 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_extensions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_extensions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,107 +6,511 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_enable_monitoring_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[_models.ClusterMonitoringRequest] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_monitoring_status_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_disable_monitoring_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_enable_azure_monitor_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[_models.AzureMonitorRequest] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_azure_monitor_status_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_disable_azure_monitor_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + extension_name: str, + *, + json: Optional[_models.Extension] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_azure_async_operation_status_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}/azureAsyncOperations/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ExtensionsOperations(object): - """ExtensionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`extensions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + - def _enable_monitoring_initial( + def _enable_monitoring_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterMonitoringRequest" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.ClusterMonitoringRequest, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._enable_monitoring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterMonitoringRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'ClusterMonitoringRequest') + + request = build_enable_monitoring_request_initial( + 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._enable_monitoring_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _enable_monitoring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore + _enable_monitoring_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore + - def begin_enable_monitoring( + @distributed_trace + def begin_enable_monitoring( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterMonitoringRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.ClusterMonitoringRequest, + **kwargs: Any + ) -> LROPoller[None]: """Enables the Operations Management Suite (OMS) on the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -116,45 +521,55 @@ def begin_enable_monitoring( :type parameters: ~azure.mgmt.hdinsight.models.ClusterMonitoringRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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._enable_monitoring_initial( + raw_result = self._enable_monitoring_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -163,17 +578,17 @@ 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) - begin_enable_monitoring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_enable_monitoring.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore + + @distributed_trace def get_monitoring_status( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterMonitoringResponse" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> _models.ClusterMonitoringResponse: """Gets the status of Operations Management Suite (OMS) on the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -185,38 +600,40 @@ def get_monitoring_status( :rtype: ~azure.mgmt.hdinsight.models.ClusterMonitoringResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterMonitoringResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_monitoring_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterMonitoringResponse] + + + request = build_get_monitoring_status_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_monitoring_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterMonitoringResponse', pipeline_response) @@ -225,61 +642,64 @@ def get_monitoring_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_monitoring_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore - def _disable_monitoring_initial( + get_monitoring_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore + + + def _disable_monitoring_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._disable_monitoring_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_disable_monitoring_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._disable_monitoring_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _disable_monitoring_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore + _disable_monitoring_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore - def begin_disable_monitoring( + + @distributed_trace + def begin_disable_monitoring( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Disables the Operations Management Suite (OMS) on the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -288,44 +708,52 @@ def begin_disable_monitoring( :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. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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._disable_monitoring_initial( + raw_result = self._disable_monitoring_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -334,70 +762,70 @@ 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) - begin_disable_monitoring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_disable_monitoring.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/clustermonitoring"} # type: ignore - def _enable_azure_monitor_initial( + def _enable_azure_monitor_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.AzureMonitorRequest" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.AzureMonitorRequest, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._enable_azure_monitor_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AzureMonitorRequest') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'AzureMonitorRequest') + + request = build_enable_azure_monitor_request_initial( + 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._enable_azure_monitor_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _enable_azure_monitor_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore + _enable_azure_monitor_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore + - def begin_enable_azure_monitor( + @distributed_trace + def begin_enable_azure_monitor( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.AzureMonitorRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + parameters: _models.AzureMonitorRequest, + **kwargs: Any + ) -> LROPoller[None]: """Enables the Azure Monitor on the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -408,45 +836,55 @@ def begin_enable_azure_monitor( :type parameters: ~azure.mgmt.hdinsight.models.AzureMonitorRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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._enable_azure_monitor_initial( + raw_result = self._enable_azure_monitor_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -455,17 +893,17 @@ 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) - begin_enable_azure_monitor.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_enable_azure_monitor.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore + @distributed_trace def get_azure_monitor_status( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AzureMonitorResponse" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> _models.AzureMonitorResponse: """Gets the status of Azure Monitor on the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -477,38 +915,40 @@ def get_azure_monitor_status( :rtype: ~azure.mgmt.hdinsight.models.AzureMonitorResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureMonitorResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_monitor_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AzureMonitorResponse] + + + request = build_get_azure_monitor_status_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_azure_monitor_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AzureMonitorResponse', pipeline_response) @@ -517,61 +957,64 @@ def get_azure_monitor_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_monitor_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore - def _disable_azure_monitor_initial( + get_azure_monitor_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore + + + def _disable_azure_monitor_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._disable_azure_monitor_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_azure_monitor_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._disable_azure_monitor_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _disable_azure_monitor_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore + _disable_azure_monitor_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore - def begin_disable_azure_monitor( + + @distributed_trace + def begin_disable_azure_monitor( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Disables the Azure Monitor on the HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -580,44 +1023,52 @@ def begin_disable_azure_monitor( :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. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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._disable_azure_monitor_initial( + raw_result = self._disable_azure_monitor_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -626,73 +1077,73 @@ 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) - begin_disable_azure_monitor.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_disable_azure_monitor.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/azureMonitor"} # type: ignore - def _create_initial( + def _create_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - extension_name, # type: str - parameters, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + extension_name: str, + parameters: _models.Extension, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(parameters, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + extension_name=extension_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore + _create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore - def begin_create( + + @distributed_trace + def begin_create( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - extension_name, # type: str - parameters, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + extension_name: str, + parameters: _models.Extension, + **kwargs: Any + ) -> LROPoller[None]: """Creates an HDInsight cluster extension. :param resource_group_name: The name of the resource group. @@ -705,47 +1156,56 @@ def begin_create( :type parameters: ~azure.mgmt.hdinsight.models.Extension :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_initial( + raw_result = self._create_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -754,18 +1214,18 @@ 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) - begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterMonitoringResponse" + resource_group_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> _models.ClusterMonitoringResponse: """Gets the extension properties for the specified HDInsight cluster extension. :param resource_group_name: The name of the resource group. @@ -779,39 +1239,41 @@ def get( :rtype: ~azure.mgmt.hdinsight.models.ClusterMonitoringResponse :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterMonitoringResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterMonitoringResponse] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + extension_name=extension_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterMonitoringResponse', pipeline_response) @@ -820,64 +1282,67 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore - def _delete_initial( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + extension_name=extension_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified extension for HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -888,46 +1353,53 @@ def begin_delete( :type extension_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, extension_name=extension_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -936,19 +1408,19 @@ 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) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}"} # type: ignore + + @distributed_trace def get_azure_async_operation_status( self, - resource_group_name, # type: str - cluster_name, # type: str - extension_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AsyncOperationResult" + resource_group_name: str, + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> _models.AsyncOperationResult: """Gets the async operation status. :param resource_group_name: The name of the resource group. @@ -964,40 +1436,42 @@ def get_azure_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_azure_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_azure_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -1006,4 +1480,6 @@ def get_azure_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}/azureAsyncOperations/{operationId}'} # type: ignore + + get_azure_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/extensions/{extensionName}/azureAsyncOperations/{operationId}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_locations_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_locations_operations.py index 1436a03193ef..a94d2317543e 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_locations_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_locations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,51 +6,279 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from 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 -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_capabilities_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_usages_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_billing_specs_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_azure_async_operation_status_request( + subscription_id: str, + location: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/azureasyncoperations/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: Optional[_models.NameAvailabilityCheckRequestParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_validate_cluster_create_request_request( + subscription_id: str, + location: str, + *, + json: Optional[_models.ClusterCreateRequestValidationParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + +class LocationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class LocationsOperations(object): - """LocationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`locations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def get_capabilities( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CapabilitiesResult" + location: str, + **kwargs: Any + ) -> _models.CapabilitiesResult: """Gets the capabilities for the specified location. :param location: The Azure location (region) for which to make the request. @@ -59,37 +288,39 @@ def get_capabilities( :rtype: ~azure.mgmt.hdinsight.models.CapabilitiesResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilitiesResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_capabilities.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.CapabilitiesResult] + + + request = build_get_capabilities_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=self.get_capabilities.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CapabilitiesResult', pipeline_response) @@ -98,14 +329,16 @@ def get_capabilities( return cls(pipeline_response, deserialized, {}) return deserialized - get_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities'} # type: ignore + get_capabilities.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities"} # type: ignore + + + @distributed_trace def list_usages( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UsagesListResult" + location: str, + **kwargs: Any + ) -> _models.UsagesListResult: """Lists the usages for the specified location. :param location: The Azure location (region) for which to make the request. @@ -115,37 +348,39 @@ def list_usages( :rtype: ~azure.mgmt.hdinsight.models.UsagesListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UsagesListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_usages.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.UsagesListResult] + + + request = build_list_usages_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=self.list_usages.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UsagesListResult', pipeline_response) @@ -154,14 +389,16 @@ def list_usages( return cls(pipeline_response, deserialized, {}) return deserialized - list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages'} # type: ignore + list_usages.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages"} # type: ignore + + + @distributed_trace def list_billing_specs( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BillingResponseListResult" + location: str, + **kwargs: Any + ) -> _models.BillingResponseListResult: """Lists the billingSpecs for the specified subscription and location. :param location: The Azure location (region) for which to make the request. @@ -171,37 +408,39 @@ def list_billing_specs( :rtype: ~azure.mgmt.hdinsight.models.BillingResponseListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.BillingResponseListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_billing_specs.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.BillingResponseListResult] + + + request = build_list_billing_specs_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + template_url=self.list_billing_specs.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BillingResponseListResult', pipeline_response) @@ -210,15 +449,17 @@ def list_billing_specs( return cls(pipeline_response, deserialized, {}) return deserialized - list_billing_specs.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs'} # type: ignore + list_billing_specs.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs"} # type: ignore + + + @distributed_trace def get_azure_async_operation_status( self, - location, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AsyncOperationResult" + location: str, + operation_id: str, + **kwargs: Any + ) -> _models.AsyncOperationResult: """Get the async operation status. :param location: The Azure location (region) for which to make the request. @@ -230,38 +471,40 @@ def get_azure_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_azure_async_operation_status_request( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_azure_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -270,15 +513,17 @@ def get_azure_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_azure_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/azureasyncoperations/{operationId}'} # type: ignore + get_azure_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/azureasyncoperations/{operationId}"} # type: ignore + + + @distributed_trace def check_name_availability( self, - location, # type: str - parameters, # type: "_models.NameAvailabilityCheckRequestParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NameAvailabilityCheckResult" + location: str, + parameters: _models.NameAvailabilityCheckRequestParameters, + **kwargs: Any + ) -> _models.NameAvailabilityCheckResult: """Check the cluster name is available or not. :param location: The Azure location (region) for which to make the request. @@ -290,42 +535,43 @@ def check_name_availability( :rtype: ~azure.mgmt.hdinsight.models.NameAvailabilityCheckResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityCheckResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NameAvailabilityCheckRequestParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.NameAvailabilityCheckResult] + + _json = self._serialize.body(parameters, 'NameAvailabilityCheckRequestParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('NameAvailabilityCheckResult', pipeline_response) @@ -334,15 +580,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability'} # type: ignore + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/checkNameAvailability"} # type: ignore + + + @distributed_trace def validate_cluster_create_request( self, - location, # type: str - parameters, # type: "_models.ClusterCreateRequestValidationParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterCreateValidationResult" + location: str, + parameters: _models.ClusterCreateRequestValidationParameters, + **kwargs: Any + ) -> _models.ClusterCreateValidationResult: """Validate the cluster create request spec is valid or not. :param location: The Azure location (region) for which to make the request. @@ -354,42 +602,43 @@ def validate_cluster_create_request( :rtype: ~azure.mgmt.hdinsight.models.ClusterCreateValidationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCreateValidationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_cluster_create_request.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterCreateRequestValidationParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCreateValidationResult] + + _json = self._serialize.body(parameters, 'ClusterCreateRequestValidationParameters') + + request = build_validate_cluster_create_request_request( + subscription_id=self._config.subscription_id, + location=location, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.validate_cluster_create_request.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCreateValidationResult', pipeline_response) @@ -398,4 +647,6 @@ def validate_cluster_create_request( return cls(pipeline_response, deserialized, {}) return deserialized - validate_cluster_create_request.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest'} # type: ignore + + validate_cluster_create_request.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/validateCreateRequest"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_operations.py index b5f55534be2e..3f0935e7c5b9 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,51 +6,78 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.HDInsight/operations") -class Operations(object): - """Operations operations. + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable[_models.OperationListResult]: """Lists all of the available HDInsight REST API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,35 +85,43 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,17 +130,22 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.HDInsight/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.HDInsight/operations"} # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_patch.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_endpoint_connections_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_endpoint_connections_operations.py index 62273e935e76..b7832229c7c9 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_endpoint_connections_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_endpoint_connections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,55 +6,217 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_cluster_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + *, + json: Optional[_models.PrivateEndpointConnection] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list_by_cluster( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable[_models.PrivateEndpointConnectionListResult]: """Lists the private endpoint connections for a HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -61,45 +224,55 @@ def list_by_cluster( :param cluster_name: The name of the cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,69 +281,73 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections"} # type: ignore def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - parameters, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + _json = self._serialize.body(parameters, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -182,17 +359,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - parameters, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: """Approve or reject a private endpoint connection manually. :param resource_group_name: The name of the resource group. @@ -205,50 +384,59 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hdinsight.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -257,18 +445,18 @@ 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) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: """Gets the specific private endpoint connection. :param resource_group_name: The name of the resource group. @@ -282,39 +470,41 @@ def get( :rtype: ~azure.mgmt.hdinsight.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -323,64 +513,67 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - def _delete_initial( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specific private endpoint connection. :param resource_group_name: The name of the resource group. @@ -391,46 +584,53 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] 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( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'azure-async-operation'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -439,6 +639,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) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_link_resources_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_link_resources_operations.py index 50556d4b7138..1f3ddbbb22db 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_link_resources_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_private_link_resources_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,52 +6,128 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from 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 -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_cluster_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + private_link_resource_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list_by_cluster( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: """Lists the private link resources in a HDInsight cluster. :param resource_group_name: The name of the resource group. @@ -62,38 +139,40 @@ def list_by_cluster( :rtype: ~azure.mgmt.hdinsight.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + + + request = build_list_by_cluster_request( + 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'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) @@ -102,16 +181,18 @@ def list_by_cluster( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources"} # type: ignore + + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - private_link_resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResource" + resource_group_name: str, + cluster_name: str, + private_link_resource_name: str, + **kwargs: Any + ) -> _models.PrivateLinkResource: """Gets the specific private link resource. :param resource_group_name: The name of the resource group. @@ -125,39 +206,41 @@ def get( :rtype: ~azure.mgmt.hdinsight.models.PrivateLinkResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_link_resource_name=private_link_resource_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -166,4 +249,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_actions_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_actions_operations.py index 73c74d134097..8f04edffb924 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_actions_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_actions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,54 +6,208 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + script_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "scriptName": _SERIALIZER.url("script_name", script_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_by_cluster_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_execution_detail_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + script_execution_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "scriptExecutionId": _SERIALIZER.url("script_execution_id", script_execution_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_execution_async_operation_status_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions/azureasyncoperations/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ScriptActionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ScriptActionsOperations(object): - """ScriptActionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`script_actions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + - def delete( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - script_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + script_name: str, + **kwargs: Any + ) -> None: """Deletes a specified persisted script action of the cluster. :param resource_group_name: The name of the resource group. @@ -66,53 +221,56 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + script_name=script_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions/{scriptName}"} # type: ignore + + @distributed_trace def list_by_cluster( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScriptActionsList"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable[_models.ScriptActionsList]: """Lists all the persisted script actions for the specified cluster. :param resource_group_name: The name of the resource group. @@ -124,41 +282,49 @@ def list_by_cluster( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.ScriptActionsList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptActionsList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ScriptActionsList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptActionsList', pipeline_response) + deserialized = self._deserialize("ScriptActionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -167,29 +333,34 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptActions"} # type: ignore + @distributed_trace def get_execution_detail( self, - resource_group_name, # type: str - cluster_name, # type: str - script_execution_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RuntimeScriptActionDetail" + resource_group_name: str, + cluster_name: str, + script_execution_id: str, + **kwargs: Any + ) -> _models.RuntimeScriptActionDetail: """Gets the script execution detail for the given script execution ID. :param resource_group_name: The name of the resource group. @@ -203,39 +374,41 @@ def get_execution_detail( :rtype: ~azure.mgmt.hdinsight.models.RuntimeScriptActionDetail :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.RuntimeScriptActionDetail"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_execution_detail.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'scriptExecutionId': self._serialize.url("script_execution_id", script_execution_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.RuntimeScriptActionDetail] + + + request = build_get_execution_detail_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + script_execution_id=script_execution_id, + api_version=api_version, + template_url=self.get_execution_detail.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RuntimeScriptActionDetail', pipeline_response) @@ -244,16 +417,18 @@ def get_execution_detail( return cls(pipeline_response, deserialized, {}) return deserialized - get_execution_detail.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}'} # type: ignore + get_execution_detail.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}"} # type: ignore + + + @distributed_trace def get_execution_async_operation_status( self, - resource_group_name, # type: str - cluster_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AsyncOperationResult" + resource_group_name: str, + cluster_name: str, + operation_id: str, + **kwargs: Any + ) -> _models.AsyncOperationResult: """Gets the async operation status of execution operation. :param resource_group_name: The name of the resource group. @@ -267,39 +442,41 @@ def get_execution_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_execution_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_execution_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_execution_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -308,4 +485,6 @@ def get_execution_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_execution_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions/azureasyncoperations/{operationId}'} # type: ignore + + get_execution_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions/azureasyncoperations/{operationId}"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_execution_history_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_execution_history_operations.py index c540085ae1ba..c01f74544059 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_execution_history_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_script_execution_history_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,53 +6,129 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +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 HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_cluster_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -class ScriptExecutionHistoryOperations(object): - """ScriptExecutionHistoryOperations operations. +def build_promote_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + script_execution_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "scriptExecutionId": _SERIALIZER.url("script_execution_id", script_execution_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ScriptExecutionHistoryOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`script_execution_history` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list_by_cluster( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScriptActionExecutionHistoryList"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable[_models.ScriptActionExecutionHistoryList]: """Lists all scripts' execution history for the specified cluster. :param resource_group_name: The name of the resource group. @@ -59,45 +136,55 @@ def list_by_cluster( :param cluster_name: The name of the cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ScriptActionExecutionHistoryList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.ScriptActionExecutionHistoryList] + :return: An iterator like instance of either ScriptActionExecutionHistoryList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hdinsight.models.ScriptActionExecutionHistoryList] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptActionExecutionHistoryList"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ScriptActionExecutionHistoryList] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_by_cluster.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ScriptActionExecutionHistoryList', pipeline_response) + deserialized = self._deserialize("ScriptActionExecutionHistoryList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,29 +193,34 @@ 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]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory'} # type: ignore + list_by_cluster.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory"} # type: ignore - def promote( + @distributed_trace + def promote( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - script_execution_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + script_execution_id: str, + **kwargs: Any + ) -> None: """Promotes the specified ad-hoc script execution to a persisted script. :param resource_group_name: The name of the resource group. @@ -142,42 +234,45 @@ def promote( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.promote.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'scriptExecutionId': self._serialize.url("script_execution_id", script_execution_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + request = build_promote_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + script_execution_id=script_execution_id, + api_version=api_version, + template_url=self.promote.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - promote.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote'} # type: ignore + promote.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/scriptExecutionHistory/{scriptExecutionId}/promote"} # type: ignore + diff --git a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_virtual_machines_operations.py b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_virtual_machines_operations.py index e01cfdd68dc6..684828f78042 100644 --- a/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_virtual_machines_operations.py +++ b/sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/_virtual_machines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,54 +6,175 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, List, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_hosts_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_restart_hosts_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[List[str]] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_get_async_operation_status_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts/azureasyncoperations/{operationId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class VirtualMachinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class VirtualMachinesOperations(object): - """VirtualMachinesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.hdinsight.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.hdinsight.HDInsightManagementClient`'s + :attr:`virtual_machines` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list_hosts( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.HostInfo"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> List[_models.HostInfo]: """Lists the HDInsight clusters hosts. :param resource_group_name: The name of the resource group. @@ -64,38 +186,40 @@ def list_hosts( :rtype: list[~azure.mgmt.hdinsight.models.HostInfo] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[List["_models.HostInfo"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_hosts.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[List[_models.HostInfo]] + + + request = build_list_hosts_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list_hosts.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[HostInfo]', pipeline_response) @@ -104,68 +228,70 @@ def list_hosts( return cls(pipeline_response, deserialized, {}) return deserialized - list_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts'} # type: ignore - def _restart_hosts_initial( + list_hosts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts"} # type: ignore + + + def _restart_hosts_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - hosts, # type: List[str] - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + hosts: List[str], + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restart_hosts_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(hosts, '[str]') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[None] + + _json = self._serialize.body(hosts, '[str]') + + request = build_restart_hosts_request_initial( + 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._restart_hosts_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # 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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _restart_hosts_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts'} # type: ignore + _restart_hosts_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts"} # type: ignore + - def begin_restart_hosts( + @distributed_trace + def begin_restart_hosts( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - hosts, # type: List[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + hosts: List[str], + **kwargs: Any + ) -> LROPoller[None]: """Restarts the specified HDInsight cluster hosts. :param resource_group_name: The name of the resource group. @@ -176,45 +302,55 @@ def begin_restart_hosts( :type hosts: list[str] :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._restart_hosts_initial( + raw_result = self._restart_hosts_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, hosts=hosts, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + lro_options={'final-state-via': 'location'}, + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -223,18 +359,18 @@ 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) - begin_restart_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_restart_hosts.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts"} # type: ignore + @distributed_trace def get_async_operation_status( self, - resource_group_name, # type: str - cluster_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AsyncOperationResult" + resource_group_name: str, + cluster_name: str, + operation_id: str, + **kwargs: Any + ) -> _models.AsyncOperationResult: """Gets the async operation status. :param resource_group_name: The name of the resource group. @@ -248,39 +384,41 @@ def get_async_operation_status( :rtype: ~azure.mgmt.hdinsight.models.AsyncOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_async_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.AsyncOperationResult] + + + request = build_get_async_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + operation_id=operation_id, + api_version=api_version, + template_url=self.get_async_operation_status.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # 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, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AsyncOperationResult', pipeline_response) @@ -289,4 +427,6 @@ def get_async_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_async_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts/azureasyncoperations/{operationId}'} # type: ignore + + get_async_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts/azureasyncoperations/{operationId}"} # type: ignore +