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

com.pulumi.aws.s3tables.kotlin.Table.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.s3tables.kotlin

import com.pulumi.aws.s3tables.kotlin.outputs.TableMaintenanceConfiguration
import com.pulumi.aws.s3tables.kotlin.outputs.TableMaintenanceConfiguration.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

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

    public var args: TableArgs = TableArgs()

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

/**
 * Resource for managing an Amazon S3 Tables Table.
 * ## Example Usage
 * ### Basic Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const exampleTableBucket = new aws.s3tables.TableBucket("example", {name: "example-bucket"});
 * const exampleNamespace = new aws.s3tables.Namespace("example", {
 *     namespace: "example-namespace",
 *     tableBucketArn: exampleTableBucket.arn,
 * });
 * const example = new aws.s3tables.Table("example", {
 *     name: "example-table",
 *     namespace: exampleNamespace,
 *     tableBucketArn: exampleNamespace.tableBucketArn,
 *     format: "ICEBERG",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * example_table_bucket = aws.s3tables.TableBucket("example", name="example-bucket")
 * example_namespace = aws.s3tables.Namespace("example",
 *     namespace="example-namespace",
 *     table_bucket_arn=example_table_bucket.arn)
 * example = aws.s3tables.Table("example",
 *     name="example-table",
 *     namespace=example_namespace,
 *     table_bucket_arn=example_namespace.table_bucket_arn,
 *     format="ICEBERG")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleTableBucket = new Aws.S3Tables.TableBucket("example", new()
 *     {
 *         Name = "example-bucket",
 *     });
 *     var exampleNamespace = new Aws.S3Tables.Namespace("example", new()
 *     {
 *         NameSpace = "example-namespace",
 *         TableBucketArn = exampleTableBucket.Arn,
 *     });
 *     var example = new Aws.S3Tables.Table("example", new()
 *     {
 *         Name = "example-table",
 *         Namespace = exampleNamespace,
 *         TableBucketArn = exampleNamespace.TableBucketArn,
 *         Format = "ICEBERG",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"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 {
 * 		exampleTableBucket, err := s3tables.NewTableBucket(ctx, "example", &s3tables.TableBucketArgs{
 * 			Name: pulumi.String("example-bucket"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleNamespace, err := s3tables.NewNamespace(ctx, "example", &s3tables.NamespaceArgs{
 * 			Namespace:      pulumi.String("example-namespace"),
 * 			TableBucketArn: exampleTableBucket.Arn,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = s3tables.NewTable(ctx, "example", &s3tables.TableArgs{
 * 			Name:           pulumi.String("example-table"),
 * 			Namespace:      exampleNamespace,
 * 			TableBucketArn: exampleNamespace.TableBucketArn,
 * 			Format:         pulumi.String("ICEBERG"),
 * 		})
 * 		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.s3tables.TableBucket;
 * import com.pulumi.aws.s3tables.TableBucketArgs;
 * import com.pulumi.aws.s3tables.Namespace;
 * import com.pulumi.aws.s3tables.NamespaceArgs;
 * import com.pulumi.aws.s3tables.Table;
 * import com.pulumi.aws.s3tables.TableArgs;
 * 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 exampleTableBucket = new TableBucket("exampleTableBucket", TableBucketArgs.builder()
 *             .name("example-bucket")
 *             .build());
 *         var exampleNamespace = new Namespace("exampleNamespace", NamespaceArgs.builder()
 *             .namespace("example-namespace")
 *             .tableBucketArn(exampleTableBucket.arn())
 *             .build());
 *         var example = new Table("example", TableArgs.builder()
 *             .name("example-table")
 *             .namespace(exampleNamespace)
 *             .tableBucketArn(exampleNamespace.tableBucketArn())
 *             .format("ICEBERG")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: aws:s3tables:Table
 *     properties:
 *       name: example-table
 *       namespace: ${exampleNamespace}
 *       tableBucketArn: ${exampleNamespace.tableBucketArn}
 *       format: ICEBERG
 *   exampleNamespace:
 *     type: aws:s3tables:Namespace
 *     name: example
 *     properties:
 *       namespace: example-namespace
 *       tableBucketArn: ${exampleTableBucket.arn}
 *   exampleTableBucket:
 *     type: aws:s3tables:TableBucket
 *     name: example
 *     properties:
 *       name: example-bucket
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import S3 Tables Table using the `table_bucket_arn`, the value of `namespace`, and the value of `name`, separated by a semicolon (`;`). For example:
 * ```sh
 * $ pulumi import aws:s3tables/table:Table example 'arn:aws:s3tables:us-west-2:123456789012:bucket/example-bucket;example-namespace;example-table'
 * ```
 */
public class Table internal constructor(
    override val javaResource: com.pulumi.aws.s3tables.Table,
) : KotlinCustomResource(javaResource, TableMapper) {
    /**
     * ARN of the table.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * Date and time when the namespace was created.
     */
    public val createdAt: Output
        get() = javaResource.createdAt().applyValue({ args0 -> args0 })

    /**
     * Account ID of the account that created the namespace.
     */
    public val createdBy: Output
        get() = javaResource.createdBy().applyValue({ args0 -> args0 })

    /**
     * Format of the table.
     * Must be `ICEBERG`.
     */
    public val format: Output
        get() = javaResource.format().applyValue({ args0 -> args0 })

    /**
     * A single table bucket maintenance configuration block.
     * See `maintenance_configuration` below
     */
    public val maintenanceConfiguration: Output
        get() = javaResource.maintenanceConfiguration().applyValue({ args0 ->
            args0.let({ args0 ->
                toKotlin(args0)
            })
        })

    /**
     * Location of table metadata.
     */
    public val metadataLocation: Output
        get() = javaResource.metadataLocation().applyValue({ args0 -> args0 })

    /**
     * Date and time when the namespace was last modified.
     */
    public val modifiedAt: Output
        get() = javaResource.modifiedAt().applyValue({ args0 -> args0 })

    /**
     * Account ID of the account that last modified the namespace.
     */
    public val modifiedBy: Output
        get() = javaResource.modifiedBy().applyValue({ args0 -> args0 })

    /**
     * Name of the table.
     * Must be between 1 and 255 characters in length.
     * Can consist of lowercase letters, numbers, and underscores, and must begin and end with a lowercase letter or number.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Name of the namespace for this table.
     * Must be between 1 and 255 characters in length.
     * Can consist of lowercase letters, numbers, and underscores, and must begin and end with a lowercase letter or number.
     */
    public val namespace: Output
        get() = javaResource.namespace().applyValue({ args0 -> args0 })

    /**
     * Account ID of the account that owns the namespace.
     */
    public val ownerAccountId: Output
        get() = javaResource.ownerAccountId().applyValue({ args0 -> args0 })

    /**
     * ARN referencing the Table Bucket that contains this Namespace.
     * The following argument is optional:
     */
    public val tableBucketArn: Output
        get() = javaResource.tableBucketArn().applyValue({ args0 -> args0 })

    /**
     * Type of the table.
     * One of `customer` or `aws`.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * Identifier for the current version of table data.
     */
    public val versionToken: Output
        get() = javaResource.versionToken().applyValue({ args0 -> args0 })

    /**
     * S3 URI pointing to the S3 Bucket that contains the table data.
     */
    public val warehouseLocation: Output
        get() = javaResource.warehouseLocation().applyValue({ args0 -> args0 })
}

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

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

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

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