Skip to content

Commit cef0845

Browse files
author
awstools
committed
feat(client-dynamodb): This release adds ReturnValuesOnConditionCheckFailure 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
1 parent ce985ba commit cef0845

11 files changed

+296
-504
lines changed

clients/client-dynamodb/src/commands/BatchExecuteStatementCommand.ts

+46-42
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export interface BatchExecuteStatementCommandOutput extends BatchExecuteStatemen
105105
* },
106106
* ],
107107
* ConsistentRead: true || false,
108+
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
108109
* },
109110
* ],
110111
* ReturnConsumedCapacity: "INDEXES" || "TOTAL" || "NONE",
@@ -117,53 +118,56 @@ export interface BatchExecuteStatementCommandOutput extends BatchExecuteStatemen
117118
* // Error: { // BatchStatementError
118119
* // Code: "ConditionalCheckFailed" || "ItemCollectionSizeLimitExceeded" || "RequestLimitExceeded" || "ValidationError" || "ProvisionedThroughputExceeded" || "TransactionConflict" || "ThrottlingError" || "InternalServerError" || "ResourceNotFound" || "AccessDenied" || "DuplicateItem",
119120
* // Message: "STRING_VALUE",
120-
* // },
121-
* // TableName: "STRING_VALUE",
122-
* // Item: { // AttributeMap
123-
* // "<keys>": { // AttributeValue Union: only one key present
124-
* // S: "STRING_VALUE",
125-
* // N: "STRING_VALUE",
126-
* // B: "BLOB_VALUE",
127-
* // SS: [ // StringSetAttributeValue
128-
* // "STRING_VALUE",
129-
* // ],
130-
* // NS: [ // NumberSetAttributeValue
131-
* // "STRING_VALUE",
132-
* // ],
133-
* // BS: [ // BinarySetAttributeValue
134-
* // "BLOB_VALUE",
135-
* // ],
136-
* // M: { // MapAttributeValue
137-
* // "<keys>": {// Union: only one key present
138-
* // S: "STRING_VALUE",
139-
* // N: "STRING_VALUE",
140-
* // B: "BLOB_VALUE",
141-
* // SS: [
142-
* // "STRING_VALUE",
143-
* // ],
144-
* // NS: [
145-
* // "STRING_VALUE",
146-
* // ],
147-
* // BS: [
148-
* // "BLOB_VALUE",
149-
* // ],
150-
* // M: {
151-
* // "<keys>": "<AttributeValue>",
121+
* // Item: { // AttributeMap
122+
* // "<keys>": { // AttributeValue Union: only one key present
123+
* // S: "STRING_VALUE",
124+
* // N: "STRING_VALUE",
125+
* // B: "BLOB_VALUE",
126+
* // SS: [ // StringSetAttributeValue
127+
* // "STRING_VALUE",
128+
* // ],
129+
* // NS: [ // NumberSetAttributeValue
130+
* // "STRING_VALUE",
131+
* // ],
132+
* // BS: [ // BinarySetAttributeValue
133+
* // "BLOB_VALUE",
134+
* // ],
135+
* // M: { // MapAttributeValue
136+
* // "<keys>": {// Union: only one key present
137+
* // S: "STRING_VALUE",
138+
* // N: "STRING_VALUE",
139+
* // B: "BLOB_VALUE",
140+
* // SS: [
141+
* // "STRING_VALUE",
142+
* // ],
143+
* // NS: [
144+
* // "STRING_VALUE",
145+
* // ],
146+
* // BS: [
147+
* // "BLOB_VALUE",
148+
* // ],
149+
* // M: {
150+
* // "<keys>": "<AttributeValue>",
151+
* // },
152+
* // L: [ // ListAttributeValue
153+
* // "<AttributeValue>",
154+
* // ],
155+
* // NULL: true || false,
156+
* // BOOL: true || false,
152157
* // },
153-
* // L: [ // ListAttributeValue
154-
* // "<AttributeValue>",
155-
* // ],
156-
* // NULL: true || false,
157-
* // BOOL: true || false,
158158
* // },
159+
* // L: [
160+
* // "<AttributeValue>",
161+
* // ],
162+
* // NULL: true || false,
163+
* // BOOL: true || false,
159164
* // },
160-
* // L: [
161-
* // "<AttributeValue>",
162-
* // ],
163-
* // NULL: true || false,
164-
* // BOOL: true || false,
165165
* // },
166166
* // },
167+
* // TableName: "STRING_VALUE",
168+
* // Item: {
169+
* // "<keys>": "<AttributeValue>",
170+
* // },
167171
* // },
168172
* // ],
169173
* // ConsumedCapacity: [ // ConsumedCapacityMultiple

