All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.cloudshiftdev.awscdk.services.fsx.LustreFileSystem.kt Maven / Gradle / Ivy

The newest version!
@file:Suppress("RedundantVisibilityModifier","RedundantUnitReturnType","RemoveRedundantQualifierName","unused","UnusedImport","ClassName","REDUNDANT_PROJECTION","DEPRECATION")

package io.cloudshiftdev.awscdk.services.fsx

import io.cloudshiftdev.awscdk.RemovalPolicy
import io.cloudshiftdev.awscdk.common.CdkDslMarker
import io.cloudshiftdev.awscdk.services.ec2.Connections
import io.cloudshiftdev.awscdk.services.ec2.ISecurityGroup
import io.cloudshiftdev.awscdk.services.ec2.ISubnet
import io.cloudshiftdev.awscdk.services.ec2.IVpc
import io.cloudshiftdev.awscdk.services.kms.IKey
import kotlin.Number
import kotlin.String
import kotlin.Unit
import kotlin.jvm.JvmName
import io.cloudshiftdev.constructs.Construct as CloudshiftdevConstructsConstruct
import software.constructs.Construct as SoftwareConstructsConstruct

/**
 * The FSx for Lustre File System implementation of IFileSystem.
 *
 * Example:
 *
 * ```
 * import io.cloudshiftdev.awscdk.services.s3.*;
 * Vpc vpc;
 * Bucket bucket;
 * Map<String, Object> lustreConfiguration = Map.of(
 * "deploymentType", LustreDeploymentType.SCRATCH_2,
 * "exportPath", bucket.s3UrlForObject(),
 * "importPath", bucket.s3UrlForObject(),
 * "autoImportPolicy", LustreAutoImportPolicy.NEW_CHANGED_DELETED);
 * LustreFileSystem fs = LustreFileSystem.Builder.create(this, "FsxLustreFileSystem")
 * .vpc(vpc)
 * .vpcSubnet(vpc.getPrivateSubnets()[0])
 * .storageCapacityGiB(1200)
 * .lustreConfiguration(lustreConfiguration)
 * .build();
 * ```
 *
 * [Documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-fsx-filesystem.html)
 */
