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

178 lines
5.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding: utf-8
import re
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ResourceGroup:
"""
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 = []
openapi_types = {
'namespace': 'str',
'dimensions': 'list[MetricsDimension]',
'status': 'str'
}
attribute_map = {
'namespace': 'namespace',
'dimensions': 'dimensions',
'status': 'status'
}
def __init__(self, namespace=None, dimensions=None, status=None):
"""ResourceGroup
The model defined in huaweicloud sdk
:param namespace: 资源类型。即命名空间如弹性云服务器的资源命名空间为SYS.ECS各服务的命名空间可查看“[服务命名空间](https://support.huaweicloud.com/usermanual-ces/zh-cn_topic_0202622212.html)”。
:type namespace: str
:param dimensions: 一个或者多个资源维度。
:type dimensions: list[:class:`huaweicloudsdkces.v1.MetricsDimension`]
:param status: 资源分组中该资源的当前状态值可为health、unhealth、no_alarm_rulehealth表示健康unhealth表示不健康no_alarm_rule表示未设置告警规则。
:type status: str
"""
self._namespace = None
self._dimensions = None
self._status = None
self.discriminator = None
if namespace is not None:
self.namespace = namespace
if dimensions is not None:
self.dimensions = dimensions
if status is not None:
self.status = status
@property
def namespace(self):
"""Gets the namespace of this ResourceGroup.
资源类型。即命名空间如弹性云服务器的资源命名空间为SYS.ECS各服务的命名空间可查看“[服务命名空间](https://support.huaweicloud.com/usermanual-ces/zh-cn_topic_0202622212.html)”。
:return: The namespace of this ResourceGroup.
:rtype: str
"""
return self._namespace
@namespace.setter
def namespace(self, namespace):
"""Sets the namespace of this ResourceGroup.
资源类型。即命名空间如弹性云服务器的资源命名空间为SYS.ECS各服务的命名空间可查看“[服务命名空间](https://support.huaweicloud.com/usermanual-ces/zh-cn_topic_0202622212.html)”。
:param namespace: The namespace of this ResourceGroup.
:type namespace: str
"""
self._namespace = namespace
@property
def dimensions(self):
"""Gets the dimensions of this ResourceGroup.
一个或者多个资源维度。
:return: The dimensions of this ResourceGroup.
:rtype: list[:class:`huaweicloudsdkces.v1.MetricsDimension`]
"""
return self._dimensions
@dimensions.setter
def dimensions(self, dimensions):
"""Sets the dimensions of this ResourceGroup.
一个或者多个资源维度。
:param dimensions: The dimensions of this ResourceGroup.
:type dimensions: list[:class:`huaweicloudsdkces.v1.MetricsDimension`]
"""
self._dimensions = dimensions
@property
def status(self):
"""Gets the status of this ResourceGroup.
资源分组中该资源的当前状态值可为health、unhealth、no_alarm_rulehealth表示健康unhealth表示不健康no_alarm_rule表示未设置告警规则。
:return: The status of this ResourceGroup.
:rtype: str
"""
return self._status
@status.setter
def status(self, status):
"""Sets the status of this ResourceGroup.
资源分组中该资源的当前状态值可为health、unhealth、no_alarm_rulehealth表示健康unhealth表示不健康no_alarm_rule表示未设置告警规则。
:param status: The status of this ResourceGroup.
:type status: str
"""
self._status = status
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
return result
def to_str(self):
"""Returns the string representation of the model"""
import simplejson as json
if six.PY2:
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
return json.dumps(sanitize_for_serialization(self), ensure_ascii=False)
def __repr__(self):
"""For `print`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, ResourceGroup):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other