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] MetricAlert swagger fix #3099

Closed
Closed
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
12 changes: 12 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,8 @@
from .trigger_condition_py3 import TriggerCondition
from .az_ns_action_group_py3 import AzNsActionGroup
from .alerting_action_py3 import AlertingAction
from .metric_namespace_name_py3 import MetricNamespaceName
from .metric_namespace_py3 import MetricNamespace
except (SyntaxError, ImportError):
from .resource import Resource
from .scale_capacity import ScaleCapacity
Expand Down Expand Up @@ -203,6 +205,8 @@
from .trigger_condition import TriggerCondition
from .az_ns_action_group import AzNsActionGroup
from .alerting_action import AlertingAction
from .metric_namespace_name import MetricNamespaceName
from .metric_namespace import MetricNamespace
from .autoscale_setting_resource_paged import AutoscaleSettingResourcePaged
from .incident_paged import IncidentPaged
from .alert_rule_resource_paged import AlertRuleResourcePaged
Expand All @@ -214,6 +218,7 @@
from .metric_definition_paged import MetricDefinitionPaged
from .metric_alert_resource_paged import MetricAlertResourcePaged
from .log_search_rule_resource_paged import LogSearchRuleResourcePaged
from .metric_namespace_paged import MetricNamespacePaged
from .monitor_management_client_enums import (
MetricStatisticType,
TimeAggregationType,
Expand All @@ -229,6 +234,8 @@
Unit,
AggregationType,
Sensitivity,
MetricAlertRuleCondition,
MetricAlertRuleTimeAggregation,
Enabled,
ProvisioningState,
QueryType,
Expand Down Expand Up @@ -335,6 +342,8 @@
'TriggerCondition',
'AzNsActionGroup',
'AlertingAction',
'MetricNamespaceName',
'MetricNamespace',
'AutoscaleSettingResourcePaged',
'IncidentPaged',
'AlertRuleResourcePaged',
Expand All @@ -346,6 +355,7 @@
'MetricDefinitionPaged',
'MetricAlertResourcePaged',
'LogSearchRuleResourcePaged',
'MetricNamespacePaged',
'MetricStatisticType',
'TimeAggregationType',
'ComparisonOperationType',
Expand All @@ -360,6 +370,8 @@
'Unit',
'AggregationType',
'Sensitivity',
'MetricAlertRuleCondition',
'MetricAlertRuleTimeAggregation',
'Enabled',
'ProvisioningState',
'QueryType',
Expand Down
14 changes: 9 additions & 5 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/metric_criteria.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ class MetricCriteria(Model):
:type metric_name: str
:param metric_namespace: Namespace of the metric.
:type metric_namespace: str
:param operator: Required. the criteria operator.
:type operator: object
:param operator: Required. the criteria operator. Possible values include:
'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan',
'LessThanOrEqual'
:type operator: str or ~azure.mgmt.monitor.models.MetricAlertRuleCondition
:param time_aggregation: Required. the criteria time aggregation types.
:type time_aggregation: object
Possible values include: 'Average', 'Minimum', 'Maximum', 'Total'
:type time_aggregation: str or
~azure.mgmt.monitor.models.MetricAlertRuleTimeAggregation
:param threshold: Required. the criteria threshold value that activates
the alert.
:type threshold: float
Expand All @@ -46,8 +50,8 @@ class MetricCriteria(Model):
'name': {'key': 'name', 'type': 'str'},
'metric_name': {'key': 'metricName', 'type': 'str'},
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'operator': {'key': 'operator', 'type': 'object'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'object'},
'operator': {'key': 'operator', 'type': 'str'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'str'},
'threshold': {'key': 'threshold', 'type': 'float'},
'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ class MetricCriteria(Model):
:type metric_name: str
:param metric_namespace: Namespace of the metric.
:type metric_namespace: str
:param operator: Required. the criteria operator.
:type operator: object
:param operator: Required. the criteria operator. Possible values include:
'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan',
'LessThanOrEqual'
:type operator: str or ~azure.mgmt.monitor.models.MetricAlertRuleCondition
:param time_aggregation: Required. the criteria time aggregation types.
:type time_aggregation: object
Possible values include: 'Average', 'Minimum', 'Maximum', 'Total'
:type time_aggregation: str or
~azure.mgmt.monitor.models.MetricAlertRuleTimeAggregation
:param threshold: Required. the criteria threshold value that activates
the alert.
:type threshold: float
Expand All @@ -46,8 +50,8 @@ class MetricCriteria(Model):
'name': {'key': 'name', 'type': 'str'},
'metric_name': {'key': 'metricName', 'type': 'str'},
'metric_namespace': {'key': 'metricNamespace', 'type': 'str'},
'operator': {'key': 'operator', 'type': 'object'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'object'},
'operator': {'key': 'operator', 'type': 'str'},
'time_aggregation': {'key': 'timeAggregation', 'type': 'str'},
'threshold': {'key': 'threshold', 'type': 'float'},
'dimensions': {'key': 'dimensions', 'type': '[MetricDimension]'},
}
Expand Down
41 changes: 41 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/models/metric_namespace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 MetricNamespace(Model):
"""Metric namespace class specifies the metadata for a metric namespace.

:param id: The ID of the metricNamespace.
:type id: str
:param type: The type of the namespace.
:type type: str
:param name: The name of the namespace.
:type name: str
:param properties: Properties which include the fully qualified namespace
name.
:type properties: ~azure.mgmt.monitor.models.MetricNamespaceName
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'MetricNamespaceName'},
}

def __init__(self, **kwargs):
super(MetricNamespace, self).__init__(**kwargs)
self.id = kwargs.get('id', None)
self.type = kwargs.get('type', None)
self.name = kwargs.get('name', None)
self.properties = kwargs.get('properties', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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 MetricNamespaceName(Model):
"""The fully qualified metric namespace name.

