diff --git a/azure-mgmt-hdinsight/MANIFEST.in b/azure-mgmt-hdinsight/MANIFEST.in index 6ceb27f7a96e..e4884efef41b 100644 --- a/azure-mgmt-hdinsight/MANIFEST.in +++ b/azure-mgmt-hdinsight/MANIFEST.in @@ -1,3 +1,4 @@ +recursive-include tests *.py *.yaml include *.rst include azure/__init__.py include azure/mgmt/__init__.py diff --git a/azure-mgmt-hdinsight/README.rst b/azure-mgmt-hdinsight/README.rst index 4a5e684c2950..f2b441c2102f 100644 --- a/azure-mgmt-hdinsight/README.rst +++ b/azure-mgmt-hdinsight/README.rst @@ -14,25 +14,6 @@ For the older Azure Service Management (ASM) libraries, see For a more complete set of Azure libraries, see the `azure `__ bundle package. -Compatibility -============= - -**IMPORTANT**: If you have an earlier version of the azure package -(version < 1.0), you should uninstall it before installing this package. - -You can check the version using pip: - -.. code:: shell - - pip freeze - -If you see azure==0.11.0 (or any version below 1.0), uninstall it first: - -.. code:: shell - - pip uninstall azure - - Usage ===== diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py index a99d4b7ecd87..afc85ab41a95 100644 --- a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py @@ -43,6 +43,8 @@ from .cluster_list_runtime_script_action_detail_result_py3 import ClusterListRuntimeScriptActionDetailResult from .cluster_resize_parameters_py3 import ClusterResizeParameters from .cluster_disk_encryption_parameters_py3 import ClusterDiskEncryptionParameters + from .update_gateway_settings_parameters_py3 import UpdateGatewaySettingsParameters + from .gateway_settings_py3 import GatewaySettings from .operation_resource_py3 import OperationResource from .resource_py3 import Resource from .tracked_resource_py3 import TrackedResource @@ -55,6 +57,7 @@ from .localized_name_py3 import LocalizedName from .usage_py3 import Usage from .usages_list_result_py3 import UsagesListResult + from .cluster_configurations_py3 import ClusterConfigurations from .extension_py3 import Extension from .cluster_monitoring_response_py3 import ClusterMonitoringResponse from .cluster_monitoring_request_py3 import ClusterMonitoringRequest @@ -95,6 +98,8 @@ from .cluster_list_runtime_script_action_detail_result import ClusterListRuntimeScriptActionDetailResult from .cluster_resize_parameters import ClusterResizeParameters from .cluster_disk_encryption_parameters import ClusterDiskEncryptionParameters + from .update_gateway_settings_parameters import UpdateGatewaySettingsParameters + from .gateway_settings import GatewaySettings from .operation_resource import OperationResource from .resource import Resource from .tracked_resource import TrackedResource @@ -107,6 +112,7 @@ from .localized_name import LocalizedName from .usage import Usage from .usages_list_result import UsagesListResult + from .cluster_configurations import ClusterConfigurations from .extension import Extension from .cluster_monitoring_response import ClusterMonitoringResponse from .cluster_monitoring_request import ClusterMonitoringRequest @@ -161,6 +167,8 @@ 'ClusterListRuntimeScriptActionDetailResult', 'ClusterResizeParameters', 'ClusterDiskEncryptionParameters', + 'UpdateGatewaySettingsParameters', + 'GatewaySettings', 'OperationResource', 'Resource', 'TrackedResource', @@ -173,6 +181,7 @@ 'LocalizedName', 'Usage', 'UsagesListResult', + 'ClusterConfigurations', 'Extension', 'ClusterMonitoringResponse', 'ClusterMonitoringRequest', diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/cluster_configurations.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/cluster_configurations.py new file mode 100644 index 000000000000..15df30d5672a --- /dev/null +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/cluster_configurations.py @@ -0,0 +1,29 @@ +# 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 msrest.serialization import Model + + +class ClusterConfigurations(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) diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/cluster_configurations_py3.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/cluster_configurations_py3.py new file mode 100644 index 000000000000..9286c9554ee8 --- /dev/null +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/cluster_configurations_py3.py @@ -0,0 +1,29 @@ +# 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 msrest.serialization import Model + + +class ClusterConfigurations(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, *, configurations=None, **kwargs) -> None: + super(ClusterConfigurations, self).__init__(**kwargs) + self.configurations = configurations diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/gateway_settings.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/gateway_settings.py new file mode 100644 index 000000000000..00c63a753026 --- /dev/null +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/gateway_settings.py @@ -0,0 +1,46 @@ +# 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 msrest.serialization import Model + + +class GatewaySettings(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 diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/gateway_settings_py3.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/gateway_settings_py3.py new file mode 100644 index 000000000000..dc78168ba19b --- /dev/null +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/gateway_settings_py3.py @@ -0,0 +1,46 @@ +# 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 msrest.serialization import Model + + +class GatewaySettings(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) -> None: + super(GatewaySettings, self).__init__(**kwargs) + self.is_credential_enabled = None + self.user_name = None + self.password = None diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/update_gateway_settings_parameters.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/update_gateway_settings_parameters.py new file mode 100644 index 000000000000..44ba4c058085 --- /dev/null +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/update_gateway_settings_parameters.py @@ -0,0 +1,37 @@ +# 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 msrest.serialization import Model + + +class UpdateGatewaySettingsParameters(Model): + """The update gateway settings request parameters. + + :param is_credential_enabled: Indicates whether or not the gateway + settings based authorization is enabled. Default value: True . + :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) diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/update_gateway_settings_parameters_py3.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/update_gateway_settings_parameters_py3.py new file mode 100644 index 000000000000..4d49f95bde54 --- /dev/null +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/update_gateway_settings_parameters_py3.py @@ -0,0 +1,37 @@ +# 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 msrest.serialization import Model + + +class UpdateGatewaySettingsParameters(Model): + """The update gateway settings request parameters. + + :param is_credential_enabled: Indicates whether or not the gateway + settings based authorization is enabled. Default value: True . + :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, *, is_credential_enabled: bool=True, user_name: str=None, password: str=None, **kwargs) -> None: + super(UpdateGatewaySettingsParameters, self).__init__(**kwargs) + self.is_credential_enabled = is_credential_enabled + self.user_name = user_name + self.password = password diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/clusters_operations.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/clusters_operations.py index 7b8df20b343d..2910ba67c293 100644 --- a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/clusters_operations.py +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/clusters_operations.py @@ -652,6 +652,153 @@ def get_long_running_output(response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) rotate_disk_encryption_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey'} + def get_gateway_settings( + self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config): + """Gets the gateway settings for the specified cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster. + :type cluster_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: GatewaySettings or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.hdinsight.models.GatewaySettings or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_gateway_settings.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('GatewaySettings', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_gateway_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/getGatewaySettings'} + + + def _update_gateway_settings_initial( + self, resource_group_name, cluster_name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update_gateway_settings.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'UpdateGatewaySettingsParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def update_gateway_settings( + self, resource_group_name, cluster_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Configures the gateway settings on the specified cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster. + :type cluster_name: str + :param parameters: The cluster configurations. + :type parameters: + ~azure.mgmt.hdinsight.models.UpdateGatewaySettingsParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._update_gateway_settings_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update_gateway_settings.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/updateGatewaySettings'} + def _execute_script_actions_initial( self, resource_group_name, cluster_name, persist_on_success, script_actions=None, custom_headers=None, raw=False, **operation_config): diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/configurations_operations.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/configurations_operations.py index c0b9a95c02f9..e4dd4136d1c7 100644 --- a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/configurations_operations.py +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/configurations_operations.py @@ -38,6 +38,67 @@ def __init__(self, client, config, serializer, deserializer): self.config = config + def list( + self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config): + """Gets all configuration information for an HDI cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster. + :type cluster_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ClusterConfigurations or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.hdinsight.models.ClusterConfigurations or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ClusterConfigurations', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/configurations'} + def _update_initial( self, resource_group_name, cluster_name, configuration_name, parameters, custom_headers=None, raw=False, **operation_config): @@ -81,7 +142,9 @@ def _update_initial( def update( self, resource_group_name, cluster_name, configuration_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): - """Configures the configuration on the specified cluster. + """Configures the HTTP settings on the specified cluster. This API is + deprecated, please use UpdateGatewaySettings in cluster endpoint + instead. :param resource_group_name: The name of the resource group. :type resource_group_name: str @@ -129,7 +192,9 @@ def get_long_running_output(response): def get( self, resource_group_name, cluster_name, configuration_name, custom_headers=None, raw=False, **operation_config): - """The configuration object for the specified cluster. + """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. :param resource_group_name: The name of the resource group. :type resource_group_name: str diff --git a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/version.py b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/version.py index 3da0f49f071f..e0ec669828cb 100644 --- a/azure-mgmt-hdinsight/azure/mgmt/hdinsight/version.py +++ b/azure-mgmt-hdinsight/azure/mgmt/hdinsight/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.2.1" +VERSION = "0.1.0"