From 4a76ec8443613f0ed3add530f9896d77eabd899d Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 31 Aug 2018 15:53:55 -0700 Subject: [PATCH] [AutoPR] hanaonazure/resource-manager (#3251) * Generated from d1446d423e320cce211206a2c7e4230223361674 (#3226) Added HANA instance restart API * Package 0.2.1 --- azure-mgmt-hanaonazure/HISTORY.rst | 7 +++ .../operations/hana_instances_operations.py | 54 +++++++++++++++++++ .../azure/mgmt/hanaonazure/version.py | 2 +- 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/azure-mgmt-hanaonazure/HISTORY.rst b/azure-mgmt-hanaonazure/HISTORY.rst index f9626673a971..5bd5e91b90b9 100644 --- a/azure-mgmt-hanaonazure/HISTORY.rst +++ b/azure-mgmt-hanaonazure/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== +0.2.1 (2018-08-31) +++++++++++++++++++ + +**Features** + +- Add restart operation + 0.2.0 (2018-08-06) ++++++++++++++++++ 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 0ee39e68ed77..c0cf8275c92c 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 @@ -11,6 +11,7 @@ import uuid from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError from .. import models @@ -237,3 +238,56 @@ def get( return deserialized get.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` + """ + # Construct URL + url = self.restart.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'), + 'hanaInstanceName': self._serialize.url("hana_instance_name", hana_instance_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 = {} + 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 [202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + 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 9bd1dfac7ecb..3da0f49f071f 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.2.0" +VERSION = "0.2.1"