@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:37.740Z") @Stability(value=Stable) public interface CustomRuleProps extends software.amazon.jsii.JsiiSerializable, RuleProps
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());
| Modifier and Type | Interface and Description |
|---|---|
static class |
CustomRuleProps.Builder
A builder for
CustomRuleProps |
static class |
CustomRuleProps.Jsii$Proxy
An implementation for
CustomRuleProps |
| Modifier and Type | Method and Description |
|---|---|
static CustomRuleProps.Builder |
builder() |
default Boolean |
getConfigurationChanges()
Whether to run the rule on configuration changes.
|
IFunction |
getLambdaFunction()
The Lambda function to run.
|
default Boolean |
getPeriodic()
Whether to run the rule on a fixed frequency.
|
getConfigRuleName, getDescription, getInputParameters, getMaximumExecutionFrequency, getRuleScope@Stability(value=Stable) @NotNull IFunction getLambdaFunction()
@Stability(value=Stable) @Nullable default Boolean getConfigurationChanges()
Default: false
@Stability(value=Stable) @Nullable default Boolean getPeriodic()
Default: false
@Stability(value=Stable) static CustomRuleProps.Builder builder()
builder in interface RulePropsCustomRuleProps.Builder of CustomRulePropsCopyright © 2022. All rights reserved.