Module: AWSCDK::DynamoDB::ITable

Includes:
IResource, Interfaces::AWSDynamodb::ITableRef
Included in:
ITableV2, TableBase
Defined in:
dynamo_db/i_table.rb

Overview

An interface that represents a DynamoDB Table - either created with the CDK, or an existing one.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'dynamo_db/i_table.rb', line 301

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :table_ref => { kind: :property, name: "tableRef", is_optional: false },
    :table_arn => { kind: :property, name: "tableArn", is_optional: false },
    :table_name => { kind: :property, name: "tableName", is_optional: false },
    :encryption_key => { kind: :property, name: "encryptionKey", is_optional: true },
    :table_stream_arn => { kind: :property, name: "tableStreamArn", is_optional: true },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
    :grant => { kind: :method, name: "grant", is_optional: false },
    :grant_full_access => { kind: :method, name: "grantFullAccess", 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_for_operations => { kind: :method, name: "metricSystemErrorsForOperations", is_optional: false },
    :metric_throttled_requests => { kind: :method, name: "metricThrottledRequests", 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 },
  }
end

Instance Method Details

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



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

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?

Optional KMS encryption key associated with this table.

Returns:



62
63
64
# File 'dynamo_db/i_table.rb', line 62

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.



27
28
29
# File 'dynamo_db/i_table.rb', line 27

def env()
  jsii_get_property("env")
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.

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:



112
113
114
115
116
117
118
# File 'dynamo_db/i_table.rb', line 112

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.

Parameters:

Returns:



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

def grant_full_access(grantee)
  Jsii::Type.check_type(grantee, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfaWFtLklHcmFudGFibGUifQ==")), "grantee")
  jsii_call_method("grantFullAccess", [grantee])
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.

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

Parameters:

Returns:



139
140
141
142
# File 'dynamo_db/i_table.rb', line 139

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

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

Parameters:

Returns:



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

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.

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:



167
168
169
170
171
172
173
# File 'dynamo_db/i_table.rb', line 167

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.

Parameters:

Returns:



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

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.

Parameters:

Returns:



191
192
193
194
# File 'dynamo_db/i_table.rb', line 191

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.

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

Parameters:

Returns:



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

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

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

Metric for the number of Errors executing all Lambdas.

Parameters:

Returns:



213
214
215
216
217
218
# File 'dynamo_db/i_table.rb', line 213

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.

Parameters:

Returns:



224
225
226
227
228
# File 'dynamo_db/i_table.rb', line 224

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.

Parameters:

Returns:



234
235
236
237
238
# File 'dynamo_db/i_table.rb', line 234

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.

Parameters:

Returns:



244
245
246
247
248
# File 'dynamo_db/i_table.rb', line 244

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.

Parameters:

Returns:



254
255
256
257
258
# File 'dynamo_db/i_table.rb', line 254

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_for_operations(props = nil) ⇒ AWSCDK::CloudWatch::IMetric

Metric for the system errors this table.

Parameters:

Returns:



264
265
266
267
268
# File 'dynamo_db/i_table.rb', line 264

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.

use metricThrottledRequestsForOperations

Metric for throttled requests.

Parameters:

Returns:



275
276
277
278
279
# File 'dynamo_db/i_table.rb', line 275

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_operations(props = nil) ⇒ AWSCDK::CloudWatch::IMetric

Metric for throttled requests.

Parameters:

Returns:



285
286
287
288
289
# File 'dynamo_db/i_table.rb', line 285

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.

Parameters:

Returns:



295
296
297
298
299
# File 'dynamo_db/i_table.rb', line 295

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)


12
13
14
# File 'dynamo_db/i_table.rb', line 12

def node()
  jsii_get_property("node")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



34
35
36
# File 'dynamo_db/i_table.rb', line 34

def stack()
  jsii_get_property("stack")
end

#table_arnString

Arn of the dynamodb table.

Returns:

  • (String)


48
49
50
# File 'dynamo_db/i_table.rb', line 48

def table_arn()
  jsii_get_property("tableArn")
end

#table_nameString

Table name of the dynamodb table.

Returns:

  • (String)


55
56
57
# File 'dynamo_db/i_table.rb', line 55

def table_name()
  jsii_get_property("tableName")
end

#table_refAWSCDK::Interfaces::AWSDynamodb::TableReference

A reference to a Table resource.



41
42
43
# File 'dynamo_db/i_table.rb', line 41

def table_ref()
  jsii_get_property("tableRef")
end

#table_stream_arnString?

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

Returns:

  • (String, nil)


69
70
71
# File 'dynamo_db/i_table.rb', line 69

def table_stream_arn()
  jsii_get_property("tableStreamArn")
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.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



80
81
82
83
84
85
# File 'dynamo_db/i_table.rb', line 80

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