Class: Kubernetes::V1Volume

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

Overview

Volume represents a named volume in a pod that may be accessed by any container in the pod.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1Volume

Initializes the object

Parameters:

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

    Model attributes in the form of hash



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
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
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
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/kubernetes/models/v1_volume.rb', line 169

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#aws_elastic_block_storeObject

Returns the value of attribute aws_elastic_block_store.



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

def aws_elastic_block_store
  @aws_elastic_block_store
end

#azure_diskObject

Returns the value of attribute azure_disk.



21
22
23
# File 'lib/kubernetes/models/v1_volume.rb', line 21

def azure_disk
  @azure_disk
end

#azure_fileObject

Returns the value of attribute azure_file.



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

def azure_file
  @azure_file
end

#cephfsObject

Returns the value of attribute cephfs.



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

def cephfs
  @cephfs
end

#cinderObject

Returns the value of attribute cinder.



27
28
29
# File 'lib/kubernetes/models/v1_volume.rb', line 27

def cinder
  @cinder
end

#config_mapObject

Returns the value of attribute config_map.



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

def config_map
  @config_map
end

#csiObject

Returns the value of attribute csi.



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

def csi
  @csi
end

#downward_apiObject

Returns the value of attribute downward_api.



33
34
35
# File 'lib/kubernetes/models/v1_volume.rb', line 33

def downward_api
  @downward_api
end

#empty_dirObject

Returns the value of attribute empty_dir.



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

def empty_dir
  @empty_dir
end

#ephemeralObject

Returns the value of attribute ephemeral.



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

def ephemeral
  @ephemeral
end

#fcObject

Returns the value of attribute fc.



39
40
41
# File 'lib/kubernetes/models/v1_volume.rb', line 39

def fc
  @fc
end

#flex_volumeObject

Returns the value of attribute flex_volume.



41
42
43
# File 'lib/kubernetes/models/v1_volume.rb', line 41

def flex_volume
  @flex_volume
end

#flockerObject

Returns the value of attribute flocker.



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

def flocker
  @flocker
end

#gce_persistent_diskObject

Returns the value of attribute gce_persistent_disk.



45
46
47
# File 'lib/kubernetes/models/v1_volume.rb', line 45

def gce_persistent_disk
  @gce_persistent_disk
end

#git_repoObject

Returns the value of attribute git_repo.



47
48
49
# File 'lib/kubernetes/models/v1_volume.rb', line 47

def git_repo
  @git_repo
end

#glusterfsObject

Returns the value of attribute glusterfs.



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

def glusterfs
  @glusterfs
end

#host_pathObject

Returns the value of attribute host_path.



51
52
53
# File 'lib/kubernetes/models/v1_volume.rb', line 51

def host_path
  @host_path
end

#imageObject

Returns the value of attribute image.



53
54
55
# File 'lib/kubernetes/models/v1_volume.rb', line 53

def image
  @image
end

#iscsiObject

Returns the value of attribute iscsi.



55
56
57
# File 'lib/kubernetes/models/v1_volume.rb', line 55

def iscsi
  @iscsi
end

#nameObject

name of the volume. Must be a DNS_LABEL and unique within the pod. More info: kubernetes.io/docs/concepts/overview/working-with-objects/names/#names



58
59
60
# File 'lib/kubernetes/models/v1_volume.rb', line 58

def name
  @name
end

#nfsObject

Returns the value of attribute nfs.



60
61
62
# File 'lib/kubernetes/models/v1_volume.rb', line 60

def nfs
  @nfs
end

#persistent_volume_claimObject

Returns the value of attribute persistent_volume_claim.



62
63
64
# File 'lib/kubernetes/models/v1_volume.rb', line 62

def persistent_volume_claim
  @persistent_volume_claim
end

#photon_persistent_diskObject

Returns the value of attribute photon_persistent_disk.



64
65
66
# File 'lib/kubernetes/models/v1_volume.rb', line 64

def photon_persistent_disk
  @photon_persistent_disk
end

#portworx_volumeObject

