2020-05-18 07:34:40 +00:00
|
|
|
|
# coding: utf-8
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
import six
|
|
|
|
|
|
|
|
|
|
|
2020-07-15 09:30:15 +00:00
|
|
|
|
|
2021-07-26 11:24:08 +00:00
|
|
|
|
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
|
2020-07-15 09:30:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Condition:
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
Attributes:
|
|
|
|
|
openapi_types (dict): The key is attribute name
|
|
|
|
|
and the value is attribute type.
|
|
|
|
|
attribute_map (dict): The key is attribute name
|
|
|
|
|
and the value is json key in definition.
|
|
|
|
|
"""
|
|
|
|
|
|
2020-06-15 07:04:23 +00:00
|
|
|
|
sensitive_list = []
|
|
|
|
|
|
2020-05-18 07:34:40 +00:00
|
|
|
|
openapi_types = {
|
|
|
|
|
'comparison_operator': 'str',
|
|
|
|
|
'count': 'int',
|
|
|
|
|
'filter': 'str',
|
|
|
|
|
'period': 'int',
|
|
|
|
|
'unit': 'str',
|
2020-11-30 13:39:15 +00:00
|
|
|
|
'value': 'float',
|
|
|
|
|
'suppress_duration': 'int'
|
2020-05-18 07:34:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
attribute_map = {
|
|
|
|
|
'comparison_operator': 'comparison_operator',
|
|
|
|
|
'count': 'count',
|
|
|
|
|
'filter': 'filter',
|
|
|
|
|
'period': 'period',
|
|
|
|
|
'unit': 'unit',
|
2020-11-30 13:39:15 +00:00
|
|
|
|
'value': 'value',
|
|
|
|
|
'suppress_duration': 'suppress_duration'
|
2020-05-18 07:34:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-30 13:39:15 +00:00
|
|
|
|
def __init__(self, comparison_operator=None, count=None, filter=None, period=None, unit=None, value=None, suppress_duration=None):
|
2022-04-21 12:03:46 +00:00
|
|
|
|
"""Condition
|
|
|
|
|
|
|
|
|
|
The model defined in huaweicloud sdk
|
|
|
|
|
|
|
|
|
|
:param comparison_operator: 告警阈值的比较条件,可以是>、=、<、>=、<=。
|
|
|
|
|
:type comparison_operator: str
|
|
|
|
|
:param count: 触发告警的连续发生次数,取值范围[1, 5]。
|
|
|
|
|
:type count: int
|
|
|
|
|
:param filter: 数据聚合的方式,支持max、min、average、sum、variance,分别表示最大值、最小值、平均值、求和值、方差值。
|
|
|
|
|
:type filter: str
|
|
|
|
|
:param period: 告警条件判断周期,单位为秒,支持的值为1,300,1200,3600,14400,86400。说明:当period设置为1时,表示以原始的指标数据判断告警。当alarm_type为(EVENT.SYS| EVENT.CUSTOM)时允许为0。
|
|
|
|
|
:type period: int
|
|
|
|
|
:param unit: 数据的单位,最大长度为32位。
|
|
|
|
|
:type unit: str
|
|
|
|
|
:param value: 告警阈值,取值范围[0, Number.MAX_VALUE],Number.MAX_VALUE值为1.7976931348623157e+108。具体阈值取值请参见附录中各服务监控指标中取值范围,如支持监控的服务列表中ECS的CPU使用率cpu_util取值范围可配置80。
|
|
|
|
|
:type value: float
|
|
|
|
|
:param suppress_duration: 发送告警的周期,值可为0, 300, 600, 900, 1800, 3600, 10800, 21600, 43200, 86400;0表示只告警一次,300表示每5分钟告警一次,600表示每10分钟告警一次,900表示每15分钟告警一次,1800表示每30分钟告警一次,3600表示每1小时告警一次,10800表示每3小时告警一次,21600表示每6小时告警一次,43200表示每12小时告警一次,86400表示每1天告警一次。
|
|
|
|
|
:type suppress_duration: int
|
|
|
|
|
"""
|
2020-07-15 09:30:15 +00:00
|
|
|
|
|
|
|
|
|
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
self._comparison_operator = None
|
|
|
|
|
self._count = None
|
|
|
|
|
self._filter = None
|
|
|
|
|
self._period = None
|
|
|
|
|
self._unit = None
|
|
|
|
|
self._value = None
|
2020-11-30 13:39:15 +00:00
|
|
|
|
self._suppress_duration = None
|
2020-05-18 07:34:40 +00:00
|
|
|
|
self.discriminator = None
|
|
|
|
|
|
|
|
|
|
self.comparison_operator = comparison_operator
|
|
|
|
|
self.count = count
|
|
|
|
|
self.filter = filter
|
|
|
|
|
self.period = period
|
|
|
|
|
if unit is not None:
|
|
|
|
|
self.unit = unit
|
|
|
|
|
self.value = value
|
2020-11-30 13:39:15 +00:00
|
|
|
|
if suppress_duration is not None:
|
|
|
|
|
self.suppress_duration = suppress_duration
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def comparison_operator(self):
|
|
|
|
|
"""Gets the comparison_operator of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
告警阈值的比较条件,可以是>、=、<、>=、<=。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:return: The comparison_operator of this Condition.
|
|
|
|
|
:rtype: str
|
|
|
|
|
"""
|
|
|
|
|
return self._comparison_operator
|
|
|
|
|
|
|
|
|
|
@comparison_operator.setter
|
|
|
|
|
def comparison_operator(self, comparison_operator):
|
|
|
|
|
"""Sets the comparison_operator of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
告警阈值的比较条件,可以是>、=、<、>=、<=。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:param comparison_operator: The comparison_operator of this Condition.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type comparison_operator: str
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._comparison_operator = comparison_operator
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def count(self):
|
|
|
|
|
"""Gets the count of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
触发告警的连续发生次数,取值范围[1, 5]。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:return: The count of this Condition.
|
|
|
|
|
:rtype: int
|
|
|
|
|
"""
|
|
|
|
|
return self._count
|
|
|
|
|
|
|
|
|
|
@count.setter
|
|
|
|
|
def count(self, count):
|
|
|
|
|
"""Sets the count of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
触发告警的连续发生次数,取值范围[1, 5]。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:param count: The count of this Condition.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type count: int
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._count = count
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def filter(self):
|
|
|
|
|
"""Gets the filter of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
数据聚合的方式,支持max、min、average、sum、variance,分别表示最大值、最小值、平均值、求和值、方差值。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:return: The filter of this Condition.
|
|
|
|
|
:rtype: str
|
|
|
|
|
"""
|
|
|
|
|
return self._filter
|
|
|
|
|
|
|
|
|
|
@filter.setter
|
|
|
|
|
def filter(self, filter):
|
|
|
|
|
"""Sets the filter of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
数据聚合的方式,支持max、min、average、sum、variance,分别表示最大值、最小值、平均值、求和值、方差值。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:param filter: The filter of this Condition.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type filter: str
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._filter = filter
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def period(self):
|
|
|
|
|
"""Gets the period of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
告警条件判断周期,单位为秒,支持的值为1,300,1200,3600,14400,86400。说明:当period设置为1时,表示以原始的指标数据判断告警。当alarm_type为(EVENT.SYS| EVENT.CUSTOM)时允许为0。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:return: The period of this Condition.
|
|
|
|
|
:rtype: int
|
|
|
|
|
"""
|
|
|
|
|
return self._period
|
|
|
|
|
|
|
|
|
|
@period.setter
|
|
|
|
|
def period(self, period):
|
|
|
|
|
"""Sets the period of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
告警条件判断周期,单位为秒,支持的值为1,300,1200,3600,14400,86400。说明:当period设置为1时,表示以原始的指标数据判断告警。当alarm_type为(EVENT.SYS| EVENT.CUSTOM)时允许为0。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:param period: The period of this Condition.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type period: int
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._period = period
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def unit(self):
|
|
|
|
|
"""Gets the unit of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
数据的单位,最大长度为32位。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:return: The unit of this Condition.
|
|
|
|
|
:rtype: str
|
|
|
|
|
"""
|
|
|
|
|
return self._unit
|
|
|
|
|
|
|
|
|
|
@unit.setter
|
|
|
|
|
def unit(self, unit):
|
|
|
|
|
"""Sets the unit of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
数据的单位,最大长度为32位。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:param unit: The unit of this Condition.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type unit: str
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._unit = unit
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def value(self):
|
|
|
|
|
"""Gets the value of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
告警阈值,取值范围[0, Number.MAX_VALUE],Number.MAX_VALUE值为1.7976931348623157e+108。具体阈值取值请参见附录中各服务监控指标中取值范围,如支持监控的服务列表中ECS的CPU使用率cpu_util取值范围可配置80。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:return: The value of this Condition.
|
2020-11-02 12:51:27 +00:00
|
|
|
|
:rtype: float
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
return self._value
|
|
|
|
|
|
|
|
|
|
@value.setter
|
|
|
|
|
def value(self, value):
|
|
|
|
|
"""Sets the value of this Condition.
|
|
|
|
|
|
2020-09-30 02:47:34 +00:00
|
|
|
|
告警阈值,取值范围[0, Number.MAX_VALUE],Number.MAX_VALUE值为1.7976931348623157e+108。具体阈值取值请参见附录中各服务监控指标中取值范围,如支持监控的服务列表中ECS的CPU使用率cpu_util取值范围可配置80。
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
:param value: The value of this Condition.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type value: float
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._value = value
|
|
|
|
|
|
2020-11-30 13:39:15 +00:00
|
|
|
|
@property
|
|
|
|
|
def suppress_duration(self):
|
|
|
|
|
"""Gets the suppress_duration of this Condition.
|
|
|
|
|
|
|
|
|
|
发送告警的周期,值可为0, 300, 600, 900, 1800, 3600, 10800, 21600, 43200, 86400;0表示只告警一次,300表示每5分钟告警一次,600表示每10分钟告警一次,900表示每15分钟告警一次,1800表示每30分钟告警一次,3600表示每1小时告警一次,10800表示每3小时告警一次,21600表示每6小时告警一次,43200表示每12小时告警一次,86400表示每1天告警一次。
|
|
|
|
|
|
|
|
|
|
:return: The suppress_duration of this Condition.
|
|
|
|
|
:rtype: int
|
|
|
|
|
"""
|
|
|
|
|
return self._suppress_duration
|
|
|
|
|
|
|
|
|
|
@suppress_duration.setter
|
|
|
|
|
def suppress_duration(self, suppress_duration):
|
|
|
|
|
"""Sets the suppress_duration of this Condition.
|
|
|
|
|
|
|
|
|
|
发送告警的周期,值可为0, 300, 600, 900, 1800, 3600, 10800, 21600, 43200, 86400;0表示只告警一次,300表示每5分钟告警一次,600表示每10分钟告警一次,900表示每15分钟告警一次,1800表示每30分钟告警一次,3600表示每1小时告警一次,10800表示每3小时告警一次,21600表示每6小时告警一次,43200表示每12小时告警一次,86400表示每1天告警一次。
|
|
|
|
|
|
|
|
|
|
:param suppress_duration: The suppress_duration of this Condition.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type suppress_duration: int
|
2020-11-30 13:39:15 +00:00
|
|
|
|
"""
|
|
|
|
|
self._suppress_duration = suppress_duration
|
|
|
|
|
|
2020-05-18 07:34:40 +00:00
|
|
|
|
def to_dict(self):
|
|
|
|
|
"""Returns the model properties as a dict"""
|
|
|
|
|
result = {}
|
|
|
|
|
|
|
|
|
|
for attr, _ in six.iteritems(self.openapi_types):
|
|
|
|
|
value = getattr(self, attr)
|
|
|
|
|
if isinstance(value, list):
|
|
|
|
|
result[attr] = list(map(
|
|
|
|
|
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
|
|
|
|
|
value
|
|
|
|
|
))
|
|
|
|
|
elif hasattr(value, "to_dict"):
|
|
|
|
|
result[attr] = value.to_dict()
|
|
|
|
|
elif isinstance(value, dict):
|
|
|
|
|
result[attr] = dict(map(
|
|
|
|
|
lambda item: (item[0], item[1].to_dict())
|
|
|
|
|
if hasattr(item[1], "to_dict") else item,
|
|
|
|
|
value.items()
|
|
|
|
|
))
|
|
|
|
|
else:
|
2020-06-15 07:04:23 +00:00
|
|
|
|
if attr in self.sensitive_list:
|
|
|
|
|
result[attr] = "****"
|
|
|
|
|
else:
|
|
|
|
|
result[attr] = value
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
def to_str(self):
|
2021-08-10 12:26:18 +00:00
|
|
|
|
"""Returns the string representation of the model"""
|
2021-07-09 10:57:08 +00:00
|
|
|
|
import simplejson as json
|
2021-08-10 12:26:18 +00:00
|
|
|
|
if six.PY2:
|
|
|
|
|
import sys
|
|
|
|
|
reload(sys)
|
|
|
|
|
sys.setdefaultencoding("utf-8")
|
|
|
|
|
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
def __repr__(self):
|
2021-08-10 12:26:18 +00:00
|
|
|
|
"""For `print`"""
|
2020-05-18 07:34:40 +00:00
|
|
|
|
return self.to_str()
|
|
|
|
|
|
|
|
|
|
def __eq__(self, other):
|
|
|
|
|
"""Returns true if both objects are equal"""
|
|
|
|
|
if not isinstance(other, Condition):
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
return self.__dict__ == other.__dict__
|
|
|
|
|
|
|
|
|
|
def __ne__(self, other):
|
|
|
|
|
"""Returns true if both objects are not equal"""
|
|
|
|
|
return not self == other
|