Skip to content

Commit

Permalink
feat(client-dynamodb): This release adds ReturnValuesOnConditionCheck…
Browse files Browse the repository at this point in the history
…Failure parameter to PutItem, UpdateItem, DeleteItem, ExecuteStatement, BatchExecuteStatement and ExecuteTransaction APIs. When set to ALL_OLD, API returns a copy of the item as it was when a conditional write failed
  • Loading branch information
awstools committed Jun 29, 2023
1 parent ce985ba commit cef0845
Show file tree
Hide file tree
Showing 11 changed files with 296 additions and 504 deletions.
Expand Up @@ -105,6 +105,7 @@ export interface BatchExecuteStatementCommandOutput extends BatchExecuteStatemen
* },
* ],
* ConsistentRead: true || false,
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
* },
* ],
* ReturnConsumedCapacity: "INDEXES" || "TOTAL" || "NONE",
Expand All @@ -117,53 +118,56 @@ export interface BatchExecuteStatementCommandOutput extends BatchExecuteStatemen
* // Error: { // BatchStatementError
* // Code: "ConditionalCheckFailed" || "ItemCollectionSizeLimitExceeded" || "RequestLimitExceeded" || "ValidationError" || "ProvisionedThroughputExceeded" || "TransactionConflict" || "ThrottlingError" || "InternalServerError" || "ResourceNotFound" || "AccessDenied" || "DuplicateItem",
* // Message: "STRING_VALUE",
* // },
* // TableName: "STRING_VALUE",
* // Item: { // AttributeMap
* // "<keys>": { // AttributeValue Union: only one key present
* // S: "STRING_VALUE",
* // N: "STRING_VALUE",
* // B: "BLOB_VALUE",
* // SS: [ // StringSetAttributeValue
* // "STRING_VALUE",
* // ],
* // NS: [ // NumberSetAttributeValue
* // "STRING_VALUE",
* // ],
* // BS: [ // BinarySetAttributeValue
* // "BLOB_VALUE",
* // ],
* // M: { // MapAttributeValue
* // "<keys>": {// Union: only one key present
* // S: "STRING_VALUE",
* // N: "STRING_VALUE",
* // B: "BLOB_VALUE",
* // SS: [
* // "STRING_VALUE",
* // ],
* // NS: [
* // "STRING_VALUE",
* // ],
* // BS: [
* // "BLOB_VALUE",
* // ],
* // M: {
* // "<keys>": "<AttributeValue>",
* // Item: { // AttributeMap
* // "<keys>": { // AttributeValue Union: only one key present
* // S: "STRING_VALUE",
* // N: "STRING_VALUE",
* // B: "BLOB_VALUE",
* // SS: [ // StringSetAttributeValue
* // "STRING_VALUE",
* // ],
* // NS: [ // NumberSetAttributeValue
* // "STRING_VALUE",
* // ],
* // BS: [ // BinarySetAttributeValue
* // "BLOB_VALUE",
* // ],
* // M: { // MapAttributeValue
* // "<keys>": {// Union: only one key present
* // S: "STRING_VALUE",
* // N: "STRING_VALUE",
* // B: "BLOB_VALUE",
* // SS: [
* // "STRING_VALUE",
* // ],
* // NS: [
* // "STRING_VALUE",
* // ],
* // BS: [
* // "BLOB_VALUE",
* // ],
* // M: {
* // "<keys>": "<AttributeValue>",
* // },
* // L: [ // ListAttributeValue
* // "<AttributeValue>",
* // ],
* // NULL: true || false,
* // BOOL: true || false,
* // },
* // L: [ // ListAttributeValue
* // "<AttributeValue>",
* // ],
* // NULL: true || false,
* // BOOL: true || false,
* // },
* // L: [
* // "<AttributeValue>",
* // ],
* // NULL: true || false,
* // BOOL: true || false,
* // },
* // L: [
* // "<AttributeValue>",
* // ],
* // NULL: true || false,
* // BOOL: true || false,
* // },
* // },
* // TableName: "STRING_VALUE",
* // Item: {
* // "<keys>": "<AttributeValue>",
* // },
* // },
* // ],
* // ConsumedCapacity: [ // ConsumedCapacityMultiple
Expand Down
8 changes: 4 additions & 4 deletions clients/client-dynamodb/src/commands/BatchWriteItemCommand.ts
Expand Up @@ -44,10 +44,10 @@ export interface BatchWriteItemCommandOutput extends BatchWriteItemOutput, __Met
* for the API call. For more details on this distinction, see <a href="https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html">Naming Rules and Data Types</a>.</p>
* <note>
* <p>
* <code>BatchWriteItem</code> cannot update items. If you perform a <code>BatchWriteItem</code>
* operation on an existing item, that item's values will be overwritten by the
* operation and it will appear like it was updated. To update items, we recommend you
* use the <code>UpdateItem</code> action.</p>
* <code>BatchWriteItem</code> cannot update items. If you perform a
* <code>BatchWriteItem</code> operation on an existing item, that item's values
* will be overwritten by the operation and it will appear like it was updated. To
* update items, we recommend you use the <code>UpdateItem</code> action.</p>
* </note>
* <p>The individual <code>PutItem</code> and <code>DeleteItem</code> operations specified
* in <code>BatchWriteItem</code> are atomic; however <code>BatchWriteItem</code> as a
Expand Down
1 change: 1 addition & 0 deletions clients/client-dynamodb/src/commands/DeleteItemCommand.ts
Expand Up @@ -121,6 +121,7 @@ export interface DeleteItemCommandOutput extends DeleteItemOutput, __MetadataBea
* ExpressionAttributeValues: { // ExpressionAttributeValueMap
* "<keys>": "<AttributeValue>",
* },
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
* };
* const command = new DeleteItemCommand(input);
* const response = await client.send(command);
Expand Down
Expand Up @@ -106,6 +106,7 @@ export interface ExecuteStatementCommandOutput extends ExecuteStatementOutput, _
* NextToken: "STRING_VALUE",
* ReturnConsumedCapacity: "INDEXES" || "TOTAL" || "NONE",
* Limit: Number("int"),
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
* };
* const command = new ExecuteStatementCommand(input);
* const response = await client.send(command);
Expand Down
Expand Up @@ -99,6 +99,7 @@ export interface ExecuteTransactionCommandOutput extends ExecuteTransactionOutpu
* BOOL: true || false,
* },
* ],
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
* },
* ],
* ClientRequestToken: "STRING_VALUE",
Expand Down
4 changes: 2 additions & 2 deletions clients/client-dynamodb/src/commands/PutItemCommand.ts
Expand Up @@ -42,8 +42,7 @@ export interface PutItemCommandOutput extends PutItemOutput, __MetadataBearer {}
* a new item if one with the specified primary key doesn't exist), or replace an existing
* item if it has certain attribute values. You can return the item's attribute values in
* the same operation, using the <code>ReturnValues</code> parameter.</p>
* <p>When you add an item, the primary key attributes are the only required attributes.
* </p>
* <p>When you add an item, the primary key attributes are the only required attributes. </p>
* <p>Empty String and Binary attribute values are allowed. Attribute values of type String
* and Binary must have a length greater than zero if the attribute is used as a key
* attribute for a table or index. Set type attributes cannot be empty. </p>
Expand Down Expand Up @@ -132,6 +131,7 @@ export interface PutItemCommandOutput extends PutItemOutput, __MetadataBearer {}
* ExpressionAttributeValues: { // ExpressionAttributeValueMap
* "<keys>": "<AttributeValue>",
* },
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
* };
* const command = new PutItemCommand(input);
* const response = await client.send(command);
Expand Down
1 change: 1 addition & 0 deletions clients/client-dynamodb/src/commands/UpdateItemCommand.ts
Expand Up @@ -124,6 +124,7 @@ export interface UpdateItemCommandOutput extends UpdateItemOutput, __MetadataBea
* ExpressionAttributeValues: { // ExpressionAttributeValueMap
* "<keys>": "<AttributeValue>",
* },
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
* };
* const command = new UpdateItemCommand(input);
* const response = await client.send(command);
Expand Down

0 comments on commit cef0845

Please sign in to comment.