Interface OnEventOptions

All Superinterfaces:
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.84.0 (build 5404dcf)", date="2023-06-19T16:30:37.051Z") @Stability(Stable) public interface OnEventOptions extends software.amazon.jsii.JsiiSerializable
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_14_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());
 
  • Method Details

    • getDescription

      @Stability(Stable) @Nullable default String getDescription()
      A description of the rule's purpose.

      Default: - No description

    • getEventPattern

      @Stability(Stable) @Nullable default EventPattern getEventPattern()
      Additional restrictions for the event to route to the specified target.

      The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering.

      Default: - No additional filtering based on an event pattern.

      See Also:
    • getRuleName

      @Stability(Stable) @Nullable default String getRuleName()
      A name for the rule.

      Default: AWS CloudFormation generates a unique physical ID.

    • getTarget

      @Stability(Stable) @Nullable default IRuleTarget getTarget()
      The target to register for the event.

      Default: - No target is added to the rule. Use `addTarget()` to add a target.

    • builder

      @Stability(Stable) static OnEventOptions.Builder builder()
      Returns:
      a OnEventOptions.Builder of OnEventOptions