java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IResource, ITable, IResourceWithPolicy, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-07-11T03:45:52.800Z") @Stability(Stable) public class Table extends TableBase
Provides a DynamoDB table.

Example:

 import software.amazon.awscdk.*;
 import software.amazon.awscdk.services.s3.*;
 IBucket bucket;
 App app = new App();
 Stack stack = new Stack(app, "Stack");
 Table.Builder.create(stack, "Table")
         .partitionKey(Attribute.builder()
                 .name("id")
                 .type(AttributeType.STRING)
                 .build())
         .importSource(ImportSourceSpecification.builder()
                 .compressionType(InputCompressionType.GZIP)
                 .inputFormat(InputFormat.csv(CsvOptions.builder()
                         .delimiter(",")
                         .headerList(List.of("id", "name"))
                         .build()))
                 .bucket(bucket)
                 .keyPrefix("prefix")
                 .build())
         .build();
 
  • Constructor Details

    • Table

      protected Table(software.amazon.jsii.JsiiObjectRef objRef)
    • Table

      protected Table(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Table

      @Stability(Stable) public Table(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TableProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromTableArn

      @Stability(Stable) @NotNull public static ITable fromTableArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String tableArn)
      Creates a Table construct that represents an external table via table arn.

      Parameters:
      scope - The parent creating construct (usually this). This parameter is required.
      id - The construct's name. This parameter is required.
      tableArn - The table's ARN. This parameter is required.
    • fromTableAttributes

      @Stability(Stable) @NotNull public static ITable fromTableAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TableAttributes attrs)
      Creates a Table construct that represents an external table.

      Parameters:
      scope - The parent creating construct (usually this). This parameter is required.
      id - The construct's name. This parameter is required.
      attrs - A TableAttributes object. This parameter is required.
    • fromTableName

      @Stability(Stable) @NotNull public static ITable fromTableName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String tableName)
      Creates a Table construct that represents an external table via table name.

      Parameters:
      scope - The parent creating construct (usually this). This parameter is required.
      id - The construct's name. This parameter is required.
      tableName - The table's name. This parameter is required.
    • addGlobalSecondaryIndex

      @Stability(Stable) public void addGlobalSecondaryIndex(@NotNull GlobalSecondaryIndexProps props)
      Add a global secondary index of table.

      Parameters:
      props - the property of global secondary index. This parameter is required.
    • addLocalSecondaryIndex

      @Stability(Stable) public void addLocalSecondaryIndex(@NotNull LocalSecondaryIndexProps props)
      Add a local secondary index of table.

      Parameters:
      props - the property of local secondary index. This parameter is required.
    • autoScaleGlobalSecondaryIndexReadCapacity

      @Stability(Stable) @NotNull public IScalableTableAttribute autoScaleGlobalSecondaryIndexReadCapacity(@NotNull String indexName, @NotNull EnableScalingProps props)
      Enable read capacity scaling for the given GSI.

      Parameters:
      indexName - This parameter is required.
      props - This parameter is required.
      Returns:
      An object to configure additional AutoScaling settings for this attribute
    • autoScaleGlobalSecondaryIndexWriteCapacity

      @Stability(Stable) @NotNull public IScalableTableAttribute autoScaleGlobalSecondaryIndexWriteCapacity(@NotNull String indexName, @NotNull EnableScalingProps props)
      Enable write capacity scaling for the given GSI.

      Parameters:
      indexName - This parameter is required.
      props - This parameter is required.
      Returns:
      An object to configure additional AutoScaling settings for this attribute
    • autoScaleReadCapacity

      @Stability(Stable) @NotNull public IScalableTableAttribute autoScaleReadCapacity(@NotNull EnableScalingProps props)
      Enable read capacity scaling for this table.

      Parameters:
      props - This parameter is required.
      Returns:
      An object to configure additional AutoScaling settings
    • autoScaleWriteCapacity

      @Stability(Stable) @NotNull public IScalableTableAttribute autoScaleWriteCapacity(@NotNull EnableScalingProps props)
      Enable write capacity scaling for this table.

      Parameters:
      props - This parameter is required.
      Returns:
      An object to configure additional AutoScaling settings for this attribute
    • schema

      @Stability(Stable) @NotNull public SchemaOptions schema(@Nullable String indexName)
      Get schema attributes of table or index.

      Parameters:
      indexName -
      Returns:
      Schema of table or index.
    • schema

      @Stability(Stable) @NotNull public SchemaOptions schema()
      Get schema attributes of table or index.

      Returns:
      Schema of table or index.
    • getHasIndex

      @Stability(Stable) @NotNull protected Boolean getHasIndex()
      Whether this table has indexes.
      Specified by:
      getHasIndex in class TableBase
    • getTableArn

      @Stability(Stable) @NotNull public String getTableArn()
      Arn of the dynamodb table.
      Specified by:
      getTableArn in interface ITable
      Specified by:
      getTableArn in class TableBase
    • getTableName

      @Stability(Stable) @NotNull public String getTableName()
      Table name of the dynamodb table.
      Specified by:
      getTableName in interface ITable
      Specified by:
      getTableName in class TableBase
    • getEncryptionKey

      @Stability(Stable) @Nullable public IKey getEncryptionKey()
      KMS encryption key, if this table uses a customer-managed encryption key.
      Specified by:
      getEncryptionKey in interface ITable
      Specified by:
      getEncryptionKey in class TableBase
    • getTableStreamArn

      @Stability(Stable) @Nullable public String getTableStreamArn()
      ARN of the table's stream, if there is one.
      Specified by:
      getTableStreamArn in interface ITable
      Specified by:
      getTableStreamArn in class TableBase
    • getResourcePolicy

      @Stability(Stable) @Nullable public PolicyDocument getResourcePolicy()
      Resource policy to assign to DynamoDB Table.

      Default: - No resource policy statements are added to the created table.

      Specified by:
      getResourcePolicy in class TableBase
      See Also:
    • setResourcePolicy

      @Stability(Stable) public void setResourcePolicy(@Nullable PolicyDocument value)
      Resource policy to assign to DynamoDB Table.

      Default: - No resource policy statements are added to the created table.

      Specified by:
      setResourcePolicy in class TableBase
      See Also: