Skip to content

Commit f82dc2b

Browse files
authored
Generated from d1446d423e320cce211206a2c7e4230223361674 (#3226)
Added HANA instance restart API
1 parent 930047d commit f82dc2b

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/hana_instances_operations.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import uuid
1313
from msrest.pipeline import ClientRawResponse
14+
from msrestazure.azure_exceptions import CloudError
1415

1516
from .. import models
1617

@@ -237,3 +238,56 @@ def get(
237238

238239
return deserialized
239240
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}'}
241+
242+
def restart(
243+
self, resource_group_name, hana_instance_name, custom_headers=None, raw=False, **operation_config):
244+
"""The operation to restart a SAP HANA instance.
245+
246+
:param resource_group_name: Name of the resource group.
247+
:type resource_group_name: str
248+
:param hana_instance_name: Name of the SAP HANA on Azure instance.
249+
:type hana_instance_name: str
250+
:param dict custom_headers: headers that will be added to the request
251+
:param bool raw: returns the direct response alongside the
252+
deserialized response
253+
:param operation_config: :ref:`Operation configuration
254+
overrides<msrest:optionsforoperations>`.
255+
:return: None or ClientRawResponse if raw=true
256+
:rtype: None or ~msrest.pipeline.ClientRawResponse
257+
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
258+
"""
259+
# Construct URL
260+
url = self.restart.metadata['url']
261+
path_format_arguments = {
262+
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
263+
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
264+
'hanaInstanceName': self._serialize.url("hana_instance_name", hana_instance_name, 'str')
265+
}
266+
url = self._client.format_url(url, **path_format_arguments)
267+
268+
# Construct parameters
269+
query_parameters = {}
270+
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
271+
272+
# Construct headers
273+
header_parameters = {}
274+
if self.config.generate_client_request_id:
275+
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
276+
if custom_headers:
277+
header_parameters.update(custom_headers)
278+
if self.config.accept_language is not None:
279+
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
280+
281+
# Construct and send request
282+
request = self._client.post(url, query_parameters, header_parameters)
283+
response = self._client.send(request, stream=False, **operation_config)
284+
285+
if response.status_code not in [202]:
286+
exp = CloudError(response)
287+
exp.request_id = response.headers.get('x-ms-request-id')
288+
raise exp
289+
290+
if raw:
291+
client_raw_response = ClientRawResponse(None, response)
292+
return client_raw_response
293+
restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/restart'}

azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
VERSION = "0.2.0"
12+
VERSION = "0.1.0"
1313

0 commit comments

Comments
 (0)