diff --git a/azure-mgmt-hanaonazure/HISTORY.rst b/azure-mgmt-hanaonazure/HISTORY.rst index af129fd6e19a..59d0c188c11c 100644 --- a/azure-mgmt-hanaonazure/HISTORY.rst +++ b/azure-mgmt-hanaonazure/HISTORY.rst @@ -3,6 +3,13 @@ Release History =============== +0.5.0 (2019-04-15) +++++++++++++++++++ + +**Features** + +- Added operation enable_monitoring + 0.4.0 (2019-02-21) ++++++++++++++++++ diff --git a/azure-mgmt-hanaonazure/MANIFEST.in b/azure-mgmt-hanaonazure/MANIFEST.in index 6ceb27f7a96e..e4884efef41b 100644 --- a/azure-mgmt-hanaonazure/MANIFEST.in +++ b/azure-mgmt-hanaonazure/MANIFEST.in @@ -1,3 +1,4 @@ +recursive-include tests *.py *.yaml include *.rst include azure/__init__.py include azure/mgmt/__init__.py diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/__init__.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/__init__.py index 14c784db2fb6..8d282e9edc8e 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/__init__.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/__init__.py @@ -22,6 +22,7 @@ from .operation_py3 import Operation from .error_response_py3 import ErrorResponse, ErrorResponseException from .tags_py3 import Tags + from .monitoring_details_py3 import MonitoringDetails except (SyntaxError, ImportError): from .resource import Resource from .hardware_profile import HardwareProfile @@ -35,12 +36,14 @@ from .operation import Operation from .error_response import ErrorResponse, ErrorResponseException from .tags import Tags + from .monitoring_details import MonitoringDetails from .operation_paged import OperationPaged from .hana_instance_paged import HanaInstancePaged from .hana_management_client_enums import ( HanaHardwareTypeNamesEnum, HanaInstanceSizeNamesEnum, HanaInstancePowerStateEnum, + HanaDatabaseContainersEnum, ) __all__ = [ @@ -56,9 +59,11 @@ 'Operation', 'ErrorResponse', 'ErrorResponseException', 'Tags', + 'MonitoringDetails', 'OperationPaged', 'HanaInstancePaged', 'HanaHardwareTypeNamesEnum', 'HanaInstanceSizeNamesEnum', 'HanaInstancePowerStateEnum', + 'HanaDatabaseContainersEnum', ] diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/hana_management_client_enums.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/hana_management_client_enums.py index ae4ad333dbcf..44d11692b12b 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/hana_management_client_enums.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/hana_management_client_enums.py @@ -48,3 +48,9 @@ class HanaInstancePowerStateEnum(str, Enum): stopped = "stopped" restarting = "restarting" unknown = "unknown" + + +class HanaDatabaseContainersEnum(str, Enum): + + single = "single" + multiple = "multiple" diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py new file mode 100644 index 000000000000..ddd0cf9cf640 --- /dev/null +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MonitoringDetails(Model): + """Details needed to monitor a Hana Instance. + + :param hana_vnet: ARM ID of an Azure Vnet with access to the HANA + instance. + :type hana_vnet: str + :param hana_hostname: Hostname of the HANA Instance blade. + :type hana_hostname: str + :param hana_instance_num: A number between 00 and 99, stored as a string + to maintain leading zero. + :type hana_instance_num: str + :param db_container: Either single or multiple depending on the use of + MDC(Multiple Database Containers). Possible values include: 'single', + 'multiple'. Default value: "single" . + :type db_container: str or + ~azure.mgmt.hanaonazure.models.HanaDatabaseContainersEnum + :param hana_database: Name of the database itself. It only needs to be + specified if using MDC + :type hana_database: str + :param hana_db_username: Username for the HANA database to login to for + monitoring + :type hana_db_username: str + :param hana_db_password: Password for the HANA database to login for + monitoring + :type hana_db_password: str + """ + + _attribute_map = { + 'hana_vnet': {'key': 'hanaVnet', 'type': 'str'}, + 'hana_hostname': {'key': 'hanaHostname', 'type': 'str'}, + 'hana_instance_num': {'key': 'hanaInstanceNum', 'type': 'str'}, + 'db_container': {'key': 'dbContainer', 'type': 'str'}, + 'hana_database': {'key': 'hanaDatabase', 'type': 'str'}, + 'hana_db_username': {'key': 'hanaDbUsername', 'type': 'str'}, + 'hana_db_password': {'key': 'hanaDbPassword', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(MonitoringDetails, self).__init__(**kwargs) + self.hana_vnet = kwargs.get('hana_vnet', None) + self.hana_hostname = kwargs.get('hana_hostname', None) + self.hana_instance_num = kwargs.get('hana_instance_num', None) + self.db_container = kwargs.get('db_container', "single") + self.hana_database = kwargs.get('hana_database', None) + self.hana_db_username = kwargs.get('hana_db_username', None) + self.hana_db_password = kwargs.get('hana_db_password', None) diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.py new file mode 100644 index 000000000000..e7fd465e6a8d --- /dev/null +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model + + +class MonitoringDetails(Model): + """Details needed to monitor a Hana Instance. + + :param hana_vnet: ARM ID of an Azure Vnet with access to the HANA + instance. + :type hana_vnet: str + :param hana_hostname: Hostname of the HANA Instance blade. + :type hana_hostname: str + :param hana_instance_num: A number between 00 and 99, stored as a string + to maintain leading zero. + :type hana_instance_num: str + :param db_container: Either single or multiple depending on the use of + MDC(Multiple Database Containers). Possible values include: 'single', + 'multiple'. Default value: "single" . + :type db_container: str or + ~azure.mgmt.hanaonazure.models.HanaDatabaseContainersEnum + :param hana_database: Name of the database itself. It only needs to be + specified if using MDC + :type hana_database: str + :param hana_db_username: Username for the HANA database to login to for + monitoring + :type hana_db_username: str + :param hana_db_password: Password for the HANA database to login for + monitoring + :type hana_db_password: str + """ + + _attribute_map = { + 'hana_vnet': {'key': 'hanaVnet', 'type': 'str'}, + 'hana_hostname': {'key': 'hanaHostname', 'type': 'str'}, + 'hana_instance_num': {'key': 'hanaInstanceNum', 'type': 'str'}, + 'db_container': {'key': 'dbContainer', 'type': 'str'}, + 'hana_database': {'key': 'hanaDatabase', 'type': 'str'}, + 'hana_db_username': {'key': 'hanaDbUsername', 'type': 'str'}, + 'hana_db_password': {'key': 'hanaDbPassword', 'type': 'str'}, + } + + def __init__(self, *, hana_vnet: str=None, hana_hostname: str=None, hana_instance_num: str=None, db_container="single", hana_database: str=None, hana_db_username: str=None, hana_db_password: str=None, **kwargs) -> None: + super(MonitoringDetails, self).__init__(**kwargs) + self.hana_vnet = hana_vnet + self.hana_hostname = hana_hostname + self.hana_instance_num = hana_instance_num + self.db_container = db_container + self.hana_database = hana_database + self.hana_db_username = hana_db_username + self.hana_db_password = hana_db_password 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 3377a3824203..af7da1551f59 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 @@ -391,3 +391,91 @@ def get_long_running_output(response): 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'} + + + def _enable_monitoring_initial( + self, resource_group_name, hana_instance_name, monitoring_parameter, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.enable_monitoring.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 = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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 body + body_content = self._serialize.body(monitoring_parameter, 'MonitoringDetails') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 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 + + def enable_monitoring( + self, resource_group_name, hana_instance_name, monitoring_parameter, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to add a monitor to an 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 monitoring_parameter: Request body that only contains + monitoring attributes + :type monitoring_parameter: + ~azure.mgmt.hanaonazure.models.MonitoringDetails + :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._enable_monitoring_initial( + resource_group_name=resource_group_name, + hana_instance_name=hana_instance_name, + monitoring_parameter=monitoring_parameter, + 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) + enable_monitoring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/monitoring'} diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py index 7e15bc578c31..266f5a486d79 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py @@ -9,4 +9,5 @@ # regenerated. # -------------------------------------------------------------------------- -VERSION = "0.4.0" +VERSION = "0.5.0" + diff --git a/azure-mgmt-hanaonazure/setup.py b/azure-mgmt-hanaonazure/setup.py index 9f44001ba520..d88dbac05eaf 100644 --- a/azure-mgmt-hanaonazure/setup.py +++ b/azure-mgmt-hanaonazure/setup.py @@ -53,6 +53,7 @@ version=version, description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), long_description=readme + '\n\n' + history, + long_description_content_type='text/x-rst', license='MIT License', author='Microsoft Corporation', author_email='azpysdkhelp@microsoft.com',