Class: CDK8sPlus25::PersistentVolume

Inherits:
Resource
  • Object
show all
Includes:
IPersistentVolume, IStorage
Defined in:
persistent_volume.rb

Overview

A PersistentVolume (PV) is a piece of storage in the cluster that has been provisioned by an administrator or dynamically provisioned using Storage Classes.

It is a resource in the cluster just like a node is a cluster resource. PVs are volume plugins like Volumes, but have a lifecycle independent of any individual Pod that uses the PV. This API object captures the details of the implementation of the storage, be that NFS, iSCSI, or a cloud-provider-specific storage system.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props = nil, &jsii_block) ⇒ PersistentVolume

Returns a new instance of PersistentVolume.

Parameters:



19
20
21
22
23
24
25
# File 'persistent_volume.rb', line 19

def initialize(scope, id, props = nil, &jsii_block)
  props = props.is_a?(Hash) ? ::CDK8sPlus25::PersistentVolumeProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, "eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9", "scope")
  Jsii::Type.check_type(id, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "id")
  Jsii::Type.check_type(props, "eyJmcW4iOiJjZGs4cy1wbHVzLTI1LlBlcnNpc3RlbnRWb2x1bWVQcm9wcyJ9", "props") unless props.nil?
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props, &jsii_block)
end

Class Method Details

.from_persistent_volume_name(scope, id, volume_name) ⇒ CDK8sPlus25::IPersistentVolume

Imports a pv from the cluster as a reference.

Parameters:

Returns:



62
63
64
65
66
67
# File 'persistent_volume.rb', line 62

def self.from_persistent_volume_name(scope, id, volume_name)
  Jsii::Type.check_type(scope, "eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9", "scope")
  Jsii::Type.check_type(id, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "id")
  Jsii::Type.check_type(volume_name, "eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==", "volumeName")
  Jsii::Kernel.instance.call_static("cdk8s-plus-25.PersistentVolume", "fromPersistentVolumeName", [scope, id, volume_name])
end

.jsii_overridable_methodsObject



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
# File 'persistent_volume.rb', line 27

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :api_group => { kind: :property, name: "apiGroup", is_optional: false },
    :api_object => { kind: :property, name: "apiObject", is_optional: false },
    :api_version => { kind: :property, name: "apiVersion", is_optional: false },
    :kind => { kind: :property, name: "kind", is_optional: false },
    :metadata => { kind: :property, name: "metadata", is_optional: false },
    :name => { kind: :property, name: "name", is_optional: false },
    :permissions => { kind: :property, name: "permissions", is_optional: false },
    :resource_type => { kind: :property, name: "resourceType", is_optional: false },
    :resource_name => { kind: :property, name: "resourceName", is_optional: true },
    :mode => { kind: :property, name: "mode", is_optional: false },
    :reclaim_policy => { kind: :property, name: "reclaimPolicy", is_optional: false },
    :access_modes => { kind: :property, name: "accessModes", is_optional: true },
    :claim => { kind: :property, name: "claim", is_optional: true },
    :mount_options => { kind: :property, name: "mountOptions", is_optional: true },
    :storage => { kind: :property, name: "storage", is_optional: true },
    :storage_class_name => { kind: :property, name: "storageClassName", is_optional: true },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :as_api_resource => { kind: :method, name: "asApiResource", is_optional: false },
    :as_non_api_resource => { kind: :method, name: "asNonApiResource", is_optional: false },
    :as_volume => { kind: :method, name: "asVolume", is_optional: false },
    :bind => { kind: :method, name: "bind", is_optional: false },
    :reserve => { kind: :method, name: "reserve", is_optional: false },
  }
end

Instance Method Details

#access_modesArray<CDK8sPlus25::PersistentVolumeAccessMode>?

Access modes requirement of this claim.



155
156
157
# File 'persistent_volume.rb', line 155

def access_modes()
  jsii_get_property("accessModes")
end

#api_groupString

The group portion of the API version (e.g. "authorization.k8s.io").

Returns:

  • (String)


79
80
81
# File 'persistent_volume.rb', line 79

def api_group()
  jsii_get_property("apiGroup")
end

#api_objectCDK8s::APIObject

The underlying cdk8s API object.

Returns:

See Also:

  • CDK8sPlus25::PersistentVolume.basebase.Resourcebase.Resource.apiObject


87
88
89
# File 'persistent_volume.rb', line 87

def api_object()
  jsii_get_property("apiObject")
end

#api_versionString

The object's API version (e.g. "authorization.k8s.io/v1").

Returns:

  • (String)


94
95
96
# File 'persistent_volume.rb', line 94

def api_version()
  jsii_get_property("apiVersion")
end

#as_api_resourceCDK8sPlus25::IAPIResource?

Return the IApiResource this object represents.

Returns:



216
217
218
# File 'persistent_volume.rb', line 216

def as_api_resource()
  jsii_call_method("asApiResource", [])
end

#as_non_api_resourceString?

Return the non resource url this object represents.

Returns:

  • (String, nil)


223
224
225
# File 'persistent_volume.rb', line 223

def as_non_api_resource()
  jsii_call_method("asNonApiResource", [])
end

#as_volumeCDK8sPlus25::Volume

Convert the piece of storage into a concrete volume.

Returns:



230
231
232
# File 'persistent_volume.rb', line 230

def as_volume()
  jsii_call_method("asVolume", [])
end

#bind(claim) ⇒ void

This method returns an undefined value.

Bind a volume to a specific claim.

Note that you must also bind the claim to the volume.



241
242
243
244
# File 'persistent_volume.rb', line 241

def bind(claim)
  Jsii::Type.check_type(claim, "eyJmcW4iOiJjZGs4cy1wbHVzLTI1LklQZXJzaXN0ZW50Vm9sdW1lQ2xhaW0ifQ==", "claim")
  jsii_call_method("bind", [claim])
end

#claimCDK8sPlus25::IPersistentVolumeClaim?

PVC this volume is bound to.

Undefined means this volume is not yet claimed by any PVC.



165
166
167
# File 'persistent_volume.rb', line 165

def claim()
  jsii_get_property("claim")
end

#kindString

The object kind (e.g. "Deployment").

Returns:

  • (String)


101
102
103
# File 'persistent_volume.rb', line 101

def kind()
  jsii_get_property("kind")
end

#metadataCDK8s::APIObjectMetadataDefinition



106
107
108
# File 'persistent_volume.rb', line 106

def ()
  jsii_get_property("metadata")
end

#modeCDK8sPlus25::PersistentVolumeMode

Volume mode of this volume.



141
142
143
# File 'persistent_volume.rb', line 141

def mode()
  jsii_get_property("mode")
end

#mount_optionsArray<String>?

Mount options of this volume.

Returns:

  • (Array<String>, nil)


172
173
174
# File 'persistent_volume.rb', line 172

def mount_options()
  jsii_get_property("mountOptions")
end

#nameString

The name of this API object.

Returns:

  • (String)


113
114
115
# File 'persistent_volume.rb', line 113

def name()
  jsii_get_property("name")
end

#nodeConstructs::Node

The tree node.

Returns:



72
73
74
# File 'persistent_volume.rb', line 72

def node()
  jsii_get_property("node")
end

#permissionsCDK8sPlus25::ResourcePermissions



118
119
120
# File 'persistent_volume.rb', line 118

def permissions()
  jsii_get_property("permissions")
end

#reclaim_policyCDK8sPlus25::PersistentVolumeReclaimPolicy

Reclaim policy of this volume.



148
149
150
# File 'persistent_volume.rb', line 148

def reclaim_policy()
  jsii_get_property("reclaimPolicy")
end

#reserveCDK8sPlus25::PersistentVolumeClaim

Reserve a PersistentVolume by creating a PersistentVolumeClaim that is wired to claim this volume.

Note that this method will throw in case the volume is already claimed.



252
253
254
# File 'persistent_volume.rb', line 252

def reserve()
  jsii_call_method("reserve", [])
end

#resource_nameString?

The unique, namespace-global, name of an object inside the Kubernetes cluster.

If this is omitted, the ApiResource should represent all objects of the given type.

Returns:

  • (String, nil)


134
135
136
# File 'persistent_volume.rb', line 134

def resource_name()
  jsii_get_property("resourceName")
end

#resource_typeString

The name of a resource type as it appears in the relevant API endpoint.

Returns:

  • (String)


125
126
127
# File 'persistent_volume.rb', line 125

def resource_type()
  jsii_get_property("resourceType")
end

#storageCDK8s::Size?

Storage size of this volume.

Returns:



179
180
181
# File 'persistent_volume.rb', line 179

def storage()
  jsii_get_property("storage")
end

#storage_class_nameString?

Storage class this volume belongs to.

Returns:

  • (String, nil)


186
187
188
# File 'persistent_volume.rb', line 186

def storage_class_name()
  jsii_get_property("storageClassName")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


193
194
195
# File 'persistent_volume.rb', line 193

def to_string()
  jsii_call_method("toString", [])
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

Returns:



206
207
208
209
210
211
# File 'persistent_volume.rb', line 206

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, "eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9", "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end