java.lang.Object
software.amazon.awssdk.services.config.model.ConfigRule
All Implemented Interfaces:
Serializable, SdkPojo, ToCopyableBuilder<ConfigRule.Builder,ConfigRule>

@Generated("software.amazon.awssdk:codegen") public final class ConfigRule extends Object implements SdkPojo, Serializable, ToCopyableBuilder<ConfigRule.Builder,ConfigRule>

Config rules evaluate the configuration settings of your Amazon Web Services resources. A rule can run when Config detects a configuration change to an Amazon Web Services resource or at a periodic frequency that you choose (for example, every 24 hours). There are two types of rules: Config Managed Rules and Config Custom Rules.

Config Managed Rules are predefined, customizable rules created by Config. For a list of managed rules, see List of Config Managed Rules.

Config Custom Rules are rules that you create from scratch. There are two ways to create Config custom rules: with Lambda functions ( Lambda Developer Guide) and with Guard (Guard GitHub Repository), a policy-as-code language. Config custom rules created with Lambda are called Config Custom Lambda Rules and Config custom rules created with Guard are called Config Custom Policy Rules.

For more information about developing and using Config rules, see Evaluating Resource with Config Rules in the Config Developer Guide.

You can use the Amazon Web Services CLI and Amazon Web Services SDKs if you want to create a rule that triggers evaluations for your resources when Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.

