@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:50.719Z") public class CfnConfigRule extends CfnResource implements IInspectable
Adds or updates an AWS Config rule to evaluate if your AWS resources comply with your desired configurations. For information on how many AWS Config rules you can have per account, see Service Limits in the AWS Config Developer Guide .
There are two types of rules: AWS Config Managed Rules and AWS Config Custom Rules . You can use the ConfigRule
resource to create both AWS Config Managed Rules and AWS Config Custom Rules.
AWS Config Managed Rules are predefined, customizable rules created by AWS Config . For a list of managed rules, see List of AWS Config Managed Rules . If you are adding an AWS Config managed rule, you must specify the rule's identifier for the SourceIdentifier
key.
AWS Config Custom Rules are rules that you create from scratch. There are two ways to create AWS Config custom rules: with Lambda functions ( AWS Lambda Developer Guide ) and with Guard ( Guard GitHub Repository ), a policy-as-code language. AWS Config custom rules created with AWS Lambda are called AWS Config Custom Lambda Rules and AWS Config custom rules created with Guard are called AWS Config Custom Policy Rules .
If you are adding a new AWS Config Custom Lambda rule, you first need to create an AWS Lambda function that the rule invokes to evaluate your resources. When you use the ConfigRule
resource to add a Custom Lambda rule to AWS Config , you must specify the Amazon Resource Name (ARN) that AWS Lambda assigns to the function. You specify the ARN in the SourceIdentifier
key. This key is part of the Source
object, which is part of the ConfigRule
object.
For any new AWS Config rule that you add, specify the ConfigRuleName
in the ConfigRule
object. Do not specify the ConfigRuleArn
or the ConfigRuleId
. These values are generated by AWS Config for new rules.
If you are updating a rule that you added previously, you can specify the rule by ConfigRuleName
, ConfigRuleId
, or ConfigRuleArn
in the ConfigRule
data type that you use in this request.
For more information about developing and using AWS Config rules, see Evaluating Resources with AWS Config Rules in the AWS Config Developer Guide .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.config.*; Object inputParameters; CfnConfigRule cfnConfigRule = CfnConfigRule.Builder.create(this, "MyCfnConfigRule") .source(SourceProperty.builder() .owner("owner") // the properties below are optional .customPolicyDetails(CustomPolicyDetailsProperty.builder() .enableDebugLogDelivery(false) .policyRuntime("policyRuntime") .policyText("policyText") .build()) .sourceDetails(List.of(SourceDetailProperty.builder() .eventSource("eventSource") .messageType("messageType") // the properties below are optional .maximumExecutionFrequency("maximumExecutionFrequency") .build())) .sourceIdentifier("sourceIdentifier") .build()) // the properties below are optional .configRuleName("configRuleName") .description("description") .inputParameters(inputParameters) .maximumExecutionFrequency("maximumExecutionFrequency") .scope(ScopeProperty.builder() .complianceResourceId("complianceResourceId") .complianceResourceTypes(List.of("complianceResourceTypes")) .tagKey("tagKey") .tagValue("tagValue") .build()) .build();
Modifier and Type | Class and Description |
---|---|
static class |
CfnConfigRule.Builder
A fluent builder for
CfnConfigRule . |
static interface |
CfnConfigRule.CustomPolicyDetailsProperty
Provides the runtime system, policy definition, and whether debug logging enabled.
|
static interface |
CfnConfigRule.ScopeProperty
Defines which resources trigger an evaluation for an AWS Config rule.
|
static interface |
CfnConfigRule.SourceDetailProperty
Provides the source and the message types that trigger AWS Config to evaluate your AWS resources against a rule.
|
static interface |
CfnConfigRule.SourceProperty
Provides the CustomPolicyDetails, the rule owner ( `AWS` for managed rules, `CUSTOM_POLICY` for Custom Policy rules, and `CUSTOM_LAMBDA` for Custom Lambda rules), the rule identifier, and the events that cause the evaluation of your AWS resources.
|
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnConfigRule(Construct scope,
java.lang.String id,
CfnConfigRuleProps props)
Create a new `AWS::Config::ConfigRule`.
|
protected |
CfnConfigRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnConfigRule(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttrArn()
The Amazon Resource Name (ARN) of the AWS Config rule, such as `arn:aws:config:us-east-1:123456789012:config-rule/config-rule-a1bzhi` .
|
java.lang.String |
getAttrComplianceType()
The compliance status of an AWS Config rule, such as `COMPLIANT` or `NON_COMPLIANT` .
|
java.lang.String |
getAttrConfigRuleId()
The ID of the AWS Config rule, such as `config-rule-a1bzhi` .
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.String |
getConfigRuleName()
A name for the AWS Config rule.
|
java.lang.String |
getDescription()
The description that you provide for the AWS Config rule.
|
java.lang.Object |
getInputParameters()
A string, in JSON format, that is passed to the AWS Config rule Lambda function.
|
java.lang.String |
getMaximumExecutionFrequency()
The maximum frequency with which AWS Config runs evaluations for a rule.
|
java.lang.Object |
getScope()
Defines which resources can trigger an evaluation for the rule.
|
java.lang.Object |
getSource()
Provides the rule owner ( `AWS` for managed rules, `CUSTOM_POLICY` for Custom Policy rules, and `CUSTOM_LAMBDA` for Custom Lambda rules), the rule identifier, and the notifications that cause the function to evaluate your AWS resources.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setConfigRuleName(java.lang.String value)
A name for the AWS Config rule.
|
void |
setDescription(java.lang.String value)
The description that you provide for the AWS Config rule.
|
void |
setInputParameters(java.lang.Object value)
A string, in JSON format, that is passed to the AWS Config rule Lambda function.
|
void |
setMaximumExecutionFrequency(java.lang.String value)
The maximum frequency with which AWS Config runs evaluations for a rule.
|
void |
setScope(CfnConfigRule.ScopeProperty value)
Defines which resources can trigger an evaluation for the rule.
|
void |
setScope(IResolvable value)
Defines which resources can trigger an evaluation for the rule.
|
void |
setSource(CfnConfigRule.SourceProperty value)
Provides the rule owner ( `AWS` for managed rules, `CUSTOM_POLICY` for Custom Policy rules, and `CUSTOM_LAMBDA` for Custom Lambda rules), the rule identifier, and the notifications that cause the function to evaluate your AWS resources.
|
void |
setSource(IResolvable value)
Provides the rule owner ( `AWS` for managed rules, `CUSTOM_POLICY` for Custom Policy rules, and `CUSTOM_LAMBDA` for Custom Lambda rules), the rule identifier, and the notifications that cause the function to evaluate your AWS resources.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnConfigRule(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnConfigRule(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnConfigRule(Construct scope, java.lang.String id, CfnConfigRuleProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrArn()
public java.lang.String getAttrComplianceType()
public java.lang.String getAttrConfigRuleId()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public java.lang.Object getInputParameters()
public void setInputParameters(java.lang.Object value)
public java.lang.Object getSource()
public void setSource(CfnConfigRule.SourceProperty value)
public void setSource(IResolvable value)
public java.lang.String getConfigRuleName()
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the rule name. For more information, see Name Type .
public void setConfigRuleName(java.lang.String value)
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the rule name. For more information, see Name Type .
public java.lang.String getDescription()
public void setDescription(java.lang.String value)
public java.lang.String getMaximumExecutionFrequency()
You can specify a value for MaximumExecutionFrequency
when:
By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the
MaximumExecutionFrequency
parameter.
public void setMaximumExecutionFrequency(java.lang.String value)
You can specify a value for MaximumExecutionFrequency
when:
By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the
MaximumExecutionFrequency
parameter.
public java.lang.Object getScope()
The scope can include one or more resource types, a combination of one resource type and one resource ID, or a combination of a tag key and value. Specify a scope to constrain the resources that can trigger an evaluation for the rule. If you do not specify a scope, evaluations are triggered when any resource in the recording group changes.
The scope can be empty.
public void setScope(IResolvable value)
The scope can include one or more resource types, a combination of one resource type and one resource ID, or a combination of a tag key and value. Specify a scope to constrain the resources that can trigger an evaluation for the rule. If you do not specify a scope, evaluations are triggered when any resource in the recording group changes.
The scope can be empty.
public void setScope(CfnConfigRule.ScopeProperty value)
The scope can include one or more resource types, a combination of one resource type and one resource ID, or a combination of a tag key and value. Specify a scope to constrain the resources that can trigger an evaluation for the rule. If you do not specify a scope, evaluations are triggered when any resource in the recording group changes.
The scope can be empty.