com.pulumi.aws.s3.kotlin.BucketLoggingV2Args.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.s3.kotlin
import com.pulumi.aws.s3.BucketLoggingV2Args.builder
import com.pulumi.aws.s3.kotlin.inputs.BucketLoggingV2TargetGrantArgs
import com.pulumi.aws.s3.kotlin.inputs.BucketLoggingV2TargetGrantArgsBuilder
import com.pulumi.aws.s3.kotlin.inputs.BucketLoggingV2TargetObjectKeyFormatArgs
import com.pulumi.aws.s3.kotlin.inputs.BucketLoggingV2TargetObjectKeyFormatArgsBuilder
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 an S3 bucket (server access) logging resource. For more information, see [Logging requests using server access logging](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html)
* in the AWS S3 User Guide.
* > **Note:** Amazon S3 supports server access logging, AWS CloudTrail, or a combination of both. Refer to the [Logging options for Amazon S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/logging-with-S3.html)
* to decide which method meets your requirements.
* > This resource cannot be used with S3 directory buckets.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.s3.BucketV2("example", {bucket: "my-tf-example-bucket"});
* const exampleBucketAclV2 = new aws.s3.BucketAclV2("example", {
* bucket: example.id,
* acl: "private",
* });
* const logBucket = new aws.s3.BucketV2("log_bucket", {bucket: "my-tf-log-bucket"});
* const logBucketAcl = new aws.s3.BucketAclV2("log_bucket_acl", {
* bucket: logBucket.id,
* acl: "log-delivery-write",
* });
* const exampleBucketLoggingV2 = new aws.s3.BucketLoggingV2("example", {
* bucket: example.id,
* targetBucket: logBucket.id,
* targetPrefix: "log/",
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.s3.BucketV2("example", bucket="my-tf-example-bucket")
* example_bucket_acl_v2 = aws.s3.BucketAclV2("example",
* bucket=example.id,
* acl="private")
* log_bucket = aws.s3.BucketV2("log_bucket", bucket="my-tf-log-bucket")
* log_bucket_acl = aws.s3.BucketAclV2("log_bucket_acl",
* bucket=log_bucket.id,
* acl="log-delivery-write")
* example_bucket_logging_v2 = aws.s3.BucketLoggingV2("example",
* bucket=example.id,
* target_bucket=log_bucket.id,
* target_prefix="log/")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.S3.BucketV2("example", new()
* {
* Bucket = "my-tf-example-bucket",
* });
* var exampleBucketAclV2 = new Aws.S3.BucketAclV2("example", new()
* {
* Bucket = example.Id,
* Acl = "private",
* });
* var logBucket = new Aws.S3.BucketV2("log_bucket", new()
* {
* Bucket = "my-tf-log-bucket",
* });
* var logBucketAcl = new Aws.S3.BucketAclV2("log_bucket_acl", new()
* {
* Bucket = logBucket.Id,
* Acl = "log-delivery-write",
* });
* var exampleBucketLoggingV2 = new Aws.S3.BucketLoggingV2("example", new()
* {
* Bucket = example.Id,
* TargetBucket = logBucket.Id,
* TargetPrefix = "log/",
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := s3.NewBucketV2(ctx, "example", &s3.BucketV2Args{
* Bucket: pulumi.String("my-tf-example-bucket"),
* })
* if err != nil {
* return err
* }
* _, err = s3.NewBucketAclV2(ctx, "example", &s3.BucketAclV2Args{
* Bucket: example.ID(),
* Acl: pulumi.String("private"),
* })
* if err != nil {
* return err
* }
* logBucket, err := s3.NewBucketV2(ctx, "log_bucket", &s3.BucketV2Args{
* Bucket: pulumi.String("my-tf-log-bucket"),
* })
* if err != nil {
* return err
* }
* _, err = s3.NewBucketAclV2(ctx, "log_bucket_acl", &s3.BucketAclV2Args{
* Bucket: logBucket.ID(),
* Acl: pulumi.String("log-delivery-write"),
* })
* if err != nil {
* return err
* }
* _, err = s3.NewBucketLoggingV2(ctx, "example", &s3.BucketLoggingV2Args{
* Bucket: example.ID(),
* TargetBucket: logBucket.ID(),
* TargetPrefix: pulumi.String("log/"),
* })
* 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.s3.BucketV2;
* import com.pulumi.aws.s3.BucketV2Args;
* import com.pulumi.aws.s3.BucketAclV2;
* import com.pulumi.aws.s3.BucketAclV2Args;
* import com.pulumi.aws.s3.BucketLoggingV2;
* import com.pulumi.aws.s3.BucketLoggingV2Args;
* 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 BucketV2("example", BucketV2Args.builder()
* .bucket("my-tf-example-bucket")
* .build());
* var exampleBucketAclV2 = new BucketAclV2("exampleBucketAclV2", BucketAclV2Args.builder()
* .bucket(example.id())
* .acl("private")
* .build());
* var logBucket = new BucketV2("logBucket", BucketV2Args.builder()
* .bucket("my-tf-log-bucket")
* .build());
* var logBucketAcl = new BucketAclV2("logBucketAcl", BucketAclV2Args.builder()
* .bucket(logBucket.id())
* .acl("log-delivery-write")
* .build());
* var exampleBucketLoggingV2 = new BucketLoggingV2("exampleBucketLoggingV2", BucketLoggingV2Args.builder()
* .bucket(example.id())
* .targetBucket(logBucket.id())
* .targetPrefix("log/")
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:s3:BucketV2
* properties:
* bucket: my-tf-example-bucket
* exampleBucketAclV2:
* type: aws:s3:BucketAclV2
* name: example
* properties:
* bucket: ${example.id}
* acl: private
* logBucket:
* type: aws:s3:BucketV2
* name: log_bucket
* properties:
* bucket: my-tf-log-bucket
* logBucketAcl:
* type: aws:s3:BucketAclV2
* name: log_bucket_acl
* properties:
* bucket: ${logBucket.id}
* acl: log-delivery-write
* exampleBucketLoggingV2:
* type: aws:s3:BucketLoggingV2
* name: example
* properties:
* bucket: ${example.id}
* targetBucket: ${logBucket.id}
* targetPrefix: log/
* ```
*
* ## Import
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
* __Using `pulumi import` to import__ S3 bucket logging using the `bucket` or using the `bucket` and `expected_bucket_owner` separated by a comma (`,`). For example:
* If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, import using the `bucket`:
* ```sh
* $ pulumi import aws:s3/bucketLoggingV2:BucketLoggingV2 example bucket-name
* ```
* If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the `bucket` and `expected_bucket_owner` separated by a comma (`,`):
* ```sh
* $ pulumi import aws:s3/bucketLoggingV2:BucketLoggingV2 example bucket-name,123456789012
* ```
* @property bucket Name of the bucket.
* @property expectedBucketOwner Account ID of the expected bucket owner.
* @property targetBucket Name of the bucket where you want Amazon S3 to store server access logs.
* @property targetGrants Set of configuration blocks with information for granting permissions. See below.
* @property targetObjectKeyFormat Amazon S3 key format for log objects. See below.
* @property targetPrefix Prefix for all log object keys.
*/
public data class BucketLoggingV2Args(
public val bucket: Output? = null,
public val expectedBucketOwner: Output? = null,
public val targetBucket: Output? = null,
public val targetGrants: Output>? = null,
public val targetObjectKeyFormat: Output? = null,
public val targetPrefix: Output? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.aws.s3.BucketLoggingV2Args =
com.pulumi.aws.s3.BucketLoggingV2Args.builder()
.bucket(bucket?.applyValue({ args0 -> args0 }))
.expectedBucketOwner(expectedBucketOwner?.applyValue({ args0 -> args0 }))
.targetBucket(targetBucket?.applyValue({ args0 -> args0 }))
.targetGrants(
targetGrants?.applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
})
}),
)
.targetObjectKeyFormat(
targetObjectKeyFormat?.applyValue({ args0 ->
args0.let({ args0 ->
args0.toJava()
})
}),
)
.targetPrefix(targetPrefix?.applyValue({ args0 -> args0 })).build()
}
/**
* Builder for [BucketLoggingV2Args].
*/
@PulumiTagMarker
public class BucketLoggingV2ArgsBuilder internal constructor() {
private var bucket: Output? = null
private var expectedBucketOwner: Output? = null
private var targetBucket: Output? = null
private var targetGrants: Output>? = null
private var targetObjectKeyFormat: Output? = null
private var targetPrefix: Output? = null
/**
* @param value Name of the bucket.
*/
@JvmName("nvewpiegxqcnckxk")
public suspend fun bucket(`value`: Output) {
this.bucket = value
}
/**
* @param value Account ID of the expected bucket owner.
*/
@JvmName("fuuaikoxxyrppgfe")
public suspend fun expectedBucketOwner(`value`: Output) {
this.expectedBucketOwner = value
}
/**
* @param value Name of the bucket where you want Amazon S3 to store server access logs.
*/
@JvmName("nkykkxwpgngoviqu")
public suspend fun targetBucket(`value`: Output) {
this.targetBucket = value
}
/**
* @param value Set of configuration blocks with information for granting permissions. See below.
*/
@JvmName("pujhjuhxixmeijjb")
public suspend fun targetGrants(`value`: Output>) {
this.targetGrants = value
}
@JvmName("dvpwooyiupicfmah")
public suspend fun targetGrants(vararg values: Output) {
this.targetGrants = Output.all(values.asList())
}
/**
* @param values Set of configuration blocks with information for granting permissions. See below.
*/
@JvmName("flmystneqwhfgtob")
public suspend fun targetGrants(values: List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy