Class: AWSCDK::IoT::CfnTopicRule::DynamoDBActionProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
io_t/cfn_topic_rule.rb

Overview

Describes an action to write to a DynamoDB table.

The table_name , hash_key_field , and range_key_field values must match the values used when you created the table.

The hash_key_value and range_keyvalue fields use a substitution template syntax. These templates provide data at runtime. The syntax is as follows: ${ sql-expression }.

You can specify any valid expression in a WHERE or SELECT clause, including JSON properties, comparisons, calculations, and functions. For example, the following field uses the third level of the topic:

"hashKeyValue": "${topic(3)}"

The following field uses the timestamp:

"rangeKeyValue": "${timestamp()}"

For more information, see DynamoDBv2 Action in the AWS IoT Developer Guide .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash_key_field:, hash_key_value:, role_arn:, table_name:, hash_key_type: nil, payload_field: nil, range_key_field: nil, range_key_type: nil, range_key_value: nil) ⇒ DynamoDBActionProperty

Returns a new instance of DynamoDBActionProperty.

Parameters:

  • hash_key_field (String)

    The hash key name.

  • hash_key_value (String)

    The hash key value.

  • role_arn (String)

    The ARN of the IAM role that grants access to the DynamoDB table.

  • table_name (String)

    The name of the DynamoDB table.

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

    The hash key type.

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

    The action payload.

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

    The range key name.

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

    The range key type.

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

    The range key value.



1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
# File 'io_t/cfn_topic_rule.rb', line 1268

def initialize(hash_key_field:, hash_key_value:, role_arn:, table_name:, hash_key_type: nil, payload_field: nil, range_key_field: nil, range_key_type: nil, range_key_value: nil)
  @hash_key_field = hash_key_field
  Jsii::Type.check_type(@hash_key_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "hashKeyField")
  @hash_key_value = hash_key_value
  Jsii::Type.check_type(@hash_key_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "hashKeyValue")
  @role_arn = role_arn
  Jsii::Type.check_type(@role_arn, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "roleArn")
  @table_name = table_name
  Jsii::Type.check_type(@table_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tableName")
  @hash_key_type = hash_key_type
  Jsii::Type.check_type(@hash_key_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "hashKeyType") unless @hash_key_type.nil?
  @payload_field = payload_field
  Jsii::Type.check_type(@payload_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "payloadField") unless @payload_field.nil?
  @range_key_field = range_key_field
  Jsii::Type.check_type(@range_key_field, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "rangeKeyField") unless @range_key_field.nil?
  @range_key_type = range_key_type
  Jsii::Type.check_type(@range_key_type, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "rangeKeyType") unless @range_key_type.nil?
  @range_key_value = range_key_value
  Jsii::Type.check_type(@range_key_value, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "rangeKeyValue") unless @range_key_value.nil?
end

Instance Attribute Details

#hash_key_fieldString (readonly)

The hash key name.



1293
1294
1295
# File 'io_t/cfn_topic_rule.rb', line 1293

def hash_key_field
  @hash_key_field
end

#hash_key_typeString? (readonly)

The hash key type.

Valid values are "STRING" or "NUMBER"



1315
1316
1317
# File 'io_t/cfn_topic_rule.rb', line 1315

def hash_key_type
  @hash_key_type
end

#hash_key_valueString (readonly)

The hash key value.



1298
1299
1300
# File 'io_t/cfn_topic_rule.rb', line 1298

def hash_key_value
  @hash_key_value
end

#payload_fieldString? (readonly)

The action payload.

This name can be customized.



1322
1323
1324
# File 'io_t/cfn_topic_rule.rb', line 1322

def payload_field
  @payload_field
end

#range_key_fieldString? (readonly)

The range key name.



1327
1328
1329
# File 'io_t/cfn_topic_rule.rb', line 1327

def range_key_field
  @range_key_field
end

#range_key_typeString? (readonly)

The range key type.

Valid values are "STRING" or "NUMBER"



1334
1335
1336
# File 'io_t/cfn_topic_rule.rb', line 1334

def range_key_type
  @range_key_type
end

#range_key_valueString? (readonly)

The range key value.



1339
1340
1341
# File 'io_t/cfn_topic_rule.rb', line 1339

def range_key_value
  @range_key_value
end

#role_arnString (readonly)

The ARN of the IAM role that grants access to the DynamoDB table.



1303
1304
1305
# File 'io_t/cfn_topic_rule.rb', line 1303

def role_arn
  @role_arn
end

#table_nameString (readonly)

The name of the DynamoDB table.



1308
1309
1310
# File 'io_t/cfn_topic_rule.rb', line 1308

def table_name
  @table_name
end

Class Method Details

.jsii_propertiesObject



1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
# File 'io_t/cfn_topic_rule.rb', line 1341

def self.jsii_properties
  {
    :hash_key_field => "hashKeyField",
    :hash_key_value => "hashKeyValue",
    :role_arn => "roleArn",
    :table_name => "tableName",
    :hash_key_type => "hashKeyType",
    :payload_field => "payloadField",
    :range_key_field => "rangeKeyField",
    :range_key_type => "rangeKeyType",
    :range_key_value => "rangeKeyValue",
  }
end

Instance Method Details

#to_jsiiObject



1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
# File 'io_t/cfn_topic_rule.rb', line 1355

def to_jsii
  result = {}
  result.merge!({
    "hashKeyField" => @hash_key_field,
    "hashKeyValue" => @hash_key_value,
    "roleArn" => @role_arn,
    "tableName" => @table_name,
    "hashKeyType" => @hash_key_type,
    "payloadField" => @payload_field,
    "rangeKeyField" => @range_key_field,
    "rangeKeyType" => @range_key_type,
    "rangeKeyValue" => @range_key_value,
  })
  result.compact
end