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 V1CELDeviceSelector(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 'expression': 'str'37 }38 39 attribute_map = {40 'expression': 'expression'41 }42 43 def __init__(self, expression=None, local_vars_configuration=None): # noqa: E50144 """V1CELDeviceSelector - a model defined in OpenAPI""" # noqa: E50145 if local_vars_configuration is None:46 local_vars_configuration = Configuration()47 self.local_vars_configuration = local_vars_configuration48 49 self._expression = None50 self.discriminator = None51 52 self.expression = expression53 54 @property55 def expression(self):56 """Gets the expression of this V1CELDeviceSelector. # noqa: E50157 58 Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort. The expression's input is an object named \"device\", which carries the following properties: - driver (string): the name of the driver which defines this device. - attributes (map[string]object): the device's attributes, grouped by prefix (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all of the attributes which were prefixed by \"dra.example.com\". - capacity (map[string]object): the device's capacities, grouped by prefix. - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device (v1.34+ with the DRAConsumableCapacity feature enabled). Example: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields: device.driver device.attributes[\"dra.example.com\"].model device.attributes[\"ext.example.com\"].family device.capacity[\"dra.example.com\"].modules The device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers. The value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity. If an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort. A robust expression should check for the existence of attributes before referencing them. For ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example: cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool) The length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps. # noqa: E50159 60 :return: The expression of this V1CELDeviceSelector. # noqa: E50161 :rtype: str62 """63 return self._expression64 65 @expression.setter66 def expression(self, expression):67 """Sets the expression of this V1CELDeviceSelector.68 69 Expression is a CEL expression which evaluates a single device. It must evaluate to true when the device under consideration satisfies the desired criteria, and false when it does not. Any other result is an error and causes allocation of devices to abort. The expression's input is an object named \"device\", which carries the following properties: - driver (string): the name of the driver which defines this device. - attributes (map[string]object): the device's attributes, grouped by prefix (e.g. device.attributes[\"dra.example.com\"] evaluates to an object with all of the attributes which were prefixed by \"dra.example.com\". - capacity (map[string]object): the device's capacities, grouped by prefix. - allowMultipleAllocations (bool): the allowMultipleAllocations property of the device (v1.34+ with the DRAConsumableCapacity feature enabled). Example: Consider a device with driver=\"dra.example.com\", which exposes two attributes named \"model\" and \"ext.example.com/family\" and which exposes one capacity named \"modules\". This input to this expression would have the following fields: device.driver device.attributes[\"dra.example.com\"].model device.attributes[\"ext.example.com\"].family device.capacity[\"dra.example.com\"].modules The device.driver field can be used to check for a specific driver, either as a high-level precondition (i.e. you only want to consider devices from this driver) or as part of a multi-clause expression that is meant to consider devices from different drivers. The value type of each attribute is defined by the device definition, and users who write these expressions must consult the documentation for their specific drivers. The value type of each capacity is Quantity. If an unknown prefix is used as a lookup in either device.attributes or device.capacity, an empty map will be returned. Any reference to an unknown field will cause an evaluation error and allocation to abort. A robust expression should check for the existence of attributes before referencing them. For ease of use, the cel.bind() function is enabled, and can be used to simplify expressions that access multiple attributes with the same domain. For example: cel.bind(dra, device.attributes[\"dra.example.com\"], dra.someBool && dra.anotherBool) The length of the expression must be smaller or equal to 10 Ki. The cost of evaluating it is also limited based on the estimated number of logical steps. # noqa: E50170 71 :param expression: The expression of this V1CELDeviceSelector. # noqa: E50172 :type: str73 """74 if self.local_vars_configuration.client_side_validation and expression is None: # noqa: E50175 raise ValueError("Invalid value for `expression`, must not be `None`") # noqa: E50176 77 self._expression = expression78 79 def to_dict(self):80 """Returns the model properties as a dict"""81 result = {}82 83 for attr, _ in six.iteritems(self.openapi_types):84 value = getattr(self, attr)85 if isinstance(value, list):86 result[attr] = list(map(87 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,88 value89 ))90 elif hasattr(value, "to_dict"):91 result[attr] = value.to_dict()92 elif isinstance(value, dict):93 result[attr] = dict(map(94 lambda item: (item[0], item[1].to_dict())95 if hasattr(item[1], "to_dict") else item,96 value.items()97 ))98 else:99 result[attr] = value100 101 return result102 103 def to_str(self):104 """Returns the string representation of the model"""105 return pprint.pformat(self.to_dict())106 107 def __repr__(self):108 """For `print` and `pprint`"""109 return self.to_str()110 111 def __eq__(self, other):112 """Returns true if both objects are equal"""113 if not isinstance(other, V1CELDeviceSelector):114 return False115 116 return self.to_dict() == other.to_dict()117 118 def __ne__(self, other):119 """Returns true if both objects are not equal"""120 if not isinstance(other, V1CELDeviceSelector):121 return True122 123 return self.to_dict() != other.to_dict()124 