com.pulumi.aws.s3control.kotlin.BucketLifecycleConfiguration.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-aws-kotlin Show documentation
Show all versions of pulumi-aws-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.s3control.kotlin
import com.pulumi.aws.s3control.kotlin.outputs.BucketLifecycleConfigurationRule
import com.pulumi.aws.s3control.kotlin.outputs.BucketLifecycleConfigurationRule.Companion.toKotlin
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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [BucketLifecycleConfiguration].
*/
@PulumiTagMarker
public class BucketLifecycleConfigurationResourceBuilder internal constructor() {
public var name: String? = null
public var args: BucketLifecycleConfigurationArgs = BucketLifecycleConfigurationArgs()
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 BucketLifecycleConfigurationArgsBuilder.() -> Unit) {
val builder = BucketLifecycleConfigurationArgsBuilder()
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(): BucketLifecycleConfiguration {
val builtJavaResource =
com.pulumi.aws.s3control.BucketLifecycleConfiguration(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return BucketLifecycleConfiguration(builtJavaResource)
}
}
/**
* 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
* ```
*/
public class BucketLifecycleConfiguration internal constructor(
override val javaResource: com.pulumi.aws.s3control.BucketLifecycleConfiguration,
) : KotlinCustomResource(javaResource, BucketLifecycleConfigurationMapper) {
/**
* Amazon Resource Name (ARN) of the bucket.
*/
public val bucket: Output
get() = javaResource.bucket().applyValue({ args0 -> args0 })
/**
* Configuration block(s) containing lifecycle rules for the bucket.
*/
public val rules: Output>
get() = javaResource.rules().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
toKotlin(args0)
})
})
})
}
public object BucketLifecycleConfigurationMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.s3control.BucketLifecycleConfiguration::class == javaResource::class
override fun map(javaResource: Resource): BucketLifecycleConfiguration =
BucketLifecycleConfiguration(
javaResource as
com.pulumi.aws.s3control.BucketLifecycleConfiguration,
)
}
/**
* @see [BucketLifecycleConfiguration].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [BucketLifecycleConfiguration].
*/
public suspend fun bucketLifecycleConfiguration(
name: String,
block: suspend BucketLifecycleConfigurationResourceBuilder.() -> Unit,
): BucketLifecycleConfiguration {
val builder = BucketLifecycleConfigurationResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [BucketLifecycleConfiguration].
* @param name The _unique_ name of the resulting resource.
*/
public fun bucketLifecycleConfiguration(name: String): BucketLifecycleConfiguration {
val builder = BucketLifecycleConfigurationResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy