Class RuleScope
Determines which resources trigger an evaluation of an AWS Config rule.
Inheritance
Namespace: Amazon.CDK.AWS.Config
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class RuleScope : DeputyBase
Syntax (vb)
Public Class RuleScope
Inherits DeputyBase
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)
});
Synopsis
Constructors
RuleScope(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
RuleScope(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Key | tag key applied to resources that will trigger evaluation of a rule. |
ResourceId | ID of the only AWS resource that will trigger evaluation of a rule. |
ResourceTypes | Resource types that will trigger evaluation of a rule. |
Value | tag value applied to resources that will trigger evaluation of a rule. |
Methods
FromResource(ResourceType, String) | restricts scope of changes to a specific resource type or resource identifier. |
FromResources(ResourceType[]) | restricts scope of changes to specific resource types. |
FromTag(String, String) | restricts scope of changes to a specific tag. |
Constructors
RuleScope(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected RuleScope(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
RuleScope(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected RuleScope(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Key
tag key applied to resources that will trigger evaluation of a rule.
public virtual string Key { get; }
Property Value
System.String
ResourceId
ID of the only AWS resource that will trigger evaluation of a rule.
public virtual string ResourceId { get; }
Property Value
System.String
ResourceTypes
Resource types that will trigger evaluation of a rule.
public virtual ResourceType[] ResourceTypes { get; }
Property Value
Value
tag value applied to resources that will trigger evaluation of a rule.
public virtual string Value { get; }
Property Value
System.String
Methods
FromResource(ResourceType, String)
restricts scope of changes to a specific resource type or resource identifier.
public static RuleScope FromResource(ResourceType resourceType, string resourceId = null)
Parameters
- resourceType ResourceType
- resourceId System.String
Returns
FromResources(ResourceType[])
restricts scope of changes to specific resource types.
public static RuleScope FromResources(ResourceType[] resourceTypes)
Parameters
- resourceTypes ResourceType[]
Returns
FromTag(String, String)
restricts scope of changes to a specific tag.
public static RuleScope FromTag(string key, string value = null)
Parameters
- key System.String
- value System.String
Returns