Class: AWSCDK::DynamoDB::Table

Inherits:
TableBase
  • Object
show all
Defined in:
dynamo_db/table.rb

Overview

Provides a DynamoDB table.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope, id, props) ⇒ Table

Returns a new instance of Table.

Parameters:



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

def initialize(scope, id, props)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::TableProps.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("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuVGFibGVQcm9wcyJ9")), "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::ITable

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:



81
82
83
84
85
86
# File 'dynamo_db/table.rb', line 81

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.Table", "fromTableArn", [scope, id, table_arn])
end

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

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::TableAttributes)

    A TableAttributes object.

Returns:



94
95
96
97
98
99
100
# File 'dynamo_db/table.rb', line 94

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::TableAttributes.new(**attrs.transform_keys(&:to_sym)) : attrs
  Jsii::Type.check_type(attrs, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuVGFibGVBdHRyaWJ1dGVzIn0=")), "attrs")
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_dynamodb.Table", "fromTableAttributes", [scope, id, attrs])
end

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

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:



108
109
110
111
112
113
# File 'dynamo_db/table.rb', line 108

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.Table", "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
72
73
# File 'dynamo_db/table.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 },
    :regional_arns => { kind: :property, name: "regionalArns", is_optional: false },
    :stream_grants => { kind: :property, name: "streamGrants", 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 },
    :regions => { kind: :property, name: "regions", is_optional: true },
    :table_stream_arn => { kind: :property, name: "tableStreamArn", is_optional: true },
    :resource_policy => { kind: :property, name: "resourcePolicy", 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 },
    :auto_scale_global_secondary_index_read_capacity => { kind: :method, name: "autoScaleGlobalSecondaryIndexReadCapacity", is_optional: false },
    :auto_scale_global_secondary_index_write_capacity => { kind: :method, name: "autoScaleGlobalSecondaryIndexWriteCapacity", is_optional: false },
    :auto_scale_read_capacity => { kind: :method, name: "autoScaleReadCapacity", is_optional: false },
    :auto_scale_write_capacity => { kind: :method, name: "autoScaleWriteCapacity", is_optional: false },
    :schema => { kind: :method, name: "schema", is_optional: false },
    :schema_v2 => { kind: :method, name: "schemaV2", is_optional: false },
  }
end

.PROPERTY_INJECTION_IDString

Uniquely identifies this class.

Returns:

  • (String)


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

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

Instance Method Details

#add_global_secondary_index(props) ⇒ void

This method returns an undefined value.

Add a global secondary index of table.

Parameters:



652
653
654
655
656
# File 'dynamo_db/table.rb', line 652

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

#add_local_secondary_index(props) ⇒ void

This method returns an undefined value.

Add a local secondary index of table.

Parameters:



662
663
664
665
666
# File 'dynamo_db/table.rb', line 662

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_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:



348
349
350
351
# File 'dynamo_db/table.rb', line 348

