@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
106 lines • 4.26 kB
JavaScript
;
// *** 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.TableItem = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a DynamoDB table item resource
*
* > **Note:** This resource is not meant to be used for managing large amounts of data in your table, it is not designed to scale.
* You should perform **regular backups** of all data in the table, see [AWS docs for more](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/BackupRestore.html).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const exampleTable = new aws.dynamodb.Table("example", {
* name: "example-name",
* readCapacity: 10,
* writeCapacity: 10,
* hashKey: "exampleHashKey",
* attributes: [{
* name: "exampleHashKey",
* type: "S",
* }],
* });
* const example = new aws.dynamodb.TableItem("example", {
* tableName: exampleTable.name,
* hashKey: exampleTable.hashKey,
* item: `{
* "exampleHashKey": {"S": "something"},
* "one": {"N": "11111"},
* "two": {"N": "22222"},
* "three": {"N": "33333"},
* "four": {"N": "44444"}
* }
* `,
* });
* ```
*
* ## Import
*
* You cannot import DynamoDB table items.
*/
class TableItem extends pulumi.CustomResource {
/**
* Get an existing TableItem 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 state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new TableItem(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of TableItem. 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'] === TableItem.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["hashKey"] = state ? state.hashKey : undefined;
resourceInputs["item"] = state ? state.item : undefined;
resourceInputs["rangeKey"] = state ? state.rangeKey : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["tableName"] = state ? state.tableName : undefined;
}
else {
const args = argsOrState;
if ((!args || args.hashKey === undefined) && !opts.urn) {
throw new Error("Missing required property 'hashKey'");
}
if ((!args || args.item === undefined) && !opts.urn) {
throw new Error("Missing required property 'item'");
}
if ((!args || args.tableName === undefined) && !opts.urn) {
throw new Error("Missing required property 'tableName'");
}
resourceInputs["hashKey"] = args ? args.hashKey : undefined;
resourceInputs["item"] = args ? args.item : undefined;
resourceInputs["rangeKey"] = args ? args.rangeKey : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["tableName"] = args ? args.tableName : undefined;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TableItem.__pulumiType, name, resourceInputs, opts);
}
}
exports.TableItem = TableItem;
/** @internal */
TableItem.__pulumiType = 'aws:dynamodb/tableItem:TableItem';
//# sourceMappingURL=tableItem.js.map