RuleTargetInput

class aws_cdk.aws_events.RuleTargetInput

Bases: object

The input to send to the event target.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_iam as iam
import aws_cdk.aws_stepfunctions as sfn


rule = events.Rule(self, "Rule",
    schedule=events.Schedule.rate(Duration.minutes(1))
)

dlq = sqs.Queue(self, "DeadLetterQueue")

role = iam.Role(self, "Role",
    assumed_by=iam.ServicePrincipal("events.amazonaws.com")
)
state_machine = sfn.StateMachine(self, "SM",
    definition=sfn.Wait(self, "Hello", time=sfn.WaitTime.duration(Duration.seconds(10)))
)

rule.add_target(targets.SfnStateMachine(state_machine,
    input=events.RuleTargetInput.from_object({"SomeParam": "SomeValue"}),
    dead_letter_queue=dlq,
    role=role
))

Methods

abstract bind(rule)

Return the input properties for this input object.

Parameters:

rule (IRule) –

Return type:

RuleTargetInputProperties

Static Methods

classmethod from_event_path(path)

Take the event target input from a path in the event JSON.

Parameters:

path (str) –

Return type:

RuleTargetInput

classmethod from_multiline_text(text)

Pass text to the event target, splitting on newlines.

This is only useful when passing to a target that does not take a single argument.

May contain strings returned by EventField.from() to substitute in parts of the matched event.

Parameters:

text (str) –

Return type:

RuleTargetInput

classmethod from_object(obj)

Pass a JSON object to the event target.

May contain strings returned by EventField.from() to substitute in parts of the matched event.

Parameters:

obj (Any) –

Return type:

RuleTargetInput

classmethod from_text(text)

Pass text to the event target.

May contain strings returned by EventField.from() to substitute in parts of the matched event.

The Rule Target input value will be a single string: the string you pass here. Do not use this method to pass a complex value like a JSON object to a Rule Target. Use RuleTargetInput.fromObject() instead.

Parameters:

text (str) –

Return type:

RuleTargetInput