|
11 | 11 |
|
12 | 12 | import uuid
|
13 | 13 | from msrest.pipeline import ClientRawResponse
|
| 14 | +from msrestazure.azure_exceptions import CloudError |
14 | 15 |
|
15 | 16 | from .. import models
|
16 | 17 |
|
@@ -237,3 +238,56 @@ def get(
|
237 | 238 |
|
238 | 239 | return deserialized
|
239 | 240 | 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'} |
0 commit comments