Class: ArgoWorkflows::IoK8sApiCoreV1PersistentVolumeClaimSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb

Overview

PersistentVolumeClaimSpec describes the common attributes of storage devices and allows a Source for provider-specific attributes

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ IoK8sApiCoreV1PersistentVolumeClaimSpec

Initializes the object

Parameters:

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

    Model attributes in the form of hash



77
78
79
80
81
82
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
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 77

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

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'accessModes')
    if (value = attributes[:'accessModes']).is_a?(Array)
      self.access_modes = value
    end
  end

  if attributes.has_key?(:'dataSource')
    self.data_source = attributes[:'dataSource']
  end

  if attributes.has_key?(:'dataSourceRef')
    self.data_source_ref = attributes[:'dataSourceRef']
  end

  if attributes.has_key?(:'resources')
    self.resources = attributes[:'resources']
  end

  if attributes.has_key?(:'selector')
    self.selector = attributes[:'selector']
  end

  if attributes.has_key?(:'storageClassName')
    self.storage_class_name = attributes[:'storageClassName']
  end

  if attributes.has_key?(:'volumeAttributesClassName')
    self.volume_attributes_class_name = attributes[:'volumeAttributesClassName']
  end

  if attributes.has_key?(:'volumeMode')
    self.volume_mode = attributes[:'volumeMode']
  end

  if attributes.has_key?(:'volumeName')
    self.volume_name = attributes[:'volumeName']
  end
end

Instance Attribute Details

#access_modesObject

accessModes contains the desired access modes the volume should have. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1



19
20
21
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 19

def access_modes
  @access_modes
end

#data_sourceObject

dataSource field can be used to specify either: * An existing VolumeSnapshot object (snapshot.storage.k8s.io/VolumeSnapshot) * An existing PVC (PersistentVolumeClaim) If the provisioner or an external controller can support the specified data source, it will create a new volume based on the contents of the specified data source. When the AnyVolumeDataSource feature gate is enabled, dataSource contents will be copied to dataSourceRef, and dataSourceRef contents will be copied to dataSource when dataSourceRef.namespace is not specified. If the namespace is specified, then dataSourceRef will not be copied to dataSource.



22
23
24
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 22

def data_source
  @data_source
end

#data_source_refObject

dataSourceRef specifies the object from which to populate the volume with data, if a non-empty volume is desired. This may be any object from a non-empty API group (non core object) or a PersistentVolumeClaim object. When this field is specified, volume binding will only succeed if the type of the specified object matches some installed volume populator or dynamic provisioner. This field will replace the functionality of the dataSource field and as such if both fields are non-empty, they must have the same value. For backwards compatibility, when namespace isn’t specified in dataSourceRef, both fields (dataSource and dataSourceRef) will be set to the same value automatically if one of them is empty and the other is non-empty. When namespace is specified in dataSourceRef, dataSource isn’t set to the same value and must be empty. There are three important differences between dataSource and dataSourceRef: * While dataSource only allows two specific types of objects, dataSourceRef allows any non-core object, as well as PersistentVolumeClaim objects. * While dataSource ignores disallowed values (dropping them), dataSourceRef preserves all values, and generates an error if a disallowed value is specified. * While dataSource only allows local objects, dataSourceRef allows objects in any namespaces. (Beta) Using this field requires the AnyVolumeDataSource feature gate to be enabled. (Alpha) Using the namespace field of dataSourceRef requires the CrossNamespaceVolumeDataSource feature gate to be enabled.



25
26
27
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 25

def data_source_ref
  @data_source_ref
end

#resourcesObject

resources represents the minimum resources the volume should have. If RecoverVolumeExpansionFailure feature is enabled users are allowed to specify resource requirements that are lower than previous value but must still be higher than capacity recorded in the status field of the claim. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#resources



28
29
30
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 28

def resources
  @resources
end

#selectorObject

selector is a label query over volumes to consider for binding.



31
32
33
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 31

def selector
  @selector
end

#storage_class_nameObject

storageClassName is the name of the StorageClass required by the claim. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#class-1



34
35
36
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 34

def storage_class_name
  @storage_class_name
end

#volume_attributes_class_nameObject

volumeAttributesClassName may be used to set the VolumeAttributesClass used by this claim. If specified, the CSI driver will create or update the volume with the attributes defined in the corresponding VolumeAttributesClass. This has a different purpose than storageClassName, it can be changed after the claim is created. An empty string value means that no VolumeAttributesClass will be applied to the claim but it’s not allowed to reset this field to empty string once it is set. If unspecified and the PersistentVolumeClaim is unbound, the default VolumeAttributesClass will be set by the persistentvolume controller if it exists. If the resource referred to by volumeAttributesClass does not exist, this PersistentVolumeClaim will be set to a Pending state, as reflected by the modifyVolumeStatus field, until such as a resource exists. More info: kubernetes.io/docs/concepts/storage/volume-attributes-classes/ (Beta) Using this field requires the VolumeAttributesClass feature gate to be enabled (off by default).



37
38
39
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 37

def volume_attributes_class_name
  @volume_attributes_class_name
end

#volume_modeObject

volumeMode defines what type of volume is required by the claim. Value of Filesystem is implied when not included in claim spec.



40
41
42
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 40

def volume_mode
  @volume_mode
end

#volume_nameObject

volumeName is the binding reference to the PersistentVolume backing this claim.



43
44
45
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 43

def volume_name
  @volume_name
end

Class Method Details

.attribute_mapObject

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



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 46

def self.attribute_map
  {
    :'access_modes' => :'accessModes',
    :'data_source' => :'dataSource',
    :'data_source_ref' => :'dataSourceRef',
    :'resources' => :'resources',
    :'selector' => :'selector',
    :'storage_class_name' => :'storageClassName',
    :'volume_attributes_class_name' => :'volumeAttributesClassName',
    :'volume_mode' => :'volumeMode',
    :'volume_name' => :'volumeName'
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    :'access_modes' => :'Array<String>',
    :'data_source' => :'IoK8sApiCoreV1TypedLocalObjectReference',
    :'data_source_ref' => :'IoK8sApiCoreV1TypedObjectReference',
    :'resources' => :'IoK8sApiCoreV1VolumeResourceRequirements',
    :'selector' => :'IoK8sApimachineryPkgApisMetaV1LabelSelector',
    :'storage_class_name' => :'String',
    :'volume_attributes_class_name' => :'String',
    :'volume_mode' => :'String',
    :'volume_name' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 137

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      access_modes == o.access_modes &&
      data_source == o.data_source &&
      data_source_ref == o.data_source_ref &&
      resources == o.resources &&
      selector == o.selector &&
      storage_class_name == o.storage_class_name &&
      volume_attributes_class_name == o.volume_attributes_class_name &&
      volume_mode == o.volume_mode &&
      volume_name == o.volume_name
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



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 187

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 = ArgoWorkflows.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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 253

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



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 166

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 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 # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


153
154
155
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 153

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



159
160
161
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 159

def hash
  [access_modes, data_source, data_source_ref, resources, selector, storage_class_name, volume_attributes_class_name, volume_mode, volume_name].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



124
125
126
127
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 124

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



233
234
235
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 233

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



239
240
241
242
243
244
245
246
247
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 239

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

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



227
228
229
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 227

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



131
132
133
# File 'lib/argo_workflows/models/io_k8s_api_core_v1_persistent_volume_claim_spec.rb', line 131

def valid?
  true
end