class RuleTargetInput
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Events.RuleTargetInput |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsevents#RuleTargetInput |
![]() | software.amazon.awscdk.services.events.RuleTargetInput |
![]() | aws_cdk.aws_events.RuleTargetInput |
![]() | aws-cdk-lib » aws_events » RuleTargetInput |
Obtainable from
Log
.fromObject()
The input to send to the event target.
Example
import * as appsync from 'aws-cdk-lib/aws-appsync';
const api = new appsync.GraphqlApi(this, 'api', {
name: 'api',
definition: appsync.Definition.fromFile('schema.graphql'),
authorizationConfig: {
defaultAuthorization: { authorizationType: appsync.AuthorizationType.IAM }
},
});
const rule = new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});
rule.addTarget(new targets.AppSync(api, {
graphQLOperation: 'mutation Publish($message: String!){ publish(message: $message) { message } }',
variables: events.RuleTargetInput.fromObject({
message: 'hello world',
}),
}));
Initializer
new RuleTargetInput()
Methods
Name | Description |
---|---|
bind(rule) | Return the input properties for this input object. |
static from | Take the event target input from a path in the event JSON. |
static from | Pass text to the event target, splitting on newlines. |
static from | Pass a JSON object to the event target. |
static from | Pass text to the event target. |
bind(rule)
public bind(rule: IRule): RuleTargetInputProperties
Parameters
- rule
IRule
Returns
Return the input properties for this input object.
static fromEventPath(path)
public static fromEventPath(path: string): RuleTargetInput
Parameters
- path
string
Returns
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
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
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
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.