@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
106 lines • 4.07 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, { ...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?.hashKey;
resourceInputs["item"] = state?.item;
resourceInputs["rangeKey"] = state?.rangeKey;
resourceInputs["region"] = state?.region;
resourceInputs["tableName"] = state?.tableName;
}
else {
const args = argsOrState;
if (args?.hashKey === undefined && !opts.urn) {
throw new Error("Missing required property 'hashKey'");
}
if (args?.item === undefined && !opts.urn) {
throw new Error("Missing required property 'item'");
}
if (args?.tableName === undefined && !opts.urn) {
throw new Error("Missing required property 'tableName'");
}
resourceInputs["hashKey"] = args?.hashKey;
resourceInputs["item"] = args?.item;
resourceInputs["rangeKey"] = args?.rangeKey;
resourceInputs["region"] = args?.region;
resourceInputs["tableName"] = args?.tableName;
}
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