huaweicloud-sdk-python-v3/huaweicloud-sdk-asm/huaweicloudsdkasm/v1/model/selector.py

137 lines
4.0 KiB
Python
Raw Normal View History

2023-02-02 09:08:05 +00:00
# coding: utf-8
import six
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
2023-10-12 09:41:03 +00:00
class Selector:
2023-02-02 09:08:05 +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 = []
openapi_types = {
2023-10-12 09:41:03 +00:00
'field_selector': 'FieldSelector',
'label_selector': 'LabelSelector'
2023-02-02 09:08:05 +00:00
}
attribute_map = {
2023-10-12 09:41:03 +00:00
'field_selector': 'fieldSelector',
'label_selector': 'labelSelector'
2023-02-02 09:08:05 +00:00
}
2023-10-12 09:41:03 +00:00
def __init__(self, field_selector=None, label_selector=None):
"""Selector
2023-02-02 09:08:05 +00:00
The model defined in huaweicloud sdk
2023-10-12 09:41:03 +00:00
:param field_selector:
:type field_selector: :class:`huaweicloudsdkasm.v1.FieldSelector`
:param label_selector:
:type label_selector: :class:`huaweicloudsdkasm.v1.LabelSelector`
2023-02-02 09:08:05 +00:00
"""
2023-10-12 09:41:03 +00:00
self._field_selector = None
self._label_selector = None
2023-02-02 09:08:05 +00:00
self.discriminator = None
2023-10-12 09:41:03 +00:00
if field_selector is not None:
self.field_selector = field_selector
if label_selector is not None:
self.label_selector = label_selector
2023-02-02 09:08:05 +00:00
@property
2023-10-12 09:41:03 +00:00
def field_selector(self):
"""Gets the field_selector of this Selector.
2023-02-02 09:08:05 +00:00
2023-10-12 09:41:03 +00:00
:return: The field_selector of this Selector.
:rtype: :class:`huaweicloudsdkasm.v1.FieldSelector`
2023-02-02 09:08:05 +00:00
"""
2023-10-12 09:41:03 +00:00
return self._field_selector
2023-02-02 09:08:05 +00:00
2023-10-12 09:41:03 +00:00
@field_selector.setter
def field_selector(self, field_selector):
"""Sets the field_selector of this Selector.
2023-02-02 09:08:05 +00:00
2023-10-12 09:41:03 +00:00
:param field_selector: The field_selector of this Selector.
:type field_selector: :class:`huaweicloudsdkasm.v1.FieldSelector`
2023-02-02 09:08:05 +00:00
"""
2023-10-12 09:41:03 +00:00
self._field_selector = field_selector
2023-02-02 09:08:05 +00:00
@property
2023-10-12 09:41:03 +00:00
def label_selector(self):
"""Gets the label_selector of this Selector.
2023-02-02 09:08:05 +00:00
2023-10-12 09:41:03 +00:00
:return: The label_selector of this Selector.
:rtype: :class:`huaweicloudsdkasm.v1.LabelSelector`
2023-02-02 09:08:05 +00:00
"""
2023-10-12 09:41:03 +00:00
return self._label_selector
2023-02-02 09:08:05 +00:00
2023-10-12 09:41:03 +00:00
@label_selector.setter
def label_selector(self, label_selector):
"""Sets the label_selector of this Selector.
2023-02-02 09:08:05 +00:00
2023-10-12 09:41:03 +00:00
:param label_selector: The label_selector of this Selector.
:type label_selector: :class:`huaweicloudsdkasm.v1.LabelSelector`
2023-02-02 09:08:05 +00:00
"""
2023-10-12 09:41:03 +00:00
self._label_selector = label_selector
2023-02-02 09:08:05 +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
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"""
2023-10-12 09:41:03 +00:00
if not isinstance(other, Selector):
2023-02-02 09:08:05 +00:00
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other