public open class LustreFileSystem(
  cdkObject: software.amazon.awscdk.services.fsx.LustreFileSystem,
) : FileSystemBase(cdkObject) {
  public constructor(
    scope: CloudshiftdevConstructsConstruct,
    id: String,
    props: LustreFileSystemProps,
  ) :
      this(software.amazon.awscdk.services.fsx.LustreFileSystem(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
      id, props.let(LustreFileSystemProps.Companion::unwrap))
  )

  public constructor(
    scope: CloudshiftdevConstructsConstruct,
    id: String,
    props: LustreFileSystemProps.Builder.() -> Unit,
  ) : this(scope, id, LustreFileSystemProps(props)
  )

  /**
   * The security groups/rules used to allow network connections to the file system.
   */
  public override fun connections(): Connections =
      unwrap(this).getConnections().let(Connections::wrap)

  /**
   * The DNS name assigned to this file system.
   */
  public override fun dnsName(): String = unwrap(this).getDnsName()

  /**
   * The ID that AWS assigns to the file system.
   */
  public override fun fileSystemId(): String = unwrap(this).getFileSystemId()

  /**
   * The mount name of the file system, generated by FSx.
   */
  public open fun mountName(): String = unwrap(this).getMountName()

  /**
   * A fluent builder for [io.cloudshiftdev.awscdk.services.fsx.LustreFileSystem].
   */
  @CdkDslMarker
  public interface Builder {
    /**
     * The ID of the backup.
     *
     * Specifies the backup to use if you're creating a file system from an existing backup.
     *
     * Default: - no backup will be used.
     *
     * @param backupId The ID of the backup. 
     */
    public fun backupId(backupId: String)

    /**
     * The KMS key used for encryption to protect your data at rest.
     *
     * Default: - the aws/fsx default KMS key for the AWS account being deployed into.
     *
     * @param kmsKey The KMS key used for encryption to protect your data at rest. 
     */
    public fun kmsKey(kmsKey: IKey)

    /**
     * Additional configuration for FSx specific to Lustre.
     *
     * @param lustreConfiguration Additional configuration for FSx specific to Lustre. 
     */
    public fun lustreConfiguration(lustreConfiguration: LustreConfiguration)

    /**
     * Additional configuration for FSx specific to Lustre.
     *
     * @param lustreConfiguration Additional configuration for FSx specific to Lustre. 
     */
    @kotlin.Suppress("INAPPLICABLE_JVM_NAME")
    @JvmName("947f8a9e89536a25714205f01b078cf895fa9d6392b7a1666f9491eb6dc9d46e")
    public fun lustreConfiguration(lustreConfiguration: LustreConfiguration.Builder.() -> Unit)

    /**
     * Policy to apply when the file system is removed from the stack.
     *
     * Default: RemovalPolicy.RETAIN
     *
     * @param removalPolicy Policy to apply when the file system is removed from the stack. 
     */
    public fun removalPolicy(removalPolicy: RemovalPolicy)

    /**
     * Security Group to assign to this file system.
     *
     * Default: - creates new security group which allows all outbound traffic.
     *
     * @param securityGroup Security Group to assign to this file system. 
     */
    public fun securityGroup(securityGroup: ISecurityGroup)

    /**
     * The storage capacity of the file system being created.
     *
     * For Windows file systems, valid values are 32 GiB to 65,536 GiB.
     * For SCRATCH_1 deployment types, valid values are 1,200, 2,400, 3,600, then continuing in
     * increments of 3,600 GiB.
     * For SCRATCH_2 and PERSISTENT_1 types, valid values are 1,200, 2,400, then continuing in
     * increments of 2,400 GiB.
     *
     * @param storageCapacityGiB The storage capacity of the file system being created. 
     */
    public fun storageCapacityGiB(storageCapacityGiB: Number)

    /**
     * The VPC to launch the file system in.
     *
     * @param vpc The VPC to launch the file system in. 
     */
    public fun vpc(vpc: IVpc)

    /**
     * The subnet that the file system will be accessible from.
     *
     * @param vpcSubnet The subnet that the file system will be accessible from. 
     */
    public fun vpcSubnet(vpcSubnet: ISubnet)
  }

  private class BuilderImpl(
    scope: SoftwareConstructsConstruct,
    id: String,
  ) : Builder {
    private val cdkBuilder: software.amazon.awscdk.services.fsx.LustreFileSystem.Builder =
        software.amazon.awscdk.services.fsx.LustreFileSystem.Builder.create(scope, id)

    /**
     * The ID of the backup.
     *
     * Specifies the backup to use if you're creating a file system from an existing backup.
     *
     * Default: - no backup will be used.
     *
     * @param backupId The ID of the backup. 
     */
    override fun backupId(backupId: String) {
      cdkBuilder.backupId(backupId)
    }

    /**
     * The KMS key used for encryption to protect your data at rest.
     *
     * Default: - the aws/fsx default KMS key for the AWS account being deployed into.
     *
     * @param kmsKey The KMS key used for encryption to protect your data at rest. 
     */
    override fun kmsKey(kmsKey: IKey) {
      cdkBuilder.kmsKey(kmsKey.let(IKey.Companion::unwrap))
    }

    /**
     * Additional configuration for FSx specific to Lustre.
     *
     * @param lustreConfiguration Additional configuration for FSx specific to Lustre. 
     */
    override fun lustreConfiguration(lustreConfiguration: LustreConfiguration) {
      cdkBuilder.lustreConfiguration(lustreConfiguration.let(LustreConfiguration.Companion::unwrap))
    }

    /**
     * Additional configuration for FSx specific to Lustre.
     *
     * @param lustreConfiguration Additional configuration for FSx specific to Lustre. 
     */
    @kotlin.Suppress("INAPPLICABLE_JVM_NAME")
    @JvmName("947f8a9e89536a25714205f01b078cf895fa9d6392b7a1666f9491eb6dc9d46e")
    override fun lustreConfiguration(lustreConfiguration: LustreConfiguration.Builder.() -> Unit):
        Unit = lustreConfiguration(LustreConfiguration(lustreConfiguration))

    /**
     * Policy to apply when the file system is removed from the stack.
     *
     * Default: RemovalPolicy.RETAIN
     *
     * @param removalPolicy Policy to apply when the file system is removed from the stack. 
     */
    override fun removalPolicy(removalPolicy: RemovalPolicy) {
      cdkBuilder.removalPolicy(removalPolicy.let(RemovalPolicy.Companion::unwrap))
    }

    /**
     * Security Group to assign to this file system.
     *
     * Default: - creates new security group which allows all outbound traffic.
     *
     * @param securityGroup Security Group to assign to this file system. 
     */
    override fun securityGroup(securityGroup: ISecurityGroup) {
      cdkBuilder.securityGroup(securityGroup.let(ISecurityGroup.Companion::unwrap))
    }

    /**
     * The storage capacity of the file system being created.
     *
     * For Windows file systems, valid values are 32 GiB to 65,536 GiB.
     * For SCRATCH_1 deployment types, valid values are 1,200, 2,400, 3,600, then continuing in
     * increments of 3,600 GiB.
     * For SCRATCH_2 and PERSISTENT_1 types, valid values are 1,200, 2,400, then continuing in
     * increments of 2,400 GiB.
     *
     * @param storageCapacityGiB The storage capacity of the file system being created. 
     */
    override fun storageCapacityGiB(storageCapacityGiB: Number) {
      cdkBuilder.storageCapacityGiB(storageCapacityGiB)
    }

    /**
     * The VPC to launch the file system in.
     *
     * @param vpc The VPC to launch the file system in. 
     */
    override fun vpc(vpc: IVpc) {
      cdkBuilder.vpc(vpc.let(IVpc.Companion::unwrap))
    }

    /**
     * The subnet that the file system will be accessible from.
     *
     * @param vpcSubnet The subnet that the file system will be accessible from. 
     */
    override fun vpcSubnet(vpcSubnet: ISubnet) {
      cdkBuilder.vpcSubnet(vpcSubnet.let(ISubnet.Companion::unwrap))
    }

    public fun build(): software.amazon.awscdk.services.fsx.LustreFileSystem = cdkBuilder.build()
  }

  public companion object {
    public fun fromLustreFileSystemAttributes(
      scope: CloudshiftdevConstructsConstruct,
      id: String,
      attrs: FileSystemAttributes,
    ): IFileSystem =
        software.amazon.awscdk.services.fsx.LustreFileSystem.fromLustreFileSystemAttributes(scope.let(CloudshiftdevConstructsConstruct.Companion::unwrap),
        id, attrs.let(FileSystemAttributes.Companion::unwrap)).let(IFileSystem::wrap)

    @kotlin.Suppress("INAPPLICABLE_JVM_NAME")
    @JvmName("cebd825229cf3b382afac49973d6ddd64b711e5f0ef72f664a1a0aaf4ef0bd42")
    public fun fromLustreFileSystemAttributes(
      scope: CloudshiftdevConstructsConstruct,
      id: String,
      attrs: FileSystemAttributes.Builder.() -> Unit,
    ): IFileSystem = fromLustreFileSystemAttributes(scope, id, FileSystemAttributes(attrs))

    public operator fun invoke(
      scope: CloudshiftdevConstructsConstruct,
      id: String,
      block: Builder.() -> Unit = {},
    ): LustreFileSystem {
      val builderImpl = BuilderImpl(CloudshiftdevConstructsConstruct.unwrap(scope), id)
      return LustreFileSystem(builderImpl.apply(block).build())
    }

    internal fun wrap(cdkObject: software.amazon.awscdk.services.fsx.LustreFileSystem):
        LustreFileSystem = LustreFileSystem(cdkObject)

    internal fun unwrap(wrapped: LustreFileSystem):
        software.amazon.awscdk.services.fsx.LustreFileSystem = wrapped.cdkObject as
        software.amazon.awscdk.services.fsx.LustreFileSystem
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy