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/hana_management_client.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/hana_management_client.py index 8b660e12b291..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,6 +15,7 @@ from .version import VERSION from .operations.operations import Operations from .operations.hana_instances_operations import HanaInstancesOperations +from .operations.monitoring_operations import MonitoringOperations 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 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 @@ -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.monitoring = MonitoringOperations( + self._client, self.config, self._serialize, self._deserialize) 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..8bd56e781d07 --- /dev/null +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details.py @@ -0,0 +1,72 @@ +# 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. + + 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" . + :vartype db_container: str or + ~azure.mgmt.hanaonazure.models.HanaDatabaseContainersEnum + :ivar hana_database: Name of the database itself. It only needs to be + specified if using MDC + :vartype hana_database: str + :ivar hana_db_username: Username for the HANA database to login to for + monitoring + :vartype hana_db_username: str + :ivar hana_db_password: Password for the HANA database to login for + monitoring + :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'}, + '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 = 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 new file mode 100644 index 000000000000..2797e9ae9ed7 --- /dev/null +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/models/monitoring_details_py3.py @@ -0,0 +1,72 @@ +# 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. + + 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" . + :vartype db_container: str or + ~azure.mgmt.hanaonazure.models.HanaDatabaseContainersEnum + :ivar hana_database: Name of the database itself. It only needs to be + specified if using MDC + :vartype hana_database: str + :ivar hana_db_username: Username for the HANA database to login to for + monitoring + :vartype hana_db_username: str + :ivar hana_db_password: Password for the HANA database to login for + monitoring + :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'}, + '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) -> None: + super(MonitoringDetails, self).__init__(**kwargs) + 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..4caadf133f9b 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 .monitoring_operations import MonitoringOperations __all__ = [ 'Operations', 'HanaInstancesOperations', + 'MonitoringOperations', ] diff --git a/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitoring_operations.py b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitoring_operations.py new file mode 100644 index 000000000000..7074dcc9bf31 --- /dev/null +++ b/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/operations/monitoring_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 MonitoringOperations(object): + """MonitoringOperations 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'} 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" +