Skip to content

Commit

Permalink
[AutoPR] hanaonazure/resource-manager (#4725)
Browse files Browse the repository at this point in the history
* [AutoPR hanaonazure/resource-manager] [Hub Generated] Review request for Microsoft.HanaOnAzure to add version 2017-11-03-preview (#4673)

* Generated from 92fad58f912382b44669e53ffca8431095245aed

Added to the monitoring examples file

* Packaging update of azure-mgmt-hanaonazure

* Generated from 63387d3bf8b494abaa639cbfab1265a161c02195

Fixing copy-pasta issue

* Generated from 034e18b310f183e5369dd257d36a1ea40a9e5546

Adding monitoring fields to hanaonazure.json

* Generated from 688cc869f214b2a425d55885b4d93249917246fd

Adding monitoring fields to hanaonazure.json

* Generated from 0106ae19b0c74b848b5d12db6034690be430759a

Adding monitoring fields to hanaonazure.json

* Packaging update of azure-mgmt-hanaonazure

* updated versioning and change log

* Generated from f96fc02af1b1c2e4192e3ab6080f83e778bcdf3f (#4862)

Fixing the parameters because they should not be readonly

* Generated from a2fd1bdd9003acdbe77080a379efed2461665d89 (#4872)

Fixing operation id to be named consistently

* Update version.py

* Update HISTORY.rst
  • Loading branch information
AutorestCI authored and lmazuel committed Apr 17, 2019
1 parent dfbc340 commit 92293a4
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 1 deletion.
7 changes: 7 additions & 0 deletions azure-mgmt-hanaonazure/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Release History
===============

0.5.0 (2019-04-15)
++++++++++++++++++

**Features**

- Added operation enable_monitoring

0.4.0 (2019-02-21)
++++++++++++++++++

Expand Down
1 change: 1 addition & 0 deletions azure-mgmt-hanaonazure/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
recursive-include tests *.py *.yaml
include *.rst
include azure/__init__.py
include azure/mgmt/__init__.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__ = [
Expand All @@ -56,9 +59,11 @@
'Operation',
'ErrorResponse', 'ErrorResponseException',
'Tags',
'MonitoringDetails',
'OperationPaged',
'HanaInstancePaged',
'HanaHardwareTypeNamesEnum',
'HanaInstanceSizeNamesEnum',
'HanaInstancePowerStateEnum',
'HanaDatabaseContainersEnum',
]
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@ class HanaInstancePowerStateEnum(str, Enum):
stopped = "stopped"
restarting = "restarting"
unknown = "unknown"


class HanaDatabaseContainersEnum(str, Enum):

single = "single"
multiple = "multiple"
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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<None> if raw==True
:rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
:raises: :class:`CloudError<msrestazure.azure_exceptions.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'}
3 changes: 2 additions & 1 deletion azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "0.4.0"
VERSION = "0.5.0"

1 change: 1 addition & 0 deletions azure-mgmt-hanaonazure/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',
Expand Down

0 comments on commit 92293a4

Please sign in to comment.