Class CustomPolicy

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.config.CustomPolicy
All Implemented Interfaces:
IResource, IRule, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:04.840Z") @Stability(Stable) public class CustomPolicy extends Resource implements IRule
A new custom policy.

Example:

 String samplePolicyText = "\n# This rule checks if point in time recovery (PITR) is enabled on active Amazon DynamoDB tables\nlet status = ['ACTIVE']\n\nrule tableisactive when\n    resourceType == \"AWS::DynamoDB::Table\" {\n    configuration.tableStatus == %status\n}\n\nrule checkcompliance when\n    resourceType == \"AWS::DynamoDB::Table\"\n    tableisactive {\n        let pitr = supplementaryConfiguration.ContinuousBackupsDescription.pointInTimeRecoveryDescription.pointInTimeRecoveryStatus\n        %pitr == \"ENABLED\"\n}\n";
 CustomPolicy.Builder.create(this, "Custom")
         .policyText(samplePolicyText)
         .enableDebugLog(true)
         .ruleScope(RuleScope.fromResources(List.of(ResourceType.DYNAMODB_TABLE)))
         .build();
 
  • Constructor Details

    • CustomPolicy

      protected CustomPolicy(software.amazon.jsii.JsiiObjectRef objRef)
    • CustomPolicy

      protected CustomPolicy(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CustomPolicy

      @Stability(Stable) public CustomPolicy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CustomPolicyProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromConfigRuleName

      @Stability(Stable) @NotNull public static IRule fromConfigRuleName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String configRuleName)
      Imports an existing rule.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      configRuleName - the name of the rule. This parameter is required.
    • onComplianceChange

      @Stability(Stable) @NotNull public Rule onComplianceChange(@NotNull String id, @Nullable OnEventOptions options)
      Defines an EventBridge event rule which triggers for rule compliance events.

      Specified by:
      onComplianceChange in interface IRule
      Parameters:
      id - This parameter is required.
      options -
    • onComplianceChange

      @Stability(Stable) @NotNull public Rule onComplianceChange(@NotNull String id)
      Defines an EventBridge event rule which triggers for rule compliance events.

      Specified by:
      onComplianceChange in interface IRule
      Parameters:
      id - This parameter is required.
    • onEvent

      @Stability(Stable) @NotNull public Rule onEvent(@NotNull String id, @Nullable OnEventOptions options)
      Defines an EventBridge event rule which triggers for rule events.

      Use rule.addEventPattern(pattern) to specify a filter.

      Specified by:
      onEvent in interface IRule
      Parameters:
      id - This parameter is required.
      options -
    • onEvent

      @Stability(Stable) @NotNull public Rule onEvent(@NotNull String id)
      Defines an EventBridge event rule which triggers for rule events.

      Use rule.addEventPattern(pattern) to specify a filter.

      Specified by:
      onEvent in interface IRule
      Parameters:
      id - This parameter is required.
    • onReEvaluationStatus

      @Stability(Stable) @NotNull public Rule onReEvaluationStatus(@NotNull String id, @Nullable OnEventOptions options)
      Defines an EventBridge event rule which triggers for rule re-evaluation status events.

      Specified by:
      onReEvaluationStatus in interface IRule
      Parameters:
      id - This parameter is required.
      options -
    • onReEvaluationStatus

      @Stability(Stable) @NotNull public Rule onReEvaluationStatus(@NotNull String id)
      Defines an EventBridge event rule which triggers for rule re-evaluation status events.

      Specified by:
      onReEvaluationStatus in interface IRule
      Parameters:
      id - This parameter is required.
    • getConfigRuleArn

      @Stability(Stable) @NotNull public String getConfigRuleArn()
      The arn of the rule.
    • getConfigRuleComplianceType

      @Stability(Stable) @NotNull public String getConfigRuleComplianceType()
      The compliance status of the rule.
    • getConfigRuleId

      @Stability(Stable) @NotNull public String getConfigRuleId()
      The id of the rule.
    • getConfigRuleName

      @Stability(Stable) @NotNull public String getConfigRuleName()
      The name of the rule.
      Specified by:
      getConfigRuleName in interface IRule
    • getIsCustomWithChanges

      @Stability(Stable) @Nullable protected Boolean getIsCustomWithChanges()
    • setIsCustomWithChanges

      @Stability(Stable) protected void setIsCustomWithChanges(@Nullable Boolean value)
    • getIsManaged

      @Stability(Stable) @Nullable protected Boolean getIsManaged()
    • setIsManaged

      @Stability(Stable) protected void setIsManaged(@Nullable Boolean value)
    • getRuleScope

      @Stability(Stable) @Nullable protected RuleScope getRuleScope()
    • setRuleScope

      @Stability(Stable) protected void setRuleScope(@Nullable RuleScope value)