"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.Table = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * The ``AWS::DynamoDB::Table`` resource creates a DDB table. For more information, see [CreateTable](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html) in the *API Reference*.
 *  You should be aware of the following behaviors when working with DDB tables:
 *   +  CFNlong typically creates DDB tables in parallel. However, if your template includes multiple DDB tables with indexes, you must declare dependencies so that the tables are created sequentially. DDBlong limits the number of tables with secondary indexes that are in the creating state. If you create multiple tables with indexes at the same time, DDB returns an error and the stack operation fails. For an example, see [DynamoDB Table with a DependsOn Attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html#aws-resource-dynamodb-table--examples--DynamoDB_Table_with_a_DependsOn_Attribute).
 *
 *    Our guidance is to use the latest schema documented for your CFNlong templates. This schema supports the provisioning of all table settings below. When using this schema in your CFNlong templates, please ensure that your Identity and Access Management (IAM) policies are updated with appropriate permissions to allow for the authorization of these setting changes.
 *
 * ## Example Usage
 * ### Example
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws_native from "@pulumi/aws-native";
 *
 * const myDynamoDBTable = new aws_native.dynamodb.Table("myDynamoDBTable", {
 *     attributeDefinitions: [
 *         {
 *             attributeName: "Album",
 *             attributeType: "S",
 *         },
 *         {
 *             attributeName: "Artist",
 *             attributeType: "S",
 *         },
 *         {
 *             attributeName: "Sales",
 *             attributeType: "N",
 *         },
 *         {
 *             attributeName: "NumberOfSongs",
 *             attributeType: "N",
 *         },
 *     ],
 *     keySchema: [
 *         {
 *             attributeName: "Album",
 *             keyType: "HASH",
 *         },
 *         {
 *             attributeName: "Artist",
 *             keyType: "RANGE",
 *         },
 *     ],
 *     provisionedThroughput: {
 *         readCapacityUnits: 5,
 *         writeCapacityUnits: 5,
 *     },
 *     tableName: "myTableName",
 *     globalSecondaryIndexes: [
 *         {
 *             indexName: "myGSI",
 *             keySchema: [
 *                 {
 *                     attributeName: "Sales",
 *                     keyType: "HASH",
 *                 },
 *                 {
 *                     attributeName: "Artist",
 *                     keyType: "RANGE",
 *                 },
 *             ],
 *             projection: {
 *                 nonKeyAttributes: [
 *                     "Album",
 *                     "NumberOfSongs",
 *                 ],
 *                 projectionType: "INCLUDE",
 *             },
 *             provisionedThroughput: {
 *                 readCapacityUnits: 5,
 *                 writeCapacityUnits: 5,
 *             },
 *         },
 *         {
 *             indexName: "myGSI2",
 *             keySchema: [
 *                 {
 *                     attributeName: "NumberOfSongs",
 *                     keyType: "HASH",
 *                 },
 *                 {
 *                     attributeName: "Sales",
 *                     keyType: "RANGE",
 *                 },
 *             ],
 *             projection: {
 *                 nonKeyAttributes: [
 *                     "Album",
 *                     "Artist",
 *                 ],
 *                 projectionType: "INCLUDE",
 *             },
 *             provisionedThroughput: {
 *                 readCapacityUnits: 5,
 *                 writeCapacityUnits: 5,
 *             },
 *         },
 *     ],
 *     localSecondaryIndexes: [{
 *         indexName: "myLSI",
 *         keySchema: [
 *             {
 *                 attributeName: "Album",
 *                 keyType: "HASH",
 *             },
 *             {
 *                 attributeName: "Sales",
 *                 keyType: "RANGE",
 *             },
 *         ],
 *         projection: {
 *             nonKeyAttributes: [
 *                 "Artist",
 *                 "NumberOfSongs",
 *             ],
 *             projectionType: "INCLUDE",
 *         },
 *     }],
 * });
 *
 * ```
 * ### Example
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws_native from "@pulumi/aws-native";
 *
 * const myDynamoDBTable = new aws_native.dynamodb.Table("myDynamoDBTable", {
 *     attributeDefinitions: [
 *         {
 *             attributeName: "Album",
 *             attributeType: "S",
 *         },
 *         {
 *             attributeName: "Artist",
 *             attributeType: "S",
 *         },
 *         {
 *             attributeName: "Sales",
 *             attributeType: "N",
 *         },
 *         {
 *             attributeName: "NumberOfSongs",
 *             attributeType: "N",
 *         },
 *     ],
 *     keySchema: [
 *         {
 *             attributeName: "Album",
 *             keyType: "HASH",
 *         },
 *         {
 *             attributeName: "Artist",
 *             keyType: "RANGE",
 *         },
 *     ],
 *     provisionedThroughput: {
 *         readCapacityUnits: 5,
 *         writeCapacityUnits: 5,
 *     },
 *     tableName: "myTableName",
 *     globalSecondaryIndexes: [
 *         {
 *             indexName: "myGSI",
 *             keySchema: [
 *                 {
 *                     attributeName: "Sales",
 *                     keyType: "HASH",
 *                 },
 *                 {
 *                     attributeName: "Artist",
 *                     keyType: "RANGE",
 *                 },
 *             ],
 *             projection: {
 *                 nonKeyAttributes: [
 *                     "Album",
 *                     "NumberOfSongs",
 *                 ],
 *                 projectionType: "INCLUDE",
 *             },
 *             provisionedThroughput: {
 *                 readCapacityUnits: 5,
 *                 writeCapacityUnits: 5,
 *             },
 *         },
 *         {
 *             indexName: "myGSI2",
 *             keySchema: [
 *                 {
 *                     attributeName: "NumberOfSongs",
 *                     keyType: "HASH",
 *                 },
 *                 {
 *                     attributeName: "Sales",
 *                     keyType: "RANGE",
 *                 },
 *             ],
 *             projection: {
 *                 nonKeyAttributes: [
 *                     "Album",
 *                     "Artist",
 *                 ],
 *                 projectionType: "INCLUDE",
 *             },
 *             provisionedThroughput: {
 *                 readCapacityUnits: 5,
 *                 writeCapacityUnits: 5,
 *             },
 *         },
 *     ],
 *     localSecondaryIndexes: [{
 *         indexName: "myLSI",
 *         keySchema: [
 *             {
 *                 attributeName: "Album",
 *                 keyType: "HASH",
 *             },
 *             {
 *                 attributeName: "Sales",
 *                 keyType: "RANGE",
 *             },
 *         ],
 *         projection: {
 *             nonKeyAttributes: [
 *                 "Artist",
 *                 "NumberOfSongs",
 *             ],
 *             projectionType: "INCLUDE",
 *         },
 *     }],
 * });
 *
 * ```
 */
class Table extends pulumi.CustomResource {
    /**
     * Get an existing Table resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, opts) {
        return new Table(name, undefined, Object.assign(Object.assign({}, opts), { id: id }));
    }
    /**
     * Returns true if the given object is an instance of Table.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === Table.__pulumiType;
    }
    /**
     * Create a Table resource with the given unique name, arguments, and options.
     *
     * @param name The _unique_ name of the resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param opts A bag of options that control this resource's behavior.
     */
    constructor(name, args, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (!opts.id) {
            if ((!args || args.keySchema === undefined) && !opts.urn) {
                throw new Error("Missing required property 'keySchema'");
            }
            resourceInputs["attributeDefinitions"] = args ? args.attributeDefinitions : undefined;
            resourceInputs["billingMode"] = args ? args.billingMode : undefined;
            resourceInputs["contributorInsightsSpecification"] = args ? args.contributorInsightsSpecification : undefined;
            resourceInputs["deletionProtectionEnabled"] = args ? args.deletionProtectionEnabled : undefined;
            resourceInputs["globalSecondaryIndexes"] = args ? args.globalSecondaryIndexes : undefined;
            resourceInputs["importSourceSpecification"] = args ? args.importSourceSpecification : undefined;
            resourceInputs["keySchema"] = args ? args.keySchema : undefined;
            resourceInputs["kinesisStreamSpecification"] = args ? args.kinesisStreamSpecification : undefined;
            resourceInputs["localSecondaryIndexes"] = args ? args.localSecondaryIndexes : undefined;
            resourceInputs["onDemandThroughput"] = args ? args.onDemandThroughput : undefined;
            resourceInputs["pointInTimeRecoverySpecification"] = args ? args.pointInTimeRecoverySpecification : undefined;
            resourceInputs["provisionedThroughput"] = args ? args.provisionedThroughput : undefined;
            resourceInputs["resourcePolicy"] = args ? args.resourcePolicy : undefined;
            resourceInputs["sseSpecification"] = args ? args.sseSpecification : undefined;
            resourceInputs["streamSpecification"] = args ? args.streamSpecification : undefined;
            resourceInputs["tableClass"] = args ? args.tableClass : undefined;
            resourceInputs["tableName"] = args ? args.tableName : undefined;
            resourceInputs["tags"] = args ? args.tags : undefined;
            resourceInputs["timeToLiveSpecification"] = args ? args.timeToLiveSpecification : undefined;
            resourceInputs["warmThroughput"] = args ? args.warmThroughput : undefined;
            resourceInputs["arn"] = undefined /*out*/;
            resourceInputs["streamArn"] = undefined /*out*/;
        }
        else {
            resourceInputs["arn"] = undefined /*out*/;
            resourceInputs["attributeDefinitions"] = undefined /*out*/;
            resourceInputs["billingMode"] = undefined /*out*/;
            resourceInputs["contributorInsightsSpecification"] = undefined /*out*/;
            resourceInputs["deletionProtectionEnabled"] = undefined /*out*/;
            resourceInputs["globalSecondaryIndexes"] = undefined /*out*/;
            resourceInputs["importSourceSpecification"] = undefined /*out*/;
            resourceInputs["keySchema"] = undefined /*out*/;
            resourceInputs["kinesisStreamSpecification"] = undefined /*out*/;
            resourceInputs["localSecondaryIndexes"] = undefined /*out*/;
            resourceInputs["onDemandThroughput"] = undefined /*out*/;
            resourceInputs["pointInTimeRecoverySpecification"] = undefined /*out*/;
            resourceInputs["provisionedThroughput"] = undefined /*out*/;
            resourceInputs["resourcePolicy"] = undefined /*out*/;
            resourceInputs["sseSpecification"] = undefined /*out*/;
            resourceInputs["streamArn"] = undefined /*out*/;
            resourceInputs["streamSpecification"] = undefined /*out*/;
            resourceInputs["tableClass"] = undefined /*out*/;
            resourceInputs["tableName"] = undefined /*out*/;
            resourceInputs["tags"] = undefined /*out*/;
            resourceInputs["timeToLiveSpecification"] = undefined /*out*/;
            resourceInputs["warmThroughput"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const replaceOnChanges = { replaceOnChanges: ["importSourceSpecification", "tableName"] };
        opts = pulumi.mergeOptions(opts, replaceOnChanges);
        super(Table.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Table = Table;
/** @internal */
Table.__pulumiType = 'aws-native:dynamodb:Table';
//# sourceMappingURL=table.js.map