Module: AWSCDK::DynamoDB::ITableV2

Includes:
ITable
Included in:
TableBaseV2
Defined in:
dynamo_db/i_table_v2.rb

Overview

Represents an instance of a DynamoDB table.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'dynamo_db/i_table_v2.rb', line 314

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 },
    :grants => { kind: :property, name: "grants", is_optional: false },
    :table_id => { kind: :property, name: "tableId", 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:



112
113
114
115
# File 'dynamo_db/i_table_v2.rb', line 112

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:



61
62
63
# File 'dynamo_db/i_table_v2.rb', line 61

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.



26
27
28
# File 'dynamo_db/i_table_v2.rb', line 26

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:



125
126
127
128
129
130
131
# File 'dynamo_db/i_table_v2.rb', line 125

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:



140
141
142
143
# File 'dynamo_db/i_table_v2.rb', line 140

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:



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

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:



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

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:



180
181
182
183
184
185
186
# File 'dynamo_db/i_table_v2.rb', line 180

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:



195
196
197
198
# File 'dynamo_db/i_table_v2.rb', line 195

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:



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

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:



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

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.



75
76
77
# File 'dynamo_db/i_table_v2.rb', line 75

def grants()
  jsii_get_property("grants")
end

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

Metric for the number of Errors executing all Lambdas.

Parameters:

Returns:



226
227
228
229
230
231
# File 'dynamo_db/i_table_v2.rb', line 226

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:



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

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:



247
248
249
250
251
# File 'dynamo_db/i_table_v2.rb', line 247

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:



257
258
259
260
261
# File 'dynamo_db/i_table_v2.rb', line 257

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:



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

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:



277
278
279
280
281
# File 'dynamo_db/i_table_v2.rb', line 277

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:



288
289
290
291
292
# File 'dynamo_db/i_table_v2.rb', line 288

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:



298
299
300
301
302
# File 'dynamo_db/i_table_v2.rb', line 298

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:



308
309
310
311
312
# File 'dynamo_db/i_table_v2.rb', line 308

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)


11
12
13
# File 'dynamo_db/i_table_v2.rb', line 11

def node()
  jsii_get_property("node")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



33
34
35
# File 'dynamo_db/i_table_v2.rb', line 33

def stack()
  jsii_get_property("stack")
end

#table_arnString

Arn of the dynamodb table.

Returns:

  • (String)


47
48
49
# File 'dynamo_db/i_table_v2.rb', line 47

def table_arn()
  jsii_get_property("tableArn")
end

#table_idString?

The ID of the table.

Returns:

  • (String, nil)


82
83
84
# File 'dynamo_db/i_table_v2.rb', line 82

def table_id()
  jsii_get_property("tableId")
end

#table_nameString

Table name of the dynamodb table.

Returns:

  • (String)


54
55
56
# File 'dynamo_db/i_table_v2.rb', line 54

def table_name()
  jsii_get_property("tableName")
end

#table_refAWSCDK::Interfaces::AWSDynamodb::TableReference

A reference to a Table resource.



40
41
42
# File 'dynamo_db/i_table_v2.rb', line 40

def table_ref()
  jsii_get_property("tableRef")
end

#table_stream_arnString?

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

Returns:

  • (String, nil)


68
69
70
# File 'dynamo_db/i_table_v2.rb', line 68

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



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

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