Class OnEventOptions
Standard set of options for onXxx
event handlers on construct.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.Events
Assembly: Amazon.CDK.AWS.Events.dll
Syntax (csharp)
public class OnEventOptions : Object, IOnEventOptions
Syntax (vb)
Public Class OnEventOptions
Inherits Object
Implements IOnEventOptions
Remarks
ExampleMetadata: infused
Examples
// Lambda function containing logic that evaluates compliance with the rule.
var evalComplianceFn = new Function(this, "CustomFunction", new FunctionProps {
Code = AssetCode.FromInline("exports.handler = (event) => console.log(event);"),
Handler = "index.handler",
Runtime = Runtime.NODEJS_14_X
});
// A custom rule that runs on configuration changes of EC2 instances
var customRule = new CustomRule(this, "Custom", new CustomRuleProps {
ConfigurationChanges = true,
LambdaFunction = evalComplianceFn,
RuleScope = RuleScope.FromResource(ResourceType.EC2_INSTANCE)
});
// A rule to detect stack drifts
var driftRule = new CloudFormationStackDriftDetectionCheck(this, "Drift");
// Topic to which compliance notification events will be published
var complianceTopic = new Topic(this, "ComplianceTopic");
// Send notification on compliance change events
driftRule.OnComplianceChange("ComplianceChange", new OnEventOptions {
Target = new SnsTopic(complianceTopic)
});
Synopsis
Constructors
OnEventOptions() |
Properties
Description | A description of the rule's purpose. |
EventPattern | Additional restrictions for the event to route to the specified target. |
RuleName | A name for the rule. |
Target | The target to register for the event. |
Constructors
OnEventOptions()
public OnEventOptions()
Properties
Description
A description of the rule's purpose.
public string Description { get; set; }
Property Value
System.String
Remarks
Default: - No description
EventPattern
Additional restrictions for the event to route to the specified target.
public IEventPattern EventPattern { get; set; }
Property Value
Remarks
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: https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-and-event-patterns.html
RuleName
A name for the rule.
public string RuleName { get; set; }
Property Value
System.String
Remarks
Default: AWS CloudFormation generates a unique physical ID.
Target
The target to register for the event.
public IRuleTarget Target { get; set; }
Property Value
Remarks
Default: - No target is added to the rule. Use addTarget()
to add a target.