Skip to content

Commit 111e152

Browse files
changlong-liuSDK Automationaim-for-betterlmazuelZhenyu Zhou
authored
Sdk automation/azure mgmt hdinsight (#11704)
* Update from master * changelog and run test * run live * [HDInsight] Fix hdi test failure (#11806) * Initial generation Synapse autorest v5 * Fix empty model generation * Fix Test Failure: Skip 3 test case: test_create_with_adlsgen1, test_create_with_additional_storage, test_oms_on_running_cluster Rename test_http_extend to test_gateway_setting for http settings is replaced with gateway settings Co-authored-by: Laurent Mazuel <[email protected]> Co-authored-by: Zhenyu Zhou <[email protected]> * run test * correct testcase Co-authored-by: SDK Automation <[email protected]> Co-authored-by: aim-for-better <[email protected]> Co-authored-by: Laurent Mazuel <[email protected]> Co-authored-by: Zhenyu Zhou <[email protected]>
1 parent 45934b6 commit 111e152

31 files changed

+21086
-16310
lines changed

sdk/hdinsight/azure-mgmt-hdinsight/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 1.5.0 (2020-05-29)
4+
5+
**Features**
6+
7+
- Added operation group VirtualMachinesOperations
8+
39
## 1.4.0 (2020-01-16)
410

511
**Features**
+10-18
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
1-
## Microsoft Azure SDK for Python
1+
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure HDInsight Management Client Library.
4-
5-
Azure Resource Manager (ARM) is the next generation of management APIs
6-
that replace the old Azure Service Management (ASM).
7-
84
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
5+
For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/)
96

10-
For the older Azure Service Management (ASM) libraries, see
11-
[azure-servicemanagement-legacy](https://pypi.python.org/pypi/azure-servicemanagement-legacy)
12-
library.
13-
14-
For a more complete set of Azure libraries, see the
15-
[azure](https://pypi.python.org/pypi/azure) bundle package.
167

17-
## Usage
8+
# Usage
189

19-
For code examples, see [HDInsight
20-
Management](https://docs.microsoft.com/python/api/overview/azure/hdinsight)
10+
For code examples, see [HDInsight Management](https://docs.microsoft.com/python/api/overview/azure/hdinsight)
2111
on docs.microsoft.com.
2212

23-
## Provide Feedback
2413

25-
If you encounter any bugs or have suggestions, please file an issue in
26-
the [Issues](https://github.com/Azure/azure-sdk-for-python/issues)
14+
# Provide Feedback
15+
16+
If you encounter any bugs or have suggestions, please file an issue in the
17+
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
2718
section of the project.
2819

29-
![image](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-hdinsight%2FREADME.png)
20+
21+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-hdinsight%2FREADME.png)

sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/_hd_insight_management_client.py

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from .operations import ScriptActionsOperations
2222
from .operations import ScriptExecutionHistoryOperations
2323
from .operations import Operations
24+
from .operations import VirtualMachinesOperations
2425
from . import models
2526

2627

@@ -46,6 +47,8 @@ class HDInsightManagementClient(SDKClient):
4647
:vartype script_execution_history: azure.mgmt.hdinsight.operations.ScriptExecutionHistoryOperations
4748
:ivar operations: Operations operations
4849
:vartype operations: azure.mgmt.hdinsight.operations.Operations
50+
:ivar virtual_machines: VirtualMachines operations
51+
:vartype virtual_machines: azure.mgmt.hdinsight.operations.VirtualMachinesOperations
4952
5053
:param credentials: Credentials needed for the client to connect to Azure.
5154
:type credentials: :mod:`A msrestazure Credentials
@@ -84,3 +87,5 @@ def __init__(
8487
self._client, self.config, self._serialize, self._deserialize)
8588
self.operations = Operations(
8689
self._client, self.config, self._serialize, self._deserialize)
90+
self.virtual_machines = VirtualMachinesOperations(
91+
self._client, self.config, self._serialize, self._deserialize)

sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
from ._models_py3 import Extension
5151
from ._models_py3 import GatewaySettings
5252
from ._models_py3 import HardwareProfile
53+
from ._models_py3 import HostInfo
54+
from ._models_py3 import HostInfoListResult
5355
from ._models_py3 import KafkaRestProperties
5456
from ._models_py3 import LinuxOperatingSystemProfile
5557
from ._models_py3 import LocalizedName
@@ -125,6 +127,8 @@
125127
from ._models import Extension
126128
from ._models import GatewaySettings
127129
from ._models import HardwareProfile
130+
from ._models import HostInfo
131+
from ._models import HostInfoListResult
128132
from ._models import KafkaRestProperties
129133
from ._models import LinuxOperatingSystemProfile
130134
from ._models import LocalizedName
@@ -216,6 +220,8 @@
216220
'Extension',
217221
'GatewaySettings',
218222
'HardwareProfile',
223+
'HostInfo',
224+
'HostInfoListResult',
219225
'KafkaRestProperties',
220226
'LinuxOperatingSystemProfile',
221227
'LocalizedName',

sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models.py

+32
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,38 @@ def __init__(self, **kwargs):
13221322
self.vm_size = kwargs.get('vm_size', None)
13231323

13241324

1325+
class HostInfo(Model):
1326+
"""The cluster host information.
1327+
1328+
:param name: The host name
1329+
:type name: str
1330+
"""
1331+
1332+
_attribute_map = {
1333+
'name': {'key': 'name', 'type': 'str'},
1334+
}
1335+
1336+
def __init__(self, **kwargs):
1337+
super(HostInfo, self).__init__(**kwargs)
1338+
self.name = kwargs.get('name', None)
1339+
1340+
1341+
class HostInfoListResult(Model):
1342+
"""Result of the request to list cluster hosts.
1343+
1344+
:param value: The list of cluster hosts.
1345+
:type value: list[~azure.mgmt.hdinsight.models.HostInfo]
1346+
"""
1347+
1348+
_attribute_map = {
1349+
'value': {'key': 'value', 'type': '[HostInfo]'},
1350+
}
1351+
1352+
def __init__(self, **kwargs):
1353+
super(HostInfoListResult, self).__init__(**kwargs)
1354+
self.value = kwargs.get('value', None)
1355+
1356+
13251357
class KafkaRestProperties(Model):
13261358
"""The kafka rest proxy configuration which contains AAD security group
13271359
information.

sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/models/_models_py3.py

+32
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,38 @@ def __init__(self, *, vm_size: str=None, **kwargs) -> None:
13221322
self.vm_size = vm_size
13231323

13241324

1325+
class HostInfo(Model):
1326+
"""The cluster host information.
1327+
1328+
:param name: The host name
1329+
:type name: str
1330+
"""
1331+
1332+
_attribute_map = {
1333+
'name': {'key': 'name', 'type': 'str'},
1334+
}
1335+
1336+
def __init__(self, *, name: str=None, **kwargs) -> None:
1337+
super(HostInfo, self).__init__(**kwargs)
1338+
self.name = name
1339+
1340+
1341+
class HostInfoListResult(Model):
1342+
"""Result of the request to list cluster hosts.
1343+
1344+
:param value: The list of cluster hosts.
1345+
:type value: list[~azure.mgmt.hdinsight.models.HostInfo]
1346+
"""
1347+
1348+
_attribute_map = {
1349+
'value': {'key': 'value', 'type': '[HostInfo]'},
1350+
}
1351+
1352+
def __init__(self, *, value=None, **kwargs) -> None:
1353+
super(HostInfoListResult, self).__init__(**kwargs)
1354+
self.value = value
1355+
1356+
13251357
class KafkaRestProperties(Model):
13261358
"""The kafka rest proxy configuration which contains AAD security group
13271359
information.

sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/operations/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from ._script_actions_operations import ScriptActionsOperations
1818
from ._script_execution_history_operations import ScriptExecutionHistoryOperations
1919
from ._operations import Operations
20+
from ._virtual_machines_operations import VirtualMachinesOperations
2021

2122
__all__ = [
2223
'ClustersOperations',
@@ -27,4 +28,5 @@
2728
'ScriptActionsOperations',
2829
'ScriptExecutionHistoryOperations',
2930
'Operations',
31+
'VirtualMachinesOperations',
3032
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
import uuid
13+
from msrest.pipeline import ClientRawResponse
14+
from msrest.polling import LROPoller, NoPolling
15+
from msrestazure.polling.arm_polling import ARMPolling
16+
17+
from .. import models
18+
19+
20+
class VirtualMachinesOperations(object):
21+
"""VirtualMachinesOperations operations.
22+
23+
You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
24+
25+
:param client: Client for service requests.
26+
:param config: Configuration of service client.
27+
:param serializer: An object model serializer.
28+
:param deserializer: An object model deserializer.
29+
:ivar api_version: The HDInsight client API Version. Constant value: "2018-06-01-preview".
30+
"""
31+
32+
models = models
33+
34+
def __init__(self, client, config, serializer, deserializer):
35+
36+
self._client = client
37+
self._serialize = serializer
38+
self._deserialize = deserializer
39+
self.api_version = "2018-06-01-preview"
40+
41+
self.config = config
42+
43+
def list_hosts(
44+
self, resource_group_name, cluster_name, custom_headers=None, raw=False, **operation_config):
45+
"""Lists the HDInsight clusters hosts.
46+
47+
:param resource_group_name: The name of the resource group.
48+
:type resource_group_name: str
49+
:param cluster_name: The name of the cluster.
50+
:type cluster_name: str
51+
:param dict custom_headers: headers that will be added to the request
52+
:param bool raw: returns the direct response alongside the
53+
deserialized response
54+
:param operation_config: :ref:`Operation configuration
55+
overrides<msrest:optionsforoperations>`.
56+
:return: HostInfoListResult or ClientRawResponse if raw=true
57+
:rtype: ~azure.mgmt.hdinsight.models.HostInfoListResult or
58+
~msrest.pipeline.ClientRawResponse
59+
:raises:
60+
:class:`ErrorResponseException<azure.mgmt.hdinsight.models.ErrorResponseException>`
61+
"""
62+
# Construct URL
63+
url = self.list_hosts.metadata['url']
64+
path_format_arguments = {
65+
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
66+
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
67+
'clusterName': self._serialize.url("cluster_name", cluster_name, 'str')
68+
}
69+
url = self._client.format_url(url, **path_format_arguments)
70+
71+
# Construct parameters
72+
query_parameters = {}
73+
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
74+
75+
# Construct headers
76+
header_parameters = {}
77+
header_parameters['Accept'] = 'application/json'
78+
if self.config.generate_client_request_id:
79+
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
80+
if custom_headers:
81+
header_parameters.update(custom_headers)
82+
if self.config.accept_language is not None:
83+
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
84+
85+
# Construct and send request
86+
request = self._client.post(url, query_parameters, header_parameters)
87+
response = self._client.send(request, stream=False, **operation_config)
88+
89+
if response.status_code not in [200]:
90+
raise models.ErrorResponseException(self._deserialize, response)
91+
92+
deserialized = None
93+
if response.status_code == 200:
94+
deserialized = self._deserialize('HostInfoListResult', response)
95+
96+
if raw:
97+
client_raw_response = ClientRawResponse(deserialized, response)
98+
return client_raw_response
99+
100+
return deserialized
101+
list_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/listHosts'}
102+
103+
104+
def _restart_hosts_initial(
105+
self, resource_group_name, cluster_name, hosts, custom_headers=None, raw=False, **operation_config):
106+
# Construct URL
107+
url = self.restart_hosts.metadata['url']
108+
path_format_arguments = {
109+
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
110+
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
111+
'clusterName': self._serialize.url("cluster_name", cluster_name, 'str')
112+
}
113+
url = self._client.format_url(url, **path_format_arguments)
114+
115+
# Construct parameters
116+
query_parameters = {}
117+
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
118+
119+
# Construct headers
120+
header_parameters = {}
121+
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
122+
if self.config.generate_client_request_id:
123+
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
124+
if custom_headers:
125+
header_parameters.update(custom_headers)
126+
if self.config.accept_language is not None:
127+
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
128+
129+
# Construct body
130+
body_content = self._serialize.body(hosts, '[str]')
131+
132+
# Construct and send request
133+
request = self._client.post(url, query_parameters, header_parameters, body_content)
134+
response = self._client.send(request, stream=False, **operation_config)
135+
136+
if response.status_code not in [200, 202]:
137+
raise models.ErrorResponseException(self._deserialize, response)
138+
139+
if raw:
140+
client_raw_response = ClientRawResponse(None, response)
141+
return client_raw_response
142+
143+
def restart_hosts(
144+
self, resource_group_name, cluster_name, hosts, custom_headers=None, raw=False, polling=True, **operation_config):
145+
"""Restarts the specified HDInsight cluster hosts.
146+
147+
:param resource_group_name: The name of the resource group.
148+
:type resource_group_name: str
149+
:param cluster_name: The name of the cluster.
150+
:type cluster_name: str
151+
:param hosts: The list of hosts to restart
152+
:type hosts: list[str]
153+
:param dict custom_headers: headers that will be added to the request
154+
:param bool raw: The poller return type is ClientRawResponse, the
155+
direct response alongside the deserialized response
156+
:param polling: True for ARMPolling, False for no polling, or a
157+
polling object for personal polling strategy
158+
:return: An instance of LROPoller that returns None or
159+
ClientRawResponse<None> if raw==True
160+
:rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
161+
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
162+
:raises:
163+
:class:`ErrorResponseException<azure.mgmt.hdinsight.models.ErrorResponseException>`
164+
"""
165+
raw_result = self._restart_hosts_initial(
166+
resource_group_name=resource_group_name,
167+
cluster_name=cluster_name,
168+
hosts=hosts,
169+
custom_headers=custom_headers,
170+
raw=True,
171+
**operation_config
172+
)
173+
174+
def get_long_running_output(response):
175+
if raw:
176+
client_raw_response = ClientRawResponse(None, response)
177+
return client_raw_response
178+
179+
lro_delay = operation_config.get(
180+
'long_running_operation_timeout',
181+
self.config.long_running_operation_timeout)
182+
if polling is True: polling_method = ARMPolling(lro_delay, **operation_config)
183+
elif polling is False: polling_method = NoPolling()
184+
else: polling_method = polling
185+
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
186+
restart_hosts.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/restartHosts'}

sdk/hdinsight/azure-mgmt-hdinsight/azure/mgmt/hdinsight/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
VERSION = "1.4.0"
12+
VERSION = "1.5.0"
1313

sdk/hdinsight/azure-mgmt-hdinsight/dev_requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
-e ../../core/azure-core
33
-e ../../keyvault/azure-keyvault-keys
44
-e ../../keyvault/azure-mgmt-keyvault
5+
-e ../../loganalytics/azure-mgmt-loganalytics
56
-e ../../resources/azure-mgmt-msi/

0 commit comments

Comments
 (0)