Interface IOnEventOptions
Standard set of options for onXxx
event handlers on construct.
Namespace: Amazon.CDK.AWS.Events
Assembly: Amazon.CDK.AWS.Events.dll
Syntax (csharp)
public interface IOnEventOptions
Syntax (vb)
Public Interface IOnEventOptions
Remarks
ExampleMetadata: infused
Examples
// Lambda function containing logic that evaluates compliance with the rule.
Function 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
CustomRule customRule = new CustomRule(this, "Custom", new CustomRuleProps {
ConfigurationChanges = true,
LambdaFunction = evalComplianceFn,
RuleScope = RuleScope.FromResource(ResourceType.EC2_INSTANCE)
});
// 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", new OnEventOptions {
Target = new SnsTopic(complianceTopic)
});
Synopsis
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. |
Properties
Description
A description of the rule's purpose.
virtual string Description { get; }
Property Value
System.String
Remarks
Default: - No description
EventPattern
Additional restrictions for the event to route to the specified target.
virtual IEventPattern EventPattern { get; }
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.
virtual string RuleName { get; }
Property Value
System.String
Remarks
Default: AWS CloudFormation generates a unique physical ID.
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.