codekingpro/portable-devtools
114k
1# coding: utf-82 3"""4 Kubernetes5 6 No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E5017 8 The version of the OpenAPI document: release-1.359 Generated by: https://openapi-generator.tech10"""11 12 13import pprint14import re # noqa: F40115 16import six17 18from kubernetes.client.configuration import Configuration19 20 21class V1PodAffinityTerm(object):22 """NOTE: This class is auto generated by OpenAPI Generator.23 Ref: https://openapi-generator.tech24 25 Do not edit the class manually.26 """27 28 """29 Attributes:30 openapi_types (dict): The key is attribute name31 and the value is attribute type.32 attribute_map (dict): The key is attribute name33 and the value is json key in definition.34 """35 openapi_types = {36 'label_selector': 'V1LabelSelector',37 'match_label_keys': 'list[str]',38 'mismatch_label_keys': 'list[str]',39 'namespace_selector': 'V1LabelSelector',40 'namespaces': 'list[str]',41 'topology_key': 'str'42 }43 44 attribute_map = {45 'label_selector': 'labelSelector',46 'match_label_keys': 'matchLabelKeys',47 'mismatch_label_keys': 'mismatchLabelKeys',48 'namespace_selector': 'namespaceSelector',49 'namespaces': 'namespaces',50 'topology_key': 'topologyKey'51 }52 53 def __init__(self, label_selector=None, match_label_keys=None, mismatch_label_keys=None, namespace_selector=None, namespaces=None, topology_key=None, local_vars_configuration=None): # noqa: E50154 """V1PodAffinityTerm - a model defined in OpenAPI""" # noqa: E50155 if local_vars_configuration is None:56 local_vars_configuration = Configuration()57 self.local_vars_configuration = local_vars_configuration58 59 self._label_selector = None60 self._match_label_keys = None61 self._mismatch_label_keys = None62 self._namespace_selector = None63 self._namespaces = None64 self._topology_key = None65 self.discriminator = None66 67 if label_selector is not None:68 self.label_selector = label_selector69 if match_label_keys is not None:70 self.match_label_keys = match_label_keys71 if mismatch_label_keys is not None:72 self.mismatch_label_keys = mismatch_label_keys73 if namespace_selector is not None:74 self.namespace_selector = namespace_selector75 if namespaces is not None:76 self.namespaces = namespaces77 self.topology_key = topology_key78 79 @property80 def label_selector(self):81 """Gets the label_selector of this V1PodAffinityTerm. # noqa: E50182 83 84 :return: The label_selector of this V1PodAffinityTerm. # noqa: E50185 :rtype: V1LabelSelector86 """87 return self._label_selector88 89 @label_selector.setter90 def label_selector(self, label_selector):91 """Sets the label_selector of this V1PodAffinityTerm.92 93 94 :param label_selector: The label_selector of this V1PodAffinityTerm. # noqa: E50195 :type: V1LabelSelector96 """97 98 self._label_selector = label_selector99 100 @property101 def match_label_keys(self):102 """Gets the match_label_keys of this V1PodAffinityTerm. # noqa: E501103 104 MatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. # noqa: E501105 106 :return: The match_label_keys of this V1PodAffinityTerm. # noqa: E501107 :rtype: list[str]108 """109 return self._match_label_keys110 111 @match_label_keys.setter112 def match_label_keys(self, match_label_keys):113 """Sets the match_label_keys of this V1PodAffinityTerm.114 115 MatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key in (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both matchLabelKeys and labelSelector. Also, matchLabelKeys cannot be set when labelSelector isn't set. # noqa: E501116 117 :param match_label_keys: The match_label_keys of this V1PodAffinityTerm. # noqa: E501118 :type: list[str]119 """120 121 self._match_label_keys = match_label_keys122 123 @property124 def mismatch_label_keys(self):125 """Gets the mismatch_label_keys of this V1PodAffinityTerm. # noqa: E501126 127 MismatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. # noqa: E501128 129 :return: The mismatch_label_keys of this V1PodAffinityTerm. # noqa: E501130 :rtype: list[str]131 """132 return self._mismatch_label_keys133 134 @mismatch_label_keys.setter135 def mismatch_label_keys(self, mismatch_label_keys):136 """Sets the mismatch_label_keys of this V1PodAffinityTerm.137 138 MismatchLabelKeys is a set of pod label keys to select which pods will be taken into consideration. The keys are used to lookup values from the incoming pod labels, those key-value labels are merged with `labelSelector` as `key notin (value)` to select the group of existing pods which pods will be taken into consideration for the incoming pod's pod (anti) affinity. Keys that don't exist in the incoming pod labels will be ignored. The default value is empty. The same key is forbidden to exist in both mismatchLabelKeys and labelSelector. Also, mismatchLabelKeys cannot be set when labelSelector isn't set. # noqa: E501139 140 :param mismatch_label_keys: The mismatch_label_keys of this V1PodAffinityTerm. # noqa: E501141 :type: list[str]142 """143 144 self._mismatch_label_keys = mismatch_label_keys145 146 @property147 def namespace_selector(self):148 """Gets the namespace_selector of this V1PodAffinityTerm. # noqa: E501149 150 151 :return: The namespace_selector of this V1PodAffinityTerm. # noqa: E501152 :rtype: V1LabelSelector153 """154 return self._namespace_selector155 156 @namespace_selector.setter157 def namespace_selector(self, namespace_selector):158 """Sets the namespace_selector of this V1PodAffinityTerm.159 160 161 :param namespace_selector: The namespace_selector of this V1PodAffinityTerm. # noqa: E501162 :type: V1LabelSelector163 """164 165 self._namespace_selector = namespace_selector166 167 @property168 def namespaces(self):169 """Gets the namespaces of this V1PodAffinityTerm. # noqa: E501170 171 namespaces specifies a static list of namespace names that the term applies to. The term is applied to the union of the namespaces listed in this field and the ones selected by namespaceSelector. null or empty namespaces list and null namespaceSelector means \"this pod's namespace\". # noqa: E501172 173 :return: The namespaces of this V1PodAffinityTerm. # noqa: E501174 :rtype: list[str]175 """176 return self._namespaces177 178 @namespaces.setter179 def namespaces(self, namespaces):180 """Sets the namespaces of this V1PodAffinityTerm.181 182 namespaces specifies a static list of namespace names that the term applies to. The term is applied to the union of the namespaces listed in this field and the ones selected by namespaceSelector. null or empty namespaces list and null namespaceSelector means \"this pod's namespace\". # noqa: E501183 184 :param namespaces: The namespaces of this V1PodAffinityTerm. # noqa: E501185 :type: list[str]186 """187 188 self._namespaces = namespaces189 190 @property191 def topology_key(self):192 """Gets the topology_key of this V1PodAffinityTerm. # noqa: E501193 194 This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. # noqa: E501195 196 :return: The topology_key of this V1PodAffinityTerm. # noqa: E501197 :rtype: str198 """199 return self._topology_key200 201 @topology_key.setter202 def topology_key(self, topology_key):203 """Sets the topology_key of this V1PodAffinityTerm.204 205 This pod should be co-located (affinity) or not co-located (anti-affinity) with the pods matching the labelSelector in the specified namespaces, where co-located is defined as running on a node whose value of the label with key topologyKey matches that of any node on which any of the selected pods is running. Empty topologyKey is not allowed. # noqa: E501206 207 :param topology_key: The topology_key of this V1PodAffinityTerm. # noqa: E501208 :type: str209 """210 if self.local_vars_configuration.client_side_validation and topology_key is None: # noqa: E501211 raise ValueError("Invalid value for `topology_key`, must not be `None`") # noqa: E501212 213 self._topology_key = topology_key214 215 def to_dict(self):216 """Returns the model properties as a dict"""217 result = {}218 219 for attr, _ in six.iteritems(self.openapi_types):220 value = getattr(self, attr)221 if isinstance(value, list):222 result[attr] = list(map(223 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,224 value225 ))226 elif hasattr(value, "to_dict"):227 result[attr] = value.to_dict()228 elif isinstance(value, dict):229 result[attr] = dict(map(230 lambda item: (item[0], item[1].to_dict())231 if hasattr(item[1], "to_dict") else item,232 value.items()233 ))234 else:235 result[attr] = value236 237 return result238 239 def to_str(self):240 """Returns the string representation of the model"""241 return pprint.pformat(self.to_dict())242 243 def __repr__(self):244 """For `print` and `pprint`"""245 return self.to_str()246 247 def __eq__(self, other):248 """Returns true if both objects are equal"""249 if not isinstance(other, V1PodAffinityTerm):250 return False251 252 return self.to_dict() == other.to_dict()253 254 def __ne__(self, other):255 """Returns true if both objects are not equal"""256 if not isinstance(other, V1PodAffinityTerm):257 return True258 259 return self.to_dict() != other.to_dict()260 