@aws-sdk/client-dynamodb
Version:
AWS SDK for JavaScript Dynamodb Client for Node.js, Browser and React Native
52 lines • 2.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeleteItemCommand = void 0;
const models_0_1 = require("../models/models_0");
const Aws_json1_0_1 = require("../protocols/Aws_json1_0");
const middleware_serde_1 = require("@aws-sdk/middleware-serde");
const smithy_client_1 = require("@aws-sdk/smithy-client");
/**
* <p>Deletes a single item in a table by primary key. You can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value.</p>
* <p>In addition to deleting an item, you can also return the item's attribute values in the same
* operation, using the <code>ReturnValues</code> parameter.</p>
* <p>Unless you specify conditions, the <code>DeleteItem</code> is an idempotent operation; running it
* multiple times on the same item or attribute does <i>not</i> result in an error response.</p>
* <p>Conditional deletes are useful for deleting items only if specific conditions are met. If those conditions are met, DynamoDB performs the delete. Otherwise, the item is not deleted.</p>
*/
class DeleteItemCommand extends smithy_client_1.Command {
// Start section: command_properties
// End section: command_properties
constructor(input) {
// Start section: command_constructor
super();
this.input = input;
// End section: command_constructor
}
/**
* @internal
*/
resolveMiddleware(clientStack, configuration, options) {
this.middlewareStack.use(middleware_serde_1.getSerdePlugin(configuration, this.serialize, this.deserialize));
const stack = clientStack.concat(this.middlewareStack);
const { logger } = configuration;
const clientName = "DynamoDBClient";
const commandName = "DeleteItemCommand";
const handlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: models_0_1.DeleteItemInput.filterSensitiveLog,
outputFilterSensitiveLog: models_0_1.DeleteItemOutput.filterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
}
serialize(input, context) {
return Aws_json1_0_1.serializeAws_json1_0DeleteItemCommand(input, context);
}
deserialize(output, context) {
return Aws_json1_0_1.deserializeAws_json1_0DeleteItemCommand(output, context);
}
}
exports.DeleteItemCommand = DeleteItemCommand;
//# sourceMappingURL=DeleteItemCommand.js.map