Class CustomRule
A new custom rule.
Inherited Members
Namespace: Amazon.CDK.AWS.Config
Assembly: Amazon.CDK.AWS.Config.dll
Syntax (csharp)
public class CustomRule : Resource, IRule, IResource, IConstruct, IDependable
Syntax (vb)
Public Class CustomRule
Inherits Resource
Implements IRule, IResource, IConstruct, IDependable
Remarks
Resource: AWS::Config::ConfigRule
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
CustomRule(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CustomRule(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CustomRule(Construct, String, ICustomRuleProps) |
Properties
ConfigRuleArn | The arn of the rule. |
ConfigRuleComplianceType | The compliance status of the rule. |
ConfigRuleId | The id of the rule. |
ConfigRuleName | The name of the rule. |
IsCustomWithChanges | |
IsManaged | |
RuleScope |
Methods
FromConfigRuleName(Construct, String, String) | Imports an existing rule. |
OnComplianceChange(String, IOnEventOptions) | Defines an EventBridge event rule which triggers for rule compliance events. |
OnEvent(String, IOnEventOptions) | Defines an EventBridge event rule which triggers for rule events. |
OnReEvaluationStatus(String, IOnEventOptions) | Defines an EventBridge event rule which triggers for rule re-evaluation status events. |
Constructors
CustomRule(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CustomRule(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CustomRule(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CustomRule(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CustomRule(Construct, String, ICustomRuleProps)
public CustomRule(Construct scope, string id, ICustomRuleProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ICustomRuleProps
Properties
ConfigRuleArn
The arn of the rule.
public virtual string ConfigRuleArn { get; }
Property Value
System.String
Remarks
Attribute: true
ConfigRuleComplianceType
The compliance status of the rule.
public virtual string ConfigRuleComplianceType { get; }
Property Value
System.String
Remarks
Attribute: true
ConfigRuleId
The id of the rule.
public virtual string ConfigRuleId { get; }
Property Value
System.String
Remarks
Attribute: true
ConfigRuleName
The name of the rule.
public virtual string ConfigRuleName { get; }
Property Value
System.String
Remarks
Attribute: true
IsCustomWithChanges
protected virtual Nullable<bool> IsCustomWithChanges { get; set; }
Property Value
System.Nullable<System.Boolean>
IsManaged
protected virtual Nullable<bool> IsManaged { get; set; }
Property Value
System.Nullable<System.Boolean>
RuleScope
Methods
FromConfigRuleName(Construct, String, String)
Imports an existing rule.
public static IRule FromConfigRuleName(Construct scope, string id, string configRuleName)
Parameters
- scope Constructs.Construct
- id System.String
- configRuleName System.String
the name of the rule.
Returns
OnComplianceChange(String, IOnEventOptions)
Defines an EventBridge event rule which triggers for rule compliance events.
public virtual Rule OnComplianceChange(string id, IOnEventOptions options = null)
Parameters
- id System.String
- options IOnEventOptions
Returns
OnEvent(String, IOnEventOptions)
Defines an EventBridge event rule which triggers for rule events.
public virtual Rule OnEvent(string id, IOnEventOptions options = null)
Parameters
- id System.String
- options IOnEventOptions
Returns
Remarks
Use
rule.addEventPattern(pattern)
to specify a filter.
OnReEvaluationStatus(String, IOnEventOptions)
Defines an EventBridge event rule which triggers for rule re-evaluation status events.
public virtual Rule OnReEvaluationStatus(string id, IOnEventOptions options = null)
Parameters
- id System.String
- options IOnEventOptions
Returns