From 39e8a0d71445db65005bc2882ae93e721ae2b944 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 27 Sep 2018 16:23:01 -0700 Subject: [PATCH] Generated from a2ed141f095adf20aeb11d3bd796d5906fce4f6b (#3414) Update sqr documentation to include LogToMetricAction --- .../azure/mgmt/monitor/models/__init__.py | 9 ++++ .../azure/mgmt/monitor/models/action.py | 4 +- .../azure/mgmt/monitor/models/action_py3.py | 4 +- .../azure/mgmt/monitor/models/criteria.py | 38 ++++++++++++++ .../azure/mgmt/monitor/models/criteria_py3.py | 38 ++++++++++++++ .../azure/mgmt/monitor/models/dimension.py | 49 +++++++++++++++++++ .../mgmt/monitor/models/dimension_py3.py | 49 +++++++++++++++++++ .../models/log_search_rule_resource.py | 4 +- .../models/log_search_rule_resource_py3.py | 6 +-- .../monitor/models/log_to_metric_action.py | 40 +++++++++++++++ .../models/log_to_metric_action_py3.py | 40 +++++++++++++++ .../azure/mgmt/monitor/models/source.py | 3 +- .../azure/mgmt/monitor/models/source_py3.py | 5 +- 13 files changed, 275 insertions(+), 14 deletions(-) create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/criteria.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/criteria_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/dimension.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/dimension_py3.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py create mode 100644 azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_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 164f6e58b0ce..aee514b79e53 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py @@ -106,6 +106,9 @@ from .trigger_condition_py3 import TriggerCondition from .az_ns_action_group_py3 import AzNsActionGroup from .alerting_action_py3 import AlertingAction + from .dimension_py3 import Dimension + from .criteria_py3 import Criteria + from .log_to_metric_action_py3 import LogToMetricAction from .metric_namespace_name_py3 import MetricNamespaceName from .metric_namespace_py3 import MetricNamespace except (SyntaxError, ImportError): @@ -205,6 +208,9 @@ from .trigger_condition import TriggerCondition from .az_ns_action_group import AzNsActionGroup from .alerting_action import AlertingAction + from .dimension import Dimension + from .criteria import Criteria + from .log_to_metric_action import LogToMetricAction from .metric_namespace_name import MetricNamespaceName from .metric_namespace import MetricNamespace from .autoscale_setting_resource_paged import AutoscaleSettingResourcePaged @@ -340,6 +346,9 @@ 'TriggerCondition', 'AzNsActionGroup', 'AlertingAction', + 'Dimension', + 'Criteria', + 'LogToMetricAction', 'MetricNamespaceName', 'MetricNamespace', 'AutoscaleSettingResourcePaged', diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py index 2a4aa290f9f1..494f5e696a81 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action.py @@ -16,7 +16,7 @@ class Action(Model): """Action descriptor. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AlertingAction + sub-classes are: AlertingAction, LogToMetricAction All required parameters must be populated in order to send to Azure. @@ -33,7 +33,7 @@ class Action(Model): } _subtype_map = { - 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction'} + 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction', 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction': 'LogToMetricAction'} } def __init__(self, **kwargs): 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 cb4ea038d5b8..354eb4565038 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py @@ -16,7 +16,7 @@ class Action(Model): """Action descriptor. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AlertingAction + sub-classes are: AlertingAction, LogToMetricAction All required parameters must be populated in order to send to Azure. @@ -33,7 +33,7 @@ class Action(Model): } _subtype_map = { - 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction'} + 'odatatype': {'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction': 'AlertingAction', 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction': 'LogToMetricAction'} } def __init__(self, **kwargs) -> None: diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria.py new file mode 100644 index 000000000000..34bb08dd5fce --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria.py @@ -0,0 +1,38 @@ +# 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 Criteria(Model): + """Specifies the criteria for converting log to metric. + + All required parameters must be populated in order to send to Azure. + + :param metric_name: Required. Name of the metric + :type metric_name: str + :param dimensions: List of Dimensions for creating metric + :type dimensions: list[~azure.mgmt.monitor.models.Dimension] + """ + + _validation = { + 'metric_name': {'required': True}, + } + + _attribute_map = { + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + } + + def __init__(self, **kwargs): + super(Criteria, self).__init__(**kwargs) + self.metric_name = kwargs.get('metric_name', None) + self.dimensions = kwargs.get('dimensions', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria_py3.py new file mode 100644 index 000000000000..e6266bc19003 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/criteria_py3.py @@ -0,0 +1,38 @@ +# 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 Criteria(Model): + """Specifies the criteria for converting log to metric. + + All required parameters must be populated in order to send to Azure. + + :param metric_name: Required. Name of the metric + :type metric_name: str + :param dimensions: List of Dimensions for creating metric + :type dimensions: list[~azure.mgmt.monitor.models.Dimension] + """ + + _validation = { + 'metric_name': {'required': True}, + } + + _attribute_map = { + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, + } + + def __init__(self, *, metric_name: str, dimensions=None, **kwargs) -> None: + super(Criteria, self).__init__(**kwargs) + self.metric_name = metric_name + self.dimensions = dimensions diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension.py new file mode 100644 index 000000000000..82826c978cd8 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension.py @@ -0,0 +1,49 @@ +# 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 Dimension(Model): + """Specifies the criteria for converting log to metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension + :type name: str + :ivar operator: Required. Operator for dimension values. Default value: + "Include" . + :vartype operator: str + :param values: Required. List of dimension values + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True, 'constant': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + operator = "Include" + + def __init__(self, **kwargs): + super(Dimension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.values = kwargs.get('values', None) diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension_py3.py new file mode 100644 index 000000000000..d506b33189c4 --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/dimension_py3.py @@ -0,0 +1,49 @@ +# 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 Dimension(Model): + """Specifies the criteria for converting log to metric. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Name of the dimension + :type name: str + :ivar operator: Required. Operator for dimension values. Default value: + "Include" . + :vartype operator: str + :param values: Required. List of dimension values + :type values: list[str] + """ + + _validation = { + 'name': {'required': True}, + 'operator': {'required': True, 'constant': True}, + 'values': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'operator': {'key': 'operator', 'type': 'str'}, + 'values': {'key': 'values', 'type': '[str]'}, + } + + operator = "Include" + + def __init__(self, *, name: str, values, **kwargs) -> None: + super(Dimension, self).__init__(**kwargs) + self.name = name + self.values = values diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py index fc531623e212..d094c78d6478 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource.py @@ -44,7 +44,8 @@ class LogSearchRuleResource(Resource): ~azure.mgmt.monitor.models.ProvisioningState :param source: Required. Data Source against which rule will Query Data :type source: ~azure.mgmt.monitor.models.Source - :param schedule: Required. Schedule (Frequnecy, Time Window) for rule. + :param schedule: Schedule (Frequnecy, Time Window) for rule. Required for + action type - AlertingAction :type schedule: ~azure.mgmt.monitor.models.Schedule :param action: Required. Action needs to be taken on rule execution. :type action: ~azure.mgmt.monitor.models.Action @@ -58,7 +59,6 @@ class LogSearchRuleResource(Resource): 'last_updated_time': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'source': {'required': True}, - 'schedule': {'required': True}, 'action': {'required': True}, } diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py index 5cee5f349023..d184c4e9b046 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_search_rule_resource_py3.py @@ -44,7 +44,8 @@ class LogSearchRuleResource(Resource): ~azure.mgmt.monitor.models.ProvisioningState :param source: Required. Data Source against which rule will Query Data :type source: ~azure.mgmt.monitor.models.Source - :param schedule: Required. Schedule (Frequnecy, Time Window) for rule. + :param schedule: Schedule (Frequnecy, Time Window) for rule. Required for + action type - AlertingAction :type schedule: ~azure.mgmt.monitor.models.Schedule :param action: Required. Action needs to be taken on rule execution. :type action: ~azure.mgmt.monitor.models.Action @@ -58,7 +59,6 @@ class LogSearchRuleResource(Resource): 'last_updated_time': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'source': {'required': True}, - 'schedule': {'required': True}, 'action': {'required': True}, } @@ -77,7 +77,7 @@ class LogSearchRuleResource(Resource): 'action': {'key': 'properties.action', 'type': 'Action'}, } - def __init__(self, *, location: str, source, schedule, action, tags=None, description: str=None, enabled=None, **kwargs) -> None: + def __init__(self, *, location: str, source, action, tags=None, description: str=None, enabled=None, schedule=None, **kwargs) -> None: super(LogSearchRuleResource, self).__init__(location=location, tags=tags, **kwargs) self.description = description self.enabled = enabled diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py new file mode 100644 index 000000000000..06588cd4ddcf --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action.py @@ -0,0 +1,40 @@ +# 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 .action import Action + + +class LogToMetricAction(Action): + """Specifiy action need to be taken when rule type is converting log to + metric. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param criteria: Required. Severity of the alert + :type criteria: ~azure.mgmt.monitor.models.Criteria + """ + + _validation = { + 'odatatype': {'required': True}, + 'criteria': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'Criteria'}, + } + + def __init__(self, **kwargs): + super(LogToMetricAction, self).__init__(**kwargs) + self.criteria = kwargs.get('criteria', None) + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_py3.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_py3.py new file mode 100644 index 000000000000..8cb17d1a2a8c --- /dev/null +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/log_to_metric_action_py3.py @@ -0,0 +1,40 @@ +# 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 .action_py3 import Action + + +class LogToMetricAction(Action): + """Specifiy action need to be taken when rule type is converting log to + metric. + + All required parameters must be populated in order to send to Azure. + + :param odatatype: Required. Constant filled by server. + :type odatatype: str + :param criteria: Required. Severity of the alert + :type criteria: ~azure.mgmt.monitor.models.Criteria + """ + + _validation = { + 'odatatype': {'required': True}, + 'criteria': {'required': True}, + } + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'criteria': {'key': 'criteria', 'type': 'Criteria'}, + } + + def __init__(self, *, criteria, **kwargs) -> None: + super(LogToMetricAction, self).__init__(**kwargs) + self.criteria = criteria + self.odatatype = 'Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction' diff --git a/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py index 4c305b2d49ba..b36c44a8fc20 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source.py @@ -17,7 +17,7 @@ class Source(Model): All required parameters must be populated in order to send to Azure. - :param query: Required. Log search query. + :param query: Log search query. Required for action type - AlertingAction :type query: str :param authorized_resources: List of Resource referred into query :type authorized_resources: list[str] @@ -30,7 +30,6 @@ class Source(Model): """ _validation = { - 'query': {'required': True}, 'data_source_id': {'required': True}, } 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 77655c4b55b5..ef333528e077 100644 --- a/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py +++ b/azure-mgmt-monitor/azure/mgmt/monitor/models/source_py3.py @@ -17,7 +17,7 @@ class Source(Model): All required parameters must be populated in order to send to Azure. - :param query: Required. Log search query. + :param query: Log search query. Required for action type - AlertingAction :type query: str :param authorized_resources: List of Resource referred into query :type authorized_resources: list[str] @@ -30,7 +30,6 @@ class Source(Model): """ _validation = { - 'query': {'required': True}, 'data_source_id': {'required': True}, } @@ -41,7 +40,7 @@ class Source(Model): 'query_type': {'key': 'queryType', 'type': 'str'}, } - def __init__(self, *, query: str, data_source_id: str, authorized_resources=None, query_type=None, **kwargs) -> None: + def __init__(self, *, data_source_id: str, query: str=None, authorized_resources=None, query_type=None, **kwargs) -> None: super(Source, self).__init__(**kwargs) self.query = query self.authorized_resources = authorized_resources