|
11 | 11 |
|
12 | 12 | import uuid
|
13 | 13 | from msrest.pipeline import ClientRawResponse
|
14 |
| -from msrestazure.azure_exceptions import CloudError |
15 | 14 | from msrest.polling import LROPoller, NoPolling
|
16 | 15 | from msrestazure.polling.arm_polling import ARMPolling
|
17 | 16 |
|
@@ -737,91 +736,3 @@ def get_long_running_output(response):
|
737 | 736 | else: polling_method = polling
|
738 | 737 | return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
|
739 | 738 | shutdown.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/shutdown'}
|
740 |
| - |
741 |
| - |
742 |
| - def _enable_monitoring_initial( |
743 |
| - self, resource_group_name, hana_instance_name, monitoring_parameter, custom_headers=None, raw=False, **operation_config): |
744 |
| - # Construct URL |
745 |
| - url = self.enable_monitoring.metadata['url'] |
746 |
| - path_format_arguments = { |
747 |
| - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), |
748 |
| - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), |
749 |
| - 'hanaInstanceName': self._serialize.url("hana_instance_name", hana_instance_name, 'str') |
750 |
| - } |
751 |
| - url = self._client.format_url(url, **path_format_arguments) |
752 |
| - |
753 |
| - # Construct parameters |
754 |
| - query_parameters = {} |
755 |
| - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') |
756 |
| - |
757 |
| - # Construct headers |
758 |
| - header_parameters = {} |
759 |
| - header_parameters['Content-Type'] = 'application/json; charset=utf-8' |
760 |
| - if self.config.generate_client_request_id: |
761 |
| - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) |
762 |
| - if custom_headers: |
763 |
| - header_parameters.update(custom_headers) |
764 |
| - if self.config.accept_language is not None: |
765 |
| - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') |
766 |
| - |
767 |
| - # Construct body |
768 |
| - body_content = self._serialize.body(monitoring_parameter, 'MonitoringDetails') |
769 |
| - |
770 |
| - # Construct and send request |
771 |
| - request = self._client.post(url, query_parameters, header_parameters, body_content) |
772 |
| - response = self._client.send(request, stream=False, **operation_config) |
773 |
| - |
774 |
| - if response.status_code not in [200, 202]: |
775 |
| - exp = CloudError(response) |
776 |
| - exp.request_id = response.headers.get('x-ms-request-id') |
777 |
| - raise exp |
778 |
| - |
779 |
| - if raw: |
780 |
| - client_raw_response = ClientRawResponse(None, response) |
781 |
| - return client_raw_response |
782 |
| - |
783 |
| - def enable_monitoring( |
784 |
| - self, resource_group_name, hana_instance_name, monitoring_parameter, custom_headers=None, raw=False, polling=True, **operation_config): |
785 |
| - """The operation to add a monitor to an SAP HANA instance. |
786 |
| -
|
787 |
| - :param resource_group_name: Name of the resource group. |
788 |
| - :type resource_group_name: str |
789 |
| - :param hana_instance_name: Name of the SAP HANA on Azure instance. |
790 |
| - :type hana_instance_name: str |
791 |
| - :param monitoring_parameter: Request body that only contains |
792 |
| - monitoring attributes |
793 |
| - :type monitoring_parameter: |
794 |
| - ~azure.mgmt.hanaonazure.models.MonitoringDetails |
795 |
| - :param dict custom_headers: headers that will be added to the request |
796 |
| - :param bool raw: The poller return type is ClientRawResponse, the |
797 |
| - direct response alongside the deserialized response |
798 |
| - :param polling: True for ARMPolling, False for no polling, or a |
799 |
| - polling object for personal polling strategy |
800 |
| - :return: An instance of LROPoller that returns None or |
801 |
| - ClientRawResponse<None> if raw==True |
802 |
| - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or |
803 |
| - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] |
804 |
| - :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>` |
805 |
| - """ |
806 |
| - raw_result = self._enable_monitoring_initial( |
807 |
| - resource_group_name=resource_group_name, |
808 |
| - hana_instance_name=hana_instance_name, |
809 |
| - monitoring_parameter=monitoring_parameter, |
810 |
| - custom_headers=custom_headers, |
811 |
| - raw=True, |
812 |
| - **operation_config |
813 |
| - ) |
814 |
| - |
815 |
| - def get_long_running_output(response): |
816 |
| - if raw: |
817 |
| - client_raw_response = ClientRawResponse(None, response) |
818 |
| - return client_raw_response |
819 |
| - |
820 |
| - lro_delay = operation_config.get( |
821 |
| - 'long_running_operation_timeout', |
822 |
| - self.config.long_running_operation_timeout) |
823 |
| - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) |
824 |
| - elif polling is False: polling_method = NoPolling() |
825 |
| - else: polling_method = polling |
826 |
| - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) |
827 |
| - enable_monitoring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/monitoring'} |
0 commit comments