Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR monitor/resource-manager] Update ScheduledQueryRule resource documentation to include LogToMetricAction #3414

Merged
merged 1 commit into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -340,6 +346,9 @@
'TriggerCondition',
'AzNsActionGroup',
'AlertingAction',
'Dimension',
'Criteria',
'LogToMetricAction',
'MetricNamespaceName',
'MetricNamespace',
'AutoscaleSettingResourcePaged',
Expand Down
4 changes: 2 additions & 2 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/action_py3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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:
Expand Down
38 changes: 38 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/criteria.py
Original file line number Diff line number Diff line change
@@ -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)
38 changes: 38 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/criteria_py3.py
Original file line number Diff line number Diff line change
@@ -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
49 changes: 49 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/dimension.py
Original file line number Diff line number Diff line change
@@ -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)
49 changes: 49 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/dimension_py3.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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},
}

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
@@ -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'
3 changes: 1 addition & 2 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -30,7 +30,6 @@ class Source(Model):
"""

_validation = {
'query': {'required': True},
'data_source_id': {'required': True},
}

Expand Down
Loading