Class: Kubernetes::V1PersistentVolumeClaimStatus

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

Overview

PersistentVolumeClaimStatus is the current status of a persistent volume claim.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1PersistentVolumeClaimStatus

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



83
84
85
86
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
130
131
132
133
134
135
136
137
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 83

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubernetes::V1PersistentVolumeClaimStatus` 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::V1PersistentVolumeClaimStatus`. 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?(:'access_modes')
    if (value = attributes[:'access_modes']).is_a?(Array)
      self.access_modes = value
    end
  end

  if attributes.key?(:'allocated_resource_statuses')
    if (value = attributes[:'allocated_resource_statuses']).is_a?(Hash)
      self.allocated_resource_statuses = value
    end
  end

  if attributes.key?(:'allocated_resources')
    if (value = attributes[:'allocated_resources']).is_a?(Hash)
      self.allocated_resources = value
    end
  end

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

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

  if attributes.key?(:'current_volume_attributes_class_name')
    self.current_volume_attributes_class_name = attributes[:'current_volume_attributes_class_name']
  end

  if attributes.key?(:'modify_volume_status')
    self.modify_volume_status = attributes[:'modify_volume_status']
  end

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

Instance Attribute Details

#access_modesObject

accessModes contains the actual access modes the volume backing the PVC has. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1



20
21
22
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 20

def access_modes
  @access_modes
end

#allocated_resource_statusesObject

allocatedResourceStatuses stores status of resource being resized for the given PVC. Key names follow standard Kubernetes label syntax. Valid values are either: * Un-prefixed keys: - storage - the capacity of the volume. * Custom resources must use implementation-defined prefixed names such as "example.com/my-custom-resource" Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used. ClaimResourceStatus can be in any of following states: - ControllerResizeInProgress: State set when resize controller starts resizing the volume in control-plane. - ControllerResizeFailed: State set when resize has failed in resize controller with a terminal error. - NodeResizePending: State set when resize controller has finished resizing the volume but further resizing of volume is needed on the node. - NodeResizeInProgress: State set when kubelet starts resizing the volume. - NodeResizeFailed: State set when resizing has failed in kubelet with a terminal error. Transient errors don’t set NodeResizeFailed. For example: if expanding a PVC for more capacity - this field can be one of the following states: - pvc.status.allocatedResourceStatus = "ControllerResizeInProgress" - pvc.status.allocatedResourceStatus = "ControllerResizeFailed" - pvc.status.allocatedResourceStatus = "NodeResizePending" - pvc.status.allocatedResourceStatus = "NodeResizeInProgress" - pvc.status.allocatedResourceStatus = "NodeResizeFailed" When this field is not set, it means that no resize operation is in progress for the given PVC. A controller that receives PVC update with previously unknown resourceName or ClaimResourceStatus should ignore the update for the purpose it was designed. For example - a controller that only is responsible for resizing capacity of the volume, should ignore PVC updates that change other valid resources associated with PVC.



23
24
25
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 23

def allocated_resource_statuses
  @allocated_resource_statuses
end

#allocated_resourcesObject

allocatedResources tracks the resources allocated to a PVC including its capacity. Key names follow standard Kubernetes label syntax. Valid values are either: * Un-prefixed keys: - storage - the capacity of the volume. * Custom resources must use implementation-defined prefixed names such as "example.com/my-custom-resource" Apart from above values - keys that are unprefixed or have kubernetes.io prefix are considered reserved and hence may not be used. Capacity reported here may be larger than the actual capacity when a volume expansion operation is requested. For storage quota, the larger value from allocatedResources and PVC.spec.resources is used. If allocatedResources is not set, PVC.spec.resources alone is used for quota calculation. If a volume expansion capacity request is lowered, allocatedResources is only lowered if there are no expansion operations in progress and if the actual volume capacity is equal or lower than the requested capacity. A controller that receives PVC update with previously unknown resourceName should ignore the update for the purpose it was designed. For example - a controller that only is responsible for resizing capacity of the volume, should ignore PVC updates that change other valid resources associated with PVC.



26
27
28
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 26

def allocated_resources
  @allocated_resources
end

#capacityObject

capacity represents the actual resources of the underlying volume.



29
30
31
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 29

def capacity
  @capacity
end

#conditionsObject

conditions is the current Condition of persistent volume claim. If underlying persistent volume is being resized then the Condition will be set to ‘Resizing’.



32
33
34
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 32

def conditions
  @conditions
end

#current_volume_attributes_class_nameObject

currentVolumeAttributesClassName is the current name of the VolumeAttributesClass the PVC is using. When unset, there is no VolumeAttributeClass applied to this PersistentVolumeClaim



35
36
37
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 35

def current_volume_attributes_class_name
  @current_volume_attributes_class_name
end

#modify_volume_statusObject

Returns the value of attribute modify_volume_status.



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

def modify_volume_status
  @modify_volume_status
end

#phaseObject

phase represents the current phase of PersistentVolumeClaim.



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

def phase
  @phase
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



57
58
59
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 57

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 43

def self.attribute_map
  {
    :'access_modes' => :'accessModes',
    :'allocated_resource_statuses' => :'allocatedResourceStatuses',
    :'allocated_resources' => :'allocatedResources',
    :'capacity' => :'capacity',
    :'conditions' => :'conditions',
    :'current_volume_attributes_class_name' => :'currentVolumeAttributesClassName',
    :'modify_volume_status' => :'modifyVolumeStatus',
    :'phase' => :'phase'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



182
183
184
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 182

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



76
77
78
79
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 76

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 62

def self.openapi_types
  {
    :'access_modes' => :'Array<String>',
    :'allocated_resource_statuses' => :'Hash<String, String>',
    :'allocated_resources' => :'Hash<String, String>',
    :'capacity' => :'Hash<String, String>',
    :'conditions' => :'Array<V1PersistentVolumeClaimCondition>',
    :'current_volume_attributes_class_name' => :'String',
    :'modify_volume_status' => :'V1ModifyVolumeStatus',
    :'phase' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 154

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      access_modes == o.access_modes &&
      allocated_resource_statuses == o.allocated_resource_statuses &&
      allocated_resources == o.allocated_resources &&
      capacity == o.capacity &&
      conditions == o.conditions &&
      current_volume_attributes_class_name == o.current_volume_attributes_class_name &&
      modify_volume_status == o.modify_volume_status &&
      phase == o.phase
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



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
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 212

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 283

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 189

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


169
170
171
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 169

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



175
176
177
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 175

def hash
  [access_modes, allocated_resource_statuses, allocated_resources, capacity, conditions, current_volume_attributes_class_name, modify_volume_status, phase].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



141
142
143
144
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 141

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



259
260
261
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 259

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 265

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



253
254
255
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 253

def to_s
  to_hash.to_s
end

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



148
149
150
# File 'lib/kubernetes/models/v1_persistent_volume_claim_status.rb', line 148

def valid?
  true
end