aws-cdk-lib.aws_events.RuleTargetInput

class RuleTargetInput

LanguageType name
.NETAmazon.CDK.AWS.Events.RuleTargetInput
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsevents#RuleTargetInput
Javasoftware.amazon.awscdk.services.events.RuleTargetInput
Pythonaws_cdk.aws_events.RuleTargetInput
TypeScript (source)aws-cdk-lib » aws_events » RuleTargetInput

Obtainable from LogGroupTargetInput.fromObject()

The input to send to the event target.

Example

import * as iam from 'aws-cdk-lib/aws-iam';
import * as sfn from 'aws-cdk-lib/aws-stepfunctions';

const rule = new events.Rule(this, 'Rule', {
  schedule: events.Schedule.rate(Duration.minutes(1)),
});

const dlq = new sqs.Queue(this, 'DeadLetterQueue');

const role = new iam.Role(this, 'Role', {
  assumedBy: new iam.ServicePrincipal('events.amazonaws.com'),
});
const stateMachine = new sfn.StateMachine(this, 'SM', {
  definition: new sfn.Wait(this, 'Hello', { time: sfn.WaitTime.duration(Duration.seconds(10)) })
});

rule.addTarget(new targets.SfnStateMachine(stateMachine, {
  input: events.RuleTargetInput.fromObject({ SomeParam: 'SomeValue' }),
  deadLetterQueue: dlq,
  role: role
}));

Initializer

new RuleTargetInput()

Methods

NameDescription
bind(rule)Return the input properties for this input object.
static fromEventPath(path)Take the event target input from a path in the event JSON.
static fromMultilineText(text)Pass text to the event target, splitting on newlines.
static fromObject(obj)Pass a JSON object to the event target.
static fromText(text)Pass text to the event target.

bind(rule)

public bind(rule: IRule): RuleTargetInputProperties

Parameters

  • rule IRule

Returns

  • RuleTargetInputProperties

Return the input properties for this input object.


static fromEventPath(path)

public static fromEventPath(path: string): RuleTargetInput

Parameters

  • path string

Returns

  • RuleTargetInput

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


static fromMultilineText(text)

public static fromMultilineText(text: string): RuleTargetInput

Parameters

  • text string

Returns

  • RuleTargetInput

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.


static fromObject(obj)

public static fromObject(obj: any): RuleTargetInput

Parameters

  • obj any

Returns

  • RuleTargetInput

Pass a JSON object to the event target.

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


static fromText(text)

public static fromText(text: string): RuleTargetInput

Parameters

  • text string

Returns

  • RuleTargetInput

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.