Class: AWSCDK::DynamoDB::TableV2

Inherits:
TableBaseV2
  • Object
show all
Defined in:
dynamo_db/table_v2.rb

Overview

A DynamoDB Table.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ TableV2

Returns a new instance of TableV2.

Parameters:



11
12
13
14
15
16
17
# File 'dynamo_db/table_v2.rb', line 11

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::TablePropsV2.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuVGFibGVQcm9wc1YyIn0=")), "props")
  Jsii::Object.instance_method(:initialize).bind(self).call(scope, id, props)
end

Class Method Details

.from_table_arn(scope, id, table_arn) ⇒ AWSCDK::DynamoDB::ITableV2

Creates a Table construct that represents an external table via table ARN.

Parameters:

  • scope (Constructs::Construct)

    the parent creating construct (usually this).

  • id (String)

    the construct's name.

  • table_arn (String)

    the table's ARN.

Returns:



79
80
81
82
83
84
# File 'dynamo_db/table_v2.rb', line 79

def self.from_table_arn(scope, id, table_arn)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(table_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tableArn")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_dynamodb.TableV2", "fromTableArn", [scope, id, table_arn])
end

.from_table_attributes(scope, id, attrs) ⇒ AWSCDK::DynamoDB::ITableV2

Creates a Table construct that represents an external table.

Parameters:

  • scope (Constructs::Construct)

    the parent creating construct (usually this).

  • id (String)

    the construct's name.

  • attrs (AWSCDK::DynamoDB::TableAttributesV2)

    attributes of the table.

Returns:



92
93
94
95
96
97
98
# File 'dynamo_db/table_v2.rb', line 92

def self.from_table_attributes(scope, id, attrs)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  attrs = attrs.is_a?(Hash) ? ::AWSCDK::DynamoDB::TableAttributesV2.new(**attrs.transform_keys(&:to_sym)) : attrs
  Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuVGFibGVBdHRyaWJ1dGVzVjIifQ==")), "attrs")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_dynamodb.TableV2", "fromTableAttributes", [scope, id, attrs])
end

.from_table_name(scope, id, table_name) ⇒ AWSCDK::DynamoDB::ITableV2

Creates a Table construct that represents an external table via table name.

Parameters:

  • scope (Constructs::Construct)

    the parent creating construct (usually this).

  • id (String)

    the construct's name.

  • table_name (String)

    the table's name.

Returns:



106
107
108
109
110
111
# File 'dynamo_db/table_v2.rb', line 106

def self.from_table_name(scope, id, table_name)
  Jsii::Type.check_type(scope, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLkNvbnN0cnVjdCJ9")), "scope")
  Jsii::Type.check_type(id, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "id")
  Jsii::Type.check_type(table_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tableName")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_dynamodb.TableV2", "fromTableName", [scope, id, table_name])
end

.jsii_overridable_methodsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
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
# File 'dynamo_db/table_v2.rb', line 19

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :physical_name => { kind: :property, name: "physicalName", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :grants => { kind: :property, name: "grants", is_optional: false },
    :has_index => { kind: :property, name: "hasIndex", is_optional: false },
    :region => { kind: :property, name: "region", is_optional: false },
    :table_arn => { kind: :property, name: "tableArn", is_optional: false },
    :table_name => { kind: :property, name: "tableName", is_optional: false },
    :table_ref => { kind: :property, name: "tableRef", is_optional: false },
    :encryption_key => { kind: :property, name: "encryptionKey", is_optional: true },
    :table_id => { kind: :property, name: "tableId", is_optional: true },
    :table_stream_arn => { kind: :property, name: "tableStreamArn", is_optional: true },
    :resource_policy => { kind: :property, name: "resourcePolicy", is_optional: true },
    :tags => { kind: :property, name: "tags", is_optional: false },
    :stream_resource_policy => { kind: :property, name: "streamResourcePolicy", is_optional: true },
    :to_string => { kind: :method, name: "toString", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_cross_stack_reference_strength => { kind: :method, name: "applyCrossStackReferenceStrength", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :generate_physical_name => { kind: :method, name: "generatePhysicalName", is_optional: false },
    :get_resource_arn_attribute => { kind: :method, name: "getResourceArnAttribute", is_optional: false },
    :get_resource_name_attribute => { kind: :method, name: "getResourceNameAttribute", is_optional: false },
    :add_to_resource_policy => { kind: :method, name: "addToResourcePolicy", is_optional: false },
    :grant => { kind: :method, name: "grant", is_optional: false },
    :grant_full_access => { kind: :method, name: "grantFullAccess", is_optional: false },
    :grant_on_key => { kind: :method, name: "grantOnKey", is_optional: false },
    :grant_read_data => { kind: :method, name: "grantReadData", is_optional: false },
    :grant_read_write_data => { kind: :method, name: "grantReadWriteData", is_optional: false },
    :grant_stream => { kind: :method, name: "grantStream", is_optional: false },
    :grant_stream_read => { kind: :method, name: "grantStreamRead", is_optional: false },
    :grant_table_list_streams => { kind: :method, name: "grantTableListStreams", is_optional: false },
    :grant_write_data => { kind: :method, name: "grantWriteData", is_optional: false },
    :metric => { kind: :method, name: "metric", is_optional: false },
    :metric_conditional_check_failed_requests => { kind: :method, name: "metricConditionalCheckFailedRequests", is_optional: false },
    :metric_consumed_read_capacity_units => { kind: :method, name: "metricConsumedReadCapacityUnits", is_optional: false },
    :metric_consumed_write_capacity_units => { kind: :method, name: "metricConsumedWriteCapacityUnits", is_optional: false },
    :metric_successful_request_latency => { kind: :method, name: "metricSuccessfulRequestLatency", is_optional: false },
    :metric_system_errors => { kind: :method, name: "metricSystemErrors", is_optional: false },
    :metric_system_errors_for_operations => { kind: :method, name: "metricSystemErrorsForOperations", is_optional: false },
    :metric_throttled_requests => { kind: :method, name: "metricThrottledRequests", is_optional: false },
    :metric_throttled_requests_for_operation => { kind: :method, name: "metricThrottledRequestsForOperation", is_optional: false },
    :metric_throttled_requests_for_operations => { kind: :method, name: "metricThrottledRequestsForOperations", is_optional: false },
    :metric_user_errors => { kind: :method, name: "metricUserErrors", is_optional: false },
    :add_global_secondary_index => { kind: :method, name: "addGlobalSecondaryIndex", is_optional: false },
    :add_local_secondary_index => { kind: :method, name: "addLocalSecondaryIndex", is_optional: false },
    :add_replica => { kind: :method, name: "addReplica", is_optional: false },
    :add_to_stream_resource_policy => { kind: :method, name: "addToStreamResourcePolicy", is_optional: false },
    :replica => { kind: :method, name: "replica", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


230
231
232
# File 'dynamo_db/table_v2.rb', line 230

def self.PROPERTY_INJECTION_ID()
  Jsii::Kernel.instance.get_static("aws-cdk-lib.aws_dynamodb.TableV2", "PROPERTY_INJECTION_ID")
end

Instance Method Details

#add_global_secondary_index(props) ⇒ void

This method returns an undefined value.

Add a global secondary index to the table.

Note: Global secondary indexes will be inherited by all replica tables.

Parameters:



648
649
650
651
652
# File 'dynamo_db/table_v2.rb', line 648

def add_global_secondary_index(props)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::GlobalSecondaryIndexPropsV2.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuR2xvYmFsU2Vjb25kYXJ5SW5kZXhQcm9wc1YyIn0=")), "props")
  jsii_call_method("addGlobalSecondaryIndex", [props])
end

#add_local_secondary_index(props) ⇒ void

This method returns an undefined value.

Add a local secondary index to the table.

Note: Local secondary indexes will be inherited by all replica tables.

Parameters:



660
661
662
663
664
# File 'dynamo_db/table_v2.rb', line 660

def add_local_secondary_index(props)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::LocalSecondaryIndexProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuTG9jYWxTZWNvbmRhcnlJbmRleFByb3BzIn0=")), "props")
  jsii_call_method("addLocalSecondaryIndex", [props])
end

#add_replica(props) ⇒ void

This method returns an undefined value.

Add a replica table.

Note: Adding a replica table will allow you to use your table as a global table.

Parameters:



672
673
674
675
676
# File 'dynamo_db/table_v2.rb', line 672

def add_replica(props)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::ReplicaTableProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuUmVwbGljYVRhYmxlUHJvcHMifQ==")), "props")
  jsii_call_method("addReplica", [props])
end

#add_to_resource_policy(statement) ⇒ AWSCDK::IAM::AddToResourcePolicyResult

Adds a statement to the resource policy associated with this table.

A resource policy will be automatically created upon the first call to add_to_resource_policy.

Note that this does not work with imported tables.

Parameters:

Returns:



349
350
351
352
# File 'dynamo_db/table_v2.rb', line 349

def add_to_resource_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToResourcePolicy", [statement])
end

#add_to_stream_resource_policy(statement) ⇒ AWSCDK::IAM::AddToResourcePolicyResult

Adds a statement to the resource policy associated with this table's stream.

A stream resource policy will be automatically created upon the first call to add_to_stream_resource_policy.

Note that this does not work with imported tables.

Parameters:

Returns:



686
687
688
689
# File 'dynamo_db/table_v2.rb', line 686

def add_to_stream_resource_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToStreamResourcePolicy", [statement])
end

#apply_cross_stack_reference_strength(strength) ⇒ void

This method returns an undefined value.

Override the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.

Parameters:



284
285
286
287
# File 'dynamo_db/table_v2.rb', line 284

def apply_cross_stack_reference_strength(strength)
  Jsii::Type.check_type(strength, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZWZlcmVuY2VTdHJlbmd0aCJ9")), "strength")
  jsii_call_method("applyCrossStackReferenceStrength", [strength])
end

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



301
302
303
304
# File 'dynamo_db/table_v2.rb', line 301

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#encryption_keyAWSCDK::KMS::IKey?

The KMS encryption key for the table.

Returns:



197
198
199
# File 'dynamo_db/table_v2.rb', line 197

def encryption_key()
  jsii_get_property("encryptionKey")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



131
132
133
# File 'dynamo_db/table_v2.rb', line 131

def env()
  jsii_get_property("env")
end

#generate_physical_nameString

Returns:

  • (String)


307
308
309
# File 'dynamo_db/table_v2.rb', line 307

def generate_physical_name()
  jsii_call_method("generatePhysicalName", [])
end

#get_resource_arn_attribute(arn_attr, arn_components) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. bucket.bucketArn).

Normally, this token will resolve to arn_attr, but if the resource is referenced across environments, arn_components will be used to synthesize a concrete ARN with the resource's physical name. Make sure to reference this.physicalName in arn_components.

Parameters:

  • arn_attr (String)

    The CFN attribute which resolves to the ARN of the resource.

  • arn_components (AWSCDK::ARNComponents)

    The format of the ARN of this resource.

Returns:

  • (String)


321
322
323
324
325
326
# File 'dynamo_db/table_v2.rb', line 321

def get_resource_arn_attribute(arn_attr, arn_components)
  Jsii::Type.check_type(arn_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "arnAttr")
  arn_components = arn_components.is_a?(Hash) ? ::AWSCDK::ARNComponents.new(**arn_components.transform_keys(&:to_sym)) : arn_components
  Jsii::Type.check_type(arn_components, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5Bcm5Db21wb25lbnRzIn0=")), "arnComponents")
  jsii_call_method("getResourceArnAttribute", [arn_attr, arn_components])
end

#get_resource_name_attribute(name_attr) ⇒ String

Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. bucket.bucketName).

Normally, this token will resolve to name_attr, but if the resource is referenced across environments, it will be resolved to this.physicalName, which will be a concrete name.

Parameters:

  • name_attr (String)

    The CFN attribute which resolves to the resource's name.

Returns:

  • (String)


336
337
338
339
# File 'dynamo_db/table_v2.rb', line 336

def get_resource_name_attribute(name_attr)
  Jsii::Type.check_type(name_attr, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "nameAttr")
  jsii_call_method("getResourceNameAttribute", [name_attr])
end

#grant(grantee, *actions) ⇒ AWSCDK::IAM::Grant

Adds an IAM policy statement associated with this table to an IAM principal's policy.

Note: If encryption_key is present, appropriate grants to the key needs to be added separately using the table.encryptionKey.grant* methods.

[disable-awslint:no-grants]

Parameters:

  • grantee (AWSCDK::IAM::IGrantable)

    the principal (no-op if undefined).

  • actions (Array<String>)

    the set of actions to allow (i.e., 'dynamodb:PutItem', 'dynamodb:GetItem', etc.).

Returns:



364
365
366
367
368
369
370
# File 'dynamo_db/table_v2.rb', line 364

def grant(grantee, *actions)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  actions.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actions[#{index}]")
  end
  jsii_call_method("grant", [grantee, *actions])
end

#grant_full_access(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal to all DynamoDB operations ('dynamodb:*') on this table.

Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.

[disable-awslint:no-grants]

Parameters:

Returns:



381
382
383
384
# File 'dynamo_db/table_v2.rb', line 381

def grant_full_access(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantFullAccess", [grantee])
end

#grant_on_key(grantee, *actions) ⇒ AWSCDK::IAM::GrantOnKeyResult

Grants permissions on the table's encryption key.

Parameters:

  • grantee (AWSCDK::IAM::IGrantable)

    the principal to grant access to.

  • actions (Array<String>)

    the KMS actions to grant.

Returns:



391
392
393
394
395
396
397
# File 'dynamo_db/table_v2.rb', line 391

def grant_on_key(grantee, *actions)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  actions.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actions[#{index}]")
  end
  jsii_call_method("grantOnKey", [grantee, *actions])
end

#grant_read_data(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal all data read operations on this table.

Actions: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, DescribeTable.

Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.

[disable-awslint:no-grants]

Parameters:

Returns:



410
411
412
413
# File 'dynamo_db/table_v2.rb', line 410

def grant_read_data(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantReadData", [grantee])
end

#grant_read_write_data(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal to all data read/write operations on this table.

Actions: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable.

Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.

[disable-awslint:no-grants]

Parameters:

Returns:



427
428
429
430
# File 'dynamo_db/table_v2.rb', line 427

def grant_read_write_data(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantReadWriteData", [grantee])
end

#grant_stream(grantee, *actions) ⇒ AWSCDK::IAM::Grant

Adds an IAM policy statement associated with this table to an IAM principal's policy.

Note: If encryption_key is present, appropriate grants to the key needs to be added separately using the table.encryptionKey.grant* methods.

[disable-awslint:no-grants]

Parameters:

  • grantee (AWSCDK::IAM::IGrantable)

    the principal (no-op if undefined).

  • actions (Array<String>)

    the set of actions to allow (i.e., 'dynamodb:DescribeStream', 'dynamodb:GetRecords', etc.).

Returns:



442
443
444
445
446
447
448
# File 'dynamo_db/table_v2.rb', line 442

def grant_stream(grantee, *actions)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  actions.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "actions[#{index}]")
  end
  jsii_call_method("grantStream", [grantee, *actions])
end

#grant_stream_read(grantee) ⇒ AWSCDK::IAM::Grant

Adds an IAM policy statement associated with this table to an IAM principal's policy.

Actions: DescribeStream, GetRecords, GetShardIterator, ListStreams.

Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.

[disable-awslint:no-grants]

Parameters:

Returns:



461
462
463
464
# File 'dynamo_db/table_v2.rb', line 461

def grant_stream_read(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantStreamRead", [grantee])
end

#grant_table_list_streams(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal to list streams attached to this table.

[disable-awslint:no-grants]

Parameters:

Returns:



472
473
474
475
# File 'dynamo_db/table_v2.rb', line 472

def grant_table_list_streams(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantTableListStreams", [grantee])
end

#grant_write_data(grantee) ⇒ AWSCDK::IAM::Grant

Permits an IAM principal all data write operations on this table.

Actions: BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable.

Note: Appropriate grants will also be added to the customer-managed KMS keys associated with this table if one was configured.

[disable-awslint:no-grants]

Parameters:

Returns:



488
489
490
491
# File 'dynamo_db/table_v2.rb', line 488

def grant_write_data(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantWriteData", [grantee])
end

#grantsAWSCDK::DynamoDB::TableGrants

Grants for this table.



159
160
161
# File 'dynamo_db/table_v2.rb', line 159

def grants()
  jsii_get_property("grants")
end

#has_indexBoolean

Returns:

  • (Boolean)


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

def has_index()
  jsii_get_property("hasIndex")
end

#metric(metric_name, props = nil) ⇒ AWSCDK::CloudWatch::Metric

Return the given named metric for this table.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



501
502
503
504
505
506
# File 'dynamo_db/table_v2.rb', line 501

def metric(metric_name, props = nil)
  Jsii::Type.check_type(metric_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "metricName")
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metric", [metric_name, props])
end

#metric_conditional_check_failed_requests(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Metric for the conditional check failed requests for this table.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



515
516
517
518
519
# File 'dynamo_db/table_v2.rb', line 515

def metric_conditional_check_failed_requests(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricConditionalCheckFailedRequests", [props])
end

#metric_consumed_read_capacity_units(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Metric for the consumed read capacity units for this table.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



528
529
530
531
532
# File 'dynamo_db/table_v2.rb', line 528

def metric_consumed_read_capacity_units(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricConsumedReadCapacityUnits", [props])
end

#metric_consumed_write_capacity_units(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Metric for the consumed write capacity units for this table.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



541
542
543
544
545
# File 'dynamo_db/table_v2.rb', line 541

def metric_consumed_write_capacity_units(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricConsumedWriteCapacityUnits", [props])
end

#metric_successful_request_latency(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Metric for the successful request latency for this table.

By default, the metric will be calculated as an average over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



554
555
556
557
558
# File 'dynamo_db/table_v2.rb', line 554

def metric_successful_request_latency(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricSuccessfulRequestLatency", [props])
end

#metric_system_errors(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Deprecated.

use metricSystemErrorsForOperations.

Metric for the system errors this table.

Parameters:

Returns:



565
566
567
568
569
# File 'dynamo_db/table_v2.rb', line 565

def metric_system_errors(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricSystemErrors", [props])
end

#metric_system_errors_for_operations(props = nil) ⇒ AWSCDK::CloudWatch::IMetric

Metric for the system errors for this table. This will sum errors across all possible operations.

By default, each individual metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



578
579
580
581
582
# File 'dynamo_db/table_v2.rb', line 578

def metric_system_errors_for_operations(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::SystemErrorsForOperationsMetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuU3lzdGVtRXJyb3JzRm9yT3BlcmF0aW9uc01ldHJpY09wdGlvbnMifQ==")), "props") unless props.nil?
  jsii_call_method("metricSystemErrorsForOperations", [props])
end

#metric_throttled_requests(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Deprecated.

Do not use this function. It returns an invalid metric. Use metricThrottledRequestsForOperation instead.

How many requests are throttled on this table.

By default, each individual metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



592
593
594
595
596
# File 'dynamo_db/table_v2.rb', line 592

def metric_throttled_requests(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricThrottledRequests", [props])
end

#metric_throttled_requests_for_operation(operation, props = nil) ⇒ AWSCDK::CloudWatch::IMetric

How many requests are throttled on this table for the given operation.

By default, the metric will be calculated as an average over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



606
607
608
609
610
611
# File 'dynamo_db/table_v2.rb', line 606

def metric_throttled_requests_for_operation(operation, props = nil)
  Jsii::Type.check_type(operation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "operation")
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::OperationsMetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuT3BlcmF0aW9uc01ldHJpY09wdGlvbnMifQ==")), "props") unless props.nil?
  jsii_call_method("metricThrottledRequestsForOperation", [operation, props])
end

#metric_throttled_requests_for_operations(props = nil) ⇒ AWSCDK::CloudWatch::IMetric

How many requests are throttled on this table. This will sum errors across all possible operations.

By default, each individual metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



620
621
622
623
624
# File 'dynamo_db/table_v2.rb', line 620

def metric_throttled_requests_for_operations(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::OperationsMetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuT3BlcmF0aW9uc01ldHJpY09wdGlvbnMifQ==")), "props") unless props.nil?
  jsii_call_method("metricThrottledRequestsForOperations", [props])
end

#metric_user_errors(props = nil) ⇒ AWSCDK::CloudWatch::Metric

Metric for the user errors for this table.

Note: This metric reports user errors across all the tables in the account and region the table resides in.

By default, the metric will be calculated as a sum over a period of 5 minutes. You can customize this by using the statistic and period properties.

Parameters:

Returns:



636
637
638
639
640
# File 'dynamo_db/table_v2.rb', line 636

def metric_user_errors(props = nil)
  props = props.is_a?(Hash) ? ::AWSCDK::CloudWatch::MetricOptions.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfY2xvdWR3YXRjaC5NZXRyaWNPcHRpb25zIn0=")), "props") unless props.nil?
  jsii_call_method("metricUserErrors", [props])
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


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

def node()
  jsii_get_property("node")
end

#physical_nameString

Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.

This value will resolve to one of the following:

  • a concrete value (e.g. "my-awesome-bucket")
  • undefined, when a name should be generated by CloudFormation
  • a concrete name generated automatically during synthesis, in cross-environment scenarios.

Returns:

  • (String)


145
146
147
# File 'dynamo_db/table_v2.rb', line 145

def physical_name()
  jsii_get_property("physicalName")
end

#regionString

Returns:

  • (String)


169
170
171
# File 'dynamo_db/table_v2.rb', line 169

def region()
  jsii_get_property("region")
end

#replica(region) ⇒ AWSCDK::DynamoDB::ITableV2

Retrieve a replica table.

Note: Replica tables are not supported in a region agnostic stack.

Parameters:

  • region (String)

    the region of the replica table.

Returns:



697
698
699
700
# File 'dynamo_db/table_v2.rb', line 697

def replica(region)
  Jsii::Type.check_type(region, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "region")
  jsii_call_method("replica", [region])
end

#resource_policyAWSCDK::IAM::PolicyDocument?

The resource policy for the table.

Returns:



218
219
220
# File 'dynamo_db/table_v2.rb', line 218

def resource_policy()
  jsii_get_property("resourcePolicy")
end

#resource_policy=(value) ⇒ Object



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

def resource_policy=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeURvY3VtZW50In0=")), "resourcePolicy") unless value.nil?
  jsii_set_property("resourcePolicy", value)
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



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

def stack()
  jsii_get_property("stack")
end

#stream_resource_policyAWSCDK::IAM::PolicyDocument?

Resource policy associated with this table's stream.

Returns:



242
243
244
# File 'dynamo_db/table_v2.rb', line 242

def stream_resource_policy()
  jsii_get_property("streamResourcePolicy")
end

#stream_resource_policy=(value) ⇒ Object



246
247
248
249
# File 'dynamo_db/table_v2.rb', line 246

def stream_resource_policy=(value)
  Jsii::Type.check_type(value, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeURvY3VtZW50In0=")), "streamResourcePolicy") unless value.nil?
  jsii_set_property("streamResourcePolicy", value)
end

#table_arnString

The ARN of the table.

Returns:

  • (String)


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

def table_arn()
  jsii_get_property("tableArn")
end

#table_idString?

The ID of the table.

Returns:

  • (String, nil)


204
205
206
# File 'dynamo_db/table_v2.rb', line 204

def table_id()
  jsii_get_property("tableId")
end

#table_nameString

The name of the table.

Returns:

  • (String)


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

def table_name()
  jsii_get_property("tableName")
end

#table_refAWSCDK::Interfaces::AWSDynamodb::TableReference

A reference to this table.



190
191
192
# File 'dynamo_db/table_v2.rb', line 190

def table_ref()
  jsii_get_property("tableRef")
end

#table_stream_arnString?

The stream ARN of the table.

Returns:

  • (String, nil)


211
212
213
# File 'dynamo_db/table_v2.rb', line 211

def table_stream_arn()
  jsii_get_property("tableStreamArn")
end

#tagsAWSCDK::TagManager

Returns:



235
236
237
# File 'dynamo_db/table_v2.rb', line 235

def tags()
  jsii_get_property("tags")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


254
255
256
# File 'dynamo_db/table_v2.rb', line 254

def to_string()
  jsii_call_method("toString", [])
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

Parameters:

  • mixins (Array<Constructs::IMixin>)

Returns:

  • (Constructs::IConstruct)


267
268
269
270
271
272
# File 'dynamo_db/table_v2.rb', line 267

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end