Class DynamoDBPersistenceStore.Builder
java.lang.Object
software.amazon.lambda.powertools.idempotency.persistence.dynamodb.DynamoDBPersistenceStore.Builder
- Enclosing class:
DynamoDBPersistenceStore
Use this builder to get an instance of
With this builder you can configure the characteristics of the DynamoDB Table (name, key, sort key, and other field names).
You can also set a custom
DynamoDBPersistenceStore.With this builder you can configure the characteristics of the DynamoDB Table (name, key, sort key, and other field names).
You can also set a custom
DynamoDbClient for further tuning.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()withDataAttr(String dataAttr) DynamoDB attribute name for response data (optional), by default "data"withDynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient) CustomDynamoDbClientused to query DynamoDB (optional).
The default one usesUrlConnectionHttpClientas a http client and add com.amazonaws.xray.interceptors.TracingInterceptor (X-Ray) if available in the classpath.withExpiryAttr(String expiryAttr) DynamoDB attribute name for expiry timestamp (optional), by default "expiration"withInProgressExpiryAttr(String inProgressExpiryAttr) DynamoDB attribute name for in progress expiry timestamp (optional), by default "in_progress_expiration"withKeyAttr(String keyAttr) DynamoDB attribute name for partition key (optional), by default "id"withSortKeyAttr(String sortKeyAttr) DynamoDB attribute name for the sort key (optional)withStaticPkValue(String staticPkValue) DynamoDB attribute value for partition key (optional), by default "idempotency#[function-name]".withStatusAttr(String statusAttr) DynamoDB attribute name for status (optional), by default "status"withTableName(String tableName) Name of the table to use for storing execution records (mandatory)withValidationAttr(String validationAttr) DynamoDB attribute name for validation (optional), by default "validation"
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
build
Initialize and return a new instance ofDynamoDBPersistenceStore.
Example:
DynamoDBPersistenceStore.builder().withTableName("idempotency_store").build();- Returns:
- an instance of the
DynamoDBPersistenceStore
-
withTableName
Name of the table to use for storing execution records (mandatory)- Parameters:
tableName- Name of the DynamoDB table- Returns:
- the builder instance (to chain operations)
-
withKeyAttr
DynamoDB attribute name for partition key (optional), by default "id"- Parameters:
keyAttr- name of the key attribute in the table- Returns:
- the builder instance (to chain operations)
-
withStaticPkValue
DynamoDB attribute value for partition key (optional), by default "idempotency#[function-name]". This will be used if thesortKeyAttris set.- Parameters:
staticPkValue- name of the partition key attribute in the table- Returns:
- the builder instance (to chain operations)
-
withSortKeyAttr
DynamoDB attribute name for the sort key (optional)- Parameters:
sortKeyAttr- name of the sort key attribute in the table- Returns:
- the builder instance (to chain operations)
-
withExpiryAttr
DynamoDB attribute name for expiry timestamp (optional), by default "expiration"- Parameters:
expiryAttr- name of the expiry attribute in the table- Returns:
- the builder instance (to chain operations)
-
withInProgressExpiryAttr
DynamoDB attribute name for in progress expiry timestamp (optional), by default "in_progress_expiration"- Parameters:
inProgressExpiryAttr- name of the attribute in the table- Returns:
- the builder instance (to chain operations)
-
withStatusAttr
DynamoDB attribute name for status (optional), by default "status"- Parameters:
statusAttr- name of the status attribute in the table- Returns:
- the builder instance (to chain operations)
-
withDataAttr
DynamoDB attribute name for response data (optional), by default "data"- Parameters:
dataAttr- name of the data attribute in the table- Returns:
- the builder instance (to chain operations)
-
withValidationAttr
DynamoDB attribute name for validation (optional), by default "validation"- Parameters:
validationAttr- name of the validation attribute in the table- Returns:
- the builder instance (to chain operations)
-
withDynamoDbClient
public DynamoDBPersistenceStore.Builder withDynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient dynamoDbClient) CustomDynamoDbClientused to query DynamoDB (optional).
The default one usesUrlConnectionHttpClientas a http client and add com.amazonaws.xray.interceptors.TracingInterceptor (X-Ray) if available in the classpath.- Parameters:
dynamoDbClient- theDynamoDbClientinstance to use- Returns:
- the builder instance (to chain operations)
-