Class Volume.Builder

  • All Implemented Interfaces:
    software.amazon.jsii.Builder<Volume>
    Enclosing interface:
    Volume

    @Stability(Stable)
    public static final class Volume.Builder
    extends Object
    implements software.amazon.jsii.Builder<Volume>
    A builder for Volume
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • name

        @Stability(Stable)
        public Volume.Builder name​(String name)
        Sets the value of Volume.getName()
        Parameters:
        name - name of the volume. This parameter is required. Must be a DNS_LABEL and unique within the pod. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
        Returns:
        this
      • awsElasticBlockStore

        @Stability(Stable)
        public Volume.Builder awsElasticBlockStore​(AwsElasticBlockStoreVolumeSource awsElasticBlockStore)
        Parameters:
        awsElasticBlockStore - awsElasticBlockStore represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#awselasticblockstore
        Returns:
        this
      • cinder

        @Stability(Stable)
        public Volume.Builder cinder​(CinderVolumeSource cinder)
        Sets the value of Volume.getCinder()
        Parameters:
        cinder - cinder represents a cinder volume attached and mounted on kubelets host machine. More info: https://examples.k8s.io/mysql-cinder-pd/README.md
        Returns:
        this
      • csi

        @Stability(Stable)
        public Volume.Builder csi​(CsiVolumeSource csi)
        Sets the value of Volume.getCsi()
        Parameters:
        csi - csi (Container Storage Interface) represents ephemeral storage that is handled by certain external CSI drivers (Beta feature).
        Returns:
        this
      • emptyDir

        @Stability(Stable)
        public Volume.Builder emptyDir​(EmptyDirVolumeSource emptyDir)
        Sets the value of Volume.getEmptyDir()
        Parameters:
        emptyDir - emptyDir represents a temporary directory that shares a pod's lifetime. More info: https://kubernetes.io/docs/concepts/storage/volumes#emptydir
        Returns:
        this
      • ephemeral

        @Stability(Stable)
        public Volume.Builder ephemeral​(EphemeralVolumeSource ephemeral)
        Sets the value of Volume.getEphemeral()
        Parameters:
        ephemeral - ephemeral represents a volume that is handled by a cluster storage driver. The volume's lifecycle is tied to the pod that defines it - it will be created before the pod starts, and deleted when the pod is removed.

        Use this if: a) the volume is only needed while the pod runs, b) features of normal volumes like restoring from snapshot or capacity tracking are needed, c) the storage driver is specified through a storage class, and d) the storage driver supports dynamic volume provisioning through a PersistentVolumeClaim (see EphemeralVolumeSource for more information on the connection between this volume type and PersistentVolumeClaim).

        Use PersistentVolumeClaim or one of the vendor-specific APIs for volumes that persist for longer than the lifecycle of an individual pod.

        Use CSI for light-weight local ephemeral volumes if the CSI driver is meant to be used that way - see the documentation of the driver for more information.

        A pod can use both types of ephemeral volumes and persistent volumes at the same time.

        Returns:
        this
      • fc

        @Stability(Stable)
        public Volume.Builder fc​(FcVolumeSource fc)
        Sets the value of Volume.getFc()
        Parameters:
        fc - fc represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.
        Returns:
        this
      • flexVolume

        @Stability(Stable)
        public Volume.Builder flexVolume​(FlexVolumeSource flexVolume)
        Sets the value of Volume.getFlexVolume()
        Parameters:
        flexVolume - flexVolume represents a generic volume resource that is provisioned/attached using an exec based plugin.
        Returns:
        this
      • flocker

        @Stability(Stable)
        public Volume.Builder flocker​(FlockerVolumeSource flocker)
        Sets the value of Volume.getFlocker()
        Parameters:
        flocker - flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running
        Returns:
        this
      • gcePersistentDisk

        @Stability(Stable)
        public Volume.Builder gcePersistentDisk​(GcePersistentDiskVolumeSource gcePersistentDisk)
        Parameters:
        gcePersistentDisk - gcePersistentDisk represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes#gcepersistentdisk
        Returns:
        this
      • gitRepo

        @Stability(Stable)
        public Volume.Builder gitRepo​(GitRepoVolumeSource gitRepo)
        Sets the value of Volume.getGitRepo()
        Parameters:
        gitRepo - gitRepo represents a git repository at a particular revision. DEPRECATED: GitRepo is deprecated. To provision a container with a git repo, mount an EmptyDir into an InitContainer that clones the repo using git, then mount the EmptyDir into the Pod's container.
        Returns:
        this
      • glusterfs

        @Stability(Stable)
        public Volume.Builder glusterfs​(GlusterfsVolumeSource glusterfs)
        Sets the value of Volume.getGlusterfs()
        Parameters:
        glusterfs - glusterfs represents a Glusterfs mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/glusterfs/README.md
        Returns:
        this
      • hostPath

        @Stability(Stable)
        public Volume.Builder hostPath​(HostPathVolumeSource hostPath)
        Sets the value of Volume.getHostPath()
        Parameters:
        hostPath - hostPath represents a pre-existing file or directory on the host machine that is directly exposed to the container. This is generally used for system agents or other privileged things that are allowed to see the host machine. Most containers will NOT need this. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath
        Returns:
        this
      • iscsi

        @Stability(Stable)
        public Volume.Builder iscsi​(IscsiVolumeSource iscsi)
        Sets the value of Volume.getIscsi()
        Parameters:
        iscsi - iscsi represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: https://examples.k8s.io/volumes/iscsi/README.md
        Returns:
        this
      • nfs

        @Stability(Stable)
        public Volume.Builder nfs​(NfsVolumeSource nfs)
        Sets the value of Volume.getNfs()
        Parameters:
        nfs - nfs represents an NFS mount on the host that shares a pod's lifetime More info: https://kubernetes.io/docs/concepts/storage/volumes#nfs.
        Returns:
        this
      • persistentVolumeClaim

        @Stability(Stable)
        public Volume.Builder persistentVolumeClaim​(PersistentVolumeClaimVolumeSource persistentVolumeClaim)
        Parameters:
        persistentVolumeClaim - persistentVolumeClaimVolumeSource represents a reference to a PersistentVolumeClaim in the same namespace. More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#persistentvolumeclaims
        Returns:
        this
      • rbd

        @Stability(Stable)
        public Volume.Builder rbd​(RbdVolumeSource rbd)
        Sets the value of Volume.getRbd()
        Parameters:
        rbd - rbd represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: https://examples.k8s.io/volumes/rbd/README.md
        Returns:
        this
      • secret

        @Stability(Stable)
        public Volume.Builder secret​(SecretVolumeSource secret)
        Sets the value of Volume.getSecret()
        Parameters:
        secret - secret represents a secret that should populate this volume. More info: https://kubernetes.io/docs/concepts/storage/volumes#secret
        Returns:
        this
      • build

        @Stability(Stable)
        public Volume build()
        Builds the configured instance.
        Specified by:
        build in interface software.amazon.jsii.Builder<Volume>
        Returns:
        a new instance of Volume
        Throws:
        NullPointerException - if any required attribute was not provided