diff --git a/azure-mgmt-hanaonazure/HISTORY.rst b/azure-mgmt-hanaonazure/HISTORY.rst index 4ce1379cb9a0..2e0c6e4ea7cd 100644 --- a/azure-mgmt-hanaonazure/HISTORY.rst +++ b/azure-mgmt-hanaonazure/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== +0.3.1 (2019-01-24) +++++++++++++++++++ + +**Bugfixes** + +- Fix restart operation + 0.3.0 (2019-01-03) ++++++++++++++++++ diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/hana_instances_operations.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/hana_instances_operations.py index f8990f720b3f..3377a3824203 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/hana_instances_operations.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/hana_instances_operations.py @@ -12,6 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -311,23 +313,9 @@ def update( return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}'} - def restart( - self, resource_group_name, hana_instance_name, custom_headers=None, raw=False, **operation_config): - """The operation to restart a SAP HANA instance. - :param resource_group_name: Name of the resource group. - :type resource_group_name: str - :param hana_instance_name: Name of the SAP HANA on Azure instance. - :type hana_instance_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: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _restart_initial( + self, resource_group_name, hana_instance_name, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.restart.metadata['url'] path_format_arguments = { @@ -354,7 +342,7 @@ def restart( request = self._client.post(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [202]: + if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp @@ -362,4 +350,44 @@ def restart( if raw: client_raw_response = ClientRawResponse(None, response) return client_raw_response + + def restart( + self, resource_group_name, hana_instance_name, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to restart a SAP HANA instance. + + :param resource_group_name: Name of the resource group. + :type resource_group_name: str + :param hana_instance_name: Name of the SAP HANA on Azure instance. + :type hana_instance_name: str + :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:`CloudError` + """ + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + hana_instance_name=hana_instance_name, + 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) restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/restart'} diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py index 3e682bbd5fb1..54fdd938c10a 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py @@ -9,5 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.3.0" +VERSION = "0.3.1"