clients/client-dynamodb/src/commands/BatchWriteItemCommand.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ export interface BatchWriteItemCommandOutput extends BatchWriteItemOutput, __Met
4444
* 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>
4545
* <note>
4646
* <p>
47-
* <code>BatchWriteItem</code> cannot update items. If you perform a <code>BatchWriteItem</code>
48-
* operation on an existing item, that item's values will be overwritten by the
49-
* operation and it will appear like it was updated. To update items, we recommend you
50-
* use the <code>UpdateItem</code> action.</p>
47+
* <code>BatchWriteItem</code> cannot update items. If you perform a
48+
* <code>BatchWriteItem</code> operation on an existing item, that item's values
49+
* will be overwritten by the operation and it will appear like it was updated. To
50+
* update items, we recommend you use the <code>UpdateItem</code> action.</p>
5151
* </note>
5252
* <p>The individual <code>PutItem</code> and <code>DeleteItem</code> operations specified
5353
* in <code>BatchWriteItem</code> are atomic; however <code>BatchWriteItem</code> as a

clients/client-dynamodb/src/commands/DeleteItemCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ export interface DeleteItemCommandOutput extends DeleteItemOutput, __MetadataBea
121121
* ExpressionAttributeValues: { // ExpressionAttributeValueMap
122122
* "<keys>": "<AttributeValue>",
123123
* },
124+
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
124125
* };
125126
* const command = new DeleteItemCommand(input);
126127
* const response = await client.send(command);

clients/client-dynamodb/src/commands/ExecuteStatementCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ export interface ExecuteStatementCommandOutput extends ExecuteStatementOutput, _
106106
* NextToken: "STRING_VALUE",
107107
* ReturnConsumedCapacity: "INDEXES" || "TOTAL" || "NONE",
108108
* Limit: Number("int"),
109+
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
109110
* };
110111
* const command = new ExecuteStatementCommand(input);
111112
* const response = await client.send(command);

clients/client-dynamodb/src/commands/ExecuteTransactionCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ export interface ExecuteTransactionCommandOutput extends ExecuteTransactionOutpu
9999
* BOOL: true || false,
100100
* },
101101
* ],
102+
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
102103
* },
103104
* ],
104105
* ClientRequestToken: "STRING_VALUE",

clients/client-dynamodb/src/commands/PutItemCommand.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ export interface PutItemCommandOutput extends PutItemOutput, __MetadataBearer {}
4242
* a new item if one with the specified primary key doesn't exist), or replace an existing
4343
* item if it has certain attribute values. You can return the item's attribute values in
4444
* the same operation, using the <code>ReturnValues</code> parameter.</p>
45-
* <p>When you add an item, the primary key attributes are the only required attributes.
46-
* </p>
45+
* <p>When you add an item, the primary key attributes are the only required attributes. </p>
4746
* <p>Empty String and Binary attribute values are allowed. Attribute values of type String
4847
* and Binary must have a length greater than zero if the attribute is used as a key
4948
* attribute for a table or index. Set type attributes cannot be empty. </p>
@@ -132,6 +131,7 @@ export interface PutItemCommandOutput extends PutItemOutput, __MetadataBearer {}
132131
* ExpressionAttributeValues: { // ExpressionAttributeValueMap
133132
* "<keys>": "<AttributeValue>",
134133
* },
134+
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
135135
* };
136136
* const command = new PutItemCommand(input);
137137
* const response = await client.send(command);

clients/client-dynamodb/src/commands/UpdateItemCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export interface UpdateItemCommandOutput extends UpdateItemOutput, __MetadataBea
124124
* ExpressionAttributeValues: { // ExpressionAttributeValueMap
125125
* "<keys>": "<AttributeValue>",
126126
* },
127+
* ReturnValuesOnConditionCheckFailure: "ALL_OLD" || "NONE",
127128
* };
128129
* const command = new UpdateItemCommand(input);
129130
* const response = await client.send(command);

0 commit comments

Comments
 (0)