:param metric_namespace_name: The metric namespace name.
:type metric_namespace_name: str
"""

_attribute_map = {
'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'},
}

def __init__(self, **kwargs):
super(MetricNamespaceName, self).__init__(**kwargs)
self.metric_namespace_name = kwargs.get('metric_namespace_name', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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 MetricNamespaceName(Model):
"""The fully qualified metric namespace name.

:param metric_namespace_name: The metric namespace name.
:type metric_namespace_name: str
"""

_attribute_map = {
'metric_namespace_name': {'key': 'metricNamespaceName', 'type': 'str'},
}

def __init__(self, *, metric_namespace_name: str=None, **kwargs) -> None:
super(MetricNamespaceName, self).__init__(**kwargs)
self.metric_namespace_name = metric_namespace_name
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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.paging import Paged


class MetricNamespacePaged(Paged):
"""
A paging container for iterating over a list of :class:`MetricNamespace <azure.mgmt.monitor.models.MetricNamespace>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[MetricNamespace]'}
}

def __init__(self, *args, **kwargs):

super(MetricNamespacePaged, self).__init__(*args, **kwargs)
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 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 MetricNamespace(Model):
"""Metric namespace class specifies the metadata for a metric namespace.

:param id: The ID of the metricNamespace.
:type id: str
:param type: The type of the namespace.
:type type: str
:param name: The name of the namespace.
:type name: str
:param properties: Properties which include the fully qualified namespace
name.
:type properties: ~azure.mgmt.monitor.models.MetricNamespaceName
"""

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'MetricNamespaceName'},
}

def __init__(self, *, id: str=None, type: str=None, name: str=None, properties=None, **kwargs) -> None:
super(MetricNamespace, self).__init__(**kwargs)
self.id = id
self.type = type
self.name = name
self.properties = properties
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ class Sensitivity(str, Enum):
high = "High"


class MetricAlertRuleCondition(str, Enum):

equals = "Equals"
not_equals = "NotEquals"
greater_than = "GreaterThan"
greater_than_or_equal = "GreaterThanOrEqual"
less_than = "LessThan"
less_than_or_equal = "LessThanOrEqual"


class MetricAlertRuleTimeAggregation(str, Enum):

average = "Average"
minimum = "Minimum"
maximum = "Maximum"
total = "Total"


class Enabled(str, Enum):

true = "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from .operations.metric_alerts_operations import MetricAlertsOperations
from .operations.metric_alerts_status_operations import MetricAlertsStatusOperations
from .operations.scheduled_query_rules_operations import ScheduledQueryRulesOperations
from .operations.metric_namespaces_operations import MetricNamespacesOperations
from . import models


Expand Down Expand Up @@ -108,6 +109,8 @@ class MonitorManagementClient(SDKClient):
:vartype metric_alerts_status: azure.mgmt.monitor.operations.MetricAlertsStatusOperations
:ivar scheduled_query_rules: ScheduledQueryRules operations
:vartype scheduled_query_rules: azure.mgmt.monitor.operations.ScheduledQueryRulesOperations
:ivar metric_namespaces: MetricNamespaces operations
:vartype metric_namespaces: azure.mgmt.monitor.operations.MetricNamespacesOperations

:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
Expand Down Expand Up @@ -163,3 +166,5 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.scheduled_query_rules = ScheduledQueryRulesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.metric_namespaces = MetricNamespacesOperations(
self._client, self.config, self._serialize, self._deserialize)
2 changes: 2 additions & 0 deletions azure-mgmt-monitor/azure/mgmt/monitor/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .metric_alerts_operations import MetricAlertsOperations
from .metric_alerts_status_operations import MetricAlertsStatusOperations
from .scheduled_query_rules_operations import ScheduledQueryRulesOperations
from .metric_namespaces_operations import MetricNamespacesOperations

__all__ = [
'AutoscaleSettingsOperations',
Expand All @@ -47,4 +48,5 @@
'MetricAlertsOperations',
'MetricAlertsStatusOperations',
'ScheduledQueryRulesOperations',
'MetricNamespacesOperations',
]
Loading