RuleTargetInput

class aws_cdk.aws_events.RuleTargetInput

Bases: object

The input to send to the event target.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_appsync as appsync


api = appsync.GraphqlApi(self, "api",
    name="api",
    definition=appsync.Definition.from_file("schema.graphql"),
    authorization_config=appsync.AuthorizationConfig(
        default_authorization=appsync.AuthorizationMode(authorization_type=appsync.AuthorizationType.IAM)
    )
)

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

rule.add_target(targets.AppSync(api,
    graph_qLOperation="mutation Publish($message: String!){ publish(message: $message) { message } }",
    variables=events.RuleTargetInput.from_object({
        "message": "hello world"
    })
))

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