def add_to_resource_policy(statement)
  Jsii::Type.check_type(statement, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLlBvbGljeVN0YXRlbWVudCJ9")), "statement")
  jsii_call_method("addToResourcePolicy", [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:



283
284
285
286
# File 'dynamo_db/table.rb', line 283

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:



300
301
302
303
# File 'dynamo_db/table.rb', line 300

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

#auto_scale_global_secondary_index_read_capacity(index_name, props) ⇒ AWSCDK::DynamoDB::IScalableTableAttribute

Enable read capacity scaling for the given GSI.

Parameters:

Returns:



673
674
675
676
677
678
# File 'dynamo_db/table.rb', line 673

def auto_scale_global_secondary_index_read_capacity(index_name, props)
  Jsii::Type.check_type(index_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "indexName")
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::EnableScalingProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuRW5hYmxlU2NhbGluZ1Byb3BzIn0=")), "props")
  jsii_call_method("autoScaleGlobalSecondaryIndexReadCapacity", [index_name, props])
end

#auto_scale_global_secondary_index_write_capacity(index_name, props) ⇒ AWSCDK::DynamoDB::IScalableTableAttribute

Enable write capacity scaling for the given GSI.

Parameters:

Returns:



685
686
687
688
689
690
# File 'dynamo_db/table.rb', line 685

def auto_scale_global_secondary_index_write_capacity(index_name, props)
  Jsii::Type.check_type(index_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "indexName")
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::EnableScalingProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuRW5hYmxlU2NhbGluZ1Byb3BzIn0=")), "props")
  jsii_call_method("autoScaleGlobalSecondaryIndexWriteCapacity", [index_name, props])
end

#auto_scale_read_capacity(props) ⇒ AWSCDK::DynamoDB::IScalableTableAttribute

Enable read capacity scaling for this table.

Parameters:

Returns:



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

def auto_scale_read_capacity(props)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::EnableScalingProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuRW5hYmxlU2NhbGluZ1Byb3BzIn0=")), "props")
  jsii_call_method("autoScaleReadCapacity", [props])
end

#auto_scale_write_capacity(props) ⇒ AWSCDK::DynamoDB::IScalableTableAttribute

Enable write capacity scaling for this table.

Parameters:

Returns:



706
707
708
709
710
# File 'dynamo_db/table.rb', line 706

def auto_scale_write_capacity(props)
  props = props.is_a?(Hash) ? ::AWSCDK::DynamoDB::EnableScalingProps.new(**props.transform_keys(&:to_sym)) : props
  Jsii::Type.check_type(props, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfZHluYW1vZGIuRW5hYmxlU2NhbGluZ1Byb3BzIn0=")), "props")
  jsii_call_method("autoScaleWriteCapacity", [props])
end

#encryption_keyAWSCDK::KMS::IKey?

KMS encryption key, if this table uses a customer-managed encryption key.

Returns:



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

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.



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

def env()
  jsii_get_property("env")
end

#generate_physical_nameString

Returns:

  • (String)


306
307
308
# File 'dynamo_db/table.rb', line 306

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)


320
321
322
323
324
325
# File 'dynamo_db/table.rb', line 320

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)


335
336
337
338
# File 'dynamo_db/table.rb', line 335

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.

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", ...).

Returns:



362
363
364
365
366
367
368
# File 'dynamo_db/table.rb', line 362

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 all DynamoDB operations ("dynamodb:*") to an IAM principal.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

The use of this method is discouraged. Please use grants.fullAccess() instead.

[disable-awslint:no-grants]

Parameters:

Returns:



381
382
383
384
# File 'dynamo_db/table.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

Gives permissions to a grantable entity to perform actions on the encryption key.

Parameters:

Returns:



391
392
393
394
395
396
397
# File 'dynamo_db/table.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 from this table: BatchGetItem, GetRecords, GetShardIterator, Query, GetItem, Scan, DescribeTable.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

The use of this method is discouraged. Please use grants.readData() instead.

[disable-awslint:no-grants]

Parameters:

Returns:



410
411
412
413
# File 'dynamo_db/table.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 to this table.

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

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

The use of this method is discouraged. Please use grants.readWriteData() instead.

[disable-awslint:no-grants]

Parameters:

Returns:



429
430
431
432
# File 'dynamo_db/table.rb', line 429

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's stream to an IAM principal's policy.

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

The use of this method is discouraged. Please use streamGrants.stream() instead.

[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", ...).

Returns:



446
447
448
449
450
451
452
# File 'dynamo_db/table.rb', line 446

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

Permits an IAM principal all stream data read operations for this table's stream: DescribeStream, GetRecords, GetShardIterator, ListStreams.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

The use of this method is discouraged. Please use streamGrants.streamRead() instead.

[disable-awslint:no-grants]

Parameters:

Returns:



465
466
467
468
# File 'dynamo_db/table.rb', line 465

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 current dynamodb table.

The use of this method is discouraged. Please use streamGrants.tableListStreams() instead.

[disable-awslint:no-grants]

Parameters:

Returns:



478
479
480
481
# File 'dynamo_db/table.rb', line 478

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 to this table: BatchWriteItem, PutItem, UpdateItem, DeleteItem, DescribeTable.

Appropriate grants will also be added to the customer-managed KMS key if one was configured.

The use of this method is discouraged. Please use grants.writeData() instead.

[disable-awslint:no-grants]

Parameters:

Returns:



494
495
496
497
# File 'dynamo_db/table.rb', line 494

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

Grant a predefined set of permissions on this Table.



161
162
163
# File 'dynamo_db/table.rb', line 161

def grants()
  jsii_get_property("grants")
end

#has_indexBoolean

Whether this table has indexes.

Returns:

  • (Boolean)


168
169
170
# File 'dynamo_db/table.rb', line 168

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:



507
508
509
510
511
512
# File 'dynamo_db/table.rb', line 507

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 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:



521
522
523
524
525
# File 'dynamo_db/table.rb', line 521

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 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:



534
535
536
537
538
# File 'dynamo_db/table.rb', line 534

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 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:



547
548
549
550
551
# File 'dynamo_db/table.rb', line 547

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 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:



560
561
562
563
564
# File 'dynamo_db/table.rb', line 560

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:



571
572
573
574
575
# File 'dynamo_db/table.rb', line 571

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 this table.

This will sum errors across all possible operations. Note that 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:



585
586
587
588
589
# File 'dynamo_db/table.rb', line 585

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.

Default: sum over 5 minutes

Parameters:

Returns:



598
599
600
601
602
# File 'dynamo_db/table.rb', line 598

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::Metric

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

Default: sum over 5 minutes

Parameters:

Returns:



611
612
613
614
615
616
# File 'dynamo_db/table.rb', line 611

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::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("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. Note that 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:



626
627
628
629
630
# File 'dynamo_db/table.rb', line 626

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.

Note that 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:



642
643
644
645
646
# File 'dynamo_db/table.rb', line 642

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)


118
119
120
# File 'dynamo_db/table.rb', line 118

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)


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

def physical_name()
  jsii_get_property("physicalName")
end

#regional_arnsArray<String>

Deprecated.

This member is still filled but it is not read

Returns:

  • (Array<String>)


174
175
176
# File 'dynamo_db/table.rb', line 174

def regional_arns()
  jsii_get_property("regionalArns")
end

#regionsArray<String>?

Additional regions other than the main one that this table is replicated to.

Returns:

  • (Array<String>, nil)


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

def regions()
  jsii_get_property("regions")
end

#resource_policyAWSCDK::IAM::PolicyDocument?

Note:

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

Resource policy to assign to DynamoDB Table.



234
235
236
# File 'dynamo_db/table.rb', line 234

def resource_policy()
  jsii_get_property("resourcePolicy")
end

#resource_policy=(value) ⇒ Object



238
239
240
241
# File 'dynamo_db/table.rb', line 238

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

#schema(index_name = nil) ⇒ AWSCDK::DynamoDB::SchemaOptions

Deprecated.
  • use schemaV2() instead

Get schema attributes of table or index.

Parameters:

  • index_name (String, nil) (defaults to: nil)

Returns:



717
718
719
720
# File 'dynamo_db/table.rb', line 717

def schema(index_name = nil)
  Jsii::Type.check_type(index_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "indexName") unless index_name.nil?
  jsii_call_method("schema", [index_name])
end

#schema_v2(index_name = nil) ⇒ AWSCDK::DynamoDB::KeySchema

Get schema attributes of table or index.

Parameters:

  • index_name (String, nil) (defaults to: nil)

Returns:



726
727
728
729
# File 'dynamo_db/table.rb', line 726

def schema_v2(index_name = nil)
  Jsii::Type.check_type(index_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "indexName") unless index_name.nil?
  jsii_call_method("schemaV2", [index_name])
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



154
155
156
# File 'dynamo_db/table.rb', line 154

def stack()
  jsii_get_property("stack")
end

#stream_grantsAWSCDK::DynamoDB::StreamGrants

Grant a predefined set of permissions on this Table's Stream, if present.

Will throw if the Table has not been configured for streaming.



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

def stream_grants()
  jsii_get_property("streamGrants")
end

#table_arnString

Arn of the dynamodb table.

Returns:

  • (String)


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

def table_arn()
  jsii_get_property("tableArn")
end

#table_nameString

Table name of the dynamodb table.

Returns:

  • (String)


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

def table_name()
  jsii_get_property("tableName")
end

#table_refAWSCDK::Interfaces::AWSDynamodb::TableReference

A reference to a Table resource.



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

def table_ref()
  jsii_get_property("tableRef")
end

#table_stream_arnString?

ARN of the table's stream, if there is one.

Returns:

  • (String, nil)


225
226
227
# File 'dynamo_db/table.rb', line 225

def table_stream_arn()
  jsii_get_property("tableStreamArn")
end

#to_stringString

Returns a string representation of this construct.

Returns:

  • (String)


253
254
255
# File 'dynamo_db/table.rb', line 253

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)


266
267
268
269
270
271
# File 'dynamo_db/table.rb', line 266

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