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

com.pulumi.aws.efs.kotlin.FileSystem.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.66.3.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.efs.kotlin

import com.pulumi.aws.efs.kotlin.outputs.FileSystemLifecyclePolicy
import com.pulumi.aws.efs.kotlin.outputs.FileSystemProtection
import com.pulumi.aws.efs.kotlin.outputs.FileSystemSizeInByte
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Double
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.aws.efs.kotlin.outputs.FileSystemLifecyclePolicy.Companion.toKotlin as fileSystemLifecyclePolicyToKotlin
import com.pulumi.aws.efs.kotlin.outputs.FileSystemProtection.Companion.toKotlin as fileSystemProtectionToKotlin
import com.pulumi.aws.efs.kotlin.outputs.FileSystemSizeInByte.Companion.toKotlin as fileSystemSizeInByteToKotlin

/**
 * Builder for [FileSystem].
 */
@PulumiTagMarker
public class FileSystemResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: FileSystemArgs = FileSystemArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend FileSystemArgsBuilder.() -> Unit) {
        val builder = FileSystemArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): FileSystem {
        val builtJavaResource = com.pulumi.aws.efs.FileSystem(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return FileSystem(builtJavaResource)
    }
}

/**
 * Provides an Elastic File System (EFS) File System resource.
 * ## Example Usage
 * ### EFS File System w/ tags
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const foo = new aws.efs.FileSystem("foo", {
 *     creationToken: "my-product",
 *     tags: {
 *         Name: "MyProduct",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * foo = aws.efs.FileSystem("foo",
 *     creation_token="my-product",
 *     tags={
 *         "Name": "MyProduct",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var foo = new Aws.Efs.FileSystem("foo", new()
 *     {
 *         CreationToken = "my-product",
 *         Tags =
 *         {
 *             { "Name", "MyProduct" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/efs"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := efs.NewFileSystem(ctx, "foo", &efs.FileSystemArgs{
 * 			CreationToken: pulumi.String("my-product"),
 * 			Tags: pulumi.StringMap{
 * 				"Name": pulumi.String("MyProduct"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.efs.FileSystem;
 * import com.pulumi.aws.efs.FileSystemArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var foo = new FileSystem("foo", FileSystemArgs.builder()
 *             .creationToken("my-product")
 *             .tags(Map.of("Name", "MyProduct"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   foo:
 *     type: aws:efs:FileSystem
 *     properties:
 *       creationToken: my-product
 *       tags:
 *         Name: MyProduct
 * ```
 * 
 * ### Using lifecycle policy
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const fooWithLifecylePolicy = new aws.efs.FileSystem("foo_with_lifecyle_policy", {
 *     creationToken: "my-product",
 *     lifecyclePolicies: [{
 *         transitionToIa: "AFTER_30_DAYS",
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * foo_with_lifecyle_policy = aws.efs.FileSystem("foo_with_lifecyle_policy",
 *     creation_token="my-product",
 *     lifecycle_policies=[{
 *         "transition_to_ia": "AFTER_30_DAYS",
 *     }])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var fooWithLifecylePolicy = new Aws.Efs.FileSystem("foo_with_lifecyle_policy", new()
 *     {
 *         CreationToken = "my-product",
 *         LifecyclePolicies = new[]
 *         {
 *             new Aws.Efs.Inputs.FileSystemLifecyclePolicyArgs
 *             {
 *                 TransitionToIa = "AFTER_30_DAYS",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/efs"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := efs.NewFileSystem(ctx, "foo_with_lifecyle_policy", &efs.FileSystemArgs{
 * 			CreationToken: pulumi.String("my-product"),
 * 			LifecyclePolicies: efs.FileSystemLifecyclePolicyArray{
 * 				&efs.FileSystemLifecyclePolicyArgs{
 * 					TransitionToIa: pulumi.String("AFTER_30_DAYS"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.efs.FileSystem;
 * import com.pulumi.aws.efs.FileSystemArgs;
 * import com.pulumi.aws.efs.inputs.FileSystemLifecyclePolicyArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var fooWithLifecylePolicy = new FileSystem("fooWithLifecylePolicy", FileSystemArgs.builder()
 *             .creationToken("my-product")
 *             .lifecyclePolicies(FileSystemLifecyclePolicyArgs.builder()
 *                 .transitionToIa("AFTER_30_DAYS")
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   fooWithLifecylePolicy:
 *     type: aws:efs:FileSystem
 *     name: foo_with_lifecyle_policy
 *     properties:
 *       creationToken: my-product
 *       lifecyclePolicies:
 *         - transitionToIa: AFTER_30_DAYS
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import the EFS file systems using the `id`. For example:
 * ```sh
 * $ pulumi import aws:efs/fileSystem:FileSystem foo fs-6fa144c6
 * ```
 */
public class FileSystem internal constructor(
    override val javaResource: com.pulumi.aws.efs.FileSystem,
) : KotlinCustomResource(javaResource, FileSystemMapper) {
    /**
     * Amazon Resource Name of the file system.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * The identifier of the Availability Zone in which the file system's One Zone storage classes exist.
     */
    public val availabilityZoneId: Output
        get() = javaResource.availabilityZoneId().applyValue({ args0 -> args0 })

    /**
     * the AWS Availability Zone in which to create the file system. Used to create a file system that uses One Zone storage classes. See [user guide](https://docs.aws.amazon.com/efs/latest/ug/availability-durability.html) for more information.
     */
    public val availabilityZoneName: Output
        get() = javaResource.availabilityZoneName().applyValue({ args0 -> args0 })

    /**
     * A unique name (a maximum of 64 characters are allowed)
     * used as reference when creating the Elastic File System to ensure idempotent file
     * system creation. By default generated by this provider. See [Elastic File System]
     * user guide for more information.
     */
    public val creationToken: Output
        get() = javaResource.creationToken().applyValue({ args0 -> args0 })

    /**
     * The DNS name for the filesystem per [documented convention](http://docs.aws.amazon.com/efs/latest/ug/mounting-fs-mount-cmd-dns-name.html).
     */
    public val dnsName: Output
        get() = javaResource.dnsName().applyValue({ args0 -> args0 })

    /**
     * If true, the disk will be encrypted.
     */
    public val encrypted: Output
        get() = javaResource.encrypted().applyValue({ args0 -> args0 })

    /**
     * The ARN for the KMS encryption key. When specifying kms_key_id, encrypted needs to be set to true.
     */
    public val kmsKeyId: Output
        get() = javaResource.kmsKeyId().applyValue({ args0 -> args0 })

    /**
     * A file system [lifecycle policy](https://docs.aws.amazon.com/efs/latest/ug/API_LifecyclePolicy.html) object. See `lifecycle_policy` block below for details.
     */
    public val lifecyclePolicies: Output>?
        get() = javaResource.lifecyclePolicies().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        fileSystemLifecyclePolicyToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The value of the file system's `Name` tag.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The current number of mount targets that the file system has.
     */
    public val numberOfMountTargets: Output
        get() = javaResource.numberOfMountTargets().applyValue({ args0 -> args0 })

    /**
     * The AWS account that created the file system. If the file system was createdby an IAM user, the parent account to which the user belongs is the owner.
     */
    public val ownerId: Output
        get() = javaResource.ownerId().applyValue({ args0 -> args0 })

    /**
     * The file system performance mode. Can be either `"generalPurpose"` or `"maxIO"` (Default: `"generalPurpose"`).
     */
    public val performanceMode: Output
        get() = javaResource.performanceMode().applyValue({ args0 -> args0 })

    /**
     * A file system [protection](https://docs.aws.amazon.com/efs/latest/ug/API_FileSystemProtectionDescription.html) object. See `protection` block below for details.
     */
    public val protection: Output
        get() = javaResource.protection().applyValue({ args0 ->
            args0.let({ args0 ->
                fileSystemProtectionToKotlin(args0)
            })
        })

    /**
     * The throughput, measured in MiB/s, that you want to provision for the file system. Only applicable with `throughput_mode` set to `provisioned`.
     */
    public val provisionedThroughputInMibps: Output?
        get() = javaResource.provisionedThroughputInMibps().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The latest known metered size (in bytes) of data stored in the file system, the value is not the exact size that the file system was at any point in time. See Size In Bytes.
     */
    public val sizeInBytes: Output>
        get() = javaResource.sizeInBytes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    fileSystemSizeInByteToKotlin(args0)
                })
            })
        })

    /**
     * A map of tags to assign to the file system. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
     */
    @Deprecated(
        message = """
  Please use `tags` instead.
  """,
    )
    public val tagsAll: Output>
        get() = javaResource.tagsAll().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Throughput mode for the file system. Defaults to `bursting`. Valid values: `bursting`, `provisioned`, or `elastic`. When using `provisioned`, also set `provisioned_throughput_in_mibps`.
     */
    public val throughputMode: Output?
        get() = javaResource.throughputMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object FileSystemMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.efs.FileSystem::class == javaResource::class

    override fun map(javaResource: Resource): FileSystem = FileSystem(
        javaResource as
            com.pulumi.aws.efs.FileSystem,
    )
}

/**
 * @see [FileSystem].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [FileSystem].
 */
public suspend fun fileSystem(name: String, block: suspend FileSystemResourceBuilder.() -> Unit): FileSystem {
    val builder = FileSystemResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [FileSystem].
 * @param name The _unique_ name of the resulting resource.
 */
public fun fileSystem(name: String): FileSystem {
    val builder = FileSystemResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy