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

com.pulumi.aws.s3control.kotlin.BucketLifecycleConfigurationArgs.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.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.s3control.kotlin

import com.pulumi.aws.s3control.BucketLifecycleConfigurationArgs.builder
import com.pulumi.aws.s3control.kotlin.inputs.BucketLifecycleConfigurationRuleArgs
import com.pulumi.aws.s3control.kotlin.inputs.BucketLifecycleConfigurationRuleArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Provides a resource to manage an S3 Control Bucket Lifecycle Configuration.
 * > **NOTE:** Each S3 Control Bucket can only have one Lifecycle Configuration. Using multiple of this resource against the same S3 Control Bucket will result in perpetual differences each provider run.
 * > This functionality is for managing [S3 on Outposts](https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html). To manage S3 Bucket Lifecycle Configurations in an AWS Partition, see the `aws.s3.BucketV2` resource.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = new aws.s3control.BucketLifecycleConfiguration("example", {
 *     bucket: exampleAwsS3controlBucket.arn,
 *     rules: [
 *         {
 *             expiration: {
 *                 days: 365,
 *             },
 *             filter: {
 *                 prefix: "logs/",
 *             },
 *             id: "logs",
 *         },
 *         {
 *             expiration: {
 *                 days: 7,
 *             },
 *             filter: {
 *                 prefix: "temp/",
 *             },
 *             id: "temp",
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.s3control.BucketLifecycleConfiguration("example",
 *     bucket=example_aws_s3control_bucket["arn"],
 *     rules=[
 *         {
 *             "expiration": {
 *                 "days": 365,
 *             },
 *             "filter": {
 *                 "prefix": "logs/",
 *             },
 *             "id": "logs",
 *         },
 *         {
 *             "expiration": {
 *                 "days": 7,
 *             },
 *             "filter": {
 *                 "prefix": "temp/",
 *             },
 *             "id": "temp",
 *         },
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Aws.S3Control.BucketLifecycleConfiguration("example", new()
 *     {
 *         Bucket = exampleAwsS3controlBucket.Arn,
 *         Rules = new[]
 *         {
 *             new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleArgs
 *             {
 *                 Expiration = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleExpirationArgs
 *                 {
 *                     Days = 365,
 *                 },
 *                 Filter = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleFilterArgs
 *                 {
 *                     Prefix = "logs/",
 *                 },
 *                 Id = "logs",
 *             },
 *             new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleArgs
 *             {
 *                 Expiration = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleExpirationArgs
 *                 {
 *                     Days = 7,
 *                 },
 *                 Filter = new Aws.S3Control.Inputs.BucketLifecycleConfigurationRuleFilterArgs
 *                 {
 *                     Prefix = "temp/",
 *                 },
 *                 Id = "temp",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3control"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := s3control.NewBucketLifecycleConfiguration(ctx, "example", &s3control.BucketLifecycleConfigurationArgs{
 * 			Bucket: pulumi.Any(exampleAwsS3controlBucket.Arn),
 * 			Rules: s3control.BucketLifecycleConfigurationRuleArray{
 * 				&s3control.BucketLifecycleConfigurationRuleArgs{
 * 					Expiration: &s3control.BucketLifecycleConfigurationRuleExpirationArgs{
 * 						Days: pulumi.Int(365),
 * 					},
 * 					Filter: &s3control.BucketLifecycleConfigurationRuleFilterArgs{
 * 						Prefix: pulumi.String("logs/"),
 * 					},
 * 					Id: pulumi.String("logs"),
 * 				},
 * 				&s3control.BucketLifecycleConfigurationRuleArgs{
 * 					Expiration: &s3control.BucketLifecycleConfigurationRuleExpirationArgs{
 * 						Days: pulumi.Int(7),
 * 					},
 * 					Filter: &s3control.BucketLifecycleConfigurationRuleFilterArgs{
 * 						Prefix: pulumi.String("temp/"),
 * 					},
 * 					Id: pulumi.String("temp"),
 * 				},
 * 			},
 * 		})
 * 		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.s3control.BucketLifecycleConfiguration;
 * import com.pulumi.aws.s3control.BucketLifecycleConfigurationArgs;
 * import com.pulumi.aws.s3control.inputs.BucketLifecycleConfigurationRuleArgs;
 * import com.pulumi.aws.s3control.inputs.BucketLifecycleConfigurationRuleExpirationArgs;
 * import com.pulumi.aws.s3control.inputs.BucketLifecycleConfigurationRuleFilterArgs;
 * 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 example = new BucketLifecycleConfiguration("example", BucketLifecycleConfigurationArgs.builder()
 *             .bucket(exampleAwsS3controlBucket.arn())
 *             .rules(
 *                 BucketLifecycleConfigurationRuleArgs.builder()
 *                     .expiration(BucketLifecycleConfigurationRuleExpirationArgs.builder()
 *                         .days(365)
 *                         .build())
 *                     .filter(BucketLifecycleConfigurationRuleFilterArgs.builder()
 *                         .prefix("logs/")
 *                         .build())
 *                     .id("logs")
 *                     .build(),
 *                 BucketLifecycleConfigurationRuleArgs.builder()
 *                     .expiration(BucketLifecycleConfigurationRuleExpirationArgs.builder()
 *                         .days(7)
 *                         .build())
 *                     .filter(BucketLifecycleConfigurationRuleFilterArgs.builder()
 *                         .prefix("temp/")
 *                         .build())
 *                     .id("temp")
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:s3control:BucketLifecycleConfiguration
 *     properties:
 *       bucket: ${exampleAwsS3controlBucket.arn}
 *       rules:
 *         - expiration:
 *             days: 365
 *           filter:
 *             prefix: logs/
 *           id: logs
 *         - expiration:
 *             days: 7
 *           filter:
 *             prefix: temp/
 *           id: temp
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import S3 Control Bucket Lifecycle Configurations using the Amazon Resource Name (ARN). For example:
 * ```sh
 * $ pulumi import aws:s3control/bucketLifecycleConfiguration:BucketLifecycleConfiguration example arn:aws:s3-outposts:us-east-1:123456789012:outpost/op-12345678/bucket/example
 * ```
 * @property bucket Amazon Resource Name (ARN) of the bucket.
 * @property rules Configuration block(s) containing lifecycle rules for the bucket.
 */
public data class BucketLifecycleConfigurationArgs(
    public val bucket: Output? = null,
    public val rules: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.s3control.BucketLifecycleConfigurationArgs =
        com.pulumi.aws.s3control.BucketLifecycleConfigurationArgs.builder()
            .bucket(bucket?.applyValue({ args0 -> args0 }))
            .rules(
                rules?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 ->
                            args0.toJava()
                        })
                    })
                }),
            ).build()
}

/**
 * Builder for [BucketLifecycleConfigurationArgs].
 */
@PulumiTagMarker
public class BucketLifecycleConfigurationArgsBuilder internal constructor() {
    private var bucket: Output? = null

    private var rules: Output>? = null

    /**
     * @param value Amazon Resource Name (ARN) of the bucket.
     */
    @JvmName("xvuomidaocvrlbni")
    public suspend fun bucket(`value`: Output) {
        this.bucket = value
    }

    /**
     * @param value Configuration block(s) containing lifecycle rules for the bucket.
     */
    @JvmName("onvlpotrmkvuddjj")
    public suspend fun rules(`value`: Output>) {
        this.rules = value
    }

    @JvmName("breomlbmxhoosoei")
    public suspend fun rules(vararg values: Output) {
        this.rules = Output.all(values.asList())
    }

    /**
     * @param values Configuration block(s) containing lifecycle rules for the bucket.
     */
    @JvmName("kfophfuwdnrsqckb")
    public suspend fun rules(values: List>) {
        this.rules = Output.all(values)
    }

    /**
     * @param value Amazon Resource Name (ARN) of the bucket.
     */
    @JvmName("uqhcclcytagdvyju")
    public suspend fun bucket(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.bucket = mapped
    }

    /**
     * @param value Configuration block(s) containing lifecycle rules for the bucket.
     */
    @JvmName("axvoasmtxqeblrjn")
    public suspend fun rules(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.rules = mapped
    }

    /**
     * @param argument Configuration block(s) containing lifecycle rules for the bucket.
     */
    @JvmName("jsimkrtngfyijirv")
    public suspend fun rules(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            BucketLifecycleConfigurationRuleArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.rules = mapped
    }

    /**
     * @param argument Configuration block(s) containing lifecycle rules for the bucket.
     */
    @JvmName("uudwhoeegtsiftkp")
    public suspend fun rules(vararg argument: suspend BucketLifecycleConfigurationRuleArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            BucketLifecycleConfigurationRuleArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.rules = mapped
    }

    /**
     * @param argument Configuration block(s) containing lifecycle rules for the bucket.
     */
    @JvmName("ubxbtnrpppjwbafk")
    public suspend fun rules(argument: suspend BucketLifecycleConfigurationRuleArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            BucketLifecycleConfigurationRuleArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.rules = mapped
    }

    /**
     * @param values Configuration block(s) containing lifecycle rules for the bucket.
     */
    @JvmName("hicejchfukujpfdf")
    public suspend fun rules(vararg values: BucketLifecycleConfigurationRuleArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.rules = mapped
    }

    internal fun build(): BucketLifecycleConfigurationArgs = BucketLifecycleConfigurationArgs(
        bucket = bucket,
        rules = rules,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy