Class: CDK8sPlus25::K8S::VolumeAttachmentSource

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
k8_s/volume_attachment_source.rb

Overview

VolumeAttachmentSource represents a volume that should be attached.

Right now only PersistenVolumes can be attached via external attacher, in future we may allow also inline volumes in pods. Exactly one member can be set.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(inline_volume_spec: nil, persistent_volume_name: nil) ⇒ VolumeAttachmentSource

Returns a new instance of VolumeAttachmentSource.

Parameters:

  • inline_volume_spec (CDK8sPlus25::K8S::PersistentVolumeSpec, nil) (defaults to: nil)

    inlineVolumeSpec contains all the information necessary to attach a persistent volume defined by a pod's inline VolumeSource.

  • persistent_volume_name (String, nil) (defaults to: nil)

    Name of the persistent volume to attach.



11
12
13
14
15
16
# File 'k8_s/volume_attachment_source.rb', line 11

def initialize(inline_volume_spec: nil, persistent_volume_name: nil)
  @inline_volume_spec = inline_volume_spec.is_a?(Hash) ? ::CDK8sPlus25::K8S::PersistentVolumeSpec.new(**inline_volume_spec.transform_keys(&:to_sym)) : inline_volume_spec
  Jsii::Type.check_type(@inline_volume_spec, "eyJmcW4iOiJjZGs4cy1wbHVzLTI1Lms4cy5QZXJzaXN0ZW50Vm9sdW1lU3BlYyJ9", "inlineVolumeSpec") unless @inline_volume_spec.nil?
  @persistent_volume_name = persistent_volume_name
  Jsii::Type.check_type(@persistent_volume_name, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "persistentVolumeName") unless @persistent_volume_name.nil?
end

Instance Attribute Details

#inline_volume_specCDK8sPlus25::K8S::PersistentVolumeSpec? (readonly)

inlineVolumeSpec contains all the information necessary to attach a persistent volume defined by a pod's inline VolumeSource.

This field is populated only for the CSIMigration feature. It contains translated fields from a pod's inline VolumeSource to a PersistentVolumeSpec. This field is beta-level and is only honored by servers that enabled the CSIMigration feature.



23
24
25
# File 'k8_s/volume_attachment_source.rb', line 23

def inline_volume_spec
  @inline_volume_spec
end

#persistent_volume_nameString? (readonly)

Name of the persistent volume to attach.

Returns:

  • (String, nil)


27
28
29
# File 'k8_s/volume_attachment_source.rb', line 27

def persistent_volume_name
  @persistent_volume_name
end

Class Method Details

.jsii_propertiesObject



29
30
31
32
33
34
# File 'k8_s/volume_attachment_source.rb', line 29

def self.jsii_properties
  {
    :inline_volume_spec => "inlineVolumeSpec",
    :persistent_volume_name => "persistentVolumeName",
  }
end

Instance Method Details

#to_jsiiObject



36
37
38
39
40
41
42
43
# File 'k8_s/volume_attachment_source.rb', line 36

def to_jsii
  result = {}
  result.merge!({
    "inlineVolumeSpec" => @inline_volume_spec,
    "persistentVolumeName" => @persistent_volume_name,
  })
  result.compact
end