Interface IRuleProps
Properties for defining an EventBridge Rule.
Inherited Members
Namespace: Amazon.CDK.AWS.Events
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IRuleProps : IEventCommonOptions
Syntax (vb)
Public Interface IRuleProps
Inherits IEventCommonOptions
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Lambda;
var fn = new Function(this, "MyFunc", new FunctionProps {
Runtime = Runtime.NODEJS_LATEST,
Handler = "index.handler",
Code = Code.FromInline("exports.handler = handler.toString()")
});
var rule = new Rule(this, "rule", new RuleProps {
EventPattern = new EventPattern {
Source = new [] { "aws.ec2" }
}
});
var queue = new Queue(this, "Queue");
rule.AddTarget(new LambdaFunction(fn, new LambdaFunctionProps {
DeadLetterQueue = queue, // Optional: add a dead letter queue
MaxEventAge = Duration.Hours(2), // Optional: set the maxEventAge retry policy
RetryAttempts = 2
}));
Synopsis
Properties
Enabled | Indicates whether the rule is enabled. |
EventBus | The event bus to associate with this rule. |
Schedule | The schedule or rate (frequency) that determines when EventBridge runs the rule. |
Targets | Targets to invoke when this rule matches an event. |
Properties
Enabled
Indicates whether the rule is enabled.
virtual Nullable<bool> Enabled { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: true
EventBus
The event bus to associate with this rule.
virtual IEventBus EventBus { get; }
Property Value
Remarks
Default: - The default event bus.
Schedule
The schedule or rate (frequency) that determines when EventBridge runs the rule.
virtual Schedule Schedule { get; }
Property Value
Remarks
You must specify this property, the eventPattern
property, or both.
For more information, see Schedule Expression Syntax for Rules in the Amazon EventBridge User Guide.
Default: - None.
See: https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html
Targets
Targets to invoke when this rule matches an event.
virtual IRuleTarget[] Targets { get; }
Property Value
Remarks
Input will be the full matched event. If you wish to specify custom
target input, use addTarget(target[, inputOptions])
.
Default: - No targets.