huaweicloud-sdk-python-v3/huaweicloud-sdk-ces/huaweicloudsdkces/v1/model/metric_alarms.py

574 lines
22 KiB
Python
Raw Normal View History

2020-05-18 07:34:40 +00:00
# coding: utf-8
import re
import six
2021-07-26 11:24:08 +00:00
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class MetricAlarms:
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.
"""
sensitive_list = []
2020-05-18 07:34:40 +00:00
openapi_types = {
'alarm_name': 'str',
'alarm_description': 'str',
'metric': 'MetricInfoForAlarm',
2020-05-18 07:34:40 +00:00
'condition': 'Condition',
'alarm_enabled': 'bool',
'alarm_level': 'int',
'alarm_type': 'str',
'alarm_action_enabled': 'bool',
'alarm_actions': 'list[AlarmActions]',
'ok_actions': 'list[AlarmActions]',
'insufficientdata_actions': 'list[AlarmActions]',
'alarm_action_begin_time': 'str',
'alarm_action_end_time': 'str',
2020-05-18 07:34:40 +00:00
'alarm_id': 'str',
'update_time': 'int',
'alarm_state': 'str',
'enterprise_project_id': 'str'
2020-05-18 07:34:40 +00:00
}
attribute_map = {
'alarm_name': 'alarm_name',
'alarm_description': 'alarm_description',
'metric': 'metric',
'condition': 'condition',
'alarm_enabled': 'alarm_enabled',
'alarm_level': 'alarm_level',
'alarm_type': 'alarm_type',
'alarm_action_enabled': 'alarm_action_enabled',
'alarm_actions': 'alarm_actions',
'ok_actions': 'ok_actions',
'insufficientdata_actions': 'insufficientdata_actions',
'alarm_action_begin_time': 'alarm_action_begin_time',
'alarm_action_end_time': 'alarm_action_end_time',
2020-05-18 07:34:40 +00:00
'alarm_id': 'alarm_id',
'update_time': 'update_time',
'alarm_state': 'alarm_state',
'enterprise_project_id': 'enterprise_project_id'
2020-05-18 07:34:40 +00:00
}
def __init__(self, alarm_name=None, alarm_description=None, metric=None, condition=None, alarm_enabled=None, alarm_level=None, alarm_type=None, alarm_action_enabled=None, alarm_actions=None, ok_actions=None, insufficientdata_actions=None, alarm_action_begin_time=None, alarm_action_end_time=None, alarm_id=None, update_time=None, alarm_state=None, enterprise_project_id=None):
2022-04-21 12:03:46 +00:00
"""MetricAlarms
The model defined in huaweicloud sdk
:param alarm_name: 告警名称
:type alarm_name: str
:param alarm_description: 告警描述
:type alarm_description: str
:param metric:
:type metric: :class:`huaweicloudsdkces.v1.MetricInfoForAlarm`
:param condition:
:type condition: :class:`huaweicloudsdkces.v1.Condition`
:param alarm_enabled: 是否启用该条告警
:type alarm_enabled: bool
:param alarm_level: 告警级别默认为2级别为1234分别对应紧急重要次要提示
:type alarm_level: int
:param alarm_type: 告警类型 仅针对事件告警的参数枚举类型EVENT.SYS或者EVENT.CUSTOM
:type alarm_type: str
:param alarm_action_enabled: 是否启用该条告警触发的动作
:type alarm_action_enabled: bool
:param alarm_actions: 告警触发的动作 结构如下 { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值 notification通知 autoscaling弹性伸缩 notificationList告警状态发生变化时被通知对象的列表
:type alarm_actions: list[:class:`huaweicloudsdkces.v1.AlarmActions`]
:param ok_actions: 告警恢复触发的动作 结构如下 { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值 notification通知 notificationList告警状态发生变化时被通知对象的列表
:type ok_actions: list[:class:`huaweicloudsdkces.v1.AlarmActions`]
:param insufficientdata_actions: 数据不足触发的动作 结构如下 { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值 数据不足触发告警通知类型取值为notification notificationList数据不足触发告警通知时被通知对象的ID列表
:type insufficientdata_actions: list[:class:`huaweicloudsdkces.v1.AlarmActions`]
:param alarm_action_begin_time: 告警规则生效的开始时间告警规则仅在生效时间内发送通知消息例如alarm_action_begin_time为8:00alarm_action_end_time为20:00则对应的告警规则仅在08:00-20:00发送通知消息
:type alarm_action_begin_time: str
:param alarm_action_end_time: 告警规则生效的结束时间告警规则仅在生效时间内发送通知消息例如alarm_action_begin_time为8:00alarm_action_end_time为20:00则对应的告警规则仅在08:00-20:00发送通知消息
:type alarm_action_end_time: str
:param alarm_id: 告警规则的ID
:type alarm_id: str
:param update_time: 告警状态变更的时间UNIX时间戳单位毫秒
:type update_time: int
:param alarm_state: 告警状态取值说明 ok正常 alarm告警 insufficient_data数据不足
:type alarm_state: str
:param enterprise_project_id: 企业项目ID 取值为all_granted_eps时表示所有企业项目; 取值为0时表示默认的企业项目default
:type enterprise_project_id: str
"""
2020-05-18 07:34:40 +00:00
self._alarm_name = None
self._alarm_description = None
self._metric = None
self._condition = None
self._alarm_enabled = None
self._alarm_level = None
self._alarm_type = None
self._alarm_action_enabled = None
self._alarm_actions = None
self._ok_actions = None
self._insufficientdata_actions = None
self._alarm_action_begin_time = None
self._alarm_action_end_time = None
2020-05-18 07:34:40 +00:00
self._alarm_id = None
self._update_time = None
self._alarm_state = None
self._enterprise_project_id = None
2020-05-18 07:34:40 +00:00
self.discriminator = None
self.alarm_name = alarm_name
if alarm_description is not None:
self.alarm_description = alarm_description
self.metric = metric
self.condition = condition
if alarm_enabled is not None:
self.alarm_enabled = alarm_enabled
if alarm_level is not None:
self.alarm_level = alarm_level
if alarm_type is not None:
self.alarm_type = alarm_type
if alarm_action_enabled is not None:
self.alarm_action_enabled = alarm_action_enabled
if alarm_actions is not None:
self.alarm_actions = alarm_actions
if ok_actions is not None:
self.ok_actions = ok_actions
if insufficientdata_actions is not None:
self.insufficientdata_actions = insufficientdata_actions
if alarm_action_begin_time is not None:
self.alarm_action_begin_time = alarm_action_begin_time
if alarm_action_end_time is not None:
self.alarm_action_end_time = alarm_action_end_time
2020-05-18 07:34:40 +00:00
self.alarm_id = alarm_id
self.update_time = update_time
self.alarm_state = alarm_state
if enterprise_project_id is not None:
self.enterprise_project_id = enterprise_project_id
2020-05-18 07:34:40 +00:00
@property
def alarm_name(self):
"""Gets the alarm_name of this MetricAlarms.
告警名称
:return: The alarm_name of this MetricAlarms.
:rtype: str
"""
return self._alarm_name
@alarm_name.setter
def alarm_name(self, alarm_name):
"""Sets the alarm_name of this MetricAlarms.
告警名称
:param alarm_name: The alarm_name of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_name: str
2020-05-18 07:34:40 +00:00
"""
self._alarm_name = alarm_name
@property
def alarm_description(self):
"""Gets the alarm_description of this MetricAlarms.
告警描述
:return: The alarm_description of this MetricAlarms.
:rtype: str
"""
return self._alarm_description
@alarm_description.setter
def alarm_description(self, alarm_description):
"""Sets the alarm_description of this MetricAlarms.
告警描述
:param alarm_description: The alarm_description of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_description: str
2020-05-18 07:34:40 +00:00
"""
self._alarm_description = alarm_description
@property
def metric(self):
"""Gets the metric of this MetricAlarms.
:return: The metric of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:rtype: :class:`huaweicloudsdkces.v1.MetricInfoForAlarm`
2020-05-18 07:34:40 +00:00
"""
return self._metric
@metric.setter
def metric(self, metric):
"""Sets the metric of this MetricAlarms.
:param metric: The metric of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type metric: :class:`huaweicloudsdkces.v1.MetricInfoForAlarm`
2020-05-18 07:34:40 +00:00
"""
self._metric = metric
@property
def condition(self):
"""Gets the condition of this MetricAlarms.
:return: The condition of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:rtype: :class:`huaweicloudsdkces.v1.Condition`
2020-05-18 07:34:40 +00:00
"""
return self._condition
@condition.setter
def condition(self, condition):
"""Sets the condition of this MetricAlarms.
:param condition: The condition of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type condition: :class:`huaweicloudsdkces.v1.Condition`
2020-05-18 07:34:40 +00:00
"""
self._condition = condition
@property
def alarm_enabled(self):
"""Gets the alarm_enabled of this MetricAlarms.
是否启用该条告警
:return: The alarm_enabled of this MetricAlarms.
:rtype: bool
"""
return self._alarm_enabled
@alarm_enabled.setter
def alarm_enabled(self, alarm_enabled):
"""Sets the alarm_enabled of this MetricAlarms.
是否启用该条告警
:param alarm_enabled: The alarm_enabled of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_enabled: bool
2020-05-18 07:34:40 +00:00
"""
self._alarm_enabled = alarm_enabled
@property
def alarm_level(self):
"""Gets the alarm_level of this MetricAlarms.
告警级别默认为2级别为1234分别对应紧急重要次要提示
:return: The alarm_level of this MetricAlarms.
:rtype: int
"""
return self._alarm_level
@alarm_level.setter
def alarm_level(self, alarm_level):
"""Sets the alarm_level of this MetricAlarms.
告警级别默认为2级别为1234分别对应紧急重要次要提示
:param alarm_level: The alarm_level of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_level: int
2020-05-18 07:34:40 +00:00
"""
self._alarm_level = alarm_level
@property
def alarm_type(self):
"""Gets the alarm_type of this MetricAlarms.
告警类型 仅针对事件告警的参数枚举类型EVENT.SYS或者EVENT.CUSTOM
:return: The alarm_type of this MetricAlarms.
:rtype: str
"""
return self._alarm_type
@alarm_type.setter
def alarm_type(self, alarm_type):
"""Sets the alarm_type of this MetricAlarms.
告警类型 仅针对事件告警的参数枚举类型EVENT.SYS或者EVENT.CUSTOM
:param alarm_type: The alarm_type of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_type: str
2020-05-18 07:34:40 +00:00
"""
self._alarm_type = alarm_type
@property
def alarm_action_enabled(self):
"""Gets the alarm_action_enabled of this MetricAlarms.
是否启用该条告警触发的动作
:return: The alarm_action_enabled of this MetricAlarms.
:rtype: bool
"""
return self._alarm_action_enabled
@alarm_action_enabled.setter
def alarm_action_enabled(self, alarm_action_enabled):
"""Sets the alarm_action_enabled of this MetricAlarms.
是否启用该条告警触发的动作
:param alarm_action_enabled: The alarm_action_enabled of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_action_enabled: bool
2020-05-18 07:34:40 +00:00
"""
self._alarm_action_enabled = alarm_action_enabled
@property
def alarm_actions(self):
"""Gets the alarm_actions of this MetricAlarms.
告警触发的动作 结构如下 { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值 notification通知。 autoscaling弹性伸缩。 notificationList告警状态发生变化时被通知对象的列表。
:return: The alarm_actions of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:rtype: list[:class:`huaweicloudsdkces.v1.AlarmActions`]
2020-05-18 07:34:40 +00:00
"""
return self._alarm_actions
@alarm_actions.setter
def alarm_actions(self, alarm_actions):
"""Sets the alarm_actions of this MetricAlarms.
告警触发的动作 结构如下 { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值 notification通知。 autoscaling弹性伸缩。 notificationList告警状态发生变化时被通知对象的列表。
:param alarm_actions: The alarm_actions of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_actions: list[:class:`huaweicloudsdkces.v1.AlarmActions`]
2020-05-18 07:34:40 +00:00
"""
self._alarm_actions = alarm_actions
@property
def ok_actions(self):
"""Gets the ok_actions of this MetricAlarms.
告警恢复触发的动作 结构如下 { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值 notification通知。 notificationList告警状态发生变化时被通知对象的列表。
2020-05-18 07:34:40 +00:00
:return: The ok_actions of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:rtype: list[:class:`huaweicloudsdkces.v1.AlarmActions`]
2020-05-18 07:34:40 +00:00
"""
return self._ok_actions
@ok_actions.setter
def ok_actions(self, ok_actions):
"""Sets the ok_actions of this MetricAlarms.
告警恢复触发的动作 结构如下 { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值 notification通知。 notificationList告警状态发生变化时被通知对象的列表。
2020-05-18 07:34:40 +00:00
:param ok_actions: The ok_actions of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type ok_actions: list[:class:`huaweicloudsdkces.v1.AlarmActions`]
2020-05-18 07:34:40 +00:00
"""
self._ok_actions = ok_actions
@property
def insufficientdata_actions(self):
"""Gets the insufficientdata_actions of this MetricAlarms.
数据不足触发的动作 结构如下 { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值 数据不足触发告警通知类型取值为notification。 notificationList数据不足触发告警通知时被通知对象的ID列表。
:return: The insufficientdata_actions of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:rtype: list[:class:`huaweicloudsdkces.v1.AlarmActions`]
"""
return self._insufficientdata_actions
@insufficientdata_actions.setter
def insufficientdata_actions(self, insufficientdata_actions):
"""Sets the insufficientdata_actions of this MetricAlarms.
数据不足触发的动作 结构如下 { \"type\": \"notification\", \"notificationList\": [\"urn:smn:southchina:68438a86d98e427e907e0097b7e35d47:sd\"] } type取值 数据不足触发告警通知类型取值为notification。 notificationList数据不足触发告警通知时被通知对象的ID列表。
:param insufficientdata_actions: The insufficientdata_actions of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type insufficientdata_actions: list[:class:`huaweicloudsdkces.v1.AlarmActions`]
"""
self._insufficientdata_actions = insufficientdata_actions
@property
def alarm_action_begin_time(self):
"""Gets the alarm_action_begin_time of this MetricAlarms.
告警规则生效的开始时间告警规则仅在生效时间内发送通知消息例如alarm_action_begin_time为8:00alarm_action_end_time为20:00则对应的告警规则仅在08:00-20:00发送通知消息
:return: The alarm_action_begin_time of this MetricAlarms.
:rtype: str
"""
return self._alarm_action_begin_time
@alarm_action_begin_time.setter
def alarm_action_begin_time(self, alarm_action_begin_time):
"""Sets the alarm_action_begin_time of this MetricAlarms.
告警规则生效的开始时间告警规则仅在生效时间内发送通知消息例如alarm_action_begin_time为8:00alarm_action_end_time为20:00则对应的告警规则仅在08:00-20:00发送通知消息
:param alarm_action_begin_time: The alarm_action_begin_time of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_action_begin_time: str
"""
self._alarm_action_begin_time = alarm_action_begin_time
@property
def alarm_action_end_time(self):
"""Gets the alarm_action_end_time of this MetricAlarms.
告警规则生效的结束时间告警规则仅在生效时间内发送通知消息例如alarm_action_begin_time为8:00alarm_action_end_time为20:00则对应的告警规则仅在08:00-20:00发送通知消息
:return: The alarm_action_end_time of this MetricAlarms.
:rtype: str
"""
return self._alarm_action_end_time
@alarm_action_end_time.setter
def alarm_action_end_time(self, alarm_action_end_time):
"""Sets the alarm_action_end_time of this MetricAlarms.
告警规则生效的结束时间告警规则仅在生效时间内发送通知消息例如alarm_action_begin_time为8:00alarm_action_end_time为20:00则对应的告警规则仅在08:00-20:00发送通知消息
:param alarm_action_end_time: The alarm_action_end_time of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_action_end_time: str
"""
self._alarm_action_end_time = alarm_action_end_time
2020-05-18 07:34:40 +00:00
@property
def alarm_id(self):
"""Gets the alarm_id of this MetricAlarms.
告警规则的ID
:return: The alarm_id of this MetricAlarms.
:rtype: str
"""
return self._alarm_id
@alarm_id.setter
def alarm_id(self, alarm_id):
"""Sets the alarm_id of this MetricAlarms.
告警规则的ID
:param alarm_id: The alarm_id of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_id: str
2020-05-18 07:34:40 +00:00
"""
self._alarm_id = alarm_id
@property
def update_time(self):
"""Gets the update_time of this MetricAlarms.
告警状态变更的时间UNIX时间戳单位毫秒
:return: The update_time of this MetricAlarms.
:rtype: int
"""
return self._update_time
@update_time.setter
def update_time(self, update_time):
"""Sets the update_time of this MetricAlarms.
告警状态变更的时间UNIX时间戳单位毫秒
:param update_time: The update_time of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type update_time: int
2020-05-18 07:34:40 +00:00
"""
self._update_time = update_time
@property
def alarm_state(self):
"""Gets the alarm_state of this MetricAlarms.
告警状态取值说明 ok正常 alarm告警 insufficient_data数据不足
:return: The alarm_state of this MetricAlarms.
:rtype: str
"""
return self._alarm_state
@alarm_state.setter
def alarm_state(self, alarm_state):
"""Sets the alarm_state of this MetricAlarms.
告警状态取值说明 ok正常 alarm告警 insufficient_data数据不足
:param alarm_state: The alarm_state of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type alarm_state: str
2020-05-18 07:34:40 +00:00
"""
self._alarm_state = alarm_state
@property
def enterprise_project_id(self):
"""Gets the enterprise_project_id of this MetricAlarms.
企业项目ID 取值为all_granted_eps时表示所有企业项目; 取值为0时表示默认的企业项目default
:return: The enterprise_project_id of this MetricAlarms.
:rtype: str
"""
return self._enterprise_project_id
@enterprise_project_id.setter
def enterprise_project_id(self, enterprise_project_id):
"""Sets the enterprise_project_id of this MetricAlarms.
企业项目ID 取值为all_granted_eps时表示所有企业项目; 取值为0时表示默认的企业项目default
:param enterprise_project_id: The enterprise_project_id of this MetricAlarms.
2022-04-21 12:03:46 +00:00
:type enterprise_project_id: str
"""
self._enterprise_project_id = enterprise_project_id
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:
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, MetricAlarms):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other