Class: Kubernetes::V1beta1BasicDevice
- Inherits:
-
Object
- Object
- Kubernetes::V1beta1BasicDevice
- Defined in:
- lib/kubernetes/models/v1beta1_basic_device.rb
Overview
BasicDevice defines one device instance.
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.
-
#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 = {}) ⇒ V1beta1BasicDevice
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 = {}) ⇒ V1beta1BasicDevice
Initializes the object
98 99 100 101 102 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 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 98 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Kubernetes::V1beta1BasicDevice` 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::V1beta1BasicDevice`. 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?(:'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/v1beta1_basic_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/v1beta1_basic_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/v1beta1_basic_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/v1beta1_basic_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 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/v1beta1_basic_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/v1beta1_basic_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/v1beta1_basic_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/v1beta1_basic_device.rb', line 41 def consumes_counters @consumes_counters 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.
44 45 46 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 44 def node_name @node_name end |
#node_selector ⇒ Object
Returns the value of attribute node_selector.
46 47 48 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 46 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.
49 50 51 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 49 def taints @taints end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
69 70 71 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 69 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 52 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', :'node_name' => :'nodeName', :'node_selector' => :'nodeSelector', :'taints' => :'taints' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
214 215 216 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 214 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
91 92 93 94 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 91 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 74 def self.openapi_types { :'all_nodes' => :'Boolean', :'allow_multiple_allocations' => :'Boolean', :'attributes' => :'Hash<String, V1beta1DeviceAttribute>', :'binding_conditions' => :'Array<String>', :'binding_failure_conditions' => :'Array<String>', :'binds_to_node' => :'Boolean', :'capacity' => :'Hash<String, V1beta1DeviceCapacity>', :'consumes_counters' => :'Array<V1beta1DeviceCounterConsumption>', :'node_name' => :'String', :'node_selector' => :'V1NodeSelector', :'taints' => :'Array<V1beta1DeviceTaint>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 183 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 && node_name == o.node_name && node_selector == o.node_selector && taints == o.taints end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 244 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
315 316 317 318 319 320 321 322 323 324 325 326 327 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 315 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
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 221 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
201 202 203 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 201 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
207 208 209 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 207 def hash [all_nodes, allow_multiple_allocations, attributes, binding_conditions, binding_failure_conditions, binds_to_node, capacity, consumes_counters, node_name, node_selector, taints].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
170 171 172 173 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 170 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
291 292 293 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 291 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 297 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
285 286 287 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 285 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
177 178 179 |
# File 'lib/kubernetes/models/v1beta1_basic_device.rb', line 177 def valid? true end |