Class RuleTargetInput
The input to send to the event target.
Namespace: Amazon.CDK.AWS.Events
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public abstract class RuleTargetInput : DeputyBase
Syntax (vb)
Public MustInherit Class RuleTargetInput Inherits DeputyBase
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.AppSync;
var api = new GraphqlApi(this, "api", new GraphqlApiProps {
Name = "api",
Definition = Definition.FromFile("schema.graphql"),
AuthorizationConfig = new AuthorizationConfig {
DefaultAuthorization = new AuthorizationMode { AuthorizationType = AuthorizationType.IAM }
}
});
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Hours(1))
});
rule.AddTarget(new AppSync(api, new AppSyncGraphQLApiProps {
GraphQLOperation = "mutation Publish($message: String!){ publish(message: $message) { message } }",
Variables = RuleTargetInput.FromObject(new Dictionary<string, string> {
{ "message", "hello world" }
})
}));
Synopsis
Constructors
RuleTargetInput() | The input to send to the event target. |
Methods
Bind(IRule) | Return the input properties for this input object. |
FromEventPath(string) | Take the event target input from a path in the event JSON. |
FromMultilineText(string) | Pass text to the event target, splitting on newlines. |
FromObject(object) | Pass a JSON object to the event target. |
FromText(string) | Pass text to the event target. |
Constructors
RuleTargetInput()
The input to send to the event target.
protected RuleTargetInput()
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.AppSync;
var api = new GraphqlApi(this, "api", new GraphqlApiProps {
Name = "api",
Definition = Definition.FromFile("schema.graphql"),
AuthorizationConfig = new AuthorizationConfig {
DefaultAuthorization = new AuthorizationMode { AuthorizationType = AuthorizationType.IAM }
}
});
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Hours(1))
});
rule.AddTarget(new AppSync(api, new AppSyncGraphQLApiProps {
GraphQLOperation = "mutation Publish($message: String!){ publish(message: $message) { message } }",
Variables = RuleTargetInput.FromObject(new Dictionary<string, string> {
{ "message", "hello world" }
})
}));
Methods
Bind(IRule)
Return the input properties for this input object.
public abstract IRuleTargetInputProperties Bind(IRule rule)
Parameters
- rule IRule
Returns
Remarks
ExampleMetadata: infused
FromEventPath(string)
Take the event target input from a path in the event JSON.
public static RuleTargetInput FromEventPath(string path)
Parameters
- path string
Returns
Remarks
ExampleMetadata: infused
FromMultilineText(string)
Pass text to the event target, splitting on newlines.
public static RuleTargetInput FromMultilineText(string text)
Parameters
- text string
Returns
Remarks
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.
FromObject(object)
Pass a JSON object to the event target.
public static RuleTargetInput FromObject(object obj)
Parameters
- obj object
Returns
RuleTargetInput
Remarks
May contain strings returned by EventField.from()
to substitute in parts of the
matched event.
FromText(string)
Pass text to the event target.
public static RuleTargetInput FromText(string text)
Parameters
- text string
Returns
Remarks
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.