See Also:
  • Method Details

    • configRuleName

      public final String configRuleName()

      The name that you assign to the Config rule. The name is required if you are adding a new rule.

      Returns:
      The name that you assign to the Config rule. The name is required if you are adding a new rule.
    • configRuleArn

      public final String configRuleArn()

      The Amazon Resource Name (ARN) of the Config rule.

      Returns:
      The Amazon Resource Name (ARN) of the Config rule.
    • configRuleId

      public final String configRuleId()

      The ID of the Config rule.

      Returns:
      The ID of the Config rule.
    • description

      public final String description()

      The description that you provide for the Config rule.

      Returns:
      The description that you provide for the Config rule.
    • scope

      public final Scope scope()

      Defines which resources can trigger an evaluation for the rule. 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.

      Returns:
      Defines which resources can trigger an evaluation for the rule. 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.

    • source

      public final Source source()

      Provides the rule owner (Amazon Web Services 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 Amazon Web Services resources.

      Returns:
      Provides the rule owner (Amazon Web Services 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 Amazon Web Services resources.
    • inputParameters

      public final String inputParameters()

      A string, in JSON format, that is passed to the Config rule Lambda function.

      Returns:
      A string, in JSON format, that is passed to the Config rule Lambda function.
    • maximumExecutionFrequency

      public final MaximumExecutionFrequency maximumExecutionFrequency()

      The maximum frequency with which Config runs evaluations for a rule. You can specify a value for MaximumExecutionFrequency when:

      • This is for an Config managed rule that is triggered at a periodic frequency.

      • Your custom rule is triggered when Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.

      By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

      If the service returns an enum value that is not available in the current SDK version, maximumExecutionFrequency will return MaximumExecutionFrequency.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from maximumExecutionFrequencyAsString().

      Returns:
      The maximum frequency with which Config runs evaluations for a rule. You can specify a value for MaximumExecutionFrequency when:

      • This is for an Config managed rule that is triggered at a periodic frequency.

      • Your custom rule is triggered when Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.

      By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

      See Also:
    • maximumExecutionFrequencyAsString

      public final String maximumExecutionFrequencyAsString()

      The maximum frequency with which Config runs evaluations for a rule. You can specify a value for MaximumExecutionFrequency when:

      • This is for an Config managed rule that is triggered at a periodic frequency.

      • Your custom rule is triggered when Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.

      By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

      If the service returns an enum value that is not available in the current SDK version, maximumExecutionFrequency will return MaximumExecutionFrequency.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from maximumExecutionFrequencyAsString().

      Returns:
      The maximum frequency with which Config runs evaluations for a rule. You can specify a value for MaximumExecutionFrequency when:

      • This is for an Config managed rule that is triggered at a periodic frequency.

      • Your custom rule is triggered when Config delivers the configuration snapshot. For more information, see ConfigSnapshotDeliveryProperties.

      By default, rules with a periodic trigger are evaluated every 24 hours. To change the frequency, specify a valid value for the MaximumExecutionFrequency parameter.

      See Also:
    • configRuleState

      public final ConfigRuleState configRuleState()

      Indicates whether the Config rule is active or is currently being deleted by Config. It can also indicate the evaluation status for the Config rule.

      Config sets the state of the rule to EVALUATING temporarily after you use the StartConfigRulesEvaluation request to evaluate your resources against the Config rule.

      Config sets the state of the rule to DELETING_RESULTS temporarily after you use the DeleteEvaluationResults request to delete the current evaluation results for the Config rule.

      Config temporarily sets the state of a rule to DELETING after you use the DeleteConfigRule request to delete the rule. After Config deletes the rule, the rule and all of its evaluations are erased and are no longer available.

      If the service returns an enum value that is not available in the current SDK version, configRuleState will return ConfigRuleState.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from configRuleStateAsString().

      Returns:
      Indicates whether the Config rule is active or is currently being deleted by Config. It can also indicate the evaluation status for the Config rule.

      Config sets the state of the rule to EVALUATING temporarily after you use the StartConfigRulesEvaluation request to evaluate your resources against the Config rule.

      Config sets the state of the rule to DELETING_RESULTS temporarily after you use the DeleteEvaluationResults request to delete the current evaluation results for the Config rule.

      Config temporarily sets the state of a rule to DELETING after you use the DeleteConfigRule request to delete the rule. After Config deletes the rule, the rule and all of its evaluations are erased and are no longer available.

      See Also:
    • configRuleStateAsString

      public final String configRuleStateAsString()

      Indicates whether the Config rule is active or is currently being deleted by Config. It can also indicate the evaluation status for the Config rule.

      Config sets the state of the rule to EVALUATING temporarily after you use the StartConfigRulesEvaluation request to evaluate your resources against the Config rule.

      Config sets the state of the rule to DELETING_RESULTS temporarily after you use the DeleteEvaluationResults request to delete the current evaluation results for the Config rule.

      Config temporarily sets the state of a rule to DELETING after you use the DeleteConfigRule request to delete the rule. After Config deletes the rule, the rule and all of its evaluations are erased and are no longer available.

      If the service returns an enum value that is not available in the current SDK version, configRuleState will return ConfigRuleState.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available from configRuleStateAsString().

      Returns:
      Indicates whether the Config rule is active or is currently being deleted by Config. It can also indicate the evaluation status for the Config rule.

      Config sets the state of the rule to EVALUATING temporarily after you use the StartConfigRulesEvaluation request to evaluate your resources against the Config rule.

      Config sets the state of the rule to DELETING_RESULTS temporarily after you use the DeleteEvaluationResults request to delete the current evaluation results for the Config rule.

      Config temporarily sets the state of a rule to DELETING after you use the DeleteConfigRule request to delete the rule. After Config deletes the rule, the rule and all of its evaluations are erased and are no longer available.

      See Also:
    • createdBy

      public final String createdBy()

      Service principal name of the service that created the rule.

      The field is populated only if the service-linked rule is created by a service. The field is empty if you create your own rule.

      Returns:
      Service principal name of the service that created the rule.

      The field is populated only if the service-linked rule is created by a service. The field is empty if you create your own rule.

    • hasEvaluationModes

      public final boolean hasEvaluationModes()
      For responses, this returns true if the service returned a value for the EvaluationModes property. This DOES NOT check that the value is non-empty (for which, you should check the isEmpty() method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified.
    • evaluationModes

      public final List<EvaluationModeConfiguration> evaluationModes()

      The modes the Config rule can be evaluated in. The valid values are distinct objects. By default, the value is Detective evaluation mode only.

      Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.

      This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the hasEvaluationModes() method.

      Returns:
      The modes the Config rule can be evaluated in. The valid values are distinct objects. By default, the value is Detective evaluation mode only.
    • toBuilder

      public ConfigRule.Builder toBuilder()
      Description copied from interface: ToCopyableBuilder
      Take this object and create a builder that contains all of the current property values of this object.
      Specified by:
      toBuilder in interface ToCopyableBuilder<ConfigRule.Builder,ConfigRule>
      Returns:
      a builder for type T
    • builder

      public static ConfigRule.Builder builder()
    • serializableBuilderClass

      public static Class<? extends ConfigRule.Builder> serializableBuilderClass()
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equalsBySdkFields

      public final boolean equalsBySdkFields(Object obj)
      Description copied from interface: SdkPojo
      Indicates whether some other object is "equal to" this one by SDK fields. An SDK field is a modeled, non-inherited field in an SdkPojo class, and is generated based on a service model.

      If an SdkPojo class does not have any inherited fields, equalsBySdkFields and equals are essentially the same.

      Specified by:
      equalsBySdkFields in interface SdkPojo
      Parameters:
      obj - the object to be compared with
      Returns:
      true if the other object equals to this object by sdk fields, false otherwise.
    • toString

      public final String toString()
      Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be redacted from this string using a placeholder value.
      Overrides:
      toString in class Object
    • getValueForField

      public final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz)
    • sdkFields

      public final List<SdkField<?>> sdkFields()
      Specified by:
      sdkFields in interface SdkPojo
      Returns:
      List of SdkField in this POJO. May be empty list but should never be null.