java.lang.Object
software.amazon.lambda.powertools.idempotency.persistence.dynamodb.DynamoDBPersistenceStore.Builder
Enclosing class:
DynamoDBPersistenceStore

public static class DynamoDBPersistenceStore.Builder extends Object
Use this builder to get an instance of 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 Details

    • Builder

      public Builder()
  • Method Details

    • build

      public DynamoDBPersistenceStore build()
      Initialize and return a new instance of DynamoDBPersistenceStore.
      Example:
           DynamoDBPersistenceStore.builder().withTableName("idempotency_store").build();
       
      Returns:
      an instance of the DynamoDBPersistenceStore
    • withTableName

      public DynamoDBPersistenceStore.Builder withTableName(String tableName)
      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

      public DynamoDBPersistenceStore.Builder withKeyAttr(String keyAttr)
      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

      public DynamoDBPersistenceStore.Builder withStaticPkValue(String staticPkValue)
      DynamoDB attribute value for partition key (optional), by default "idempotency#[function-name]". This will be used if the sortKeyAttr is set.
      Parameters:
      staticPkValue - name of the partition key attribute in the table
      Returns:
      the builder instance (to chain operations)
    • withSortKeyAttr

      public DynamoDBPersistenceStore.Builder withSortKeyAttr(String sortKeyAttr)
      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

      public DynamoDBPersistenceStore.Builder withExpiryAttr(String expiryAttr)
      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

      public DynamoDBPersistenceStore.Builder withInProgressExpiryAttr(String inProgressExpiryAttr)
      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

      public DynamoDBPersistenceStore.Builder withStatusAttr(String statusAttr)
      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

      public DynamoDBPersistenceStore.Builder withDataAttr(String dataAttr)
      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

      public DynamoDBPersistenceStore.Builder withValidationAttr(String validationAttr)
      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)
      Custom DynamoDbClient used to query DynamoDB (optional).
      The default one uses UrlConnectionHttpClient as a http client and add com.amazonaws.xray.interceptors.TracingInterceptor (X-Ray) if available in the classpath.
      Parameters:
      dynamoDbClient - the DynamoDbClient instance to use
      Returns:
      the builder instance (to chain operations)