Class: Kubernetes::V1PersistentVolumeSpec

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

Overview

PersistentVolumeSpec is the specification of a persistent volume.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ V1PersistentVolumeSpec

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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

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?(:accessModes) && (value = attributes[:accessModes]).is_a?(Array)
    self.access_modes = value
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:persistentVolumeReclaimPolicy)
    self.persistent_volume_reclaim_policy = attributes[:persistentVolumeReclaimPolicy]
  end

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

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

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

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

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

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

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

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

  return unless attributes.key?(:vsphereVolume)

  self.vsphere_volume = attributes[:vsphereVolume]
end

Instance Attribute Details

#access_modesObject

AccessModes contains all ways the volume can be mounted. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes



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

def access_modes
  @access_modes
end

#aws_elastic_block_storeObject

AWSElasticBlockStore represents an AWS Disk resource that is attached to a kubelet’s host machine and then exposed to the pod. More info: kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore



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

def aws_elastic_block_store
  @aws_elastic_block_store
end

#azure_diskObject

AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.



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

def azure_disk
  @azure_disk
end

#azure_fileObject

AzureFile represents an Azure File Service mount on the host and bind mount to the pod.



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

def azure_file
  @azure_file
end

#capacityObject

A description of the persistent volume’s resources and capacity. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#capacity



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

def capacity
  @capacity
end

#cephfsObject

CephFS represents a Ceph FS mount on the host that shares a pod’s lifetime



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

def cephfs
  @cephfs
end

#cinderObject

Cinder represents a cinder volume attached and mounted on kubelets host machine More info: releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md



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

def cinder
  @cinder
end

#claim_refObject

ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim. Expected to be non-nil when bound. claim.VolumeName is the authoritative bind between PV and PVC. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#binding



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

def claim_ref
  @claim_ref
end

#csiObject

CSI represents storage that handled by an external CSI driver (Beta feature).



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

def csi
  @csi
end

#fcObject

FC represents a Fibre Channel resource that is attached to a kubelet’s host machine and then exposed to the pod.



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

def fc
  @fc
end

#flex_volumeObject

FlexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.



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

def flex_volume
  @flex_volume
end

#flockerObject

Flocker represents a Flocker volume attached to a kubelet’s host machine and exposed to the pod for its usage. This depends on the Flocker control service being running



52
53
54
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 52

def flocker
  @flocker
end

#gce_persistent_diskObject

GCEPersistentDisk represents a GCE Disk resource that is attached to a kubelet’s host machine and then exposed to the pod. Provisioned by an admin. More info: kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk



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

def gce_persistent_disk
  @gce_persistent_disk
end

#glusterfsObject

Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod. Provisioned by an admin. More info: releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md



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

def glusterfs
  @glusterfs
end

#host_pathObject

HostPath represents a directory on the host. Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: kubernetes.io/docs/concepts/storage/volumes#hostpath



61
62
63
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 61

def host_path
  @host_path
end

#iscsiObject

ISCSI represents an ISCSI Disk resource that is attached to a kubelet’s host machine and then exposed to the pod. Provisioned by an admin.



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

def iscsi
  @iscsi
end

#localObject

Local represents directly-attached storage with node affinity



67
68
69
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 67

def local
  @local
end

#mount_optionsObject

A list of mount options, e.g. ["ro", "soft"]. Not validated - mount will simply fail if one is invalid. More info: kubernetes.io/docs/concepts/storage/persistent-volumes/#mount-options



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

def mount_options
  @mount_options
end

#nfsObject

NFS represents an NFS mount on the host. Provisioned by an admin. More info: kubernetes.io/docs/concepts/storage/volumes#nfs



73
74
75
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 73

def nfs
  @nfs
end

#node_affinityObject

NodeAffinity defines constraints that limit what nodes this volume can be accessed from. This field influences the scheduling of pods that use this volume.



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

def node_affinity
  @node_affinity
end

#persistent_volume_reclaim_policyObject

What happens to a persistent volume when released from its claim. Valid options are Retain (default for manually created PersistentVolumes), Delete (default for dynamically provisioned PersistentVolumes), and Recycle (deprecated). Recycle must be supported by the volume plugin underlying this PersistentVolume. More info: kubernetes.io/docs/concepts/storage/persistent-volumes#reclaiming



79
80
81
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 79

def persistent_volume_reclaim_policy
  @persistent_volume_reclaim_policy
end

#photon_persistent_diskObject

PhotonPersistentDisk represents a PhotonController persistent disk attached and mounted on kubelets host machine



82
83
84
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 82

def photon_persistent_disk
  @photon_persistent_disk
end

#portworx_volumeObject

PortworxVolume represents a portworx volume attached and mounted on kubelets host machine



85
86
87
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 85

def portworx_volume
  @portworx_volume
end

#quobyteObject

Quobyte represents a Quobyte mount on the host that shares a pod’s lifetime



88
89
90
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 88

def quobyte
  @quobyte
end

#rbdObject

RBD represents a Rados Block Device mount on the host that shares a pod’s lifetime. More info: releases.k8s.io/HEAD/examples/volumes/rbd/README.md



91
92
93
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 91

def rbd
  @rbd
end

#scale_ioObject

ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.



94
95
96
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 94

def scale_io
  @scale_io
end

#storage_class_nameObject

Name of StorageClass to which this persistent volume belongs. Empty value means that this volume does not belong to any StorageClass.



97
98
99
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 97

def storage_class_name
  @storage_class_name
end

#storageosObject

