Class: AWSCDK::DynamoDB::TablePropsV2

Inherits:
TableOptionsV2
  • Object
show all
Defined in:
dynamo_db/table_props_v2.rb

Overview

Properties used to configure a DynamoDB table.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contributor_insights: nil, contributor_insights_specification: nil, deletion_protection: nil, kinesis_stream: nil, point_in_time_recovery: nil, point_in_time_recovery_specification: nil, resource_policy: nil, stream_resource_policy: nil, table_class: nil, tags: nil, partition_key:, billing: nil, dynamo_stream: nil, encryption: nil, global_secondary_indexes: nil, global_table_settings_replication_mode: nil, local_secondary_indexes: nil, multi_region_consistency: nil, removal_policy: nil, replicas: nil, sort_key: nil, table_name: nil, time_to_live_attribute: nil, warm_throughput: nil, witness_region: nil) ⇒ TablePropsV2

Returns a new instance of TablePropsV2.

Parameters:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'dynamo_db/table_props_v2.rb', line 32

def initialize(contributor_insights: nil, contributor_insights_specification: nil, deletion_protection: nil, kinesis_stream: nil, point_in_time_recovery: nil, point_in_time_recovery_specification: nil, resource_policy: nil, stream_resource_policy: nil, table_class: nil, tags: nil, partition_key:, billing: nil, dynamo_stream: nil, encryption: nil, global_secondary_indexes: nil, global_table_settings_replication_mode: nil, local_secondary_indexes: nil, multi_region_consistency: nil, removal_policy: nil, replicas: nil, sort_key: nil, table_name: nil, time_to_live_attribute: nil, warm_throughput: nil, witness_region: nil)
  @contributor_insights = contributor_insights
  Jsii::Type.check_type(@contributor_insights, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "contributorInsights") unless @contributor_insights.nil?
  @contributor_insights_specification = contributor_insights_specification.is_a?(Hash) ? ::AWSCDK::DynamoDB::ContributorInsightsSpecification.new(**contributor_insights_specification.transform_keys(&:to_sym)) : contributor_insights_specification
  Jsii::Type.check_type(@contributor_insights_specification, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQ29udHJpYnV0b3JJbnNpZ2h0c1NwZWNpZmljYXRpb24ifQ==")), "contributorInsightsSpecification") unless @contributor_insights_specification.nil?
  @deletion_protection = deletion_protection
  Jsii::Type.check_type(@deletion_protection, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "deletionProtection") unless @deletion_protection.nil?
  @kinesis_stream = kinesis_stream
  Jsii::Type.check_type(@kinesis_stream, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3Nfa2luZXNpcy5JU3RyZWFtIn0=")), "kinesisStream") unless @kinesis_stream.nil?
  @point_in_time_recovery = point_in_time_recovery
  Jsii::Type.check_type(@point_in_time_recovery, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "pointInTimeRecovery") unless @point_in_time_recovery.nil?
  @point_in_time_recovery_specification = point_in_time_recovery_specification.is_a?(Hash) ? ::AWSCDK::DynamoDB::PointInTimeRecoverySpecification.new(**point_in_time_recovery_specification.transform_keys(&:to_sym)) : point_in_time_recovery_specification
  Jsii::Type.check_type(@point_in_time_recovery_specification, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuUG9pbnRJblRpbWVSZWNvdmVyeVNwZWNpZmljYXRpb24ifQ==")), "pointInTimeRecoverySpecification") unless @point_in_time_recovery_specification.nil?
  @resource_policy = resource_policy
  Jsii::Type.check_type(@resource_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeURvY3VtZW50In0=")), "resourcePolicy") unless @resource_policy.nil?
  @stream_resource_policy = stream_resource_policy
  Jsii::Type.check_type(@stream_resource_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeURvY3VtZW50In0=")), "streamResourcePolicy") unless @stream_resource_policy.nil?
  @table_class = table_class
  Jsii::Type.check_type(@table_class, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuVGFibGVDbGFzcyJ9")), "tableClass") unless @table_class.nil?
  @tags = tags.is_a?(Array) ? tags.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::CfnTag.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : tags
  Jsii::Type.check_type(@tags, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLkNmblRhZyJ9LCJraW5kIjoiYXJyYXkifX0=")), "tags") unless @tags.nil?
  @partition_key = partition_key.is_a?(Hash) ? ::AWSCDK::DynamoDB::Attribute.new(**partition_key.transform_keys(&:to_sym)) : partition_key
  Jsii::Type.check_type(@partition_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQXR0cmlidXRlIn0=")), "partitionKey")
  @billing = billing
  Jsii::Type.check_type(@billing, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQmlsbGluZyJ9")), "billing") unless @billing.nil?
  @dynamo_stream = dynamo_stream
  Jsii::Type.check_type(@dynamo_stream, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuU3RyZWFtVmlld1R5cGUifQ==")), "dynamoStream") unless @dynamo_stream.nil?
  @encryption = encryption
  Jsii::Type.check_type(@encryption, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuVGFibGVFbmNyeXB0aW9uVjIifQ==")), "encryption") unless @encryption.nil?
  @global_secondary_indexes = global_secondary_indexes.is_a?(Array) ? global_secondary_indexes.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::DynamoDB::GlobalSecondaryIndexPropsV2.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : global_secondary_indexes
  Jsii::Type.check_type(@global_secondary_indexes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19keW5hbW9kYi5HbG9iYWxTZWNvbmRhcnlJbmRleFByb3BzVjIifSwia2luZCI6ImFycmF5In19")), "globalSecondaryIndexes") unless @global_secondary_indexes.nil?
  @global_table_settings_replication_mode = global_table_settings_replication_mode
  Jsii::Type.check_type(@global_table_settings_replication_mode, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuR2xvYmFsVGFibGVTZXR0aW5nc1JlcGxpY2F0aW9uTW9kZSJ9")), "globalTableSettingsReplicationMode") unless @global_table_settings_replication_mode.nil?
  @local_secondary_indexes = local_secondary_indexes.is_a?(Array) ? local_secondary_indexes.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::DynamoDB::LocalSecondaryIndexProps.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : local_secondary_indexes
  Jsii::Type.check_type(@local_secondary_indexes, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19keW5hbW9kYi5Mb2NhbFNlY29uZGFyeUluZGV4UHJvcHMifSwia2luZCI6ImFycmF5In19")), "localSecondaryIndexes") unless @local_secondary_indexes.nil?
  @multi_region_consistency = multi_region_consistency
  Jsii::Type.check_type(@multi_region_consistency, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuTXVsdGlSZWdpb25Db25zaXN0ZW5jeSJ9")), "multiRegionConsistency") unless @multi_region_consistency.nil?
  @removal_policy = removal_policy
  Jsii::Type.check_type(@removal_policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "removalPolicy") unless @removal_policy.nil?
  @replicas = replicas.is_a?(Array) ? replicas.map { |jsii_v0| jsii_v0.is_a?(Hash) ? ::AWSCDK::DynamoDB::ReplicaTableProps.new(**jsii_v0.transform_keys(&:to_sym)) : jsii_v0 } : replicas
  Jsii::Type.check_type(@replicas, JSON.parse(Base64.strict_decode64("eyJjb2xsZWN0aW9uIjp7ImVsZW1lbnR0eXBlIjp7ImZxbiI6ImF3cy1jZGstbGliLmF3c19keW5hbW9kYi5SZXBsaWNhVGFibGVQcm9wcyJ9LCJraW5kIjoiYXJyYXkifX0=")), "replicas") unless @replicas.nil?
  @sort_key = sort_key.is_a?(Hash) ? ::AWSCDK::DynamoDB::Attribute.new(**sort_key.transform_keys(&:to_sym)) : sort_key
  Jsii::Type.check_type(@sort_key, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuQXR0cmlidXRlIn0=")), "sortKey") unless @sort_key.nil?
  @table_name = table_name
  Jsii::Type.check_type(@table_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tableName") unless @table_name.nil?
  @time_to_live_attribute = time_to_live_attribute
  Jsii::Type.check_type(@time_to_live_attribute, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "timeToLiveAttribute") unless @time_to_live_attribute.nil?
  @warm_throughput = warm_throughput.is_a?(Hash) ? ::AWSCDK::DynamoDB::WarmThroughput.new(**warm_throughput.transform_keys(&:to_sym)) : warm_throughput
  Jsii::Type.check_type(@warm_throughput, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuV2FybVRocm91Z2hwdXQifQ==")), "warmThroughput") unless @warm_throughput.nil?
  @witness_region = witness_region
  Jsii::Type.check_type(@witness_region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "witnessRegion") unless @witness_region.nil?
end

Instance Attribute Details

#billingAWSCDK::DynamoDB::Billing? (readonly)

Note:

Default: Billing.onDemand()

The billing mode and capacity settings to apply to the table.

Returns:



147
148
149
# File 'dynamo_db/table_props_v2.rb', line 147

def billing
  @billing
end

#contributor_insightsBoolean? (readonly)

Deprecated.

use contributorInsightsSpecification instead

Note:

Default: false

Whether CloudWatch contributor insights is enabled.

Returns:

  • (Boolean, nil)


90
91
92
# File 'dynamo_db/table_props_v2.rb', line 90

def contributor_insights
  @contributor_insights
end

#contributor_insights_specificationAWSCDK::DynamoDB::ContributorInsightsSpecification? (readonly)

Note:

Default: - contributor insights is not enabled

Whether CloudWatch contributor insights is enabled and what mode is selected.



95
96
97
# File 'dynamo_db/table_props_v2.rb', line 95

def contributor_insights_specification
  @contributor_insights_specification
end

#deletion_protectionBoolean? (readonly)

Note:

Default: false

Whether deletion protection is enabled.

Returns:

  • (Boolean, nil)


100
101
102
# File 'dynamo_db/table_props_v2.rb', line 100

def deletion_protection
  @deletion_protection
end

#dynamo_streamAWSCDK::DynamoDB::StreamViewType? (readonly)

Note:

Default: - streams are disabled if replicas are not configured and this property is not specified. If this property is not specified when replicas are configured, then NEW_AND_OLD_IMAGES will be the StreamViewType for all replicas

When an item in the table is modified, StreamViewType determines what information is written to the stream.



152
153
154
# File 'dynamo_db/table_props_v2.rb', line 152

def dynamo_stream
  @dynamo_stream
end

#encryptionAWSCDK::DynamoDB::TableEncryptionV2? (readonly)

Note:

Default: TableEncryptionV2.dynamoOwnedKey()

The server-side encryption.



157
158
159
# File 'dynamo_db/table_props_v2.rb', line 157

def encryption
  @encryption
end

#global_secondary_indexesArray<AWSCDK::DynamoDB::GlobalSecondaryIndexPropsV2>? (readonly)

Note:

Default: - no global secondary indexes

Global secondary indexes.

Note: You can provide a maximum of 20 global secondary indexes.



164
165
166
# File 'dynamo_db/table_props_v2.rb', line 164

def global_secondary_indexes
  @global_secondary_indexes
end

#global_table_settings_replication_modeAWSCDK::DynamoDB::GlobalTableSettingsReplicationMode? (readonly)

Note:

Default: GlobalTableSettingsReplicationMode.NONE

Controls whether table settings are synchronized across replicas.

When set to ALL, synchronizable settings (billing mode, throughput, TTL, streams view type, GSIs) are automatically replicated across all replicas. When set to NONE, each replica manages its own settings independently (billing mode must be PAY_PER_REQUEST).

Note: Some settings are always synchronized (key schema, LSIs) regardless of this setting, and some are never synchronized (table class, SSE, deletion protection, PITR, tags, resource policy).



176
177
178
# File 'dynamo_db/table_props_v2.rb', line 176

def global_table_settings_replication_mode
  @global_table_settings_replication_mode
end

#kinesis_streamAWSCDK::Kinesis::IStream? (readonly)

Note:

Default: - no Kinesis Data Stream

Kinesis Data Stream to capture item level changes.

Returns:



105
106
107
# File 'dynamo_db/table_props_v2.rb', line 105

def kinesis_stream
  @kinesis_stream
end

#local_secondary_indexesArray<AWSCDK::DynamoDB::LocalSecondaryIndexProps>? (readonly)

Note:

Default: - no local secondary indexes

Local secondary indexes.

Note: You can only provide a maximum of 5 local secondary indexes.



183
184
185
# File 'dynamo_db/table_props_v2.rb', line 183

def local_secondary_indexes
  @local_secondary_indexes
end

#multi_region_consistencyAWSCDK::DynamoDB::MultiRegionConsistency? (readonly)

Note:

Default: MultiRegionConsistency.EVENTUAL

Specifies the consistency mode for a new global table.



188
189
190
# File 'dynamo_db/table_props_v2.rb', line 188

def multi_region_consistency
  @multi_region_consistency
end

#partition_keyAWSCDK::DynamoDB::Attribute (readonly)

Partition key attribute definition.



142
143
144
# File 'dynamo_db/table_props_v2.rb', line 142

def partition_key
  @partition_key
end

#point_in_time_recoveryBoolean? (readonly)

Deprecated.

use pointInTimeRecoverySpecification instead

Note:

Default: false - point in time recovery is not enabled.

Whether point-in-time recovery is enabled.

Returns:

  • (Boolean, nil)


111
112
113
# File 'dynamo_db/table_props_v2.rb', line 111

def point_in_time_recovery
  @point_in_time_recovery
end

#point_in_time_recovery_specificationAWSCDK::DynamoDB::PointInTimeRecoverySpecification? (readonly)

Note:

Default: - point in time recovery is not enabled.

Whether point-in-time recovery is enabled and recoveryPeriodInDays is set.



116
117
118
# File 'dynamo_db/table_props_v2.rb', line 116

def point_in_time_recovery_specification
  @point_in_time_recovery_specification
end

#removal_policyAWSCDK::RemovalPolicy? (readonly)

Note:

Default: RemovalPolicy.RETAIN

The removal policy applied to the table.

Returns:



193
194
195
# File 'dynamo_db/table_props_v2.rb', line 193

def removal_policy
  @removal_policy
end

#replicasArray<AWSCDK::DynamoDB::ReplicaTableProps>? (readonly)

Note:

Default: - no replica tables

Replica tables to deploy with the primary table.

Note: Adding replica tables allows you to use your table as a global table. You cannot specify a replica table in the region that the primary table will be deployed to. Replica tables will only be supported if the stack deployment region is defined.

Returns:



202
203
204
# File 'dynamo_db/table_props_v2.rb', line 202

def replicas
  @replicas
end

#resource_policyAWSCDK::IAM::PolicyDocument? (readonly)

Note:

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

Resource policy to assign to DynamoDB Table.



122
123
124
# File 'dynamo_db/table_props_v2.rb', line 122

def resource_policy
  @resource_policy
end

#sort_keyAWSCDK::DynamoDB::Attribute? (readonly)

Note:

Default: - no sort key

Sort key attribute definition.

Returns:



207
208
209
# File 'dynamo_db/table_props_v2.rb', line 207

def sort_key
  @sort_key
end

#stream_resource_policyAWSCDK::IAM::PolicyDocument? (readonly)

Note:

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

Resource policy to assign to DynamoDB Stream.



128
129
130
# File 'dynamo_db/table_props_v2.rb', line 128

def stream_resource_policy
  @stream_resource_policy
end

#table_classAWSCDK::DynamoDB::TableClass? (readonly)

Note:

Default: TableClass.STANDARD

The table class.



133
134
135
# File 'dynamo_db/table_props_v2.rb', line 133

def table_class
  @table_class
end

#table_nameString? (readonly)

Note:

Default: - generated by CloudFormation

The name of the table.

Returns:

  • (String, nil)


212
213
214
# File 'dynamo_db/table_props_v2.rb', line 212

def table_name
  @table_name
end

#tagsArray<AWSCDK::CfnTag>? (readonly)

Note:

Default: - no tags

Tags to be applied to the primary table (default replica table).

Returns:



138
139
140
# File 'dynamo_db/table_props_v2.rb', line 138

def tags
  @tags
end

#time_to_live_attributeString? (readonly)

Note:

Default: - TTL is disabled

The name of the TTL attribute.

Returns:

  • (String, nil)


217
218
219
# File 'dynamo_db/table_props_v2.rb', line 217

def time_to_live_attribute
  @time_to_live_attribute
end

#warm_throughputAWSCDK::DynamoDB::WarmThroughput? (readonly)

Note:

Default: - no warm throughput is configured

The warm throughput configuration for the table.



222
223
224
# File 'dynamo_db/table_props_v2.rb', line 222

def warm_throughput
  @warm_throughput
end

#witness_regionString? (readonly)

Note:

Default: - no witness region

The witness Region for the MRSC global table.

A MRSC global table can be configured with either three replicas, or with two replicas and one witness.

Note: Witness region cannot be specified for a Multi-Region Eventual Consistency (MREC) Global Table. Witness regions are only supported for Multi-Region Strong Consistency (MRSC) Global Tables.

Returns:

  • (String, nil)


232
233
234
# File 'dynamo_db/table_props_v2.rb', line 232

def witness_region
  @witness_region
end

Class Method Details

.jsii_propertiesObject



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'dynamo_db/table_props_v2.rb', line 234

def self.jsii_properties
  {
    :contributor_insights => "contributorInsights",
    :contributor_insights_specification => "contributorInsightsSpecification",
    :deletion_protection => "deletionProtection",
    :kinesis_stream => "kinesisStream",
    :point_in_time_recovery => "pointInTimeRecovery",
    :point_in_time_recovery_specification => "pointInTimeRecoverySpecification",
    :resource_policy => "resourcePolicy",
    :stream_resource_policy => "streamResourcePolicy",
    :table_class => "tableClass",
    :tags => "tags",
    :partition_key => "partitionKey",
    :billing => "billing",
    :dynamo_stream => "dynamoStream",
    :encryption => "encryption",
    :global_secondary_indexes => "globalSecondaryIndexes",
    :global_table_settings_replication_mode => "globalTableSettingsReplicationMode",
    :local_secondary_indexes => "localSecondaryIndexes",
    :multi_region_consistency => "multiRegionConsistency",
    :removal_policy => "removalPolicy",
    :replicas => "replicas",
    :sort_key => "sortKey",
    :table_name => "tableName",
    :time_to_live_attribute => "timeToLiveAttribute",
    :warm_throughput => "warmThroughput",
    :witness_region => "witnessRegion",
  }
end

Instance Method Details

#to_jsiiObject



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'dynamo_db/table_props_v2.rb', line 264

def to_jsii
  result = {}
  result.merge!(super)
  result.merge!({
    "contributorInsights" => @contributor_insights,
    "contributorInsightsSpecification" => @contributor_insights_specification,
    "deletionProtection" => @deletion_protection,
    "kinesisStream" => @kinesis_stream,
    "pointInTimeRecovery" => @point_in_time_recovery,
    "pointInTimeRecoverySpecification" => @point_in_time_recovery_specification,
    "resourcePolicy" => @resource_policy,
    "streamResourcePolicy" => @stream_resource_policy,
    "tableClass" => @table_class,
    "tags" => @tags,
    "partitionKey" => @partition_key,
    "billing" => @billing,
    "dynamoStream" => @dynamo_stream,
    "encryption" => @encryption,
    "globalSecondaryIndexes" => @global_secondary_indexes,
    "globalTableSettingsReplicationMode" => @global_table_settings_replication_mode,
    "localSecondaryIndexes" => @local_secondary_indexes,
    "multiRegionConsistency" => @multi_region_consistency,
    "removalPolicy" => @removal_policy,
    "replicas" => @replicas,
    "sortKey" => @sort_key,
    "tableName" => @table_name,
    "timeToLiveAttribute" => @time_to_live_attribute,
    "warmThroughput" => @warm_throughput,
    "witnessRegion" => @witness_region,
  })
  result.compact
end