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

com.pulumi.aws.s3tables.kotlin.TableBucketPolicy.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.s3tables.kotlin

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

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

    public var args: TableBucketPolicyArgs = TableBucketPolicyArgs()

    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 TableBucketPolicyArgsBuilder.() -> Unit) {
        val builder = TableBucketPolicyArgsBuilder()
        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(): TableBucketPolicy {
        val builtJavaResource = com.pulumi.aws.s3tables.TableBucketPolicy(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return TableBucketPolicy(builtJavaResource)
    }
}

/**
 * Resource for managing an Amazon S3 Tables Table Bucket Policy.
 * ## Example Usage
 * ### Basic Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const example = aws.iam.getPolicyDocument({
 *     statements: [{}],
 * });
 * const exampleTableBucketPolicy = new aws.s3tables.TableBucketPolicy("example", {
 *     resourcePolicy: example.then(example => example.json),
 *     tableBucketArn: exampleAwsS3tablesTableBucket.arn,
 * });
 * const test = new aws.s3tables.TableBucket("test", {name: "example-bucket"});
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example = aws.iam.get_policy_document(statements=[{}])
 * example_table_bucket_policy = aws.s3tables.TableBucketPolicy("example",
 *     resource_policy=example.json,
 *     table_bucket_arn=example_aws_s3tables_table_bucket["arn"])
 * test = aws.s3tables.TableBucket("test", name="example-bucket")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = Aws.Iam.GetPolicyDocument.Invoke(new()
 *     {
 *         Statements = new[]
 *         {
 *             null,
 *         },
 *     });
 *     var exampleTableBucketPolicy = new Aws.S3Tables.TableBucketPolicy("example", new()
 *     {
 *         ResourcePolicy = example.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
 *         TableBucketArn = exampleAwsS3tablesTableBucket.Arn,
 *     });
 *     var test = new Aws.S3Tables.TableBucket("test", new()
 *     {
 *         Name = "example-bucket",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3tables"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
 * 			Statements: []iam.GetPolicyDocumentStatement{
 * 				{},
 * 			},
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = s3tables.NewTableBucketPolicy(ctx, "example", &s3tables.TableBucketPolicyArgs{
 * 			ResourcePolicy: pulumi.String(example.Json),
 * 			TableBucketArn: pulumi.Any(exampleAwsS3tablesTableBucket.Arn),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = s3tables.NewTableBucket(ctx, "test", &s3tables.TableBucketArgs{
 * 			Name: pulumi.String("example-bucket"),
 * 		})
 * 		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.iam.IamFunctions;
 * import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
 * import com.pulumi.aws.s3tables.TableBucketPolicy;
 * import com.pulumi.aws.s3tables.TableBucketPolicyArgs;
 * import com.pulumi.aws.s3tables.TableBucket;
 * import com.pulumi.aws.s3tables.TableBucketArgs;
 * 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) {
 *         final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
 *             .statements()
 *             .build());
 *         var exampleTableBucketPolicy = new TableBucketPolicy("exampleTableBucketPolicy", TableBucketPolicyArgs.builder()
 *             .resourcePolicy(example.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
 *             .tableBucketArn(exampleAwsS3tablesTableBucket.arn())
 *             .build());
 *         var test = new TableBucket("test", TableBucketArgs.builder()
 *             .name("example-bucket")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleTableBucketPolicy:
 *     type: aws:s3tables:TableBucketPolicy
 *     name: example
 *     properties:
 *       resourcePolicy: ${example.json}
 *       tableBucketArn: ${exampleAwsS3tablesTableBucket.arn}
 *   test:
 *     type: aws:s3tables:TableBucket
 *     properties:
 *       name: example-bucket
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: aws:iam:getPolicyDocument
 *       Arguments:
 *         statements:
 *           - {}
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import S3 Tables Table Bucket Policy using the `table_bucket_arn`. For example:
 * ```sh
 * $ pulumi import aws:s3tables/tableBucketPolicy:TableBucketPolicy example 'arn:aws:s3tables:us-west-2:123456789012:bucket/example-bucket;example-namespace'
 * ```
 */
public class TableBucketPolicy internal constructor(
    override val javaResource: com.pulumi.aws.s3tables.TableBucketPolicy,
) : KotlinCustomResource(javaResource, TableBucketPolicyMapper) {
    /**
     * Amazon Web Services resource-based policy document in JSON format.
     */
    public val resourcePolicy: Output
        get() = javaResource.resourcePolicy().applyValue({ args0 -> args0 })

    /**
     * ARN referencing the Table Bucket that owns this policy.
     */
    public val tableBucketArn: Output
        get() = javaResource.tableBucketArn().applyValue({ args0 -> args0 })
}

public object TableBucketPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.aws.s3tables.TableBucketPolicy::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy