Interface RuleProps
- All Superinterfaces:
EventCommonOptions
,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
RuleProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.104.0 (build e79254c)",
date="2024-12-27T17:02:02.332Z")
@Stability(Stable)
public interface RuleProps
extends software.amazon.jsii.JsiiSerializable, EventCommonOptions
Properties for defining an EventBridge Rule.
Example:
import software.amazon.awscdk.services.lambda.*; Function fn = Function.Builder.create(this, "MyFunc") .runtime(Runtime.NODEJS_LATEST) .handler("index.handler") .code(Code.fromInline("exports.handler = handler.toString()")) .build(); Rule rule = Rule.Builder.create(this, "rule") .eventPattern(EventPattern.builder() .source(List.of("aws.ec2")) .build()) .build(); Queue queue = new Queue(this, "Queue"); rule.addTarget(LambdaFunction.Builder.create(fn) .deadLetterQueue(queue) // Optional: add a dead letter queue .maxEventAge(Duration.hours(2)) // Optional: set the maxEventAge retry policy .retryAttempts(2) .build());
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic RuleProps.Builder
builder()
default Boolean
Indicates whether the rule is enabled.default IEventBus
The event bus to associate with this rule.default Schedule
The schedule or rate (frequency) that determines when EventBridge runs the rule.default List<IRuleTarget>
Targets to invoke when this rule matches an event.Methods inherited from interface software.amazon.awscdk.services.events.EventCommonOptions
getCrossStackScope, getDescription, getEventPattern, getRuleName
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getEnabled
Indicates whether the rule is enabled.Default: true
-
getEventBus
The event bus to associate with this rule.Default: - The default event bus.
-
getSchedule
The schedule or rate (frequency) that determines when EventBridge runs the rule.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 Also:
-
getTargets
Targets to invoke when this rule matches an event.Input will be the full matched event. If you wish to specify custom target input, use
addTarget(target[, inputOptions])
.Default: - No targets.
-
builder
- Returns:
- a
RuleProps.Builder
ofRuleProps
-