From 63ce653e3532538c6482f8eb7739a02a10cece6b Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 25 Mar 2019 20:10:44 +0000 Subject: [PATCH 1/6] Generated from 92fad58f912382b44669e53ffca8431095245aed Added to the monitoring examples file --- .../azure/mgmt/hanaonazure/models/__init__.py | 3 + .../hanaonazure/models/monitoring_details.py | 58 ++++++++++++ .../models/monitoring_details_py3.py | 58 ++++++++++++ .../operations/hana_instances_operations.py | 88 +++++++++++++++++++ .../azure/mgmt/hanaonazure/version.py | 3 +- 5 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py create mode 100644 azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.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..14fb694a3d94 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,6 +36,7 @@ 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 ( @@ -56,6 +58,7 @@ 'Operation', 'ErrorResponse', 'ErrorResponseException', 'Tags', + 'MonitoringDetails', 'OperationPaged', 'HanaInstancePaged', 'HanaHardwareTypeNamesEnum', 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..fd6909c2830b --- /dev/null +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py @@ -0,0 +1,58 @@ +# 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 hana_mdc: Flag to specify the use of MDC(Multi Database + Containers). Default value: False . + :type hana_mdc: bool + :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'}, + 'hana_mdc': {'key': 'hanaMdc', 'type': 'bool'}, + '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.hana_mdc = kwargs.get('hana_mdc', False) + 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..a44c986c3dc4 --- /dev/null +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.py @@ -0,0 +1,58 @@ +# 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 hana_mdc: Flag to specify the use of MDC(Multi Database + Containers). Default value: False . + :type hana_mdc: bool + :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'}, + 'hana_mdc': {'key': 'hanaMdc', 'type': 'bool'}, + '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, hana_mdc: bool=False, 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.hana_mdc = hana_mdc + 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..50e7888162c8 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 _monitoring_initial( + self, resource_group_name, hana_instance_name, monitoring_parameter, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.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 monitoring( + self, resource_group_name, hana_instance_name, monitoring_parameter, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to monitor 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 monitoring_parameter: Request body that only contains the new + Tags field + :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._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) + 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..e0ec669828cb 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.1.0" + From 18a95edb895ea64715a864c436bc1ff76e9fcafc Mon Sep 17 00:00:00 2001 From: azuresdkci Date: Mon, 25 Mar 2019 20:15:55 +0000 Subject: [PATCH 2/6] Packaging update of azure-mgmt-hanaonazure --- azure-mgmt-hanaonazure/MANIFEST.in | 1 + 1 file changed, 1 insertion(+) 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 From 0843c5bd9c9b6331a9882dcabb54c0a1274a1e10 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 25 Mar 2019 21:33:56 +0000 Subject: [PATCH 3/6] Generated from 63387d3bf8b494abaa639cbfab1265a161c02195 Fixing copy-pasta issue --- .../mgmt/hanaonazure/operations/hana_instances_operations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 50e7888162c8..6fcf98872946 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 @@ -442,8 +442,8 @@ def monitoring( :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 the new - Tags field + :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 From b9d8c0df02e6a359ece1a53f762a5ffacdff00c5 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 26 Mar 2019 18:30:13 +0000 Subject: [PATCH 4/6] Generated from 034e18b310f183e5369dd257d36a1ea40a9e5546 Adding monitoring fields to hanaonazure.json --- .../azure/mgmt/hanaonazure/models/__init__.py | 2 ++ .../models/hana_management_client_enums.py | 6 ++++++ .../mgmt/hanaonazure/models/monitoring_details.py | 12 +++++++----- .../hanaonazure/models/monitoring_details_py3.py | 14 ++++++++------ 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/__init__.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/__init__.py index 14fb694a3d94..8d282e9edc8e 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/__init__.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/__init__.py @@ -43,6 +43,7 @@ HanaHardwareTypeNamesEnum, HanaInstanceSizeNamesEnum, HanaInstancePowerStateEnum, + HanaDatabaseContainersEnum, ) __all__ = [ @@ -64,4 +65,5 @@ '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 index fd6909c2830b..ddd0cf9cf640 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py @@ -23,9 +23,11 @@ class MonitoringDetails(Model): :param hana_instance_num: A number between 00 and 99, stored as a string to maintain leading zero. :type hana_instance_num: str - :param hana_mdc: Flag to specify the use of MDC(Multi Database - Containers). Default value: False . - :type hana_mdc: bool + :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 @@ -41,7 +43,7 @@ class MonitoringDetails(Model): 'hana_vnet': {'key': 'hanaVnet', 'type': 'str'}, 'hana_hostname': {'key': 'hanaHostname', 'type': 'str'}, 'hana_instance_num': {'key': 'hanaInstanceNum', 'type': 'str'}, - 'hana_mdc': {'key': 'hanaMdc', 'type': 'bool'}, + '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'}, @@ -52,7 +54,7 @@ def __init__(self, **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.hana_mdc = kwargs.get('hana_mdc', False) + 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 index a44c986c3dc4..e7fd465e6a8d 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.py @@ -23,9 +23,11 @@ class MonitoringDetails(Model): :param hana_instance_num: A number between 00 and 99, stored as a string to maintain leading zero. :type hana_instance_num: str - :param hana_mdc: Flag to specify the use of MDC(Multi Database - Containers). Default value: False . - :type hana_mdc: bool + :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 @@ -41,18 +43,18 @@ class MonitoringDetails(Model): 'hana_vnet': {'key': 'hanaVnet', 'type': 'str'}, 'hana_hostname': {'key': 'hanaHostname', 'type': 'str'}, 'hana_instance_num': {'key': 'hanaInstanceNum', 'type': 'str'}, - 'hana_mdc': {'key': 'hanaMdc', 'type': 'bool'}, + '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, hana_mdc: bool=False, hana_database: str=None, hana_db_username: str=None, hana_db_password: str=None, **kwargs) -> None: + 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.hana_mdc = hana_mdc + self.db_container = db_container self.hana_database = hana_database self.hana_db_username = hana_db_username self.hana_db_password = hana_db_password From 2a70d5b3195e7528c4ed358c24992a925ff92ea2 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 26 Mar 2019 19:42:14 +0000 Subject: [PATCH 5/6] Generated from 688cc869f214b2a425d55885b4d93249917246fd Adding monitoring fields to hanaonazure.json --- .../hanaonazure/hana_management_client.py | 5 + .../hanaonazure/models/monitoring_details.py | 58 ++++---- .../models/monitoring_details_py3.py | 60 +++++---- .../mgmt/hanaonazure/operations/__init__.py | 2 + .../operations/hana_instances_operations.py | 88 ------------ .../operations/monitor_operations.py | 125 ++++++++++++++++++ 6 files changed, 203 insertions(+), 135 deletions(-) create mode 100644 azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitor_operations.py diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/hana_management_client.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/hana_management_client.py index 8b660e12b291..a0739f4c85de 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/hana_management_client.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/hana_management_client.py @@ -15,6 +15,7 @@ from .version import VERSION from .operations.operations import Operations from .operations.hana_instances_operations import HanaInstancesOperations +from .operations.monitor_operations import MonitorOperations from . import models @@ -62,6 +63,8 @@ class HanaManagementClient(SDKClient): :vartype operations: azure.mgmt.hanaonazure.operations.Operations :ivar hana_instances: HanaInstances operations :vartype hana_instances: azure.mgmt.hanaonazure.operations.HanaInstancesOperations + :ivar monitor: Monitor operations + :vartype monitor: azure.mgmt.hanaonazure.operations.MonitorOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -88,3 +91,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.hana_instances = HanaInstancesOperations( self._client, self.config, self._serialize, self._deserialize) + self.monitor = MonitorOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py index ddd0cf9cf640..8bd56e781d07 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py @@ -15,30 +15,42 @@ 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 + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar hana_vnet: ARM ID of an Azure Vnet with access to the HANA instance. + :vartype hana_vnet: str + :ivar hana_hostname: Hostname of the HANA Instance blade. + :vartype hana_hostname: str + :ivar hana_instance_num: A number between 00 and 99, stored as a string to + maintain leading zero. + :vartype hana_instance_num: str + :ivar 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 + :vartype db_container: str or ~azure.mgmt.hanaonazure.models.HanaDatabaseContainersEnum - :param hana_database: Name of the database itself. It only needs to be + :ivar 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 + :vartype hana_database: str + :ivar 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 + :vartype hana_db_username: str + :ivar hana_db_password: Password for the HANA database to login for monitoring - :type hana_db_password: str + :vartype hana_db_password: str """ + _validation = { + 'hana_vnet': {'readonly': True}, + 'hana_hostname': {'readonly': True}, + 'hana_instance_num': {'readonly': True}, + 'db_container': {'readonly': True}, + 'hana_database': {'readonly': True}, + 'hana_db_username': {'readonly': True}, + 'hana_db_password': {'readonly': True}, + } + _attribute_map = { 'hana_vnet': {'key': 'hanaVnet', 'type': 'str'}, 'hana_hostname': {'key': 'hanaHostname', 'type': 'str'}, @@ -51,10 +63,10 @@ class MonitoringDetails(Model): 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) + self.hana_vnet = None + self.hana_hostname = None + self.hana_instance_num = None + self.db_container = None + self.hana_database = None + self.hana_db_username = None + self.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 index e7fd465e6a8d..2797e9ae9ed7 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.py @@ -15,30 +15,42 @@ 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 + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar hana_vnet: ARM ID of an Azure Vnet with access to the HANA instance. + :vartype hana_vnet: str + :ivar hana_hostname: Hostname of the HANA Instance blade. + :vartype hana_hostname: str + :ivar hana_instance_num: A number between 00 and 99, stored as a string to + maintain leading zero. + :vartype hana_instance_num: str + :ivar 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 + :vartype db_container: str or ~azure.mgmt.hanaonazure.models.HanaDatabaseContainersEnum - :param hana_database: Name of the database itself. It only needs to be + :ivar 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 + :vartype hana_database: str + :ivar 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 + :vartype hana_db_username: str + :ivar hana_db_password: Password for the HANA database to login for monitoring - :type hana_db_password: str + :vartype hana_db_password: str """ + _validation = { + 'hana_vnet': {'readonly': True}, + 'hana_hostname': {'readonly': True}, + 'hana_instance_num': {'readonly': True}, + 'db_container': {'readonly': True}, + 'hana_database': {'readonly': True}, + 'hana_db_username': {'readonly': True}, + 'hana_db_password': {'readonly': True}, + } + _attribute_map = { 'hana_vnet': {'key': 'hanaVnet', 'type': 'str'}, 'hana_hostname': {'key': 'hanaHostname', 'type': 'str'}, @@ -49,12 +61,12 @@ class MonitoringDetails(Model): '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: + def __init__(self, **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 + self.hana_vnet = None + self.hana_hostname = None + self.hana_instance_num = None + self.db_container = None + self.hana_database = None + self.hana_db_username = None + self.hana_db_password = None diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/__init__.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/__init__.py index 8bc12830472c..f7e6e77b9f24 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/__init__.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/__init__.py @@ -11,8 +11,10 @@ from .operations import Operations from .hana_instances_operations import HanaInstancesOperations +from .monitor_operations import MonitorOperations __all__ = [ 'Operations', 'HanaInstancesOperations', + 'MonitorOperations', ] 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 6fcf98872946..3377a3824203 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,91 +391,3 @@ 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 _monitoring_initial( - self, resource_group_name, hana_instance_name, monitoring_parameter, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.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 monitoring( - self, resource_group_name, hana_instance_name, monitoring_parameter, custom_headers=None, raw=False, polling=True, **operation_config): - """The operation to monitor 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 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._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) - monitoring.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/monitoring'} diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitor_operations.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitor_operations.py new file mode 100644 index 000000000000..f76d9a81251a --- /dev/null +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitor_operations.py @@ -0,0 +1,125 @@ +# 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. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class MonitorOperations(object): + """MonitorOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client API version. Constant value: "2017-11-03-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-11-03-preview" + + self.config = config + + + def _hana_instances_method_initial( + self, resource_group_name, hana_instance_name, custom_headers=None, raw=False, **operation_config): + monitoring_parameter = None + + # Construct URL + url = self.hana_instances_method.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 hana_instances_method( + self, resource_group_name, hana_instance_name, custom_headers=None, raw=False, polling=True, **operation_config): + """The operation to monitor 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: 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._hana_instances_method_initial( + resource_group_name=resource_group_name, + hana_instance_name=hana_instance_name, + 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) + hana_instances_method.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/monitoring'} From a06e4d6e7bea731eb03425b952fc8fe1583bd981 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 26 Mar 2019 21:39:29 +0000 Subject: [PATCH 6/6] Generated from 0106ae19b0c74b848b5d12db6034690be430759a Adding monitoring fields to hanaonazure.json --- .../azure/mgmt/hanaonazure/hana_management_client.py | 8 ++++---- .../azure/mgmt/hanaonazure/operations/__init__.py | 4 ++-- .../{monitor_operations.py => monitoring_operations.py} | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) rename azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/{monitor_operations.py => monitoring_operations.py} (98%) diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/hana_management_client.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/hana_management_client.py index a0739f4c85de..9aa7dab014d4 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/hana_management_client.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/hana_management_client.py @@ -15,7 +15,7 @@ from .version import VERSION from .operations.operations import Operations from .operations.hana_instances_operations import HanaInstancesOperations -from .operations.monitor_operations import MonitorOperations +from .operations.monitoring_operations import MonitoringOperations from . import models @@ -63,8 +63,8 @@ class HanaManagementClient(SDKClient): :vartype operations: azure.mgmt.hanaonazure.operations.Operations :ivar hana_instances: HanaInstances operations :vartype hana_instances: azure.mgmt.hanaonazure.operations.HanaInstancesOperations - :ivar monitor: Monitor operations - :vartype monitor: azure.mgmt.hanaonazure.operations.MonitorOperations + :ivar monitoring: Monitoring operations + :vartype monitoring: azure.mgmt.hanaonazure.operations.MonitoringOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -91,5 +91,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.hana_instances = HanaInstancesOperations( self._client, self.config, self._serialize, self._deserialize) - self.monitor = MonitorOperations( + self.monitoring = MonitoringOperations( self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/__init__.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/__init__.py index f7e6e77b9f24..4caadf133f9b 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/__init__.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/__init__.py @@ -11,10 +11,10 @@ from .operations import Operations from .hana_instances_operations import HanaInstancesOperations -from .monitor_operations import MonitorOperations +from .monitoring_operations import MonitoringOperations __all__ = [ 'Operations', 'HanaInstancesOperations', - 'MonitorOperations', + 'MonitoringOperations', ] diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitor_operations.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitoring_operations.py similarity index 98% rename from azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitor_operations.py rename to azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitoring_operations.py index f76d9a81251a..7074dcc9bf31 100644 --- a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitor_operations.py +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitoring_operations.py @@ -18,8 +18,8 @@ from .. import models -class MonitorOperations(object): - """MonitorOperations operations. +class MonitoringOperations(object): + """MonitoringOperations operations. :param client: Client for service requests. :param config: Configuration of service client.