Returns the value of attribute portworx_volume.



66
67
68
# File 'lib/kubernetes/models/v1_volume.rb', line 66

def portworx_volume
  @portworx_volume
end

#projectedObject

Returns the value of attribute projected.



68
69
70
# File 'lib/kubernetes/models/v1_volume.rb', line 68

def projected
  @projected
end

#quobyteObject

Returns the value of attribute quobyte.



70
71
72
# File 'lib/kubernetes/models/v1_volume.rb', line 70

def quobyte
  @quobyte
end

#rbdObject

Returns the value of attribute rbd.



72
73
74
# File 'lib/kubernetes/models/v1_volume.rb', line 72

def rbd
  @rbd
end

#scale_ioObject

Returns the value of attribute scale_io.



74
75
76
# File 'lib/kubernetes/models/v1_volume.rb', line 74

def scale_io
  @scale_io
end

#secretObject

Returns the value of attribute secret.



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

def secret
  @secret
end

#storageosObject

Returns the value of attribute storageos.



78
79
80
# File 'lib/kubernetes/models/v1_volume.rb', line 78

def storageos
  @storageos
end

#vsphere_volumeObject

Returns the value of attribute vsphere_volume.



80
81
82
# File 'lib/kubernetes/models/v1_volume.rb', line 80

def vsphere_volume
  @vsphere_volume
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



120
121
122
# File 'lib/kubernetes/models/v1_volume.rb', line 120

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/kubernetes/models/v1_volume.rb', line 83

def self.attribute_map
  {
    :'aws_elastic_block_store' => :'awsElasticBlockStore',
    :'azure_disk' => :'azureDisk',
    :'azure_file' => :'azureFile',
    :'cephfs' => :'cephfs',
    :'cinder' => :'cinder',
    :'config_map' => :'configMap',
    :'csi' => :'csi',
    :'downward_api' => :'downwardAPI',
    :'empty_dir' => :'emptyDir',
    :'ephemeral' => :'ephemeral',
    :'fc' => :'fc',
    :'flex_volume' => :'flexVolume',
    :'flocker' => :'flocker',
    :'gce_persistent_disk' => :'gcePersistentDisk',
    :'git_repo' => :'gitRepo',
    :'glusterfs' => :'glusterfs',
    :'host_path' => :'hostPath',
    :'image' => :'image',
    :'iscsi' => :'iscsi',
    :'name' => :'name',
    :'nfs' => :'nfs',
    :'persistent_volume_claim' => :'persistentVolumeClaim',
    :'photon_persistent_disk' => :'photonPersistentDisk',
    :'portworx_volume' => :'portworxVolume',
    :'projected' => :'projected',
    :'quobyte' => :'quobyte',
    :'rbd' => :'rbd',
    :'scale_io' => :'scaleIO',
    :'secret' => :'secret',
    :'storageos' => :'storageos',
    :'vsphere_volume' => :'vsphereVolume'
  }
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



378
379
380
# File 'lib/kubernetes/models/v1_volume.rb', line 378

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

.openapi_nullableObject

List of attributes with nullable: true



162
163
164
165
# File 'lib/kubernetes/models/v1_volume.rb', line 162

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/kubernetes/models/v1_volume.rb', line 125

def self.openapi_types
  {
    :'aws_elastic_block_store' => :'V1AWSElasticBlockStoreVolumeSource',
    :'azure_disk' => :'V1AzureDiskVolumeSource',
    :'azure_file' => :'V1AzureFileVolumeSource',
    :'cephfs' => :'V1CephFSVolumeSource',
    :'cinder' => :'V1CinderVolumeSource',
    :'config_map' => :'V1ConfigMapVolumeSource',
    :'csi' => :'V1CSIVolumeSource',
    :'downward_api' => :'V1DownwardAPIVolumeSource',
    :'empty_dir' => :'V1EmptyDirVolumeSource',
    :'ephemeral' => :'V1EphemeralVolumeSource',
    :'fc' => :'V1FCVolumeSource',
    :'flex_volume' => :'V1FlexVolumeSource',
    :'flocker' => :'V1FlockerVolumeSource',
    :'gce_persistent_disk' => :'V1GCEPersistentDiskVolumeSource',
    :'git_repo' => :'V1GitRepoVolumeSource',
    :'glusterfs' => :'V1GlusterfsVolumeSource',
    :'host_path' => :'V1HostPathVolumeSource',
    :'image' => :'V1ImageVolumeSource',
    :'iscsi' => :'V1ISCSIVolumeSource',
    :'name' => :'String',
    :'nfs' => :'V1NFSVolumeSource',
    :'persistent_volume_claim' => :'V1PersistentVolumeClaimVolumeSource',
    :'photon_persistent_disk' => :'V1PhotonPersistentDiskVolumeSource',
    :'portworx_volume' => :'V1PortworxVolumeSource',
    :'projected' => :'V1ProjectedVolumeSource',
    :'quobyte' => :'V1QuobyteVolumeSource',
    :'rbd' => :'V1RBDVolumeSource',
    :'scale_io' => :'V1ScaleIOVolumeSource',
    :'secret' => :'V1SecretVolumeSource',
    :'storageos' => :'V1StorageOSVolumeSource',
    :'vsphere_volume' => :'V1VsphereVirtualDiskVolumeSource'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/kubernetes/models/v1_volume.rb', line 327

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      aws_elastic_block_store == o.aws_elastic_block_store &&
      azure_disk == o.azure_disk &&
      azure_file == o.azure_file &&
      cephfs == o.cephfs &&
      cinder == o.cinder &&
      config_map == o.config_map &&
      csi == o.csi &&
      downward_api == o.downward_api &&
      empty_dir == o.empty_dir &&
      ephemeral == o.ephemeral &&
      fc == o.fc &&
      flex_volume == o.flex_volume &&
      flocker == o.flocker &&
      gce_persistent_disk == o.gce_persistent_disk &&
      git_repo == o.git_repo &&
      glusterfs == o.glusterfs &&
      host_path == o.host_path &&
      image == o.image &&
      iscsi == o.iscsi &&
      name == o.name &&
      nfs == o.nfs &&
      persistent_volume_claim == o.persistent_volume_claim &&
      photon_persistent_disk == o.photon_persistent_disk &&
      portworx_volume == o.portworx_volume &&
      projected == o.projected &&
      quobyte == o.quobyte &&
      rbd == o.rbd &&
      scale_io == o.scale_io &&
      secret == o.secret &&
      storageos == o.storageos &&
      vsphere_volume == o.vsphere_volume
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



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
# File 'lib/kubernetes/models/v1_volume.rb', line 408

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



479
480
481
482
483
484
485
486
487
488
489
490
491
# File 'lib/kubernetes/models/v1_volume.rb', line 479

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



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/kubernetes/models/v1_volume.rb', line 385

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


365
366
367
# File 'lib/kubernetes/models/v1_volume.rb', line 365

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



371
372
373
# File 'lib/kubernetes/models/v1_volume.rb', line 371

def hash
  [aws_elastic_block_store, azure_disk, azure_file, cephfs, cinder, config_map, csi, downward_api, empty_dir, ephemeral, fc, flex_volume, flocker, gce_persistent_disk, git_repo, glusterfs, host_path, image, iscsi, name, nfs, persistent_volume_claim, photon_persistent_disk, portworx_volume, projected, quobyte, rbd, scale_io, secret, storageos, vsphere_volume].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



309
310
311
312
313
314
315
316
# File 'lib/kubernetes/models/v1_volume.rb', line 309

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_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



455
456
457
# File 'lib/kubernetes/models/v1_volume.rb', line 455

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



461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/kubernetes/models/v1_volume.rb', line 461

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



449
450
451
# File 'lib/kubernetes/models/v1_volume.rb', line 449

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



320
321
322
323
# File 'lib/kubernetes/models/v1_volume.rb', line 320

def valid?
  return false if @name.nil?
  true
end