github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/clients/python/bacalhau_apiclient/models/label_selector_requirement.py (about)

     1  # coding: utf-8
     2  
     3  """
     4      Bacalhau API
     5  
     6      This page is the reference of the Bacalhau REST API. Project docs are available at https://docs.bacalhau.org/. Find more information about Bacalhau at https://github.com/filecoin-project/bacalhau.  # noqa: E501
     7  
     8      OpenAPI spec version: 0.3.22.post4
     9      Contact: team@bacalhau.org
    10      Generated by: https://github.com/swagger-api/swagger-codegen.git
    11  """
    12  
    13  
    14  import pprint
    15  import re  # noqa: F401
    16  
    17  import six
    18  
    19  from bacalhau_apiclient.configuration import Configuration
    20  
    21  
    22  class LabelSelectorRequirement(object):
    23      """NOTE: This class is auto generated by the swagger code generator program.
    24  
    25      Do not edit the class manually.
    26      """
    27  
    28      """
    29      Attributes:
    30        swagger_types (dict): The key is attribute name
    31                              and the value is attribute type.
    32        attribute_map (dict): The key is attribute name
    33                              and the value is json key in definition.
    34      """
    35      swagger_types = {
    36          'key': 'str',
    37          'operator': 'LabelSelectorRequirementOperator',
    38          'values': 'list[str]'
    39      }
    40  
    41      attribute_map = {
    42          'key': 'Key',
    43          'operator': 'Operator',
    44          'values': 'Values'
    45      }
    46  
    47      def __init__(self, key=None, operator=None, values=None, _configuration=None):  # noqa: E501
    48          """LabelSelectorRequirement - a model defined in Swagger"""  # noqa: E501
    49          if _configuration is None:
    50              _configuration = Configuration()
    51          self._configuration = _configuration
    52  
    53          self._key = None
    54          self._operator = None
    55          self._values = None
    56          self.discriminator = None
    57  
    58          if key is not None:
    59              self.key = key
    60          if operator is not None:
    61              self.operator = operator
    62          if values is not None:
    63              self.values = values
    64  
    65      @property
    66      def key(self):
    67          """Gets the key of this LabelSelectorRequirement.  # noqa: E501
    68  
    69          key is the label key that the selector applies to.  # noqa: E501
    70  
    71          :return: The key of this LabelSelectorRequirement.  # noqa: E501
    72          :rtype: str
    73          """
    74          return self._key
    75  
    76      @key.setter
    77      def key(self, key):
    78          """Sets the key of this LabelSelectorRequirement.
    79  
    80          key is the label key that the selector applies to.  # noqa: E501
    81  
    82          :param key: The key of this LabelSelectorRequirement.  # noqa: E501
    83          :type: str
    84          """
    85  
    86          self._key = key
    87  
    88      @property
    89      def operator(self):
    90          """Gets the operator of this LabelSelectorRequirement.  # noqa: E501
    91  
    92  
    93          :return: The operator of this LabelSelectorRequirement.  # noqa: E501
    94          :rtype: LabelSelectorRequirementOperator
    95          """
    96          return self._operator
    97  
    98      @operator.setter
    99      def operator(self, operator):
   100          """Sets the operator of this LabelSelectorRequirement.
   101  
   102  
   103          :param operator: The operator of this LabelSelectorRequirement.  # noqa: E501
   104          :type: LabelSelectorRequirementOperator
   105          """
   106  
   107          self._operator = operator
   108  
   109      @property
   110      def values(self):
   111          """Gets the values of this LabelSelectorRequirement.  # noqa: E501
   112  
   113          values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic  # noqa: E501
   114  
   115          :return: The values of this LabelSelectorRequirement.  # noqa: E501
   116          :rtype: list[str]
   117          """
   118          return self._values
   119  
   120      @values.setter
   121      def values(self, values):
   122          """Sets the values of this LabelSelectorRequirement.
   123  
   124          values is an array of string values. If the operator is In or NotIn, the values array must be non-empty. If the operator is Exists or DoesNotExist, the values array must be empty. This array is replaced during a strategic  # noqa: E501
   125  
   126          :param values: The values of this LabelSelectorRequirement.  # noqa: E501
   127          :type: list[str]
   128          """
   129  
   130          self._values = values
   131  
   132      def to_dict(self):
   133          """Returns the model properties as a dict"""
   134          result = {}
   135  
   136          for attr, _ in six.iteritems(self.swagger_types):
   137              value = getattr(self, attr)
   138              if isinstance(value, list):
   139                  result[attr] = list(map(
   140                      lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
   141                      value
   142                  ))
   143              elif hasattr(value, "to_dict"):
   144                  result[attr] = value.to_dict()
   145              elif isinstance(value, dict):
   146                  result[attr] = dict(map(
   147                      lambda item: (item[0], item[1].to_dict())
   148                      if hasattr(item[1], "to_dict") else item,
   149                      value.items()
   150                  ))
   151              else:
   152                  result[attr] = value
   153          if issubclass(LabelSelectorRequirement, dict):
   154              for key, value in self.items():
   155                  result[key] = value
   156  
   157          return result
   158  
   159      def to_str(self):
   160          """Returns the string representation of the model"""
   161          return pprint.pformat(self.to_dict())
   162  
   163      def __repr__(self):
   164          """For `print` and `pprint`"""
   165          return self.to_str()
   166  
   167      def __eq__(self, other):
   168          """Returns true if both objects are equal"""
   169          if not isinstance(other, LabelSelectorRequirement):
   170              return False
   171  
   172          return self.to_dict() == other.to_dict()
   173  
   174      def __ne__(self, other):
   175          """Returns true if both objects are not equal"""
   176          if not isinstance(other, LabelSelectorRequirement):
   177              return True
   178  
   179          return self.to_dict() != other.to_dict()