Class TableV2
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.dynamodb.TableBaseV2
software.amazon.awscdk.services.dynamodb.TableV2
- All Implemented Interfaces:
IResource
,ITable
,ITableV2
,IResourceWithPolicy
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)",
date="2024-10-25T14:21:13.494Z")
@Stability(Stable)
public class TableV2
extends TableBaseV2
A DynamoDB Table.
Example:
import software.amazon.awscdk.*; App app = new App(); Stack stack = Stack.Builder.create(app, "Stack").env(Environment.builder().region("us-west-2").build()).build(); TableV2 globalTable = TableV2.Builder.create(stack, "GlobalTable") .partitionKey(Attribute.builder().name("pk").type(AttributeType.STRING).build()) // applys to all replicas, i.e., us-west-2, us-east-1, us-east-2 .removalPolicy(RemovalPolicy.DESTROY) .replicas(List.of(ReplicaTableProps.builder().region("us-east-1").build(), ReplicaTableProps.builder().region("us-east-2").build())) .build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.iam.IResourceWithPolicy
IResourceWithPolicy.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.services.dynamodb.ITableV2
ITableV2.Jsii$Default
-
Constructor Summary
ModifierConstructorDescriptionprotected
TableV2
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
TableV2
(software.amazon.jsii.JsiiObjectRef objRef) TableV2
(software.constructs.Construct scope, String id, TablePropsV2 props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a global secondary index to the table.void
Add a local secondary index to the table.void
addReplica
(ReplicaTableProps props) Add a replica table.static ITableV2
fromTableArn
(software.constructs.Construct scope, String id, String tableArn) Creates a Table construct that represents an external table via table ARN.static ITableV2
fromTableAttributes
(software.constructs.Construct scope, String id, TableAttributesV2 attrs) Creates a Table construct that represents an external table.static ITableV2
fromTableName
(software.constructs.Construct scope, String id, String tableName) Creates a Table construct that represents an external table via table name.The KMS encryption key for the table.protected Boolean
protected String
The resource policy for the table.The ARN of the table.The ID of the table.The name of the table.The stream ARN of the table.Retrieve a replica table.void
setResourcePolicy
(PolicyDocument value) The resource policy for the table.Methods inherited from class software.amazon.awscdk.services.dynamodb.TableBaseV2
addToResourcePolicy, grant, grantFullAccess, grantReadData, grantReadWriteData, grantStream, grantStreamRead, grantTableListStreams, grantWriteData, metric, metric, metricConditionalCheckFailedRequests, metricConditionalCheckFailedRequests, metricConsumedReadCapacityUnits, metricConsumedReadCapacityUnits, metricConsumedWriteCapacityUnits, metricConsumedWriteCapacityUnits, metricSuccessfulRequestLatency, metricSuccessfulRequestLatency, metricSystemErrors, metricSystemErrors, metricSystemErrorsForOperations, metricSystemErrorsForOperations, metricThrottledRequests, metricThrottledRequests, metricThrottledRequestsForOperation, metricThrottledRequestsForOperation, metricThrottledRequestsForOperations, metricThrottledRequestsForOperations, metricUserErrors, metricUserErrors
Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResource
Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.constructs.IConstruct
getNode
Methods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnv, getStack
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
TableV2
protected TableV2(software.amazon.jsii.JsiiObjectRef objRef) -
TableV2
protected TableV2(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
TableV2
@Stability(Stable) public TableV2(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TablePropsV2 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 ITableV2 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 (usuallythis
). 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 ITableV2 fromTableAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull TableAttributesV2 attrs) Creates a Table construct that represents an external table.- Parameters:
scope
- the parent creating construct (usuallythis
). This parameter is required.id
- the construct's name. This parameter is required.attrs
- attributes of the table. This parameter is required.
-
fromTableName
@Stability(Stable) @NotNull public static ITableV2 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 (usuallythis
). This parameter is required.id
- the construct's name. This parameter is required.tableName
- the table's name. This parameter is required.
-
addGlobalSecondaryIndex
Add a global secondary index to the table.Note: Global secondary indexes will be inherited by all replica tables.
- Parameters:
props
- the properties of the global secondary index. This parameter is required.
-
addLocalSecondaryIndex
Add a local secondary index to the table.Note: Local secondary indexes will be inherited by all replica tables.
- Parameters:
props
- the properties of the local secondary index. This parameter is required.
-
addReplica
Add a replica table.Note: Adding a replica table will allow you to use your table as a global table.
- Parameters:
props
- the properties of the replica table to add. This parameter is required.
-
replica
Retrieve a replica table.Note: Replica tables are not supported in a region agnostic stack.
- Parameters:
region
- the region of the replica table. This parameter is required.
-
getHasIndex
- Specified by:
getHasIndex
in classTableBaseV2
-
getRegion
- Specified by:
getRegion
in classTableBaseV2
-
getTableArn
The ARN of the table.- Specified by:
getTableArn
in interfaceITable
- Specified by:
getTableArn
in classTableBaseV2
-
getTableName
The name of the table.- Specified by:
getTableName
in interfaceITable
- Specified by:
getTableName
in classTableBaseV2
-
getEncryptionKey
The KMS encryption key for the table.- Specified by:
getEncryptionKey
in interfaceITable
- Specified by:
getEncryptionKey
in classTableBaseV2
-
getTableId
The ID of the table.- Specified by:
getTableId
in interfaceITableV2
- Specified by:
getTableId
in classTableBaseV2
-
getTableStreamArn
The stream ARN of the table.- Specified by:
getTableStreamArn
in interfaceITable
- Specified by:
getTableStreamArn
in classTableBaseV2
-
getResourcePolicy
The resource policy for the table.- Specified by:
getResourcePolicy
in classTableBaseV2
-
setResourcePolicy
The resource policy for the table.- Specified by:
setResourcePolicy
in classTableBaseV2
-