
org.cdk8s.plus23.PersistentVolumeClaimProps Maven / Gradle / Ivy
package org.cdk8s.plus23;
/**
* Properties for `PersistentVolumeClaim`.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.75.0 (build 63bb957)", date = "2023-02-21T09:46:03.660Z")
@software.amazon.jsii.Jsii(module = org.cdk8s.plus23.$Module.class, fqn = "cdk8s-plus-23.PersistentVolumeClaimProps")
@software.amazon.jsii.Jsii.Proxy(PersistentVolumeClaimProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface PersistentVolumeClaimProps extends software.amazon.jsii.JsiiSerializable, org.cdk8s.plus23.ResourceProps {
/**
* Contains the access modes the volume should support.
*
* Default: - No access modes requirement.
*
* @see https://kubernetes.io/docs/concepts/storage/persistent-volumes#access-modes-1
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.List getAccessModes() {
return null;
}
/**
* Minimum storage size the volume should have.
*
* Default: - No storage requirement.
*
* @see https://kubernetes.io/docs/concepts/storage/persistent-volumes#resources
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.Size getStorage() {
return null;
}
/**
* Name of the StorageClass required by the claim. When this property is not set, the behavior is as follows:.
*
*
* - If the admission plugin is turned on, the storage class marked as default will be used.
* - If the admission plugin is turned off, the pvc can only be bound to volumes without a storage class.
*
*
* Default: - Not set.
*
* @see https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getStorageClassName() {
return null;
}
/**
* The PersistentVolume backing this claim.
*
* The control plane still checks that storage class, access modes,
* and requested storage size on the volume are valid.
*
* Note that in order to guarantee a proper binding, the volume should
* also define a claimRef
referring to this claim. Otherwise, the volume may be
* claimed be other pvc's before it gets a chance to bind to this one.
*
* If the volume is managed (i.e not imported), you can use pv.claim()
to easily
* create a bi-directional bounded claim.
*
* Default: - No specific volume binding.
*
* @see https://kubernetes.io/docs/concepts/storage/persistent-volumes/#binding.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.plus23.IPersistentVolume getVolume() {
return null;
}
/**
* Defines what type of volume is required by the claim.
*
* Default: VolumeMode.FILE_SYSTEM
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable org.cdk8s.plus23.PersistentVolumeMode getVolumeMode() {
return null;
}
/**
* @return a {@link Builder} of {@link PersistentVolumeClaimProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link PersistentVolumeClaimProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.List accessModes;
org.cdk8s.Size storage;
java.lang.String storageClassName;
org.cdk8s.plus23.IPersistentVolume volume;
org.cdk8s.plus23.PersistentVolumeMode volumeMode;
org.cdk8s.ApiObjectMetadata metadata;
/**
* Sets the value of {@link PersistentVolumeClaimProps#getAccessModes}
* @param accessModes Contains the access modes the volume should support.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@SuppressWarnings("unchecked")
public Builder accessModes(java.util.List extends org.cdk8s.plus23.PersistentVolumeAccessMode> accessModes) {
this.accessModes = (java.util.List)accessModes;
return this;
}
/**
* Sets the value of {@link PersistentVolumeClaimProps#getStorage}
* @param storage Minimum storage size the volume should have.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder storage(org.cdk8s.Size storage) {
this.storage = storage;
return this;
}
/**
* Sets the value of {@link PersistentVolumeClaimProps#getStorageClassName}
* @param storageClassName Name of the StorageClass required by the claim. When this property is not set, the behavior is as follows:.
*
* - If the admission plugin is turned on, the storage class marked as default will be used.
* - If the admission plugin is turned off, the pvc can only be bound to volumes without a storage class.
*
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder storageClassName(java.lang.String storageClassName) {
this.storageClassName = storageClassName;
return this;
}
/**
* Sets the value of {@link PersistentVolumeClaimProps#getVolume}
* @param volume The PersistentVolume backing this claim.
* The control plane still checks that storage class, access modes,
* and requested storage size on the volume are valid.
*
* Note that in order to guarantee a proper binding, the volume should
* also define a claimRef
referring to this claim. Otherwise, the volume may be
* claimed be other pvc's before it gets a chance to bind to this one.
*
* If the volume is managed (i.e not imported), you can use pv.claim()
to easily
* create a bi-directional bounded claim.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder volume(org.cdk8s.plus23.IPersistentVolume volume) {
this.volume = volume;
return this;
}
/**
* Sets the value of {@link PersistentVolumeClaimProps#getVolumeMode}
* @param volumeMode Defines what type of volume is required by the claim.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder volumeMode(org.cdk8s.plus23.PersistentVolumeMode volumeMode) {
this.volumeMode = volumeMode;
return this;
}
/**
* Sets the value of {@link PersistentVolumeClaimProps#getMetadata}
* @param metadata Metadata that all persisted resources must have, which includes all objects users must create.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder metadata(org.cdk8s.ApiObjectMetadata metadata) {
this.metadata = metadata;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link PersistentVolumeClaimProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public PersistentVolumeClaimProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link PersistentVolumeClaimProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements PersistentVolumeClaimProps {
private final java.util.List accessModes;
private final org.cdk8s.Size storage;
private final java.lang.String storageClassName;
private final org.cdk8s.plus23.IPersistentVolume volume;
private final org.cdk8s.plus23.PersistentVolumeMode volumeMode;
private final org.cdk8s.ApiObjectMetadata metadata;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.accessModes = software.amazon.jsii.Kernel.get(this, "accessModes", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.PersistentVolumeAccessMode.class)));
this.storage = software.amazon.jsii.Kernel.get(this, "storage", software.amazon.jsii.NativeType.forClass(org.cdk8s.Size.class));
this.storageClassName = software.amazon.jsii.Kernel.get(this, "storageClassName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.volume = software.amazon.jsii.Kernel.get(this, "volume", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.IPersistentVolume.class));
this.volumeMode = software.amazon.jsii.Kernel.get(this, "volumeMode", software.amazon.jsii.NativeType.forClass(org.cdk8s.plus23.PersistentVolumeMode.class));
this.metadata = software.amazon.jsii.Kernel.get(this, "metadata", software.amazon.jsii.NativeType.forClass(org.cdk8s.ApiObjectMetadata.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.accessModes = (java.util.List)builder.accessModes;
this.storage = builder.storage;
this.storageClassName = builder.storageClassName;
this.volume = builder.volume;
this.volumeMode = builder.volumeMode;
this.metadata = builder.metadata;
}
@Override
public final java.util.List getAccessModes() {
return this.accessModes;
}
@Override
public final org.cdk8s.Size getStorage() {
return this.storage;
}
@Override
public final java.lang.String getStorageClassName() {
return this.storageClassName;
}
@Override
public final org.cdk8s.plus23.IPersistentVolume getVolume() {
return this.volume;
}
@Override
public final org.cdk8s.plus23.PersistentVolumeMode getVolumeMode() {
return this.volumeMode;
}
@Override
public final org.cdk8s.ApiObjectMetadata getMetadata() {
return this.metadata;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
if (this.getAccessModes() != null) {
data.set("accessModes", om.valueToTree(this.getAccessModes()));
}
if (this.getStorage() != null) {
data.set("storage", om.valueToTree(this.getStorage()));
}
if (this.getStorageClassName() != null) {
data.set("storageClassName", om.valueToTree(this.getStorageClassName()));
}
if (this.getVolume() != null) {
data.set("volume", om.valueToTree(this.getVolume()));
}
if (this.getVolumeMode() != null) {
data.set("volumeMode", om.valueToTree(this.getVolumeMode()));
}
if (this.getMetadata() != null) {
data.set("metadata", om.valueToTree(this.getMetadata()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("cdk8s-plus-23.PersistentVolumeClaimProps"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PersistentVolumeClaimProps.Jsii$Proxy that = (PersistentVolumeClaimProps.Jsii$Proxy) o;
if (this.accessModes != null ? !this.accessModes.equals(that.accessModes) : that.accessModes != null) return false;
if (this.storage != null ? !this.storage.equals(that.storage) : that.storage != null) return false;
if (this.storageClassName != null ? !this.storageClassName.equals(that.storageClassName) : that.storageClassName != null) return false;
if (this.volume != null ? !this.volume.equals(that.volume) : that.volume != null) return false;
if (this.volumeMode != null ? !this.volumeMode.equals(that.volumeMode) : that.volumeMode != null) return false;
return this.metadata != null ? this.metadata.equals(that.metadata) : that.metadata == null;
}
@Override
public final int hashCode() {
int result = this.accessModes != null ? this.accessModes.hashCode() : 0;
result = 31 * result + (this.storage != null ? this.storage.hashCode() : 0);
result = 31 * result + (this.storageClassName != null ? this.storageClassName.hashCode() : 0);
result = 31 * result + (this.volume != null ? this.volume.hashCode() : 0);
result = 31 * result + (this.volumeMode != null ? this.volumeMode.hashCode() : 0);
result = 31 * result + (this.metadata != null ? this.metadata.hashCode() : 0);
return result;
}
}
}