Interface GlobalSecondaryIndexPropsV2

All Superinterfaces:
software.amazon.jsii.JsiiSerializable, SecondaryIndexProps
All Known Implementing Classes:
GlobalSecondaryIndexPropsV2.Jsii$Proxy

@Generated(value="jsii-pacmak/1.121.0 (build d7af9b9)", date="2025-12-18T18:20:08.515Z") @Stability(Stable) public interface GlobalSecondaryIndexPropsV2 extends software.amazon.jsii.JsiiSerializable, SecondaryIndexProps
Properties used to configure a global secondary index.

Example:

 TableV2 table = TableV2.Builder.create(this, "Table")
         .partitionKey(Attribute.builder().name("pk").type(AttributeType.STRING).build())
         .globalSecondaryIndexes(List.of(GlobalSecondaryIndexPropsV2.builder()
                 .indexName("gsi1")
                 .partitionKey(Attribute.builder().name("pk").type(AttributeType.STRING).build())
                 .build()))
         .build();
 table.addGlobalSecondaryIndex(GlobalSecondaryIndexPropsV2.builder()
         .indexName("gsi2")
         .partitionKey(Attribute.builder().name("pk").type(AttributeType.STRING).build())
         .build());
 // Add a GSI with multi-attribute keys
 table.addGlobalSecondaryIndex(GlobalSecondaryIndexPropsV2.builder()
         .indexName("multi-attribute-gsi2")
         .partitionKeys(List.of(Attribute.builder().name("multi-attribute_pk1").type(AttributeType.STRING).build(), Attribute.builder().name("multi-attribute_pk2").type(AttributeType.NUMBER).build()))
         .sortKey(Attribute.builder().name("sk").type(AttributeType.STRING).build())
         .build());
 
  • Method Details

    • getMaxReadRequestUnits

      @Stability(Stable) @Nullable default Number getMaxReadRequestUnits()
      The maximum read request units.

      Note: This can only be configured if the primary table billing is PAY_PER_REQUEST.

      Default: - inherited from the primary table.

    • getMaxWriteRequestUnits

      @Stability(Stable) @Nullable default Number getMaxWriteRequestUnits()
      The maximum write request units.

      Note: This can only be configured if the primary table billing is PAY_PER_REQUEST.

      Default: - inherited from the primary table.

    • getPartitionKey

      @Stability(Stable) @Nullable default Attribute getPartitionKey()
      Partition key attribute definition.

      If a single field forms the partition key, you can use this field. Use the partitionKeys field if the partition key is a multi-attribute key (consists of multiple fields).

      Default: - exactly one of `partitionKey` and `partitionKeys` must be specified.

    • getPartitionKeys

      @Stability(Stable) @Nullable default List<Attribute> getPartitionKeys()
      Multi-attribute partition key.

      If a single field forms the partition key, you can use either partitionKey or partitionKeys to specify the partition key. Exactly one of these must be specified.

      You must use partitionKeys field if the partition key is a multi-attribute key (consists of multiple fields).

      NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields.

      The order of fields is not important.

      Default: - exactly one of `partitionKey` and `partitionKeys` must be specified.

    • getReadCapacity

      @Stability(Stable) @Nullable default Capacity getReadCapacity()
      The read capacity.

      Note: This can only be configured if the primary table billing is provisioned.

      Default: - inherited from the primary table.

    • getSortKey

      @Stability(Stable) @Nullable default Attribute getSortKey()
      Sort key attribute definition.

      If a single field forms the sort key, you can use this field. Use the sortKeys field if the sort key is a multi-attribute key (consists of multiple fields).

      Default: - no sort key

    • getSortKeys

      @Stability(Stable) @Nullable default List<Attribute> getSortKeys()
      Multi-attribute sort key.

      If a single field forms the sort key, you can use either sortKey or sortKeys to specify the sort key. At most one of these may be specified.

      You must use sortKeys field if the sort key is a multi-attribute key (consists of multiple fields).

      NOTE: although the name of this field makes it sound like it creates multiple keys, it does not. It defines a single key that consists of of multiple fields at the same time.

      NOTE: The order of fields is important!

      Default: - no sort key

    • getWarmThroughput

      @Stability(Stable) @Nullable default WarmThroughput getWarmThroughput()
      The warm throughput configuration for the global secondary index.

      Default: - no warm throughput is configured

    • getWriteCapacity

      @Stability(Stable) @Nullable default Capacity getWriteCapacity()
      The write capacity.

      Note: This can only be configured if the primary table billing is provisioned.

      Default: - inherited from the primary table.

    • builder

      @Stability(Stable) static GlobalSecondaryIndexPropsV2.Builder builder()
      Returns:
      a GlobalSecondaryIndexPropsV2.Builder of GlobalSecondaryIndexPropsV2