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 MetricDataItem:
|
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 = {
|
|
|
|
|
'metric': 'MetricInfo',
|
|
|
|
|
'ttl': 'int',
|
|
|
|
|
'collect_time': 'int',
|
|
|
|
|
'value': 'float',
|
|
|
|
|
'unit': 'str',
|
|
|
|
|
'type': 'str'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
attribute_map = {
|
|
|
|
|
'metric': 'metric',
|
|
|
|
|
'ttl': 'ttl',
|
|
|
|
|
'collect_time': 'collect_time',
|
|
|
|
|
'value': 'value',
|
|
|
|
|
'unit': 'unit',
|
|
|
|
|
'type': 'type'
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-15 09:30:15 +00:00
|
|
|
|
def __init__(self, metric=None, ttl=None, collect_time=None, value=None, unit=None, type=None):
|
2022-04-21 12:03:46 +00:00
|
|
|
|
"""MetricDataItem
|
|
|
|
|
|
|
|
|
|
The model defined in huaweicloud sdk
|
|
|
|
|
|
|
|
|
|
:param metric:
|
|
|
|
|
:type metric: :class:`huaweicloudsdkces.v1.MetricInfo`
|
|
|
|
|
:param ttl: 数据的有效期,超出该有效期则自动删除该数据,单位秒,最大值604800。
|
|
|
|
|
:type ttl: int
|
|
|
|
|
:param collect_time: 数据收集时间 UNIX时间戳,单位毫秒。 说明: 因为客户端到服务器端有延时,因此插入数据的时间戳应该在[当前时间-3天+20秒,当前时间+10分钟-20秒]区间内,保证到达服务器时不会因为传输时延造成数据不能插入数据库。
|
|
|
|
|
:type collect_time: int
|
|
|
|
|
:param value: 指标数据的值。
|
|
|
|
|
:type value: float
|
|
|
|
|
:param unit: 数据的单位。
|
|
|
|
|
:type unit: str
|
|
|
|
|
:param type: 数据的类型,只能是\"int\"或\"float\"
|
|
|
|
|
:type type: str
|
|
|
|
|
"""
|
2020-07-15 09:30:15 +00:00
|
|
|
|
|
|
|
|
|
|
2020-05-18 07:34:40 +00:00
|
|
|
|
|
|
|
|
|
self._metric = None
|
|
|
|
|
self._ttl = None
|
|
|
|
|
self._collect_time = None
|
|
|
|
|
self._value = None
|
|
|
|
|
self._unit = None
|
|
|
|
|
self._type = None
|
|
|
|
|
self.discriminator = None
|
|
|
|
|
|
|
|
|
|
self.metric = metric
|
|
|
|
|
self.ttl = ttl
|
|
|
|
|
self.collect_time = collect_time
|
|
|
|
|
self.value = value
|
|
|
|
|
if unit is not None:
|
|
|
|
|
self.unit = unit
|
|
|
|
|
if type is not None:
|
|
|
|
|
self.type = type
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def metric(self):
|
|
|
|
|
"""Gets the metric of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:return: The metric of this MetricDataItem.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:rtype: :class:`huaweicloudsdkces.v1.MetricInfo`
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
return self._metric
|
|
|
|
|
|
|
|
|
|
@metric.setter
|
|
|
|
|
def metric(self, metric):
|
|
|
|
|
"""Sets the metric of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:param metric: The metric of this MetricDataItem.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type metric: :class:`huaweicloudsdkces.v1.MetricInfo`
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._metric = metric
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def ttl(self):
|
|
|
|
|
"""Gets the ttl of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
数据的有效期,超出该有效期则自动删除该数据,单位秒,最大值604800。
|
|
|
|
|
|
|
|
|
|
:return: The ttl of this MetricDataItem.
|
|
|
|
|
:rtype: int
|
|
|
|
|
"""
|
|
|
|
|
return self._ttl
|
|
|
|
|
|
|
|
|
|
@ttl.setter
|
|
|
|
|
def ttl(self, ttl):
|
|
|
|
|
"""Sets the ttl of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
数据的有效期,超出该有效期则自动删除该数据,单位秒,最大值604800。
|
|
|
|
|
|
|
|
|
|
:param ttl: The ttl of this MetricDataItem.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type ttl: int
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._ttl = ttl
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def collect_time(self):
|
|
|
|
|
"""Gets the collect_time of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
数据收集时间 UNIX时间戳,单位毫秒。 说明: 因为客户端到服务器端有延时,因此插入数据的时间戳应该在[当前时间-3天+20秒,当前时间+10分钟-20秒]区间内,保证到达服务器时不会因为传输时延造成数据不能插入数据库。
|
|
|
|
|
|
|
|
|
|
:return: The collect_time of this MetricDataItem.
|
|
|
|
|
:rtype: int
|
|
|
|
|
"""
|
|
|
|
|
return self._collect_time
|
|
|
|
|
|
|
|
|
|
@collect_time.setter
|
|
|
|
|
def collect_time(self, collect_time):
|
|
|
|
|
"""Sets the collect_time of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
数据收集时间 UNIX时间戳,单位毫秒。 说明: 因为客户端到服务器端有延时,因此插入数据的时间戳应该在[当前时间-3天+20秒,当前时间+10分钟-20秒]区间内,保证到达服务器时不会因为传输时延造成数据不能插入数据库。
|
|
|
|
|
|
|
|
|
|
:param collect_time: The collect_time of this MetricDataItem.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type collect_time: int
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._collect_time = collect_time
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def value(self):
|
|
|
|
|
"""Gets the value of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
指标数据的值。
|
|
|
|
|
|
|
|
|
|
:return: The value of this MetricDataItem.
|
|
|
|
|
:rtype: float
|
|
|
|
|
"""
|
|
|
|
|
return self._value
|
|
|
|
|
|
|
|
|
|
@value.setter
|
|
|
|
|
def value(self, value):
|
|
|
|
|
"""Sets the value of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
指标数据的值。
|
|
|
|
|
|
|
|
|
|
:param value: The value of this MetricDataItem.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type value: float
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._value = value
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def unit(self):
|
|
|
|
|
"""Gets the unit of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
数据的单位。
|
|
|
|
|
|
|
|
|
|
:return: The unit of this MetricDataItem.
|
|
|
|
|
:rtype: str
|
|
|
|
|
"""
|
|
|
|
|
return self._unit
|
|
|
|
|
|
|
|
|
|
@unit.setter
|
|
|
|
|
def unit(self, unit):
|
|
|
|
|
"""Sets the unit of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
数据的单位。
|
|
|
|
|
|
|
|
|
|
:param unit: The unit of this MetricDataItem.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type unit: str
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._unit = unit
|
|
|
|
|
|
|
|
|
|
@property
|
|
|
|
|
def type(self):
|
|
|
|
|
"""Gets the type of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
数据的类型,只能是\"int\"或\"float\"
|
|
|
|
|
|
|
|
|
|
:return: The type of this MetricDataItem.
|
|
|
|
|
:rtype: str
|
|
|
|
|
"""
|
|
|
|
|
return self._type
|
|
|
|
|
|
|
|
|
|
@type.setter
|
|
|
|
|
def type(self, type):
|
|
|
|
|
"""Sets the type of this MetricDataItem.
|
|
|
|
|
|
|
|
|
|
数据的类型,只能是\"int\"或\"float\"
|
|
|
|
|
|
|
|
|
|
:param type: The type of this MetricDataItem.
|
2022-04-21 12:03:46 +00:00
|
|
|
|
:type type: str
|
2020-05-18 07:34:40 +00:00
|
|
|
|
"""
|
|
|
|
|
self._type = type
|
|
|
|
|
|
|
|
|
|
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, MetricDataItem):
|
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
|
return self.__dict__ == other.__dict__
|
|
|
|
|
|
|
|
|
|
def __ne__(self, other):
|
|
|
|
|
"""Returns true if both objects are not equal"""
|
|
|
|
|
return not self == other
|