Skip to content

Commit

Permalink
[AutoPR monitor/resource-manager] Adding patch support for SQR API (#…
Browse files Browse the repository at this point in the history
…2596)

* Generated from f53526896e5c001f79bd46ca892f825172b53abf

Merge branch 'master' into patchsupport

* Generated from f53526896e5c001f79bd46ca892f825172b53abf

Merge branch 'master' into patchsupport

* Generated from b37d3ace14508e3bc3f87ee29b7f2ad0b7025f67

Resolving multiple model issue

Changes - 
1. Renamed "MetricTrigger" to "LogMetricTrigger"
2. Aligned "Resources" to other specs
  • Loading branch information
AutorestCI committed Jun 6, 2018
1 parent 7d3085e commit eac2d5c
Show file tree
Hide file tree
Showing 11 changed files with 259 additions and 56 deletions.
14 changes: 10 additions & 4 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
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
Expand Down Expand Up @@ -196,6 +198,8 @@
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
Expand All @@ -214,8 +218,6 @@
MetricStatisticType,
TimeAggregationType,
ComparisonOperationType,
ConditionalOperator,
MetricTriggerType,
ScaleDirection,
ScaleType,
RecurrenceFrequency,
Expand All @@ -230,6 +232,8 @@
Enabled,
ProvisioningState,
QueryType,
ConditionalOperator,
MetricTriggerType,
AlertSeverity,
ResultType,
)
Expand Down Expand Up @@ -326,6 +330,8 @@
'Schedule',
'Action',
'LogSearchRuleResource',
'LogSearchRuleResourcePatch',
'LogMetricTrigger',
'TriggerCondition',
'AzNsActionGroup',
'AlertingAction',
Expand All @@ -343,8 +349,6 @@
'MetricStatisticType',
'TimeAggregationType',
'ComparisonOperationType',
'ConditionalOperator',
'MetricTriggerType',
'ScaleDirection',
'ScaleType',
'RecurrenceFrequency',
Expand All @@ -359,6 +363,8 @@
'Enabled',
'ProvisioningState',
'QueryType',
'ConditionalOperator',
'MetricTriggerType',
'AlertSeverity',
'ResultType',
]
45 changes: 45 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/log_metric_trigger.py
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
@@ -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
17 changes: 0 additions & 17 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/metric_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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):
Expand All @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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:
Expand Down
Loading

0 comments on commit eac2d5c

Please sign in to comment.