Interface OnEventOptions
- All Superinterfaces:
EventCommonOptions,software.amazon.jsii.JsiiSerializable
- All Known Subinterfaces:
OnCloudTrailBucketEventOptions,OnCloudTrailImagePushedOptions,OnCommitOptions,OnImageScanCompletedOptions
- All Known Implementing Classes:
OnCloudTrailBucketEventOptions.Jsii$Proxy,OnCloudTrailImagePushedOptions.Jsii$Proxy,OnCommitOptions.Jsii$Proxy,OnEventOptions.Jsii$Proxy,OnImageScanCompletedOptions.Jsii$Proxy
@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)",
date="2025-11-13T16:10:06.254Z")
@Stability(Stable)
public interface OnEventOptions
extends software.amazon.jsii.JsiiSerializable, EventCommonOptions
Standard set of options for
onXxx event handlers on construct.
Example:
// Lambda function containing logic that evaluates compliance with the rule.
Function evalComplianceFn = Function.Builder.create(this, "CustomFunction")
.code(AssetCode.fromInline("exports.handler = (event) => console.log(event);"))
.handler("index.handler")
.runtime(Runtime.NODEJS_18_X)
.build();
// A custom rule that runs on configuration changes of EC2 instances
CustomRule customRule = CustomRule.Builder.create(this, "Custom")
.configurationChanges(true)
.lambdaFunction(evalComplianceFn)
.ruleScope(RuleScope.fromResource(ResourceType.EC2_INSTANCE))
.build();
// A rule to detect stack drifts
CloudFormationStackDriftDetectionCheck driftRule = new CloudFormationStackDriftDetectionCheck(this, "Drift");
// Topic to which compliance notification events will be published
Topic complianceTopic = new Topic(this, "ComplianceTopic");
// Send notification on compliance change events
driftRule.onComplianceChange("ComplianceChange", OnEventOptions.builder()
.target(new SnsTopic(complianceTopic))
.build());
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forOnEventOptionsstatic final classAn implementation forOnEventOptions -
Method Summary
Modifier and TypeMethodDescriptionstatic OnEventOptions.Builderbuilder()default IRuleTargetThe target to register for the event.Methods inherited from interface software.amazon.awscdk.services.events.EventCommonOptions
getCrossStackScope, getDescription, getEventPattern, getRuleNameMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getTarget
The target to register for the event.Default: - No target is added to the rule. Use `addTarget()` to add a target.
-
builder
- Returns:
- a
OnEventOptions.BuilderofOnEventOptions
-