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

com.pulumi.awsnative.dynamodb.kotlin.GlobalTable.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: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.dynamodb.kotlin

import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableAttributeDefinition
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableGlobalSecondaryIndex
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableKeySchema
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableLocalSecondaryIndex
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableReplicaSpecification
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableSseSpecification
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableStreamSpecification
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableTimeToLiveSpecification
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableWriteOnDemandThroughputSettings
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableWriteProvisionedThroughputSettings
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.dynamodb.kotlin.outputs.GlobalTableAttributeDefinition.Companion.toKotlin as globalTableAttributeDefinitionToKotlin
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableGlobalSecondaryIndex.Companion.toKotlin as globalTableGlobalSecondaryIndexToKotlin
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableKeySchema.Companion.toKotlin as globalTableKeySchemaToKotlin
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableLocalSecondaryIndex.Companion.toKotlin as globalTableLocalSecondaryIndexToKotlin
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableReplicaSpecification.Companion.toKotlin as globalTableReplicaSpecificationToKotlin
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableSseSpecification.Companion.toKotlin as globalTableSseSpecificationToKotlin
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableStreamSpecification.Companion.toKotlin as globalTableStreamSpecificationToKotlin
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableTimeToLiveSpecification.Companion.toKotlin as globalTableTimeToLiveSpecificationToKotlin
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableWriteOnDemandThroughputSettings.Companion.toKotlin as globalTableWriteOnDemandThroughputSettingsToKotlin
import com.pulumi.awsnative.dynamodb.kotlin.outputs.GlobalTableWriteProvisionedThroughputSettings.Companion.toKotlin as globalTableWriteProvisionedThroughputSettingsToKotlin

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

    public var args: GlobalTableArgs = GlobalTableArgs()

    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 GlobalTableArgsBuilder.() -> Unit) {
        val builder = GlobalTableArgsBuilder()
        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(): GlobalTable {
        val builtJavaResource = com.pulumi.awsnative.dynamodb.GlobalTable(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return GlobalTable(builtJavaResource)
    }
}

/**
 * Version: None. Resource Type definition for AWS::DynamoDB::GlobalTable
 */
public class GlobalTable internal constructor(
    override val javaResource: com.pulumi.awsnative.dynamodb.GlobalTable,
) : KotlinCustomResource(javaResource, GlobalTableMapper) {
    /**
     * The Amazon Resource Name (ARN) of the DynamoDB table, such as `arn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable` . The ARN returned is that of the replica in the region the stack is deployed to.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * A list of attributes that describe the key schema for the global table and indexes.
     */
    public val attributeDefinitions: Output>
        get() = javaResource.attributeDefinitions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> globalTableAttributeDefinitionToKotlin(args0) })
            })
        })

    /**
     * Specifies how you are charged for read and write throughput and how you manage capacity. Valid values are:
     * - `PAY_PER_REQUEST`
     * - `PROVISIONED`
     * All replicas in your global table will have the same billing mode. If you use `PROVISIONED` billing mode, you must provide an auto scaling configuration via the `WriteProvisionedThroughputSettings` property. The default value of this property is `PROVISIONED` .
     */
    public val billingMode: Output?
        get() = javaResource.billingMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Global secondary indexes to be created on the global table. You can create up to 20 global secondary indexes. Each replica in your global table will have the same global secondary index settings. You can only create or delete one global secondary index in a single stack operation.
     * Since the backfilling of an index could take a long time, CloudFormation does not wait for the index to become active. If a stack operation rolls back, CloudFormation might not delete an index that has been added. In that case, you will need to delete the index manually.
     */
    public val globalSecondaryIndexes: Output>?
        get() = javaResource.globalSecondaryIndexes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        globalTableGlobalSecondaryIndexToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Specifies the attributes that make up the primary key for the table. The attributes in the `KeySchema` property must also be defined in the `AttributeDefinitions` property.
     */
    public val keySchema: Output>
        get() = javaResource.keySchema().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    globalTableKeySchemaToKotlin(args0)
                })
            })
        })

    /**
     * Local secondary indexes to be created on the table. You can create up to five local secondary indexes. Each index is scoped to a given hash key value. The size of each hash key can be up to 10 gigabytes. Each replica in your global table will have the same local secondary index settings.
     */
    public val localSecondaryIndexes: Output>?
        get() = javaResource.localSecondaryIndexes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        globalTableLocalSecondaryIndexToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * Specifies the list of replicas for your global table. The list must contain at least one element, the region where the stack defining the global table is deployed. For example, if you define your table in a stack deployed to us-east-1, you must have an entry in `Replicas` with the region us-east-1. You cannot remove the replica in the stack region.
     * > Adding a replica might take a few minutes for an empty table, or up to several hours for large tables. If you want to add or remove a replica, we recommend submitting an `UpdateStack` operation containing only that change.
     * >
     * > If you add or delete a replica during an update, we recommend that you don't update any other resources. If your stack fails to update and is rolled back while adding a new replica, you might need to manually delete the replica.
     * You can create a new global table with as many replicas as needed. You can add or remove replicas after table creation, but you can only add or remove a single replica in each update.
     */
    public val replicas: Output>
        get() = javaResource.replicas().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    globalTableReplicaSpecificationToKotlin(args0)
                })
            })
        })

    /**
     * Specifies the settings to enable server-side encryption. These settings will be applied to all replicas. If you plan to use customer-managed KMS keys, you must provide a key for each replica using the `ReplicaSpecification.ReplicaSSESpecification` property.
     */
    public val sseSpecification: Output?
        get() = javaResource.sseSpecification().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> globalTableSseSpecificationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The ARN of the DynamoDB stream, such as `arn:aws:dynamodb:us-east-1:123456789012:table/testddbstack-myDynamoDBTable-012A1SL7SMP5Q/stream/2015-11-30T20:10:00.000` . The `StreamArn` returned is that of the replica in the region the stack is deployed to.
     * > You must specify the `StreamSpecification` property to use this attribute.
     */
    public val streamArn: Output
        get() = javaResource.streamArn().applyValue({ args0 -> args0 })

    /**
     * Specifies the streams settings on your global table. You must provide a value for this property if your global table contains more than one replica. You can only change the streams settings if your global table has only one replica.
     */
    public val streamSpecification: Output?
        get() = javaResource.streamSpecification().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> globalTableStreamSpecificationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Unique identifier for the table, such as `a123b456-01ab-23cd-123a-111222aaabbb` . The `TableId` returned is that of the replica in the region the stack is deployed to.
     */
    public val tableId: Output
        get() = javaResource.tableId().applyValue({ args0 -> args0 })

    /**
     * A name for the global table. If you don't specify a name, AWS CloudFormation generates a unique ID and uses that ID as the table name. For more information, see [Name type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html) .
     * > If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
     */
    public val tableName: Output?
        get() = javaResource.tableName().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies the time to live (TTL) settings for the table. This setting will be applied to all replicas.
     */
    public val timeToLiveSpecification: Output?
        get() = javaResource.timeToLiveSpecification().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> globalTableTimeToLiveSpecificationToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Sets the write request settings for a global table or a global secondary index. You must specify this setting if you set the `BillingMode` to `PAY_PER_REQUEST` .
     */
    public val writeOnDemandThroughputSettings: Output?
        get() = javaResource.writeOnDemandThroughputSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    globalTableWriteOnDemandThroughputSettingsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Specifies an auto scaling policy for write capacity. This policy will be applied to all replicas. This setting must be specified if `BillingMode` is set to `PROVISIONED` .
     */
    public val writeProvisionedThroughputSettings:
        Output?
        get() = javaResource.writeProvisionedThroughputSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    globalTableWriteProvisionedThroughputSettingsToKotlin(args0)
                })
            }).orElse(null)
        })
}

public object GlobalTableMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.dynamodb.GlobalTable::class == javaResource::class

    override fun map(javaResource: Resource): GlobalTable = GlobalTable(
        javaResource as
            com.pulumi.awsnative.dynamodb.GlobalTable,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy