libZSservicesZSamazonka-dynamodbZSamazonka-dynamodb
Copyright(c) 2013-2021 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay <brendan.g.hay+amazonka@gmail.com>
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellNone

Amazonka.DynamoDB.TransactWriteItems

Description

TransactWriteItems is a synchronous write operation that groups up to 25 action requests. These actions can target items in different tables, but not in different AWS accounts or Regions, and no two actions can target the same item. For example, you cannot both ConditionCheck and Update the same item. The aggregate size of the items in the transaction cannot exceed 4 MB.

The actions are completed atomically so that either all of them succeed, or all of them fail. They are defined by the following objects:

  • Put  —   Initiates a PutItem operation to write a new item. This structure specifies the primary key of the item to be written, the name of the table to write it in, an optional condition expression that must be satisfied for the write to succeed, a list of the item's attributes, and a field indicating whether to retrieve the item's attributes if the condition is not met.
  • Update  —   Initiates an UpdateItem operation to update an existing item. This structure specifies the primary key of the item to be updated, the name of the table where it resides, an optional condition expression that must be satisfied for the update to succeed, an expression that defines one or more attributes to be updated, and a field indicating whether to retrieve the item's attributes if the condition is not met.
  • Delete  —   Initiates a DeleteItem operation to delete an existing item. This structure specifies the primary key of the item to be deleted, the name of the table where it resides, an optional condition expression that must be satisfied for the deletion to succeed, and a field indicating whether to retrieve the item's attributes if the condition is not met.
  • ConditionCheck  —   Applies a condition to an item that is not being modified by the transaction. This structure specifies the primary key of the item to be checked, the name of the table where it resides, a condition expression that must be satisfied for the transaction to succeed, and a field indicating whether to retrieve the item's attributes if the condition is not met.

DynamoDB rejects the entire TransactWriteItems request if any of the following is true:

  • A condition in one of the condition expressions is not met.
  • An ongoing operation is in the process of updating the same item.
  • There is insufficient provisioned capacity for the transaction to be completed.
  • An item size becomes too large (bigger than 400 KB), a local secondary index (LSI) becomes too large, or a similar validation error occurs because of changes made by the transaction.
  • The aggregate size of the items in the transaction exceeds 4 MB.
  • There is a user error, such as an invalid data format.
Synopsis

Creating a Request

data TransactWriteItems Source #

See: newTransactWriteItems smart constructor.

Constructors

TransactWriteItems' 

Fields

  • returnConsumedCapacity :: Maybe ReturnConsumedCapacity
     
  • returnItemCollectionMetrics :: Maybe ReturnItemCollectionMetrics

    Determines whether item collection metrics are returned. If set to SIZE, the response includes statistics about item collections (if any), that were modified during the operation and are returned in the response. If set to NONE (the default), no statistics are returned.

  • clientRequestToken :: Maybe Text

    Providing a ClientRequestToken makes the call to TransactWriteItems idempotent, meaning that multiple identical calls have the same effect as one single call.

    Although multiple identical calls using the same client request token produce the same result on the server (no side effects), the responses to the calls might not be the same. If the ReturnConsumedCapacity> parameter is set, then the initial TransactWriteItems call returns the amount of write capacity units consumed in making the changes. Subsequent TransactWriteItems calls with the same client token return the number of read capacity units consumed in reading the item.

    A client request token is valid for 10 minutes after the first request that uses it is completed. After 10 minutes, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 10 minutes, or the result might not be idempotent.

    If you submit a request with the same client token but a change in other parameters within the 10-minute idempotency window, DynamoDB returns an IdempotentParameterMismatch exception.

  • transactItems :: NonEmpty TransactWriteItem

    An ordered array of up to 25 TransactWriteItem objects, each of which contains a ConditionCheck, Put, Update, or Delete object. These can operate on items in different tables, but the tables must reside in the same AWS account and Region, and no two of them can operate on the same item.

Instances

Instances details
Eq TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Read TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Show TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Generic TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Associated Types

type Rep TransactWriteItems :: Type -> Type #

NFData TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Methods

rnf :: TransactWriteItems -> () #

Hashable TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

ToJSON TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

AWSRequest TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Associated Types

type AWSResponse TransactWriteItems #

ToHeaders TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

ToPath TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

ToQuery TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

type Rep TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

type Rep TransactWriteItems = D1 ('MetaData "TransactWriteItems" "Amazonka.DynamoDB.TransactWriteItems" "libZSservicesZSamazonka-dynamodbZSamazonka-dynamodb" 'False) (C1 ('MetaCons "TransactWriteItems'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "returnConsumedCapacity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ReturnConsumedCapacity)) :*: S1 ('MetaSel ('Just "returnItemCollectionMetrics") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe ReturnItemCollectionMetrics))) :*: (S1 ('MetaSel ('Just "clientRequestToken") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "transactItems") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (NonEmpty TransactWriteItem)))))
type AWSResponse TransactWriteItems Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

newTransactWriteItems Source #

Create a value of TransactWriteItems with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:returnConsumedCapacity:TransactWriteItems', transactWriteItems_returnConsumedCapacity - Undocumented member.

$sel:returnItemCollectionMetrics:TransactWriteItems', transactWriteItems_returnItemCollectionMetrics - Determines whether item collection metrics are returned. If set to SIZE, the response includes statistics about item collections (if any), that were modified during the operation and are returned in the response. If set to NONE (the default), no statistics are returned.

$sel:clientRequestToken:TransactWriteItems', transactWriteItems_clientRequestToken - Providing a ClientRequestToken makes the call to TransactWriteItems idempotent, meaning that multiple identical calls have the same effect as one single call.

Although multiple identical calls using the same client request token produce the same result on the server (no side effects), the responses to the calls might not be the same. If the ReturnConsumedCapacity> parameter is set, then the initial TransactWriteItems call returns the amount of write capacity units consumed in making the changes. Subsequent TransactWriteItems calls with the same client token return the number of read capacity units consumed in reading the item.

A client request token is valid for 10 minutes after the first request that uses it is completed. After 10 minutes, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 10 minutes, or the result might not be idempotent.

If you submit a request with the same client token but a change in other parameters within the 10-minute idempotency window, DynamoDB returns an IdempotentParameterMismatch exception.

$sel:transactItems:TransactWriteItems', transactWriteItems_transactItems - An ordered array of up to 25 TransactWriteItem objects, each of which contains a ConditionCheck, Put, Update, or Delete object. These can operate on items in different tables, but the tables must reside in the same AWS account and Region, and no two of them can operate on the same item.

Request Lenses

transactWriteItems_returnItemCollectionMetrics :: Lens' TransactWriteItems (Maybe ReturnItemCollectionMetrics) Source #

Determines whether item collection metrics are returned. If set to SIZE, the response includes statistics about item collections (if any), that were modified during the operation and are returned in the response. If set to NONE (the default), no statistics are returned.

transactWriteItems_clientRequestToken :: Lens' TransactWriteItems (Maybe Text) Source #

Providing a ClientRequestToken makes the call to TransactWriteItems idempotent, meaning that multiple identical calls have the same effect as one single call.

Although multiple identical calls using the same client request token produce the same result on the server (no side effects), the responses to the calls might not be the same. If the ReturnConsumedCapacity> parameter is set, then the initial TransactWriteItems call returns the amount of write capacity units consumed in making the changes. Subsequent TransactWriteItems calls with the same client token return the number of read capacity units consumed in reading the item.

A client request token is valid for 10 minutes after the first request that uses it is completed. After 10 minutes, any request with the same client token is treated as a new request. Do not resubmit the same request with the same client token for more than 10 minutes, or the result might not be idempotent.

If you submit a request with the same client token but a change in other parameters within the 10-minute idempotency window, DynamoDB returns an IdempotentParameterMismatch exception.

transactWriteItems_transactItems :: Lens' TransactWriteItems (NonEmpty TransactWriteItem) Source #

An ordered array of up to 25 TransactWriteItem objects, each of which contains a ConditionCheck, Put, Update, or Delete object. These can operate on items in different tables, but the tables must reside in the same AWS account and Region, and no two of them can operate on the same item.

Destructuring the Response

data TransactWriteItemsResponse Source #

See: newTransactWriteItemsResponse smart constructor.

Constructors

TransactWriteItemsResponse' 

Fields

Instances

Instances details
Eq TransactWriteItemsResponse Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Read TransactWriteItemsResponse Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Show TransactWriteItemsResponse Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Generic TransactWriteItemsResponse Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

Associated Types

type Rep TransactWriteItemsResponse :: Type -> Type #

NFData TransactWriteItemsResponse Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

type Rep TransactWriteItemsResponse Source # 
Instance details

Defined in Amazonka.DynamoDB.TransactWriteItems

type Rep TransactWriteItemsResponse = D1 ('MetaData "TransactWriteItemsResponse" "Amazonka.DynamoDB.TransactWriteItems" "libZSservicesZSamazonka-dynamodbZSamazonka-dynamodb" 'False) (C1 ('MetaCons "TransactWriteItemsResponse'" 'PrefixI 'True) (S1 ('MetaSel ('Just "itemCollectionMetrics") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe (HashMap Text [ItemCollectionMetrics]))) :*: (S1 ('MetaSel ('Just "consumedCapacity") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe [ConsumedCapacity])) :*: S1 ('MetaSel ('Just "httpStatus") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int))))

newTransactWriteItemsResponse Source #

Create a value of TransactWriteItemsResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:itemCollectionMetrics:TransactWriteItemsResponse', transactWriteItemsResponse_itemCollectionMetrics - A list of tables that were processed by TransactWriteItems and, for each table, information about any item collections that were affected by individual UpdateItem, PutItem, or DeleteItem operations.

$sel:consumedCapacity:TransactWriteItemsResponse', transactWriteItemsResponse_consumedCapacity - The capacity units consumed by the entire TransactWriteItems operation. The values of the list are ordered according to the ordering of the TransactItems request parameter.

$sel:httpStatus:TransactWriteItemsResponse', transactWriteItemsResponse_httpStatus - The response's http status code.

Response Lenses

transactWriteItemsResponse_itemCollectionMetrics :: Lens' TransactWriteItemsResponse (Maybe (HashMap Text [ItemCollectionMetrics])) Source #

A list of tables that were processed by TransactWriteItems and, for each table, information about any item collections that were affected by individual UpdateItem, PutItem, or DeleteItem operations.

transactWriteItemsResponse_consumedCapacity :: Lens' TransactWriteItemsResponse (Maybe [ConsumedCapacity]) Source #

The capacity units consumed by the entire TransactWriteItems operation. The values of the list are ordered according to the ordering of the TransactItems request parameter.