Class TableProps.Builder

java.lang.Object
software.amazon.awscdk.services.dynamodb.TableProps.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<TableProps>
Enclosing interface:
TableProps

@Stability(Stable) public static final class TableProps.Builder extends Object implements software.amazon.jsii.Builder<TableProps>
A builder for TableProps
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • kinesisStream

      @Stability(Stable) public TableProps.Builder kinesisStream(IStream kinesisStream)
      Parameters:
      kinesisStream - Kinesis Data Stream to capture item-level changes for the table.
      Returns:
      this
    • tableName

      @Stability(Stable) public TableProps.Builder tableName(String tableName)
      Sets the value of TableProps.getTableName()
      Parameters:
      tableName - Enforces a particular physical table name.
      Returns:
      this
    • billingMode

      @Stability(Stable) public TableProps.Builder billingMode(BillingMode billingMode)
      Parameters:
      billingMode - Specify how you are charged for read and write throughput and how you manage capacity.
      Returns:
      this
    • contributorInsightsEnabled

      @Stability(Stable) public TableProps.Builder contributorInsightsEnabled(Boolean contributorInsightsEnabled)
      Parameters:
      contributorInsightsEnabled - Whether CloudWatch contributor insights is enabled.
      Returns:
      this
    • deletionProtection

      @Stability(Stable) public TableProps.Builder deletionProtection(Boolean deletionProtection)
      Parameters:
      deletionProtection - Enables deletion protection for the table.
      Returns:
      this
    • encryption

      @Stability(Stable) public TableProps.Builder encryption(TableEncryption encryption)
      Parameters:
      encryption - Whether server-side encryption with an AWS managed customer master key is enabled. This property cannot be set if serverSideEncryption is set.

      NOTE: if you set this to CUSTOMER_MANAGED and encryptionKey is not specified, the key that the Tablet generates for you will be created with default permissions. If you are using CDKv2, these permissions will be sufficient to enable the key for use with DynamoDB tables. If you are using CDKv1, make sure the feature flag @aws-cdk/aws-kms:defaultKeyPolicies is set to true in your cdk.json.

      Returns:
      this
    • encryptionKey

      @Stability(Stable) public TableProps.Builder encryptionKey(IKey encryptionKey)
      Parameters:
      encryptionKey - External KMS key to use for table encryption. This property can only be set if encryption is set to TableEncryption.CUSTOMER_MANAGED.
      Returns:
      this
    • importSource

      @Stability(Stable) public TableProps.Builder importSource(ImportSourceSpecification importSource)
      Parameters:
      importSource - The properties of data being imported from the S3 bucket source to the table.
      Returns:
      this
    • maxReadRequestUnits

      @Stability(Stable) public TableProps.Builder maxReadRequestUnits(Number maxReadRequestUnits)
      Parameters:
      maxReadRequestUnits - The maximum read request units for the table. Careful if you add Global Secondary Indexes, as those will share the table's maximum on-demand throughput.

      Can only be provided if billingMode is PAY_PER_REQUEST.

      Returns:
      this
    • maxWriteRequestUnits

      @Stability(Stable) public TableProps.Builder maxWriteRequestUnits(Number maxWriteRequestUnits)
      Parameters:
      maxWriteRequestUnits - The write request units for the table. Careful if you add Global Secondary Indexes, as those will share the table's maximum on-demand throughput.

      Can only be provided if billingMode is PAY_PER_REQUEST.

      Returns:
      this
    • pointInTimeRecovery

      @Stability(Stable) public TableProps.Builder pointInTimeRecovery(Boolean pointInTimeRecovery)
      Parameters:
      pointInTimeRecovery - Whether point-in-time recovery is enabled.
      Returns:
      this
    • readCapacity

      @Stability(Stable) public TableProps.Builder readCapacity(Number readCapacity)
      Parameters:
      readCapacity - The read capacity for the table. Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.

      Can only be provided if billingMode is Provisioned.

      Returns:
      this
    • removalPolicy

      @Stability(Stable) public TableProps.Builder removalPolicy(RemovalPolicy removalPolicy)
      Parameters:
      removalPolicy - The removal policy to apply to the DynamoDB Table.
      Returns:
      this
    • replicationRegions

      @Stability(Stable) public TableProps.Builder replicationRegions(List<String> replicationRegions)
      Parameters:
      replicationRegions - Regions where replica tables will be created.
      Returns:
      this
    • replicationTimeout

      @Stability(Stable) public TableProps.Builder replicationTimeout(Duration replicationTimeout)
      Parameters:
      replicationTimeout - The timeout for a table replication operation in a single region.
      Returns:
      this
    • resourcePolicy

      @Stability(Stable) public TableProps.Builder resourcePolicy(PolicyDocument resourcePolicy)
      Parameters:
      resourcePolicy - Resource policy to assign to table.
      Returns:
      this
    • stream

      @Stability(Stable) public TableProps.Builder stream(StreamViewType stream)
      Sets the value of TableOptions.getStream()
      Parameters:
      stream - When an item in the table is modified, StreamViewType determines what information is written to the stream for this table.
      Returns:
      this
    • tableClass

      @Stability(Stable) public TableProps.Builder tableClass(TableClass tableClass)
      Parameters:
      tableClass - Specify the table class.
      Returns:
      this
    • timeToLiveAttribute

      @Stability(Stable) public TableProps.Builder timeToLiveAttribute(String timeToLiveAttribute)
      Parameters:
      timeToLiveAttribute - The name of TTL attribute.
      Returns:
      this
    • waitForReplicationToFinish

      @Stability(Stable) public TableProps.Builder waitForReplicationToFinish(Boolean waitForReplicationToFinish)
      Parameters:
      waitForReplicationToFinish - [WARNING: Use this flag with caution, misusing this flag may cause deleting existing replicas, refer to the detailed documentation for more information] Indicates whether CloudFormation stack waits for replication to finish. If set to false, the CloudFormation resource will mark the resource as created and replication will be completed asynchronously. This property is ignored if replicationRegions property is not set.

      WARNING: DO NOT UNSET this property if adding/removing multiple replicationRegions in one deployment, as CloudFormation only supports one region replication at a time. CDK overcomes this limitation by waiting for replication to finish before starting new replicationRegion.

      If the custom resource which handles replication has a physical resource ID with the format region instead of tablename-region (this would happen if the custom resource hasn't received an event since v1.91.0), DO NOT SET this property to false without making a change to the table name. This will cause the existing replicas to be deleted.

      Returns:
      this
    • writeCapacity

      @Stability(Stable) public TableProps.Builder writeCapacity(Number writeCapacity)
      Parameters:
      writeCapacity - The write capacity for the table. Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.

      Can only be provided if billingMode is Provisioned.

      Returns:
      this
    • partitionKey

      @Stability(Stable) public TableProps.Builder partitionKey(Attribute partitionKey)
      Parameters:
      partitionKey - Partition key attribute definition. This parameter is required.
      Returns:
      this
    • sortKey

      @Stability(Stable) public TableProps.Builder sortKey(Attribute sortKey)
      Sets the value of SchemaOptions.getSortKey()
      Parameters:
      sortKey - Sort key attribute definition.
      Returns:
      this
    • build

      @Stability(Stable) public TableProps build()
      Builds the configured instance.
      Specified by:
      build in interface software.amazon.jsii.Builder<TableProps>
      Returns:
      a new instance of TableProps
      Throws:
      NullPointerException - if any required attribute was not provided