Class: AWSCDK::IoTEvents::CfnAlarmModel::DynamoDBv2Property

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
io_t_events/cfn_alarm_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_name parameter 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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table_name:, payload: nil) ⇒ DynamoDBv2Property

Returns a new instance of DynamoDBv2Property.

Parameters:



1360
1361
1362
1363
1364
1365
# File 'io_t_events/cfn_alarm_model.rb', line 1360

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::CfnAlarmModel::PayloadProperty.new(**payload.transform_keys(&:to_sym)) : payload
  Jsii::Type.check_type(@payload, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19pb3RldmVudHMuQ2ZuQWxhcm1Nb2RlbC5QYXlsb2FkUHJvcGVydHkifV19fQ==")), "payload") unless @payload.nil?
end

Instance Attribute Details

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



1378
1379
1380
# File 'io_t_events/cfn_alarm_model.rb', line 1378

def payload
  @payload
end

#table_nameString (readonly)

The name of the DynamoDB table.



1371
1372
1373
# File 'io_t_events/cfn_alarm_model.rb', line 1371

def table_name
  @table_name
end

Class Method Details

.jsii_propertiesObject



1380
1381
1382
1383
1384
1385
# File 'io_t_events/cfn_alarm_model.rb', line 1380

def self.jsii_properties
  {
    :table_name => "tableName",
    :payload => "payload",
  }
end

Instance Method Details

#to_jsiiObject



1387
1388
1389
1390
1391
1392
1393
1394
# File 'io_t_events/cfn_alarm_model.rb', line 1387

def to_jsii
  result = {}
  result.merge!({
    "tableName" => @table_name,
    "payload" => @payload,
  })
  result.compact
end