From 802c7f1bab11684e033658c8e41e4f899174bec8 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 21 May 2018 17:32:02 +0000 Subject: [PATCH 1/3] Generated from f53526896e5c001f79bd46ca892f825172b53abf Merge branch 'master' into patchsupport --- .../azure/mgmt/monitor/models/__init__.py | 3 + .../monitor/models/action_group_resource.py | 2 +- .../models/action_group_resource_py3.py | 2 +- .../mgmt/monitor/models/alerting_action.py | 4 +- .../monitor/models/alerting_action_py3.py | 4 +- .../mgmt/monitor/models/az_ns_action_group.py | 11 +-- .../monitor/models/az_ns_action_group_py3.py | 11 +-- .../models/log_search_rule_resource_patch.py | 34 +++++++++ .../log_search_rule_resource_patch_py3.py | 34 +++++++++ .../monitor/models/metric_alert_resource.py | 5 -- .../models/metric_alert_resource_patch.py | 5 -- .../models/metric_alert_resource_patch_py3.py | 7 +- .../models/metric_alert_resource_py3.py | 7 +- .../azure/mgmt/monitor/models/source.py | 13 ++-- .../azure/mgmt/monitor/models/source_py3.py | 15 ++-- .../scheduled_query_rules_operations.py | 73 +++++++++++++++++++ 16 files changed, 177 insertions(+), 53 deletions(-) create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch_py3.py diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index 50353acdcea3..2d62249b08a8 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py @@ -100,6 +100,7 @@ from .source_py3 import Source from .schedule_py3 import Schedule from .log_search_rule_resource_py3 import LogSearchRuleResource + from .log_search_rule_resource_patch_py3 import LogSearchRuleResourcePatch from .trigger_condition_py3 import TriggerCondition from .az_ns_action_group_py3 import AzNsActionGroup from .alerting_action_py3 import AlertingAction @@ -194,6 +195,7 @@ from .source import Source from .schedule import Schedule from .log_search_rule_resource import LogSearchRuleResource + from .log_search_rule_resource_patch import LogSearchRuleResourcePatch from .trigger_condition import TriggerCondition from .az_ns_action_group import AzNsActionGroup from .alerting_action import AlertingAction @@ -323,6 +325,7 @@ 'Source', 'Schedule', 'LogSearchRuleResource', + 'LogSearchRuleResourcePatch', 'TriggerCondition', 'AzNsActionGroup', 'AlertingAction', diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py index 0ccca8947395..2feb3268a1df 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py @@ -75,7 +75,7 @@ class ActionGroupResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'group_short_name': {'required': True, 'max_length': 12}, + 'group_short_name': {'required': True, 'max_length': 15}, 'enabled': {'required': True}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py index 81edb6f53b0f..6c63a9d62f19 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py @@ -75,7 +75,7 @@ class ActionGroupResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'group_short_name': {'required': True, 'max_length': 12}, + 'group_short_name': {'required': True, 'max_length': 15}, 'enabled': {'required': True}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py index 462b180d180f..b58fa3b4a748 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py @@ -26,10 +26,10 @@ class AlertingAction(Action): :param severity: Required. Severity of the alert. Possible values include: '0', '1', '2', '3', '4' :type severity: str or ~azure.mgmt.monitor.models.AlertSeverity - :param azns_action: Required. azns notification group reference. + :param azns_action: Required. Azure action group reference. :type azns_action: ~azure.mgmt.monitor.models.AzNsActionGroup :param throttling_in_min: time (in minutes) for which Alerts should be - throttled + throttled or suppressed. :type throttling_in_min: int :param trigger: Required. The trigger condition that results in the alert rule being. diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py index 8e1083acad51..e6e86c2fddd9 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py @@ -26,10 +26,10 @@ class AlertingAction(Action): :param severity: Required. Severity of the alert. Possible values include: '0', '1', '2', '3', '4' :type severity: str or ~azure.mgmt.monitor.models.AlertSeverity - :param azns_action: Required. azns notification group reference. + :param azns_action: Required. Azure action group reference. :type azns_action: ~azure.mgmt.monitor.models.AzNsActionGroup :param throttling_in_min: time (in minutes) for which Alerts should be - throttled + throttled or suppressed. :type throttling_in_min: int :param trigger: Required. The trigger condition that results in the alert rule being. diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group.py index 5c5576517664..d98d5546826e 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group.py @@ -13,14 +13,15 @@ class AzNsActionGroup(Model): - """azns notification group. + """Azure action group. - :param action_group: Azure Group reference. + :param action_group: Azure Action Group reference. :type action_group: list[str] - :param email_subject: Custom subject for Azns email - :type email_subject: str - :param custom_webhook_payload: Custom webhook payload to be send to azns + :param email_subject: Custom subject override for all email ids in Azure action group + :type email_subject: str + :param custom_webhook_payload: Custom payload to be sent for all webook + URI in Azure action group :type custom_webhook_payload: str """ diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group_py3.py index bd5f281ea775..72bc693ab43d 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/az_ns_action_group_py3.py @@ -13,14 +13,15 @@ class AzNsActionGroup(Model): - """azns notification group. + """Azure action group. - :param action_group: Azure Group reference. + :param action_group: Azure Action Group reference. :type action_group: list[str] - :param email_subject: Custom subject for Azns email - :type email_subject: str - :param custom_webhook_payload: Custom webhook payload to be send to azns + :param email_subject: Custom subject override for all email ids in Azure action group + :type email_subject: str + :param custom_webhook_payload: Custom payload to be sent for all webook + URI in Azure action group :type custom_webhook_payload: str """ diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch.py new file mode 100644 index 000000000000..350f17ce36ac --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch.py @@ -0,0 +1,34 @@ +# 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 LogSearchRuleResourcePatch(Model): + """The log search rule resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: The flag which indicates whether the Log Search rule is + enabled. Value should be true or false. Possible values include: 'true', + 'false' + :type enabled: str or ~azure.mgmt.monitor.models.Enabled + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogSearchRuleResourcePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.enabled = kwargs.get('enabled', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch_py3.py new file mode 100644 index 000000000000..010407469673 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_patch_py3.py @@ -0,0 +1,34 @@ +# 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 LogSearchRuleResourcePatch(Model): + """The log search rule resource for patch operations. + + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: The flag which indicates whether the Log Search rule is + enabled. Value should be true or false. Possible values include: 'true', + 'false' + :type enabled: str or ~azure.mgmt.monitor.models.Enabled + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'enabled': {'key': 'properties.enabled', 'type': 'str'}, + } + + def __init__(self, *, tags=None, enabled=None, **kwargs) -> None: + super(LogSearchRuleResourcePatch, self).__init__(**kwargs) + self.tags = tags + self.enabled = enabled diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py index 5324dcac5a59..4a45ac4ed6f6 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py @@ -50,9 +50,6 @@ class MetricAlertResource(Resource): :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria - :param auto_mitigate: the flag that indicates whether the alert should be - auto resolved or not. - :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~azure.mgmt.monitor.models.Action] @@ -87,7 +84,6 @@ class MetricAlertResource(Resource): 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, - 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[Action]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } @@ -101,6 +97,5 @@ def __init__(self, **kwargs): self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) self.criteria = kwargs.get('criteria', None) - self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py index ec51a3f1fdbe..52be4f70d27e 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py @@ -42,9 +42,6 @@ class MetricAlertResourcePatch(Model): :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria - :param auto_mitigate: the flag that indicates whether the alert should be - auto resolved or not. - :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~azure.mgmt.monitor.models.Action] @@ -71,7 +68,6 @@ class MetricAlertResourcePatch(Model): 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, - 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[Action]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } @@ -86,6 +82,5 @@ def __init__(self, **kwargs): self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) self.criteria = kwargs.get('criteria', None) - self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py index 7a4cad2c38e2..2198413c7819 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py @@ -42,9 +42,6 @@ class MetricAlertResourcePatch(Model): :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria - :param auto_mitigate: the flag that indicates whether the alert should be - auto resolved or not. - :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~azure.mgmt.monitor.models.Action] @@ -71,12 +68,11 @@ class MetricAlertResourcePatch(Model): 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, - 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[Action]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } - def __init__(self, *, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: + def __init__(self, *, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, actions=None, **kwargs) -> None: super(MetricAlertResourcePatch, self).__init__(**kwargs) self.tags = tags self.description = description @@ -86,6 +82,5 @@ def __init__(self, *, description: str, severity: int, enabled: bool, evaluation self.evaluation_frequency = evaluation_frequency self.window_size = window_size self.criteria = criteria - self.auto_mitigate = auto_mitigate self.actions = actions self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py index 06c36b04a910..84cf1ecd43ba 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py @@ -50,9 +50,6 @@ class MetricAlertResource(Resource): :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria - :param auto_mitigate: the flag that indicates whether the alert should be - auto resolved or not. - :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~azure.mgmt.monitor.models.Action] @@ -87,12 +84,11 @@ class MetricAlertResource(Resource): 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, - 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[Action]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } - def __init__(self, *, location: str, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: + def __init__(self, *, location: str, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, actions=None, **kwargs) -> None: super(MetricAlertResource, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.severity = severity @@ -101,6 +97,5 @@ def __init__(self, *, location: str, description: str, severity: int, enabled: b self.evaluation_frequency = evaluation_frequency self.window_size = window_size self.criteria = criteria - self.auto_mitigate = auto_mitigate self.actions = actions self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py index 3f3ba2b7687a..88a973cd22b9 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py @@ -21,24 +21,23 @@ class Source(Model): :type query: str :param authorized_resources: List of Resource referred into query :type authorized_resources: list[str] - :param datasource_id: Required. The resource uri over which log search + :param data_source_id: Required. The resource uri over which log search query is to be run. - :type datasource_id: str + :type data_source_id: str :param query_type: Set value to ResultCount if query should be returning - search result count. Set it to Number if its a metric query. Possible - values include: 'ResultCount' + search result count. Possible values include: 'ResultCount' :type query_type: str or ~azure.mgmt.monitor.models.QueryType """ _validation = { 'query': {'required': True}, - 'datasource_id': {'required': True}, + 'data_source_id': {'required': True}, } _attribute_map = { 'query': {'key': 'query', 'type': 'str'}, 'authorized_resources': {'key': 'authorizedResources', 'type': '[str]'}, - 'datasource_id': {'key': 'datasourceId', 'type': 'str'}, + 'data_source_id': {'key': 'dataSourceId', 'type': 'str'}, 'query_type': {'key': 'queryType', 'type': 'str'}, } @@ -46,5 +45,5 @@ def __init__(self, **kwargs): super(Source, self).__init__(**kwargs) self.query = kwargs.get('query', None) self.authorized_resources = kwargs.get('authorized_resources', None) - self.datasource_id = kwargs.get('datasource_id', None) + self.data_source_id = kwargs.get('data_source_id', None) self.query_type = kwargs.get('query_type', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py index aaaba5c0cc01..50a3e990289e 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py @@ -21,30 +21,29 @@ class Source(Model): :type query: str :param authorized_resources: List of Resource referred into query :type authorized_resources: list[str] - :param datasource_id: Required. The resource uri over which log search + :param data_source_id: Required. The resource uri over which log search query is to be run. - :type datasource_id: str + :type data_source_id: str :param query_type: Set value to ResultCount if query should be returning - search result count. Set it to Number if its a metric query. Possible - values include: 'ResultCount' + search result count. Possible values include: 'ResultCount' :type query_type: str or ~azure.mgmt.monitor.models.QueryType """ _validation = { 'query': {'required': True}, - 'datasource_id': {'required': True}, + 'data_source_id': {'required': True}, } _attribute_map = { 'query': {'key': 'query', 'type': 'str'}, 'authorized_resources': {'key': 'authorizedResources', 'type': '[str]'}, - 'datasource_id': {'key': 'datasourceId', 'type': 'str'}, + 'data_source_id': {'key': 'dataSourceId', 'type': 'str'}, 'query_type': {'key': 'queryType', 'type': 'str'}, } - def __init__(self, *, query: str, datasource_id: str, authorized_resources=None, query_type=None, **kwargs) -> None: + def __init__(self, *, query: str, data_source_id: str, authorized_resources=None, query_type=None, **kwargs) -> None: super(Source, self).__init__(**kwargs) self.query = query self.authorized_resources = authorized_resources - self.datasource_id = datasource_id + self.data_source_id = data_source_id self.query_type = query_type diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py b/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py index 6227f567f391..16230f44386c 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/operations/scheduled_query_rules_operations.py @@ -166,6 +166,79 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} + def update( + self, resource_group_name, rule_name, tags=None, enabled=None, custom_headers=None, raw=False, **operation_config): + """Update log search Rule. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param rule_name: The name of the rule. + :type rule_name: str + :param tags: Resource tags + :type tags: dict[str, str] + :param enabled: The flag which indicates whether the Log Search rule + is enabled. Value should be true or false. Possible values include: + 'true', 'false' + :type enabled: str or ~azure.mgmt.monitor.models.Enabled + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: LogSearchRuleResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + parameters = models.LogSearchRuleResourcePatch(tags=tags, enabled=enabled) + + # Construct URL + url = self.update.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'), + 'ruleName': self._serialize.url("rule_name", rule_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(parameters, 'LogSearchRuleResourcePatch') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('LogSearchRuleResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}'} + def delete( self, resource_group_name, rule_name, custom_headers=None, raw=False, **operation_config): """Deletes a Log Search rule. From 7df9bc785fe650d46f1cb84a4336391bffe0c8d4 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Mon, 21 May 2018 17:35:20 +0000 Subject: [PATCH 2/3] Generated from f53526896e5c001f79bd46ca892f825172b53abf Merge branch 'master' into patchsupport --- .../azure/mgmt/monitor/models/action_group_resource.py | 2 +- .../azure/mgmt/monitor/models/action_group_resource_py3.py | 2 +- .../azure/mgmt/monitor/models/metric_alert_resource.py | 5 +++++ .../mgmt/monitor/models/metric_alert_resource_patch.py | 5 +++++ .../mgmt/monitor/models/metric_alert_resource_patch_py3.py | 7 ++++++- .../azure/mgmt/monitor/models/metric_alert_resource_py3.py | 7 ++++++- 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py index 2feb3268a1df..0ccca8947395 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource.py @@ -75,7 +75,7 @@ class ActionGroupResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'group_short_name': {'required': True, 'max_length': 15}, + 'group_short_name': {'required': True, 'max_length': 12}, 'enabled': {'required': True}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py index 6c63a9d62f19..81edb6f53b0f 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_group_resource_py3.py @@ -75,7 +75,7 @@ class ActionGroupResource(Resource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'group_short_name': {'required': True, 'max_length': 15}, + 'group_short_name': {'required': True, 'max_length': 12}, 'enabled': {'required': True}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py index 4a45ac4ed6f6..5324dcac5a59 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py @@ -50,6 +50,9 @@ class MetricAlertResource(Resource): :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria + :param auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~azure.mgmt.monitor.models.Action] @@ -84,6 +87,7 @@ class MetricAlertResource(Resource): 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[Action]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } @@ -97,5 +101,6 @@ def __init__(self, **kwargs): self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) self.criteria = kwargs.get('criteria', None) + self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py index 52be4f70d27e..ec51a3f1fdbe 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py @@ -42,6 +42,9 @@ class MetricAlertResourcePatch(Model): :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria + :param auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~azure.mgmt.monitor.models.Action] @@ -68,6 +71,7 @@ class MetricAlertResourcePatch(Model): 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[Action]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } @@ -82,5 +86,6 @@ def __init__(self, **kwargs): self.evaluation_frequency = kwargs.get('evaluation_frequency', None) self.window_size = kwargs.get('window_size', None) self.criteria = kwargs.get('criteria', None) + self.auto_mitigate = kwargs.get('auto_mitigate', None) self.actions = kwargs.get('actions', None) self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py index 2198413c7819..7a4cad2c38e2 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py @@ -42,6 +42,9 @@ class MetricAlertResourcePatch(Model): :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria + :param auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~azure.mgmt.monitor.models.Action] @@ -68,11 +71,12 @@ class MetricAlertResourcePatch(Model): 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[Action]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } - def __init__(self, *, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, actions=None, **kwargs) -> None: + def __init__(self, *, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: super(MetricAlertResourcePatch, self).__init__(**kwargs) self.tags = tags self.description = description @@ -82,5 +86,6 @@ def __init__(self, *, description: str, severity: int, enabled: bool, evaluation self.evaluation_frequency = evaluation_frequency self.window_size = window_size self.criteria = criteria + self.auto_mitigate = auto_mitigate self.actions = actions self.last_updated_time = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py index 84cf1ecd43ba..06c36b04a910 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py @@ -50,6 +50,9 @@ class MetricAlertResource(Resource): :param criteria: Required. defines the specific alert criteria information. :type criteria: ~azure.mgmt.monitor.models.MetricAlertCriteria + :param auto_mitigate: the flag that indicates whether the alert should be + auto resolved or not. + :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. :type actions: list[~azure.mgmt.monitor.models.Action] @@ -84,11 +87,12 @@ class MetricAlertResource(Resource): 'evaluation_frequency': {'key': 'properties.evaluationFrequency', 'type': 'duration'}, 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, + 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, 'actions': {'key': 'properties.actions', 'type': '[Action]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } - def __init__(self, *, location: str, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, actions=None, **kwargs) -> None: + def __init__(self, *, location: str, description: str, severity: int, enabled: bool, evaluation_frequency, window_size, criteria, tags=None, scopes=None, auto_mitigate: bool=None, actions=None, **kwargs) -> None: super(MetricAlertResource, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.severity = severity @@ -97,5 +101,6 @@ def __init__(self, *, location: str, description: str, severity: int, enabled: b self.evaluation_frequency = evaluation_frequency self.window_size = window_size self.criteria = criteria + self.auto_mitigate = auto_mitigate self.actions = actions self.last_updated_time = None From 6f26d9e299d2c2a53d82c563831448a983d135bf Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 5 Jun 2018 10:54:58 +0000 Subject: [PATCH 3/3] Generated from b37d3ace14508e3bc3f87ee29b7f2ad0b7025f67 Resolving multiple model issue Changes - 1. Renamed "MetricTrigger" to "LogMetricTrigger" 2. Aligned "Resources" to other specs --- .../azure/mgmt/monitor/models/__init__.py | 20 ++++++--- .../azure/mgmt/monitor/models/action.py | 10 +---- .../azure/mgmt/monitor/models/action_py3.py | 12 +---- .../mgmt/monitor/models/alerting_action.py | 6 --- .../monitor/models/alerting_action_py3.py | 10 +---- .../mgmt/monitor/models/log_metric_trigger.py | 45 +++++++++++++++++++ .../monitor/models/log_metric_trigger_py3.py | 45 +++++++++++++++++++ .../monitor/models/metric_alert_action.py | 32 +++++++++++++ .../monitor/models/metric_alert_action_py3.py | 32 +++++++++++++ .../monitor/models/metric_alert_resource.py | 4 +- .../models/metric_alert_resource_patch.py | 4 +- .../models/metric_alert_resource_patch_py3.py | 4 +- .../models/metric_alert_resource_py3.py | 4 +- .../mgmt/monitor/models/metric_trigger.py | 17 ------- .../mgmt/monitor/models/metric_trigger_py3.py | 19 +------- .../models/monitor_management_client_enums.py | 26 +++++------ .../azure/mgmt/monitor/models/source.py | 4 +- .../azure/mgmt/monitor/models/source_py3.py | 4 +- .../mgmt/monitor/models/trigger_condition.py | 4 +- .../monitor/models/trigger_condition_py3.py | 4 +- 20 files changed, 202 insertions(+), 104 deletions(-) create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py index 2d62249b08a8..1f76267967cf 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py @@ -87,7 +87,7 @@ from .baseline_response_py3 import BaselineResponse from .time_series_information_py3 import TimeSeriesInformation from .calculate_baseline_response_py3 import CalculateBaselineResponse - from .action_py3 import Action + from .metric_alert_action_py3 import MetricAlertAction from .metric_alert_criteria_py3 import MetricAlertCriteria from .metric_alert_resource_py3 import MetricAlertResource from .metric_alert_resource_patch_py3 import MetricAlertResourcePatch @@ -99,8 +99,10 @@ from .metric_alert_single_resource_multiple_metric_criteria_py3 import MetricAlertSingleResourceMultipleMetricCriteria from .source_py3 import Source from .schedule_py3 import Schedule + from .action_py3 import Action from .log_search_rule_resource_py3 import LogSearchRuleResource from .log_search_rule_resource_patch_py3 import LogSearchRuleResourcePatch + from .log_metric_trigger_py3 import LogMetricTrigger from .trigger_condition_py3 import TriggerCondition from .az_ns_action_group_py3 import AzNsActionGroup from .alerting_action_py3 import AlertingAction @@ -182,7 +184,7 @@ from .baseline_response import BaselineResponse from .time_series_information import TimeSeriesInformation from .calculate_baseline_response import CalculateBaselineResponse - from .action import Action + from .metric_alert_action import MetricAlertAction from .metric_alert_criteria import MetricAlertCriteria from .metric_alert_resource import MetricAlertResource from .metric_alert_resource_patch import MetricAlertResourcePatch @@ -194,8 +196,10 @@ from .metric_alert_single_resource_multiple_metric_criteria import MetricAlertSingleResourceMultipleMetricCriteria from .source import Source from .schedule import Schedule + from .action import Action from .log_search_rule_resource import LogSearchRuleResource from .log_search_rule_resource_patch import LogSearchRuleResourcePatch + from .log_metric_trigger import LogMetricTrigger from .trigger_condition import TriggerCondition from .az_ns_action_group import AzNsActionGroup from .alerting_action import AlertingAction @@ -214,8 +218,6 @@ MetricStatisticType, TimeAggregationType, ComparisonOperationType, - ConditionalOperator, - MetricTriggerType, ScaleDirection, ScaleType, RecurrenceFrequency, @@ -230,6 +232,8 @@ Enabled, ProvisioningState, QueryType, + ConditionalOperator, + MetricTriggerType, AlertSeverity, ResultType, ) @@ -312,7 +316,7 @@ 'BaselineResponse', 'TimeSeriesInformation', 'CalculateBaselineResponse', - 'Action', + 'MetricAlertAction', 'MetricAlertCriteria', 'MetricAlertResource', 'MetricAlertResourcePatch', @@ -324,8 +328,10 @@ 'MetricAlertSingleResourceMultipleMetricCriteria', 'Source', 'Schedule', + 'Action', 'LogSearchRuleResource', 'LogSearchRuleResourcePatch', + 'LogMetricTrigger', 'TriggerCondition', 'AzNsActionGroup', 'AlertingAction', @@ -343,8 +349,6 @@ 'MetricStatisticType', 'TimeAggregationType', 'ComparisonOperationType', - 'ConditionalOperator', - 'MetricTriggerType', 'ScaleDirection', 'ScaleType', 'RecurrenceFrequency', @@ -359,6 +363,8 @@ 'Enabled', 'ProvisioningState', 'QueryType', + 'ConditionalOperator', + 'MetricTriggerType', 'AlertSeverity', 'ResultType', ] diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py index dcb773260063..97c98e4fc86c 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py @@ -13,17 +13,13 @@ class Action(Model): - """An alert action. + """Action. You probably want to use the sub-classes and not this class directly. Known sub-classes are: AlertingAction All required parameters must be populated in order to send to Azure. - :param action_group_id: the id of the action group to use. - :type action_group_id: str - :param webhook_properties: - :type webhook_properties: dict[str, str] :param odatatype: Required. Constant filled by server. :type odatatype: str """ @@ -33,8 +29,6 @@ class Action(Model): } _attribute_map = { - 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, - 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, } @@ -44,6 +38,4 @@ class Action(Model): def __init__(self, **kwargs): super(Action, self).__init__(**kwargs) - self.action_group_id = kwargs.get('action_group_id', None) - self.webhook_properties = kwargs.get('webhook_properties', None) self.odatatype = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py index 8f20cdeaafe4..c8217283cc29 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py @@ -13,17 +13,13 @@ class Action(Model): - """An alert action. + """Action. You probably want to use the sub-classes and not this class directly. Known sub-classes are: AlertingAction All required parameters must be populated in order to send to Azure. - :param action_group_id: the id of the action group to use. - :type action_group_id: str - :param webhook_properties: - :type webhook_properties: dict[str, str] :param odatatype: Required. Constant filled by server. :type odatatype: str """ @@ -33,8 +29,6 @@ class Action(Model): } _attribute_map = { - 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, - 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, } @@ -42,8 +36,6 @@ class Action(Model): 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction'} } - def __init__(self, *, action_group_id: str=None, webhook_properties=None, **kwargs) -> None: + def __init__(self, **kwargs) -> None: super(Action, self).__init__(**kwargs) - self.action_group_id = action_group_id - self.webhook_properties = webhook_properties self.odatatype = None diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py index b58fa3b4a748..6df6d93edc5a 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action.py @@ -17,10 +17,6 @@ class AlertingAction(Action): All required parameters must be populated in order to send to Azure. - :param action_group_id: the id of the action group to use. - :type action_group_id: str - :param webhook_properties: - :type webhook_properties: dict[str, str] :param odatatype: Required. Constant filled by server. :type odatatype: str :param severity: Required. Severity of the alert. Possible values include: @@ -44,8 +40,6 @@ class AlertingAction(Action): } _attribute_map = { - 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, - 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, 'severity': {'key': 'severity', 'type': 'str'}, 'azns_action': {'key': 'aznsAction', 'type': 'AzNsActionGroup'}, diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py index e6e86c2fddd9..558088fa5315 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/alerting_action_py3.py @@ -17,10 +17,6 @@ class AlertingAction(Action): All required parameters must be populated in order to send to Azure. - :param action_group_id: the id of the action group to use. - :type action_group_id: str - :param webhook_properties: - :type webhook_properties: dict[str, str] :param odatatype: Required. Constant filled by server. :type odatatype: str :param severity: Required. Severity of the alert. Possible values include: @@ -44,8 +40,6 @@ class AlertingAction(Action): } _attribute_map = { - 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, - 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, 'severity': {'key': 'severity', 'type': 'str'}, 'azns_action': {'key': 'aznsAction', 'type': 'AzNsActionGroup'}, @@ -53,8 +47,8 @@ class AlertingAction(Action): 'trigger': {'key': 'trigger', 'type': 'TriggerCondition'}, } - def __init__(self, *, severity, azns_action, trigger, action_group_id: str=None, webhook_properties=None, throttling_in_min: int=None, **kwargs) -> None: - super(AlertingAction, self).__init__(action_group_id=action_group_id, webhook_properties=webhook_properties, **kwargs) + def __init__(self, *, severity, azns_action, trigger, throttling_in_min: int=None, **kwargs) -> None: + super(AlertingAction, self).__init__(**kwargs) self.severity = severity self.azns_action = azns_action self.throttling_in_min = throttling_in_min diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py new file mode 100644 index 000000000000..754ab30066fc --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py @@ -0,0 +1,45 @@ +# 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 LogMetricTrigger(Model): + """LogMetricTrigger. + + :param threshold_operator: Evaluation operation for Metric -'GreaterThan' + or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.models.ConditionalOperator + :param threshold: + :type threshold: float + :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or + 'Total'. Possible values include: 'Consecutive', 'Total' + :type metric_trigger_type: str or + ~azure.mgmt.monitor.models.MetricTriggerType + :param metric_column: Evaluation of metric on a particular column + :type metric_column: str + """ + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, + 'metric_column': {'key': 'metricColumn', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogMetricTrigger, self).__init__(**kwargs) + self.threshold_operator = kwargs.get('threshold_operator', None) + self.threshold = kwargs.get('threshold', None) + self.metric_trigger_type = kwargs.get('metric_trigger_type', None) + self.metric_column = kwargs.get('metric_column', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py new file mode 100644 index 000000000000..bcf1cfa94dc5 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger_py3.py @@ -0,0 +1,45 @@ +# 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 LogMetricTrigger(Model): + """LogMetricTrigger. + + :param threshold_operator: Evaluation operation for Metric -'GreaterThan' + or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', + 'LessThan', 'Equal' + :type threshold_operator: str or + ~azure.mgmt.monitor.models.ConditionalOperator + :param threshold: + :type threshold: float + :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or + 'Total'. Possible values include: 'Consecutive', 'Total' + :type metric_trigger_type: str or + ~azure.mgmt.monitor.models.MetricTriggerType + :param metric_column: Evaluation of metric on a particular column + :type metric_column: str + """ + + _attribute_map = { + 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, + 'threshold': {'key': 'threshold', 'type': 'float'}, + 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, + 'metric_column': {'key': 'metricColumn', 'type': 'str'}, + } + + def __init__(self, *, threshold_operator=None, threshold: float=None, metric_trigger_type=None, metric_column: str=None, **kwargs) -> None: + super(LogMetricTrigger, self).__init__(**kwargs) + self.threshold_operator = threshold_operator + self.threshold = threshold + self.metric_trigger_type = metric_trigger_type + self.metric_column = metric_column diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py new file mode 100644 index 000000000000..426d3cef5664 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action.py @@ -0,0 +1,32 @@ +# 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 MetricAlertAction(Model): + """An alert action. + + :param action_group_id: the id of the action group to use. + :type action_group_id: str + :param webhook_properties: + :type webhook_properties: dict[str, str] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(MetricAlertAction, self).__init__(**kwargs) + self.action_group_id = kwargs.get('action_group_id', None) + self.webhook_properties = kwargs.get('webhook_properties', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py new file mode 100644 index 000000000000..da06ee03df07 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_action_py3.py @@ -0,0 +1,32 @@ +# 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 MetricAlertAction(Model): + """An alert action. + + :param action_group_id: the id of the action group to use. + :type action_group_id: str + :param webhook_properties: + :type webhook_properties: dict[str, str] + """ + + _attribute_map = { + 'action_group_id': {'key': 'actionGroupId', 'type': 'str'}, + 'webhook_properties': {'key': 'webhookProperties', 'type': '{str}'}, + } + + def __init__(self, *, action_group_id: str=None, webhook_properties=None, **kwargs) -> None: + super(MetricAlertAction, self).__init__(**kwargs) + self.action_group_id = action_group_id + self.webhook_properties = webhook_properties diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py index 5324dcac5a59..98ac70d43bb1 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource.py @@ -55,7 +55,7 @@ class MetricAlertResource(Resource): :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - :type actions: list[~azure.mgmt.monitor.models.Action] + :type actions: list[~azure.mgmt.monitor.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: datetime """ @@ -88,7 +88,7 @@ class MetricAlertResource(Resource): 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, - 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py index ec51a3f1fdbe..72bca9080e59 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch.py @@ -47,7 +47,7 @@ class MetricAlertResourcePatch(Model): :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - :type actions: list[~azure.mgmt.monitor.models.Action] + :type actions: list[~azure.mgmt.monitor.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: datetime """ @@ -72,7 +72,7 @@ class MetricAlertResourcePatch(Model): 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, - 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py index 7a4cad2c38e2..c415f69e489b 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_patch_py3.py @@ -47,7 +47,7 @@ class MetricAlertResourcePatch(Model): :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - :type actions: list[~azure.mgmt.monitor.models.Action] + :type actions: list[~azure.mgmt.monitor.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: datetime """ @@ -72,7 +72,7 @@ class MetricAlertResourcePatch(Model): 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, - 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py index 06c36b04a910..a116607117c6 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_alert_resource_py3.py @@ -55,7 +55,7 @@ class MetricAlertResource(Resource): :type auto_mitigate: bool :param actions: the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - :type actions: list[~azure.mgmt.monitor.models.Action] + :type actions: list[~azure.mgmt.monitor.models.MetricAlertAction] :ivar last_updated_time: Last time the rule was updated in ISO8601 format. :vartype last_updated_time: datetime """ @@ -88,7 +88,7 @@ class MetricAlertResource(Resource): 'window_size': {'key': 'properties.windowSize', 'type': 'duration'}, 'criteria': {'key': 'properties.criteria', 'type': 'MetricAlertCriteria'}, 'auto_mitigate': {'key': 'properties.autoMitigate', 'type': 'bool'}, - 'actions': {'key': 'properties.actions', 'type': '[Action]'}, + 'actions': {'key': 'properties.actions', 'type': '[MetricAlertAction]'}, 'last_updated_time': {'key': 'properties.lastUpdatedTime', 'type': 'iso-8601'}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py index c674b66489f5..0bc042577bb6 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py @@ -49,17 +49,6 @@ class MetricTrigger(Model): :param threshold: Required. the threshold of the metric that triggers the scale action. :type threshold: float - :param threshold_operator: Evaluation operation for Metric -'GreaterThan' - or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', - 'LessThan', 'Equal' - :type threshold_operator: str or - ~azure.mgmt.monitor.models.ConditionalOperator - :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or - 'Total'. Possible values include: 'Consecutive', 'Total' - :type metric_trigger_type: str or - ~azure.mgmt.monitor.models.MetricTriggerType - :param metric_column: Evaluation of metric on a particular column - :type metric_column: str """ _validation = { @@ -82,9 +71,6 @@ class MetricTrigger(Model): 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'}, 'operator': {'key': 'operator', 'type': 'ComparisonOperationType'}, 'threshold': {'key': 'threshold', 'type': 'float'}, - 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, - 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, - 'metric_column': {'key': 'metricColumn', 'type': 'str'}, } def __init__(self, **kwargs): @@ -97,6 +83,3 @@ def __init__(self, **kwargs): self.time_aggregation = kwargs.get('time_aggregation', None) self.operator = kwargs.get('operator', None) self.threshold = kwargs.get('threshold', None) - self.threshold_operator = kwargs.get('threshold_operator', None) - self.metric_trigger_type = kwargs.get('metric_trigger_type', None) - self.metric_column = kwargs.get('metric_column', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py index 4cd6f809b9e7..991b29d2707c 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger_py3.py @@ -49,17 +49,6 @@ class MetricTrigger(Model): :param threshold: Required. the threshold of the metric that triggers the scale action. :type threshold: float - :param threshold_operator: Evaluation operation for Metric -'GreaterThan' - or 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', - 'LessThan', 'Equal' - :type threshold_operator: str or - ~azure.mgmt.monitor.models.ConditionalOperator - :param metric_trigger_type: Metric Trigger Type - 'Consecutive' or - 'Total'. Possible values include: 'Consecutive', 'Total' - :type metric_trigger_type: str or - ~azure.mgmt.monitor.models.MetricTriggerType - :param metric_column: Evaluation of metric on a particular column - :type metric_column: str """ _validation = { @@ -82,12 +71,9 @@ class MetricTrigger(Model): 'time_aggregation': {'key': 'timeAggregation', 'type': 'TimeAggregationType'}, 'operator': {'key': 'operator', 'type': 'ComparisonOperationType'}, 'threshold': {'key': 'threshold', 'type': 'float'}, - 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, - 'metric_trigger_type': {'key': 'metricTriggerType', 'type': 'str'}, - 'metric_column': {'key': 'metricColumn', 'type': 'str'}, } - def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, threshold_operator=None, metric_trigger_type=None, metric_column: str=None, **kwargs) -> None: + def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, statistic, time_window, time_aggregation, operator, threshold: float, **kwargs) -> None: super(MetricTrigger, self).__init__(**kwargs) self.metric_name = metric_name self.metric_resource_uri = metric_resource_uri @@ -97,6 +83,3 @@ def __init__(self, *, metric_name: str, metric_resource_uri: str, time_grain, st self.time_aggregation = time_aggregation self.operator = operator self.threshold = threshold - self.threshold_operator = threshold_operator - self.metric_trigger_type = metric_trigger_type - self.metric_column = metric_column diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py index de796532bfb7..d2bda057fbd3 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/monitor_management_client_enums.py @@ -39,19 +39,6 @@ class ComparisonOperationType(str, Enum): less_than_or_equal = "LessThanOrEqual" -class ConditionalOperator(str, Enum): - - greater_than = "GreaterThan" - less_than = "LessThan" - equal = "Equal" - - -class MetricTriggerType(str, Enum): - - consecutive = "Consecutive" - total = "Total" - - class ScaleDirection(str, Enum): none = "None" @@ -166,6 +153,19 @@ class QueryType(str, Enum): result_count = "ResultCount" +class ConditionalOperator(str, Enum): + + greater_than = "GreaterThan" + less_than = "LessThan" + equal = "Equal" + + +class MetricTriggerType(str, Enum): + + consecutive = "Consecutive" + total = "Total" + + class AlertSeverity(str, Enum): zero = "0" diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py index 88a973cd22b9..4c305b2d49ba 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py @@ -24,8 +24,8 @@ class Source(Model): :param data_source_id: Required. The resource uri over which log search query is to be run. :type data_source_id: str - :param query_type: Set value to ResultCount if query should be returning - search result count. Possible values include: 'ResultCount' + :param query_type: Set value to 'ResultCount'. Possible values include: + 'ResultCount' :type query_type: str or ~azure.mgmt.monitor.models.QueryType """ diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py index 50a3e990289e..77655c4b55b5 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py @@ -24,8 +24,8 @@ class Source(Model): :param data_source_id: Required. The resource uri over which log search query is to be run. :type data_source_id: str - :param query_type: Set value to ResultCount if query should be returning - search result count. Possible values include: 'ResultCount' + :param query_type: Set value to 'ResultCount'. Possible values include: + 'ResultCount' :type query_type: str or ~azure.mgmt.monitor.models.QueryType """ diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition.py index 9c011b1fcd62..e89fdc8c18f1 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition.py @@ -26,7 +26,7 @@ class TriggerCondition(Model): should be triggered. :type threshold: float :param metric_trigger: Trigger condition for metric query rule - :type metric_trigger: ~azure.mgmt.monitor.models.MetricTrigger + :type metric_trigger: ~azure.mgmt.monitor.models.LogMetricTrigger """ _validation = { @@ -37,7 +37,7 @@ class TriggerCondition(Model): _attribute_map = { 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, 'threshold': {'key': 'threshold', 'type': 'float'}, - 'metric_trigger': {'key': 'metricTrigger', 'type': 'MetricTrigger'}, + 'metric_trigger': {'key': 'metricTrigger', 'type': 'LogMetricTrigger'}, } def __init__(self, **kwargs): diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition_py3.py index 1a492de47033..b21e39d9a53e 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/trigger_condition_py3.py @@ -26,7 +26,7 @@ class TriggerCondition(Model): should be triggered. :type threshold: float :param metric_trigger: Trigger condition for metric query rule - :type metric_trigger: ~azure.mgmt.monitor.models.MetricTrigger + :type metric_trigger: ~azure.mgmt.monitor.models.LogMetricTrigger """ _validation = { @@ -37,7 +37,7 @@ class TriggerCondition(Model): _attribute_map = { 'threshold_operator': {'key': 'thresholdOperator', 'type': 'str'}, 'threshold': {'key': 'threshold', 'type': 'float'}, - 'metric_trigger': {'key': 'metricTrigger', 'type': 'MetricTrigger'}, + 'metric_trigger': {'key': 'metricTrigger', 'type': 'LogMetricTrigger'}, } def __init__(self, *, threshold_operator, threshold: float, metric_trigger=None, **kwargs) -> None: