Class: Kubernetes::V1beta2Device
- Inherits:
-
Object
- Object
- Kubernetes::V1beta2Device
- Defined in:
- lib/kubernetes/models/v1beta2_device.rb
Overview
Device represents one individual hardware instance that can be selected based on its attributes. Besides the name, exactly one field must be set.
Instance Attribute Summary collapse
-
#all_nodes ⇒ Object
AllNodes indicates that all nodes have access to the device.
-
#allow_multiple_allocations ⇒ Object
AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests.
-
#attributes ⇒ Object
Attributes defines the set of attributes for this device.
-
#binding_conditions ⇒ Object
BindingConditions defines the conditions for proceeding with binding.
-
#binding_failure_conditions ⇒ Object
BindingFailureConditions defines the conditions for binding failure.
-
#binds_to_node ⇒ Object
BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim.
-
#capacity ⇒ Object
Capacity defines the set of capacities for this device.
-
#consumes_counters ⇒ Object
ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets.
-
#name ⇒ Object
Name is unique identifier among all devices managed by the driver in the pool.
-
#node_name ⇒ Object
NodeName identifies the node where the device is available.
-
#node_selector ⇒ Object
Returns the value of attribute node_selector.
-
#taints ⇒ Object
If specified, these are the driver-defined taints.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ V1beta2Device
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ V1beta2Device
Initializes the object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 103 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Kubernetes::V1beta2Device` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Kubernetes::V1beta2Device`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'all_nodes') self.all_nodes = attributes[:'all_nodes'] end if attributes.key?(:'allow_multiple_allocations') self.allow_multiple_allocations = attributes[:'allow_multiple_allocations'] end if attributes.key?(:'attributes') if (value = attributes[:'attributes']).is_a?(Hash) self.attributes = value end end if attributes.key?(:'binding_conditions') if (value = attributes[:'binding_conditions']).is_a?(Array) self.binding_conditions = value end end if attributes.key?(:'binding_failure_conditions') if (value = attributes[:'binding_failure_conditions']).is_a?(Array) self.binding_failure_conditions = value end end if attributes.key?(:'binds_to_node') self.binds_to_node = attributes[:'binds_to_node'] end if attributes.key?(:'capacity') if (value = attributes[:'capacity']).is_a?(Hash) self.capacity = value end end if attributes.key?(:'consumes_counters') if (value = attributes[:'consumes_counters']).is_a?(Array) self.consumes_counters = value end end if attributes.key?(:'name') self.name = attributes[:'name'] end if attributes.key?(:'node_name') self.node_name = attributes[:'node_name'] end if attributes.key?(:'node_selector') self.node_selector = attributes[:'node_selector'] end if attributes.key?(:'taints') if (value = attributes[:'taints']).is_a?(Array) self.taints = value end end end |
Instance Attribute Details
#all_nodes ⇒ Object
AllNodes indicates that all nodes have access to the device. Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.
20 21 22 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 20 def all_nodes @all_nodes end |
#allow_multiple_allocations ⇒ Object
AllowMultipleAllocations marks whether the device is allowed to be allocated to multiple DeviceRequests. If AllowMultipleAllocations is set to true, the device can be allocated more than once, and all of its capacity is consumable, regardless of whether the requestPolicy is defined or not.
23 24 25 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 23 def allow_multiple_allocations @allow_multiple_allocations end |
#attributes ⇒ Object
Attributes defines the set of attributes for this device. The name of each attribute must be unique in that set. The maximum number of attributes and capacities combined is 32.
26 27 28 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 26 def attributes @attributes end |
#binding_conditions ⇒ Object
BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod. The maximum number of binding conditions is 4. The conditions must be a valid condition type string. This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.
29 30 31 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 29 def binding_conditions @binding_conditions end |
#binding_failure_conditions ⇒ Object
BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to "True", a binding failure occurred. The maximum number of binding failure conditions is 4. The conditions must be a valid condition type string. This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.
32 33 34 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 32 def binding_failure_conditions @binding_failure_conditions end |
#binds_to_node ⇒ Object
BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made. This is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.
35 36 37 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 35 def binds_to_node @binds_to_node end |
#capacity ⇒ Object
Capacity defines the set of capacities for this device. The name of each capacity must be unique in that set. The maximum number of attributes and capacities combined is 32.
38 39 40 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 38 def capacity @capacity end |
#consumes_counters ⇒ Object
ConsumesCounters defines a list of references to sharedCounters and the set of counters that the device will consume from those counter sets. There can only be a single entry per counterSet. The maximum number of device counter consumptions per device is 2.
41 42 43 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 41 def consumes_counters @consumes_counters end |
#name ⇒ Object
Name is unique identifier among all devices managed by the driver in the pool. It must be a DNS label.
44 45 46 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 44 def name @name end |
#node_name ⇒ Object
NodeName identifies the node where the device is available. Must only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.
47 48 49 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 47 def node_name @node_name end |
#node_selector ⇒ Object
Returns the value of attribute node_selector.
49 50 51 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 49 def node_selector @node_selector end |
#taints ⇒ Object
If specified, these are the driver-defined taints. The maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128. This is an alpha field and requires enabling the DRADeviceTaints feature gate.
52 53 54 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 52 def taints @taints end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
73 74 75 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 73 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 55 def self.attribute_map { :'all_nodes' => :'allNodes', :'allow_multiple_allocations' => :'allowMultipleAllocations', :'attributes' => :'attributes', :'binding_conditions' => :'bindingConditions', :'binding_failure_conditions' => :'bindingFailureConditions', :'binds_to_node' => :'bindsToNode', :'capacity' => :'capacity', :'consumes_counters' => :'consumesCounters', :'name' => :'name', :'node_name' => :'nodeName', :'node_selector' => :'nodeSelector', :'taints' => :'taints' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
229 230 231 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 229 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
96 97 98 99 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 96 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 78 def self.openapi_types { :'all_nodes' => :'Boolean', :'allow_multiple_allocations' => :'Boolean', :'attributes' => :'Hash<String, V1beta2DeviceAttribute>', :'binding_conditions' => :'Array<String>', :'binding_failure_conditions' => :'Array<String>', :'binds_to_node' => :'Boolean', :'capacity' => :'Hash<String, V1beta2DeviceCapacity>', :'consumes_counters' => :'Array<V1beta2DeviceCounterConsumption>', :'name' => :'String', :'node_name' => :'String', :'node_selector' => :'V1NodeSelector', :'taints' => :'Array<V1beta2DeviceTaint>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 197 def ==(o) return true if self.equal?(o) self.class == o.class && all_nodes == o.all_nodes && allow_multiple_allocations == o.allow_multiple_allocations && attributes == o.attributes && binding_conditions == o.binding_conditions && binding_failure_conditions == o.binding_failure_conditions && binds_to_node == o.binds_to_node && capacity == o.capacity && consumes_counters == o.consumes_counters && name == o.name && node_name == o.node_name && node_selector == o.node_selector && taints == o.taints end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 259 def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model # models (e.g. Pet) or oneOf klass = Kubernetes.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 330 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 236 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(o) ⇒ Boolean
216 217 218 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 216 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
222 223 224 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 222 def hash [all_nodes, allow_multiple_allocations, attributes, binding_conditions, binding_failure_conditions, binds_to_node, capacity, consumes_counters, name, node_name, node_selector, taints].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
179 180 181 182 183 184 185 186 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 179 def list_invalid_properties invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
306 307 308 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 306 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 312 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
300 301 302 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 300 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
190 191 192 193 |
# File 'lib/kubernetes/models/v1beta2_device.rb', line 190 def valid? return false if @name.nil? true end |