Class: AWSCDK::IoTEvents::CfnDetectorModel::DynamoDBv2Property
- Inherits:
-
Jsii::Struct
- Object
- Jsii::Struct
- AWSCDK::IoTEvents::CfnDetectorModel::DynamoDBv2Property
- Defined in:
- io_t_events/cfn_detector_model.rb
Overview
Defines an action to write to the Amazon DynamoDB table that you created.
The default action payload contains all the information about the detector model instance and the event that triggered the action. You can customize the payload . A separate column of the DynamoDB table receives one attribute-value pair in the payload that you specify.
You must use expressions for all parameters in DynamoDBv2Action . 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 table_name parameter can be 'GreenhouseTemperatureTable' .
- For references, you must specify either variables or input values. For example, the value for the
table_nameparameter can be$variable.ddbtableName. - 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 content_expression parameter in Payload uses a substitution template.
'{\"sensorID\": \"${$input.GreenhouseInput.sensor_id}\", \"temperature\": \"${$input.GreenhouseInput.temperature * 9 / 5 + 32}\"}'
- 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 .
The value for the type parameter in Payload must be JSON .
Instance Attribute Summary collapse
-
#payload ⇒ AWSCDK::IResolvable, ...
readonly
Information needed to configure the payload.
-
#table_name ⇒ String
readonly
The name of the DynamoDB table.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(table_name:, payload: nil) ⇒ DynamoDBv2Property
constructor
A new instance of DynamoDBv2Property.
- #to_jsii ⇒ Object
Constructor Details
#initialize(table_name:, payload: nil) ⇒ DynamoDBv2Property
Returns a new instance of DynamoDBv2Property.
1253 1254 1255 1256 1257 1258 |
# File 'io_t_events/cfn_detector_model.rb', line 1253 def initialize(table_name:, payload: nil) @table_name = table_name Jsii::Type.check_type(@table_name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "tableName") @payload = payload.is_a?(Hash) ? ::AWSCDK::IoTEvents::CfnDetectorModel::PayloadProperty.new(**payload.transform_keys(&:to_sym)) : payload Jsii::Type.check_type(@payload, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pb3RldmVudHMuQ2ZuRGV0ZWN0b3JNb2RlbC5QYXlsb2FkUHJvcGVydHkifV19fQ==")), "payload") unless @payload.nil? end |
Instance Attribute Details
#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 .
1271 1272 1273 |
# File 'io_t_events/cfn_detector_model.rb', line 1271 def payload @payload end |
#table_name ⇒ String (readonly)
The name of the DynamoDB table.
1264 1265 1266 |
# File 'io_t_events/cfn_detector_model.rb', line 1264 def table_name @table_name end |
Class Method Details
.jsii_properties ⇒ Object
1273 1274 1275 1276 1277 1278 |
# File 'io_t_events/cfn_detector_model.rb', line 1273 def self.jsii_properties { :table_name => "tableName", :payload => "payload", } end |
Instance Method Details
#to_jsii ⇒ Object
1280 1281 1282 1283 1284 1285 1286 1287 |
# File 'io_t_events/cfn_detector_model.rb', line 1280 def to_jsii result = {} result.merge!({ "tableName" => @table_name, "payload" => @payload, }) result.compact end |