Class: AWSCDK::IoTEvents::CfnAlarmModel::DynamoDBProperty
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::IoTEvents::CfnAlarmModel::DynamoDBProperty
- Defined in:
- io_t_events/cfn_alarm_model.rb
Overview
Defines an action to write to the Amazon DynamoDB table that you created.
The standard action payload contains all the information about the detector model instance and the event that triggered the action. You can customize the payload . One column of the DynamoDB table receives all attribute-value pairs in the payload that you specify.
You must use expressions for all parameters in DynamoDBAction . The expressions accept literals, operators, functions, references, and substitution templates.
Examples - For literal values, the expressions must contain single quotes. For example, the value for the hash_key_type parameter can be 'STRING' .
- For references, you must specify either variables or input values. For example, the value for the
hash_key_fieldparameter can be$input.GreenhouseInput.name. - For a substitution template, you must use
${}, and the template must be in single quotes. A substitution template can also contain a combination of literals, operators, functions, references, and substitution templates.
In the following example, the value for the hash_key_value parameter uses a substitution template.
'${$input.GreenhouseInput.temperature * 6 / 5 + 32} in Fahrenheit'
- For a string concatenation, you must use
+. A string concatenation can also contain a combination of literals, operators, functions, references, and substitution templates.
In the following example, the value for the table_name parameter uses a string concatenation.
'GreenhouseTemperatureTable ' + $input.GreenhouseInput.date
For more information, see Expressions in the AWS IoT Events Developer Guide .
If the defined payload type is a string, DynamoDBAction writes non-JSON data to the DynamoDB table as binary data. The DynamoDB console displays the data as Base64-encoded text. The value for the payload_field parameter is <payload-field>_raw .
Instance Attribute Summary collapse
-
#hash_key_field ⇒ String
readonly
The name of the hash key (also called the partition key).
-
#hash_key_type ⇒ String?
readonly
The data type for the hash key (also called the partition key).
-
#hash_key_value ⇒ String
readonly
The value of the hash key (also called the partition key).
-
#operation ⇒ String?
readonly
The type of operation to perform.
-
#payload ⇒ AWSCDK::IResolvable, ...
readonly
Information needed to configure the payload.
-
#payload_field ⇒ String?
readonly
The name of the DynamoDB column that receives the action payload.
-
#range_key_field ⇒ String?
readonly
The name of the range key (also called the sort key).
-
#range_key_type ⇒ String?
readonly
The data type for the range key (also called the sort key), You can specify the following values:.
-
#range_key_value ⇒ String?
readonly
The value of the range key (also called the sort key).
-
#table_name ⇒ String
readonly
The name of the DynamoDB table.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash_key_field:, hash_key_value:, table_name:, hash_key_type: nil, operation: nil, payload: nil, payload_field: nil, range_key_field: nil, range_key_type: nil, range_key_value: nil) ⇒ DynamoDBProperty
constructor
A new instance of DynamoDBProperty.
- #to_jsii ⇒ Object
Constructor Details
#initialize(hash_key_field:, hash_key_value:, table_name:, hash_key_type: nil, operation: nil, payload: nil, payload_field: nil, range_key_field: nil, range_key_type: nil, range_key_value: nil) ⇒ DynamoDBProperty
Returns a new instance of DynamoDBProperty.
1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 |
# File 'io_t_events/cfn_alarm_model.rb', line 1196 def initialize(hash_key_field:, hash_key_value:, table_name:, hash_key_type: nil, operation: nil, payload: 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") @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? @operation = operation Jsii::Type.check_type(@operation, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "operation") unless @operation.nil? @payload = payload.is_a?(Hash) ? ::AWSCDK::IoTEvents::CfnAlarmModel::PayloadProperty.new(**payload.transform_keys(&:to_sym)) : payload Jsii::Type.check_type(@payload, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pb3RldmVudHMuQ2ZuQWxhcm1Nb2RlbC5QYXlsb2FkUHJvcGVydHkifV19fQ==")), "payload") unless @payload.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_field ⇒ String (readonly)
The name of the hash key (also called the partition key).
The hash_key_field value must match the partition key of the target DynamoDB table.
1225 1226 1227 |
# File 'io_t_events/cfn_alarm_model.rb', line 1225 def hash_key_field @hash_key_field end |
#hash_key_type ⇒ String? (readonly)
The data type for the hash key (also called the partition key). You can specify the following values:.
'STRING'- The hash key is a string.'NUMBER'- The hash key is a number.
If you don't specify hash_key_type , the default value is 'STRING' .
1247 1248 1249 |
# File 'io_t_events/cfn_alarm_model.rb', line 1247 def hash_key_type @hash_key_type end |
#hash_key_value ⇒ String (readonly)
The value of the hash key (also called the partition key).
1230 1231 1232 |
# File 'io_t_events/cfn_alarm_model.rb', line 1230 def hash_key_value @hash_key_value end |
#operation ⇒ String? (readonly)
The type of operation to perform. You can specify the following values:.
'INSERT'- Insert data as a new item into the DynamoDB table. This item uses the specified hash key as a partition key. If you specified a range key, the item uses the range key as a sort key.'UPDATE'- Update an existing item of the DynamoDB table with new data. This item's partition key must match the specified hash key. If you specified a range key, the range key must match the item's sort key.'DELETE'- Delete an existing item of the DynamoDB table. This item's partition key must match the specified hash key. If you specified a range key, the range key must match the item's sort key.
If you don't specify this parameter, AWS IoT Events triggers the 'INSERT' operation.
1258 1259 1260 |
# File 'io_t_events/cfn_alarm_model.rb', line 1258 def operation @operation end |
#payload ⇒ AWSCDK::IResolvable, ... (readonly)
Information needed to configure the payload.
By default, AWS IoT Events generates a standard payload in JSON for any action. This action payload contains all attribute-value pairs that have the information about the detector model instance and the event triggered the action. To configure the action payload, you can use content_expression .
1265 1266 1267 |
# File 'io_t_events/cfn_alarm_model.rb', line 1265 def payload @payload end |
#payload_field ⇒ String? (readonly)
The name of the DynamoDB column that receives the action payload.
If you don't specify this parameter, the name of the DynamoDB column is payload .
1272 1273 1274 |
# File 'io_t_events/cfn_alarm_model.rb', line 1272 def payload_field @payload_field end |
#range_key_field ⇒ String? (readonly)
The name of the range key (also called the sort key).
The range_key_field value must match the sort key of the target DynamoDB table.
1279 1280 1281 |
# File 'io_t_events/cfn_alarm_model.rb', line 1279 def range_key_field @range_key_field end |
#range_key_type ⇒ String? (readonly)
The data type for the range key (also called the sort key), You can specify the following values:.
'STRING'- The range key is a string.'NUMBER'- The range key is number.
If you don't specify range_key_field , the default value is 'STRING' .
1289 1290 1291 |
# File 'io_t_events/cfn_alarm_model.rb', line 1289 def range_key_type @range_key_type end |
#range_key_value ⇒ String? (readonly)
The value of the range key (also called the sort key).
1294 1295 1296 |
# File 'io_t_events/cfn_alarm_model.rb', line 1294 def range_key_value @range_key_value end |
#table_name ⇒ String (readonly)
The name of the DynamoDB table.
The table_name value must match the table name of the target DynamoDB table.
1237 1238 1239 |
# File 'io_t_events/cfn_alarm_model.rb', line 1237 def table_name @table_name end |
Class Method Details
.jsii_properties ⇒ Object
1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 |
# File 'io_t_events/cfn_alarm_model.rb', line 1296 def self.jsii_properties { :hash_key_field => "hashKeyField", :hash_key_value => "hashKeyValue", :table_name => "tableName", :hash_key_type => "hashKeyType", :operation => "operation", :payload => "payload", :payload_field => "payloadField", :range_key_field => "rangeKeyField", :range_key_type => "rangeKeyType", :range_key_value => "rangeKeyValue", } end |
Instance Method Details
#to_jsii ⇒ Object
1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 |
# File 'io_t_events/cfn_alarm_model.rb', line 1311 def to_jsii result = {} result.merge!({ "hashKeyField" => @hash_key_field, "hashKeyValue" => @hash_key_value, "tableName" => @table_name, "hashKeyType" => @hash_key_type, "operation" => @operation, "payload" => @payload, "payloadField" => @payload_field, "rangeKeyField" => @range_key_field, "rangeKeyType" => @range_key_type, "rangeKeyValue" => @range_key_value, }) result.compact end |