Class: Kubernetes::V1NodeStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/kubernetes/models/v1_node_status.rb

Overview

NodeStatus is information about the current status of a node.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1NodeStatus

Initializes the object



87
88
89
90
91
92
93
94
95
96
97
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
# File 'lib/kubernetes/models/v1_node_status.rb', line 87

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.transform_keys(&:to_sym)

  if attributes.key?(:addresses) && (value = attributes[:addresses]).is_a?(Array)
    self.addresses = value
  end

  if attributes.key?(:allocatable) && (value = attributes[:allocatable]).is_a?(Array)
    self.allocatable = value
  end

  if attributes.key?(:capacity) && (value = attributes[:capacity]).is_a?(Array)
    self.capacity = value
  end

  if attributes.key?(:conditions) && (value = attributes[:conditions]).is_a?(Array)
    self.conditions = value
  end

  self.config = attributes[:config] if attributes.key?(:config)

  self.daemon_endpoints = attributes[:daemonEndpoints] if attributes.key?(:daemonEndpoints)

  if attributes.key?(:images) && (value = attributes[:images]).is_a?(Array)
    self.images = value
  end

  self.node_info = attributes[:nodeInfo] if attributes.key?(:nodeInfo)

  self.phase = attributes[:phase] if attributes.key?(:phase)

  if attributes.key?(:volumesAttached) && (value = attributes[:volumesAttached]).is_a?(Array)
    self.volumes_attached = value
  end

  return unless attributes.key?(:volumesInUse)
  return unless (value = attributes[:volumesInUse]).is_a?(Array)

  self.volumes_in_use = value
end

Instance Attribute Details

#addressesObject

List of addresses reachable to the node. Queried from cloud provider, if available. More info: kubernetes.io/docs/concepts/nodes/node/#addresses



19
20
21
# File 'lib/kubernetes/models/v1_node_status.rb', line 19

def addresses
  @addresses
end

#allocatableObject

Allocatable represents the resources of a node that are available for scheduling. Defaults to Capacity.



22
23
24
# File 'lib/kubernetes/models/v1_node_status.rb', line 22

def allocatable
  @allocatable
end

#capacityObject

Capacity represents the total resources of a node. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#capacity



25
26
27
# File 'lib/kubernetes/models/v1_node_status.rb', line 25

def capacity
  @capacity
end

#conditionsObject

Conditions is an array of current observed node conditions. More info: kubernetes.io/docs/concepts/nodes/node/#condition



28
29
30
# File 'lib/kubernetes/models/v1_node_status.rb', line 28

def conditions
  @conditions
end

#configObject

Status of the config assigned to the node via the dynamic Kubelet config feature.



31
32
33
# File 'lib/kubernetes/models/v1_node_status.rb', line 31

def config
  @config
end

#daemon_endpointsObject

Endpoints of daemons running on the Node.



34
35
36
# File 'lib/kubernetes/models/v1_node_status.rb', line 34

def daemon_endpoints
  @daemon_endpoints
end

#imagesObject

List of container images on this node



37
38
39
# File 'lib/kubernetes/models/v1_node_status.rb', line 37

def images
  @images
end

#node_infoObject

Set of ids/uuids to uniquely identify the node. More info: kubernetes.io/docs/concepts/nodes/node/#info



40
41
42
# File 'lib/kubernetes/models/v1_node_status.rb', line 40

def node_info
  @node_info
end

#phaseObject

NodePhase is the recently observed lifecycle phase of the node. More info: kubernetes.io/docs/concepts/nodes/node/#phase The field is never populated, and now is deprecated.



43
44
45
# File 'lib/kubernetes/models/v1_node_status.rb', line 43

def phase
  @phase
end

#volumes_attachedObject

List of volumes that are attached to the node.



46
47
48
# File 'lib/kubernetes/models/v1_node_status.rb', line 46

def volumes_attached
  @volumes_attached
end

#volumes_in_useObject

List of attachable volumes in use (mounted) by the node.



49
50
51
# File 'lib/kubernetes/models/v1_node_status.rb', line 49

def volumes_in_use
  @volumes_in_use
end

Class Method Details

.attribute_mapObject

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/v1_node_status.rb', line 52

def self.attribute_map
  {
    addresses: :addresses,
    allocatable: :allocatable,
    capacity: :capacity,
    conditions: :conditions,
    config: :config,
    daemon_endpoints: :daemonEndpoints,
    images: :images,
    node_info: :nodeInfo,
    phase: :phase,
    volumes_attached: :volumesAttached,
    volumes_in_use: :volumesInUse
  }
end

.swagger_typesObject

Attribute type mapping.



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/kubernetes/models/v1_node_status.rb', line 69

def self.swagger_types
  {
    addresses: :'Array<V1NodeAddress>',
    allocatable: :'Hash<String, String>',
    capacity: :'Hash<String, String>',
    conditions: :'Array<V1NodeCondition>',
    config: :V1NodeConfigStatus,
    daemon_endpoints: :V1NodeDaemonEndpoints,
    images: :'Array<V1ContainerImage>',
    node_info: :V1NodeSystemInfo,
    phase: :String,
    volumes_attached: :'Array<V1AttachedVolume>',
    volumes_in_use: :'Array<String>'
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/kubernetes/models/v1_node_status.rb', line 145

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    addresses == other.addresses &&
    allocatable == other.allocatable &&
    capacity == other.capacity &&
    conditions == other.conditions &&
    config == other.config &&
    daemon_endpoints == other.daemon_endpoints &&
    images == other.images &&
    node_info == other.node_info &&
    phase == other.phase &&
    volumes_attached == other.volumes_attached &&
    volumes_in_use == other.volumes_in_use
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/kubernetes/models/v1_node_status.rb', line 202

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    temp_model = Kubernetes.const_get(type).new
    temp_model.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



269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/kubernetes/models/v1_node_status.rb', line 269

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



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/kubernetes/models/v1_node_status.rb', line 178

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        send("#{key}=", attributes[self.class.attribute_map[key]].map do |v|
                          _deserialize(Regexp.last_match(1), v)
                        end)
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(other) ⇒ Boolean

See Also:

  • `==` method


164
165
166
# File 'lib/kubernetes/models/v1_node_status.rb', line 164

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.



170
171
172
173
# File 'lib/kubernetes/models/v1_node_status.rb', line 170

def hash
  [addresses, allocatable, capacity, conditions, config, daemon_endpoints, images, node_info,
   phase, volumes_attached, volumes_in_use].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?



133
134
135
# File 'lib/kubernetes/models/v1_node_status.rb', line 133

def list_invalid_properties
  []
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)



248
249
250
# File 'lib/kubernetes/models/v1_node_status.rb', line 248

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash



254
255
256
257
258
259
260
261
262
263
# File 'lib/kubernetes/models/v1_node_status.rb', line 254

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = send(attr)
    next if value.nil?

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object



242
243
244
# File 'lib/kubernetes/models/v1_node_status.rb', line 242

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid



139
140
141
# File 'lib/kubernetes/models/v1_node_status.rb', line 139

def valid?
  true
end