StorageOS represents a StorageOS volume that is attached to the kubelet’s host machine and mounted into the pod More info: releases.k8s.io/HEAD/examples/volumes/storageos/README.md



100
101
102
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 100

def storageos
  @storageos
end

#volume_modeObject

volumeMode defines if a volume is intended to be used with a formatted filesystem or to remain in raw block state. Value of Filesystem is implied when not included in spec. This is a beta feature.



103
104
105
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 103

def volume_mode
  @volume_mode
end

#vsphere_volumeObject

VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine



106
107
108
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 106

def vsphere_volume
  @vsphere_volume
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    access_modes: :accessModes,
    aws_elastic_block_store: :awsElasticBlockStore,
    azure_disk: :azureDisk,
    azure_file: :azureFile,
    capacity: :capacity,
    cephfs: :cephfs,
    cinder: :cinder,
    claim_ref: :claimRef,
    csi: :csi,
    fc: :fc,
    flex_volume: :flexVolume,
    flocker: :flocker,
    gce_persistent_disk: :gcePersistentDisk,
    glusterfs: :glusterfs,
    host_path: :hostPath,
    iscsi: :iscsi,
    local: :local,
    mount_options: :mountOptions,
    nfs: :nfs,
    node_affinity: :nodeAffinity,
    persistent_volume_reclaim_policy: :persistentVolumeReclaimPolicy,
    photon_persistent_disk: :photonPersistentDisk,
    portworx_volume: :portworxVolume,
    quobyte: :quobyte,
    rbd: :rbd,
    scale_io: :scaleIO,
    storage_class_name: :storageClassName,
    storageos: :storageos,
    volume_mode: :volumeMode,
    vsphere_volume: :vsphereVolume
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    access_modes: :'Array<String>',
    aws_elastic_block_store: :V1AWSElasticBlockStoreVolumeSource,
    azure_disk: :V1AzureDiskVolumeSource,
    azure_file: :V1AzureFilePersistentVolumeSource,
    capacity: :'Hash<String, String>',
    cephfs: :V1CephFSPersistentVolumeSource,
    cinder: :V1CinderPersistentVolumeSource,
    claim_ref: :V1ObjectReference,
    csi: :V1CSIPersistentVolumeSource,
    fc: :V1FCVolumeSource,
    flex_volume: :V1FlexPersistentVolumeSource,
    flocker: :V1FlockerVolumeSource,
    gce_persistent_disk: :V1GCEPersistentDiskVolumeSource,
    glusterfs: :V1GlusterfsPersistentVolumeSource,
    host_path: :V1HostPathVolumeSource,
    iscsi: :V1ISCSIPersistentVolumeSource,
    local: :V1LocalVolumeSource,
    mount_options: :'Array<String>',
    nfs: :V1NFSVolumeSource,
    node_affinity: :V1VolumeNodeAffinity,
    persistent_volume_reclaim_policy: :String,
    photon_persistent_disk: :V1PhotonPersistentDiskVolumeSource,
    portworx_volume: :V1PortworxVolumeSource,
    quobyte: :V1QuobyteVolumeSource,
    rbd: :V1RBDPersistentVolumeSource,
    scale_io: :V1ScaleIOPersistentVolumeSource,
    storage_class_name: :String,
    storageos: :V1StorageOSPersistentVolumeSource,
    volume_mode: :String,
    vsphere_volume: :V1VsphereVirtualDiskVolumeSource
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
306
307
308
309
310
311
312
313
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 279

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

  self.class == other.class &&
    access_modes == other.access_modes &&
    aws_elastic_block_store == other.aws_elastic_block_store &&
    azure_disk == other.azure_disk &&
    azure_file == other.azure_file &&
    capacity == other.capacity &&
    cephfs == other.cephfs &&
    cinder == other.cinder &&
    claim_ref == other.claim_ref &&
    csi == other.csi &&
    fc == other.fc &&
    flex_volume == other.flex_volume &&
    flocker == other.flocker &&
    gce_persistent_disk == other.gce_persistent_disk &&
    glusterfs == other.glusterfs &&
    host_path == other.host_path &&
    iscsi == other.iscsi &&
    local == other.local &&
    mount_options == other.mount_options &&
    nfs == other.nfs &&
    node_affinity == other.node_affinity &&
    persistent_volume_reclaim_policy == other.persistent_volume_reclaim_policy &&
    photon_persistent_disk == other.photon_persistent_disk &&
    portworx_volume == other.portworx_volume &&
    quobyte == other.quobyte &&
    rbd == other.rbd &&
    scale_io == other.scale_io &&
    storage_class_name == other.storage_class_name &&
    storageos == other.storageos &&
    volume_mode == other.volume_mode &&
    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



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 355

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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 422

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



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 331

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

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


317
318
319
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 317

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



323
324
325
326
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 323

def hash
  [access_modes, aws_elastic_block_store, azure_disk, azure_file, capacity, cephfs, cinder,
   claim_ref, csi, fc, flex_volume, flocker, gce_persistent_disk, glusterfs, host_path, iscsi, local, mount_options, nfs, node_affinity, persistent_volume_reclaim_policy, photon_persistent_disk, portworx_volume, quobyte, rbd, scale_io, storage_class_name, storageos, volume_mode, vsphere_volume].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properies with the reasons



267
268
269
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 267

def list_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



401
402
403
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 401

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



407
408
409
410
411
412
413
414
415
416
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 407

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

Returns:

  • (String)

    String presentation of the object



395
396
397
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 395

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



273
274
275
# File 'lib/kubernetes/models/v1_persistent_volume_spec.rb', line 273

def valid?
  true
end