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

com.pulumi.awsnative.timestream.kotlin.Table.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.timestream.kotlin

import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.awsnative.timestream.kotlin.outputs.MagneticStoreWritePropertiesProperties
import com.pulumi.awsnative.timestream.kotlin.outputs.RetentionPropertiesProperties
import com.pulumi.awsnative.timestream.kotlin.outputs.SchemaProperties
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
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin
import com.pulumi.awsnative.timestream.kotlin.outputs.MagneticStoreWritePropertiesProperties.Companion.toKotlin as magneticStoreWritePropertiesPropertiesToKotlin
import com.pulumi.awsnative.timestream.kotlin.outputs.RetentionPropertiesProperties.Companion.toKotlin as retentionPropertiesPropertiesToKotlin
import com.pulumi.awsnative.timestream.kotlin.outputs.SchemaProperties.Companion.toKotlin as schemaPropertiesToKotlin

/**
 * 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.awsnative.timestream.Table(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Table(builtJavaResource)
    }
}

/**
 * The AWS::Timestream::Table resource creates a Timestream Table.
 */
public class Table internal constructor(
    override val javaResource: com.pulumi.awsnative.timestream.Table,
) : KotlinCustomResource(javaResource, TableMapper) {
    /**
     * The `arn` of the table.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * The name for the database which the table to be created belongs to.
     */
    public val databaseName: Output
        get() = javaResource.databaseName().applyValue({ args0 -> args0 })

    /**
     * The properties that determine whether magnetic store writes are enabled.
     */
    public val magneticStoreWriteProperties: Output?
        get() = javaResource.magneticStoreWriteProperties().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> magneticStoreWritePropertiesPropertiesToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The table name exposed as a read-only attribute.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The retention duration of the memory store and the magnetic store.
     */
    public val retentionProperties: Output?
        get() = javaResource.retentionProperties().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> retentionPropertiesPropertiesToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * A Schema specifies the expected data model of the table.
     */
    public val schema: Output?
        get() = javaResource.schema().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    schemaPropertiesToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The name for the table. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the table name.
     */
    public val tableName: Output?
        get() = javaResource.tableName().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * An array of key-value pairs to apply to this resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })
}

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

    override fun map(javaResource: Resource): Table = Table(
        javaResource as
            com.pulumi.awsnative.timestream.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()
}