Class: Zilla::IoK8sApiCoreV1Volume

Inherits:
Object
  • Object
show all
Defined in:
lib/zilla/models/io_k8s_api_core_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 = {}) ⇒ IoK8sApiCoreV1Volume

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 109

def initialize(attributes = {})
  unless attributes.is_a?(Hash)
    raise ArgumentError,
          'The input argument (attributes) must be a hash in `Zilla::IoK8sApiCoreV1Volume` initialize method'
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) do |(k, v), h|
    unless self.class.attribute_map.key?(k.to_sym)
      raise ArgumentError,
            "`#{k}` is not a valid attribute in `Zilla::IoK8sApiCoreV1Volume`. 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
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  return unless attributes.key?(:vsphere_volume)

  self.vsphere_volume = attributes[:vsphere_volume]
end

Instance Attribute Details

#aws_elastic_block_storeObject

Returns the value of attribute aws_elastic_block_store.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def aws_elastic_block_store
  @aws_elastic_block_store
end

#azure_diskObject

Returns the value of attribute azure_disk.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def azure_disk
  @azure_disk
end

#azure_fileObject

Returns the value of attribute azure_file.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def azure_file
  @azure_file
end

#cephfsObject

Returns the value of attribute cephfs.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def cephfs
  @cephfs
end

#cinderObject

Returns the value of attribute cinder.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def cinder
  @cinder
end

#config_mapObject

Returns the value of attribute config_map.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def config_map
  @config_map
end

#csiObject

Returns the value of attribute csi.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def csi
  @csi
end

#downward_apiObject

Returns the value of attribute downward_api.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def downward_api
  @downward_api
end

#empty_dirObject

Returns the value of attribute empty_dir.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def empty_dir
  @empty_dir
end

#ephemeralObject

Returns the value of attribute ephemeral.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def ephemeral
  @ephemeral
end

#fcObject

Returns the value of attribute fc.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def fc
  @fc
end

#flex_volumeObject

Returns the value of attribute flex_volume.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def flex_volume
  @flex_volume
end

#flockerObject

Returns the value of attribute flocker.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def flocker
  @flocker
end

#gce_persistent_diskObject

Returns the value of attribute gce_persistent_disk.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def gce_persistent_disk
  @gce_persistent_disk
end

#git_repoObject

Returns the value of attribute git_repo.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def git_repo
  @git_repo
end

#glusterfsObject

Returns the value of attribute glusterfs.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def glusterfs
  @glusterfs
end

#host_pathObject

Returns the value of attribute host_path.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def host_path
  @host_path
end

#iscsiObject

Returns the value of attribute iscsi.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

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



23
24
25
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 23

def name
  @name
end

#nfsObject

Returns the value of attribute nfs.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def nfs
  @nfs
end

#persistent_volume_claimObject

Returns the value of attribute persistent_volume_claim.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def persistent_volume_claim
  @persistent_volume_claim
end

#photon_persistent_diskObject

Returns the value of attribute photon_persistent_disk.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def photon_persistent_disk
  @photon_persistent_disk
end

#portworx_volumeObject

Returns the value of attribute portworx_volume.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def portworx_volume
  @portworx_volume
end

#projectedObject

Returns the value of attribute projected.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def projected
  @projected
end

#quobyteObject

Returns the value of attribute quobyte.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def quobyte
  @quobyte
end

#rbdObject

Returns the value of attribute rbd.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def rbd
  @rbd
end

#scale_ioObject

Returns the value of attribute scale_io.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def scale_io
  @scale_io
end

#secretObject

Returns the value of attribute secret.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def secret
  @secret
end

#storageosObject

Returns the value of attribute storageos.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def storageos
  @storageos
end

#vsphere_volumeObject

Returns the value of attribute vsphere_volume.



19
20
21
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 19

def vsphere_volume
  @vsphere_volume
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



62
63
64
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 62

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 26

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,
    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



259
260
261
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 259

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

.openapi_nullableObject

List of attributes with nullable: true



103
104
105
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 103

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

.openapi_typesObject

Attribute type mapping.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 67

def self.openapi_types
  {
    aws_elastic_block_store: :IoK8sApiCoreV1AWSElasticBlockStoreVolumeSource,
    azure_disk: :IoK8sApiCoreV1AzureDiskVolumeSource,
    azure_file: :IoK8sApiCoreV1AzureFileVolumeSource,
    cephfs: :IoK8sApiCoreV1CephFSVolumeSource,
    cinder: :IoK8sApiCoreV1CinderVolumeSource,
    config_map: :IoK8sApiCoreV1ConfigMapVolumeSource,
    csi: :IoK8sApiCoreV1CSIVolumeSource,
    downward_api: :IoK8sApiCoreV1DownwardAPIVolumeSource,
    empty_dir: :IoK8sApiCoreV1EmptyDirVolumeSource,
    ephemeral: :IoK8sApiCoreV1EphemeralVolumeSource,
    fc: :IoK8sApiCoreV1FCVolumeSource,
    flex_volume: :IoK8sApiCoreV1FlexVolumeSource,
    flocker: :IoK8sApiCoreV1FlockerVolumeSource,
    gce_persistent_disk: :IoK8sApiCoreV1GCEPersistentDiskVolumeSource,
    git_repo: :IoK8sApiCoreV1GitRepoVolumeSource,
    glusterfs: :IoK8sApiCoreV1GlusterfsVolumeSource,
    host_path: :IoK8sApiCoreV1HostPathVolumeSource,
    iscsi: :IoK8sApiCoreV1ISCSIVolumeSource,
    name: :String,
    nfs: :IoK8sApiCoreV1NFSVolumeSource,
    persistent_volume_claim: :IoK8sApiCoreV1PersistentVolumeClaimVolumeSource,
    photon_persistent_disk: :IoK8sApiCoreV1PhotonPersistentDiskVolumeSource,
    portworx_volume: :IoK8sApiCoreV1PortworxVolumeSource,
    projected: :IoK8sApiCoreV1ProjectedVolumeSource,
    quobyte: :IoK8sApiCoreV1QuobyteVolumeSource,
    rbd: :IoK8sApiCoreV1RBDVolumeSource,
    scale_io: :IoK8sApiCoreV1ScaleIOVolumeSource,
    secret: :IoK8sApiCoreV1SecretVolumeSource,
    storageos: :IoK8sApiCoreV1StorageOSVolumeSource,
    vsphere_volume: :IoK8sApiCoreV1VsphereVirtualDiskVolumeSource
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 207

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

  self.class == other.class &&
    aws_elastic_block_store == other.aws_elastic_block_store &&
    azure_disk == other.azure_disk &&
    azure_file == other.azure_file &&
    cephfs == other.cephfs &&
    cinder == other.cinder &&
    config_map == other.config_map &&
    csi == other.csi &&
    downward_api == other.downward_api &&
    empty_dir == other.empty_dir &&
    ephemeral == other.ephemeral &&
    fc == other.fc &&
    flex_volume == other.flex_volume &&
    flocker == other.flocker &&
    gce_persistent_disk == other.gce_persistent_disk &&
    git_repo == other.git_repo &&
    glusterfs == other.glusterfs &&
    host_path == other.host_path &&
    iscsi == other.iscsi &&
    name == other.name &&
    nfs == other.nfs &&
    persistent_volume_claim == other.persistent_volume_claim &&
    photon_persistent_disk == other.photon_persistent_disk &&
    portworx_volume == other.portworx_volume &&
    projected == other.projected &&
    quobyte == other.quobyte &&
    rbd == other.rbd &&
    scale_io == other.scale_io &&
    secret == other.secret &&
    storageos == other.storageos &&
    vsphere_volume == other.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



293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 293

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



364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 364

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



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 266

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

  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      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)
        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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


245
246
247
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 245

def eql?(other)
  self == other
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



251
252
253
254
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 251

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, 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



190
191
192
193
194
195
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 190

def list_invalid_properties
  invalid_properties = []
  invalid_properties.push('invalid value for "name", name cannot be nil.') if @name.nil?

  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



340
341
342
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 340

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



346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 346

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = 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



334
335
336
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 334

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



199
200
201
202
203
# File 'lib/zilla/models/io_k8s_api_core_v1_volume.rb', line 199

def valid?
  return false if @name.nil?

  true
end