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 V1beta1DeviceSubRequest(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 'allocation_mode': 'str',37 'capacity': 'V1beta1CapacityRequirements',38 'count': 'int',39 'device_class_name': 'str',40 'name': 'str',41 'selectors': 'list[V1beta1DeviceSelector]',42 'tolerations': 'list[V1beta1DeviceToleration]'43 }44 45 attribute_map = {46 'allocation_mode': 'allocationMode',47 'capacity': 'capacity',48 'count': 'count',49 'device_class_name': 'deviceClassName',50 'name': 'name',51 'selectors': 'selectors',52 'tolerations': 'tolerations'53 }54 55 def __init__(self, allocation_mode=None, capacity=None, count=None, device_class_name=None, name=None, selectors=None, tolerations=None, local_vars_configuration=None): # noqa: E50156 """V1beta1DeviceSubRequest - a model defined in OpenAPI""" # noqa: E50157 if local_vars_configuration is None:58 local_vars_configuration = Configuration()59 self.local_vars_configuration = local_vars_configuration60 61 self._allocation_mode = None62 self._capacity = None63 self._count = None64 self._device_class_name = None65 self._name = None66 self._selectors = None67 self._tolerations = None68 self.discriminator = None69 70 if allocation_mode is not None:71 self.allocation_mode = allocation_mode72 if capacity is not None:73 self.capacity = capacity74 if count is not None:75 self.count = count76 self.device_class_name = device_class_name77 self.name = name78 if selectors is not None:79 self.selectors = selectors80 if tolerations is not None:81 self.tolerations = tolerations82 83 @property84 def allocation_mode(self):85 """Gets the allocation_mode of this V1beta1DeviceSubRequest. # noqa: E50186 87 AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are: - ExactCount: This request is for a specific number of devices. This is the default. The exact number is provided in the count field. - All: This subrequest is for all of the matching devices in a pool. Allocation will fail if some devices are already allocated, unless adminAccess is requested. If AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field. More modes may get added in the future. Clients must refuse to handle requests with unknown modes. # noqa: E50188 89 :return: The allocation_mode of this V1beta1DeviceSubRequest. # noqa: E50190 :rtype: str91 """92 return self._allocation_mode93 94 @allocation_mode.setter95 def allocation_mode(self, allocation_mode):96 """Sets the allocation_mode of this V1beta1DeviceSubRequest.97 98 AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are: - ExactCount: This request is for a specific number of devices. This is the default. The exact number is provided in the count field. - All: This subrequest is for all of the matching devices in a pool. Allocation will fail if some devices are already allocated, unless adminAccess is requested. If AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field. More modes may get added in the future. Clients must refuse to handle requests with unknown modes. # noqa: E50199 100 :param allocation_mode: The allocation_mode of this V1beta1DeviceSubRequest. # noqa: E501101 :type: str102 """103 104 self._allocation_mode = allocation_mode105 106 @property107 def capacity(self):108 """Gets the capacity of this V1beta1DeviceSubRequest. # noqa: E501109 110 111 :return: The capacity of this V1beta1DeviceSubRequest. # noqa: E501112 :rtype: V1beta1CapacityRequirements113 """114 return self._capacity115 116 @capacity.setter117 def capacity(self, capacity):118 """Sets the capacity of this V1beta1DeviceSubRequest.119 120 121 :param capacity: The capacity of this V1beta1DeviceSubRequest. # noqa: E501122 :type: V1beta1CapacityRequirements123 """124 125 self._capacity = capacity126 127 @property128 def count(self):129 """Gets the count of this V1beta1DeviceSubRequest. # noqa: E501130 131 Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one. # noqa: E501132 133 :return: The count of this V1beta1DeviceSubRequest. # noqa: E501134 :rtype: int135 """136 return self._count137 138 @count.setter139 def count(self, count):140 """Sets the count of this V1beta1DeviceSubRequest.141 142 Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one. # noqa: E501143 144 :param count: The count of this V1beta1DeviceSubRequest. # noqa: E501145 :type: int146 """147 148 self._count = count149 150 @property151 def device_class_name(self):152 """Gets the device_class_name of this V1beta1DeviceSubRequest. # noqa: E501153 154 DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest. A class is required. Which classes are available depends on the cluster. Administrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference. # noqa: E501155 156 :return: The device_class_name of this V1beta1DeviceSubRequest. # noqa: E501157 :rtype: str158 """159 return self._device_class_name160 161 @device_class_name.setter162 def device_class_name(self, device_class_name):163 """Sets the device_class_name of this V1beta1DeviceSubRequest.164 165 DeviceClassName references a specific DeviceClass, which can define additional configuration and selectors to be inherited by this subrequest. A class is required. Which classes are available depends on the cluster. Administrators may use this to restrict which devices may get requested by only installing classes with selectors for permitted devices. If users are free to request anything without restrictions, then administrators can create an empty DeviceClass for users to reference. # noqa: E501166 167 :param device_class_name: The device_class_name of this V1beta1DeviceSubRequest. # noqa: E501168 :type: str169 """170 if self.local_vars_configuration.client_side_validation and device_class_name is None: # noqa: E501171 raise ValueError("Invalid value for `device_class_name`, must not be `None`") # noqa: E501172 173 self._device_class_name = device_class_name174 175 @property176 def name(self):177 """Gets the name of this V1beta1DeviceSubRequest. # noqa: E501178 179 Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format <main request>/<subrequest>. Must be a DNS label. # noqa: E501180 181 :return: The name of this V1beta1DeviceSubRequest. # noqa: E501182 :rtype: str183 """184 return self._name185 186 @name.setter187 def name(self, name):188 """Sets the name of this V1beta1DeviceSubRequest.189 190 Name can be used to reference this subrequest in the list of constraints or the list of configurations for the claim. References must use the format <main request>/<subrequest>. Must be a DNS label. # noqa: E501191 192 :param name: The name of this V1beta1DeviceSubRequest. # noqa: E501193 :type: str194 """195 if self.local_vars_configuration.client_side_validation and name is None: # noqa: E501196 raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501197 198 self._name = name199 200 @property201 def selectors(self):202 """Gets the selectors of this V1beta1DeviceSubRequest. # noqa: E501203 204 Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered. # noqa: E501205 206 :return: The selectors of this V1beta1DeviceSubRequest. # noqa: E501207 :rtype: list[V1beta1DeviceSelector]208 """209 return self._selectors210 211 @selectors.setter212 def selectors(self, selectors):213 """Sets the selectors of this V1beta1DeviceSubRequest.214 215 Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered. # noqa: E501216 217 :param selectors: The selectors of this V1beta1DeviceSubRequest. # noqa: E501218 :type: list[V1beta1DeviceSelector]219 """220 221 self._selectors = selectors222 223 @property224 def tolerations(self):225 """Gets the tolerations of this V1beta1DeviceSubRequest. # noqa: E501226 227 If specified, the request's tolerations. Tolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute. In addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated. The maximum number of tolerations is 16. This is an alpha field and requires enabling the DRADeviceTaints feature gate. # noqa: E501228 229 :return: The tolerations of this V1beta1DeviceSubRequest. # noqa: E501230 :rtype: list[V1beta1DeviceToleration]231 """232 return self._tolerations233 234 @tolerations.setter235 def tolerations(self, tolerations):236 """Sets the tolerations of this V1beta1DeviceSubRequest.237 238 If specified, the request's tolerations. Tolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute. In addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated. The maximum number of tolerations is 16. This is an alpha field and requires enabling the DRADeviceTaints feature gate. # noqa: E501239 240 :param tolerations: The tolerations of this V1beta1DeviceSubRequest. # noqa: E501241 :type: list[V1beta1DeviceToleration]242 """243 244 self._tolerations = tolerations245 246 def to_dict(self):247 """Returns the model properties as a dict"""248 result = {}249 250 for attr, _ in six.iteritems(self.openapi_types):251 value = getattr(self, attr)252 if isinstance(value, list):253 result[attr] = list(map(254 lambda x: x.to_dict() if hasattr(x, "to_dict") else x,255 value256 ))257 elif hasattr(value, "to_dict"):258 result[attr] = value.to_dict()259 elif isinstance(value, dict):260 result[attr] = dict(map(261 lambda item: (item[0], item[1].to_dict())262 if hasattr(item[1], "to_dict") else item,263 value.items()264 ))265 else:266 result[attr] = value267 268 return result269 270 def to_str(self):271 """Returns the string representation of the model"""272 return pprint.pformat(self.to_dict())273 274 def __repr__(self):275 """For `print` and `pprint`"""276 return self.to_str()277 278 def __eq__(self, other):279 """Returns true if both objects are equal"""280 if not isinstance(other, V1beta1DeviceSubRequest):281 return False282 283 return self.to_dict() == other.to_dict()284 285 def __ne__(self, other):286 """Returns true if both objects are not equal"""287 if not isinstance(other, V1beta1DeviceSubRequest):288 return True289 290 return self.to_dict() != other.to_dict()291 