Class: AWSCDK::Events::CfnRule::InputTransformerProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
events/cfn_rule.rb

Overview

Contains the parameters needed for you to provide custom input to a target based on one or more pieces of data extracted from the event.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_template:, input_paths_map: nil) ⇒ InputTransformerProperty

Returns a new instance of InputTransformerProperty.

Parameters:

  • input_template (String)

    Input template where you specify placeholders that will be filled with the values of the keys from InputPathsMap to customize the data sent to the target.

  • input_paths_map (AWSCDK::IResolvable, Hash{String => String}, nil) (defaults to: nil)

    Map of JSON paths to be extracted from the event.



1234
1235
1236
1237
1238
1239
# File 'events/cfn_rule.rb', line 1234

def initialize(input_template:, input_paths_map: nil)
  @input_template = input_template
  Jsii::Type.check_type(@input_template, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "inputTemplate")
  @input_paths_map = input_paths_map
  Jsii::Type.check_type(@input_paths_map, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImNvbGxlY3Rpb24iOnsiZWxlbWVudHR5cGUiOnsicHJpbWl0aXZlIjoic3RyaW5nIn0sImtpbmQiOiJtYXAifX1dfX0=")), "inputPathsMap") unless @input_paths_map.nil?
end

Instance Attribute Details

#input_paths_mapAWSCDK::IResolvable, ... (readonly)

Map of JSON paths to be extracted from the event.

You can then insert these in the template in InputTemplate to produce the output you want to be sent to the target.

InputPathsMap is an array key-value pairs, where each value is a valid JSON path. You can have as many as 100 key-value pairs. You must use JSON dot notation, not bracket notation.

The keys cannot start with " AWS ."



1298
1299
1300
# File 'events/cfn_rule.rb', line 1298

def input_paths_map
  @input_paths_map
end

#input_templateString (readonly)

Input template where you specify placeholders that will be filled with the values of the keys from InputPathsMap to customize the data sent to the target.

Enclose each InputPathsMaps value in brackets: < value >

If InputTemplate is a JSON object (surrounded by curly braces), the following restrictions apply:

  • The placeholder cannot be used as an object key.

The following example shows the syntax for using InputPathsMap and InputTemplate .

"InputTransformer":

{

"InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"},

"InputTemplate": "<instance> is in state <status>"

}

To have the InputTemplate include quote marks within a JSON string, escape each quote marks with a slash, as in the following example:

"InputTransformer":

{

"InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"},

"InputTemplate": "<instance> is in state \"<status>\""

}

The InputTemplate can also be valid JSON with varibles in quotes or out, as in the following example:

"InputTransformer":

{

"InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"},

"InputTemplate": '{"myInstance": <instance>,"myStatus": "<instance> is in state \"<status>\""}'

}



1287
1288
1289
# File 'events/cfn_rule.rb', line 1287

def input_template
  @input_template
end

Class Method Details

.jsii_propertiesObject



1300
1301
1302
1303
1304
1305
# File 'events/cfn_rule.rb', line 1300

def self.jsii_properties
  {
    :input_template => "inputTemplate",
    :input_paths_map => "inputPathsMap",
  }
end

Instance Method Details

#to_jsiiObject



1307
1308
1309
1310
1311
1312
1313
1314
# File 'events/cfn_rule.rb', line 1307

def to_jsii
  result = {}
  result.merge!({
    "inputTemplate" => @input_template,
    "inputPathsMap" => @input_paths_map,
  })
  result.compact
end