All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.configservice.model.ConfigRule.kt Maven / Gradle / Ivy

The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.configservice.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * 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](https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html).
 *
 * 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](https://docs.aws.amazon.com/config/latest/developerguide/gettingstarted-concepts.html#gettingstarted-concepts-function)) and with Guard ([Guard GitHub Repository](https://github.com/aws-cloudformation/cloudformation-guard)), 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](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html) 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.
 */
public class ConfigRule private constructor(builder: Builder) {
    /**
     * The Amazon Resource Name (ARN) of the Config rule.
     */
    public val configRuleArn: kotlin.String? = builder.configRuleArn
    /**
     * The ID of the Config rule.
     */
    public val configRuleId: kotlin.String? = builder.configRuleId
    /**
     * The name that you assign to the Config rule. The name is required if you are adding a new rule.
     */
    public val configRuleName: kotlin.String? = builder.configRuleName
    /**
     * 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.
     */
    public val configRuleState: aws.sdk.kotlin.services.configservice.model.ConfigRuleState? = builder.configRuleState
    /**
     * 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.
     */
    public val createdBy: kotlin.String? = builder.createdBy
    /**
     * The description that you provide for the Config rule.
     */
    public val description: kotlin.String? = builder.description
    /**
     * The modes the Config rule can be evaluated in. The valid values are distinct objects. By default, the value is Detective evaluation mode only.
     */
    public val evaluationModes: List? = builder.evaluationModes
    /**
     * A string, in JSON format, that is passed to the Config rule Lambda function.
     */
    public val inputParameters: kotlin.String? = builder.inputParameters
    /**
     * 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.
     */
    public val maximumExecutionFrequency: aws.sdk.kotlin.services.configservice.model.MaximumExecutionFrequency? = builder.maximumExecutionFrequency
    /**
     * 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.
     */
    public val scope: aws.sdk.kotlin.services.configservice.model.Scope? = builder.scope
    /**
     * 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.
     */
    public val source: aws.sdk.kotlin.services.configservice.model.Source? = builder.source

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.configservice.model.ConfigRule = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("ConfigRule(")
        append("configRuleArn=$configRuleArn,")
        append("configRuleId=$configRuleId,")
        append("configRuleName=$configRuleName,")
        append("configRuleState=$configRuleState,")
        append("createdBy=$createdBy,")
        append("description=$description,")
        append("evaluationModes=$evaluationModes,")
        append("inputParameters=$inputParameters,")
        append("maximumExecutionFrequency=$maximumExecutionFrequency,")
        append("scope=$scope,")
        append("source=$source")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = configRuleArn?.hashCode() ?: 0
        result = 31 * result + (configRuleId?.hashCode() ?: 0)
        result = 31 * result + (configRuleName?.hashCode() ?: 0)
        result = 31 * result + (configRuleState?.hashCode() ?: 0)
        result = 31 * result + (createdBy?.hashCode() ?: 0)
        result = 31 * result + (description?.hashCode() ?: 0)
        result = 31 * result + (evaluationModes?.hashCode() ?: 0)
        result = 31 * result + (inputParameters?.hashCode() ?: 0)
        result = 31 * result + (maximumExecutionFrequency?.hashCode() ?: 0)
        result = 31 * result + (scope?.hashCode() ?: 0)
        result = 31 * result + (source?.hashCode() ?: 0)
        return result
    }

    override fun equals(other: kotlin.Any?): kotlin.Boolean {
        if (this === other) return true
        if (other == null || this::class != other::class) return false

        other as ConfigRule

        if (configRuleArn != other.configRuleArn) return false
        if (configRuleId != other.configRuleId) return false
        if (configRuleName != other.configRuleName) return false
        if (configRuleState != other.configRuleState) return false
        if (createdBy != other.createdBy) return false
        if (description != other.description) return false
        if (evaluationModes != other.evaluationModes) return false
        if (inputParameters != other.inputParameters) return false
        if (maximumExecutionFrequency != other.maximumExecutionFrequency) return false
        if (scope != other.scope) return false
        if (source != other.source) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.configservice.model.ConfigRule = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * The Amazon Resource Name (ARN) of the Config rule.
         */
        public var configRuleArn: kotlin.String? = null
        /**
         * The ID of the Config rule.
         */
        public var configRuleId: kotlin.String? = null
        /**
         * The name that you assign to the Config rule. The name is required if you are adding a new rule.
         */
        public var configRuleName: kotlin.String? = null
        /**
         * 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.
         */
        public var configRuleState: aws.sdk.kotlin.services.configservice.model.ConfigRuleState? = null
        /**
         * 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.
         */
        public var createdBy: kotlin.String? = null
        /**
         * The description that you provide for the Config rule.
         */
        public var description: kotlin.String? = null
        /**
         * The modes the Config rule can be evaluated in. The valid values are distinct objects. By default, the value is Detective evaluation mode only.
         */
        public var evaluationModes: List? = null
        /**
         * A string, in JSON format, that is passed to the Config rule Lambda function.
         */
        public var inputParameters: kotlin.String? = null
        /**
         * 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.
         */
        public var maximumExecutionFrequency: aws.sdk.kotlin.services.configservice.model.MaximumExecutionFrequency? = null
        /**
         * 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.
         */
        public var scope: aws.sdk.kotlin.services.configservice.model.Scope? = null
        /**
         * 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.
         */
        public var source: aws.sdk.kotlin.services.configservice.model.Source? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.configservice.model.ConfigRule) : this() {
            this.configRuleArn = x.configRuleArn
            this.configRuleId = x.configRuleId
            this.configRuleName = x.configRuleName
            this.configRuleState = x.configRuleState
            this.createdBy = x.createdBy
            this.description = x.description
            this.evaluationModes = x.evaluationModes
            this.inputParameters = x.inputParameters
            this.maximumExecutionFrequency = x.maximumExecutionFrequency
            this.scope = x.scope
            this.source = x.source
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.configservice.model.ConfigRule = ConfigRule(this)

        /**
         * construct an [aws.sdk.kotlin.services.configservice.model.Scope] inside the given [block]
         */
        public fun scope(block: aws.sdk.kotlin.services.configservice.model.Scope.Builder.() -> kotlin.Unit) {
            this.scope = aws.sdk.kotlin.services.configservice.model.Scope.invoke(block)
        }

        /**
         * construct an [aws.sdk.kotlin.services.configservice.model.Source] inside the given [block]
         */
        public fun source(block: aws.sdk.kotlin.services.configservice.model.Source.Builder.() -> kotlin.Unit) {
            this.source = aws.sdk.kotlin.services.configservice.model.Source.invoke(block)
        }

        internal fun correctErrors(): Builder {
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy