Interface IOnEventOptions
Standard set of options for onXxx
event handlers on construct.
Inherited Members
Namespace: Amazon.CDK.AWS.Events
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IOnEventOptions : IEventCommonOptions
Syntax (vb)
Public Interface IOnEventOptions
Inherits IEventCommonOptions
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_18_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
Properties
Target | The target to register for the event. |
Properties
Target
The target to register for the event.
virtual IRuleTarget Target { get; }
Property Value
Remarks
Default: - No target is added to the rule. Use addTarget()
to add a target.