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

commonMain.aws.sdk.kotlin.services.configservice.model.RemediationConfiguration.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

/**
 * An object that represents the details about the remediation configuration that includes the remediation action, parameters, and data to execute the action.
 */
public class RemediationConfiguration private constructor(builder: Builder) {
    /**
     * Amazon Resource Name (ARN) of remediation configuration.
     */
    public val arn: kotlin.String? = builder.arn
    /**
     * The remediation is triggered automatically.
     */
    public val automatic: kotlin.Boolean = builder.automatic
    /**
     * The name of the Config rule.
     */
    public val configRuleName: kotlin.String = requireNotNull(builder.configRuleName) { "A non-null value must be provided for configRuleName" }
    /**
     * Name of the service that owns the service-linked rule, if applicable.
     */
    public val createdByService: kotlin.String? = builder.createdByService
    /**
     * An ExecutionControls object.
     */
    public val executionControls: aws.sdk.kotlin.services.configservice.model.ExecutionControls? = builder.executionControls
    /**
     * The maximum number of failed attempts for auto-remediation. If you do not select a number, the default is 5.
     *
     * For example, if you specify MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config will put a RemediationException on your behalf for the failing resource after the 5th failed attempt within 50 seconds.
     */
    public val maximumAutomaticAttempts: kotlin.Int? = builder.maximumAutomaticAttempts
    /**
     * An object of the RemediationParameterValue.
     */
    public val parameters: Map? = builder.parameters
    /**
     * The type of a resource.
     */
    public val resourceType: kotlin.String? = builder.resourceType
    /**
     * Time window to determine whether or not to add a remediation exception to prevent infinite remediation attempts. If `MaximumAutomaticAttempts` remediation attempts have been made under `RetryAttemptSeconds`, a remediation exception will be added to the resource. If you do not select a number, the default is 60 seconds.
     *
     * For example, if you specify `RetryAttemptSeconds` as 50 seconds and `MaximumAutomaticAttempts` as 5, Config will run auto-remediations 5 times within 50 seconds before adding a remediation exception to the resource.
     */
    public val retryAttemptSeconds: kotlin.Long? = builder.retryAttemptSeconds
    /**
     * Target ID is the name of the SSM document.
     */
    public val targetId: kotlin.String = requireNotNull(builder.targetId) { "A non-null value must be provided for targetId" }
    /**
     * The type of the target. Target executes remediation. For example, SSM document.
     */
    public val targetType: aws.sdk.kotlin.services.configservice.model.RemediationTargetType = requireNotNull(builder.targetType) { "A non-null value must be provided for targetType" }
    /**
     * Version of the target. For example, version of the SSM document.
     *
     * If you make backward incompatible changes to the SSM document, you must call PutRemediationConfiguration API again to ensure the remediations can run.
     */
    public val targetVersion: kotlin.String? = builder.targetVersion

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

    override fun toString(): kotlin.String = buildString {
        append("RemediationConfiguration(")
        append("arn=$arn,")
        append("automatic=$automatic,")
        append("configRuleName=$configRuleName,")
        append("createdByService=$createdByService,")
        append("executionControls=$executionControls,")
        append("maximumAutomaticAttempts=$maximumAutomaticAttempts,")
        append("parameters=$parameters,")
        append("resourceType=$resourceType,")
        append("retryAttemptSeconds=$retryAttemptSeconds,")
        append("targetId=$targetId,")
        append("targetType=$targetType,")
        append("targetVersion=$targetVersion")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = arn?.hashCode() ?: 0
        result = 31 * result + (automatic.hashCode())
        result = 31 * result + (configRuleName.hashCode())
        result = 31 * result + (createdByService?.hashCode() ?: 0)
        result = 31 * result + (executionControls?.hashCode() ?: 0)
        result = 31 * result + (maximumAutomaticAttempts ?: 0)
        result = 31 * result + (parameters?.hashCode() ?: 0)
        result = 31 * result + (resourceType?.hashCode() ?: 0)
        result = 31 * result + (retryAttemptSeconds?.hashCode() ?: 0)
        result = 31 * result + (targetId.hashCode())
        result = 31 * result + (targetType.hashCode())
        result = 31 * result + (targetVersion?.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 RemediationConfiguration

        if (arn != other.arn) return false
        if (automatic != other.automatic) return false
        if (configRuleName != other.configRuleName) return false
        if (createdByService != other.createdByService) return false
        if (executionControls != other.executionControls) return false
        if (maximumAutomaticAttempts != other.maximumAutomaticAttempts) return false
        if (parameters != other.parameters) return false
        if (resourceType != other.resourceType) return false
        if (retryAttemptSeconds != other.retryAttemptSeconds) return false
        if (targetId != other.targetId) return false
        if (targetType != other.targetType) return false
        if (targetVersion != other.targetVersion) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Amazon Resource Name (ARN) of remediation configuration.
         */
        public var arn: kotlin.String? = null
        /**
         * The remediation is triggered automatically.
         */
        public var automatic: kotlin.Boolean = false
        /**
         * The name of the Config rule.
         */
        public var configRuleName: kotlin.String? = null
        /**
         * Name of the service that owns the service-linked rule, if applicable.
         */
        public var createdByService: kotlin.String? = null
        /**
         * An ExecutionControls object.
         */
        public var executionControls: aws.sdk.kotlin.services.configservice.model.ExecutionControls? = null
        /**
         * The maximum number of failed attempts for auto-remediation. If you do not select a number, the default is 5.
         *
         * For example, if you specify MaximumAutomaticAttempts as 5 with RetryAttemptSeconds as 50 seconds, Config will put a RemediationException on your behalf for the failing resource after the 5th failed attempt within 50 seconds.
         */
        public var maximumAutomaticAttempts: kotlin.Int? = null
        /**
         * An object of the RemediationParameterValue.
         */
        public var parameters: Map? = null
        /**
         * The type of a resource.
         */
        public var resourceType: kotlin.String? = null
        /**
         * Time window to determine whether or not to add a remediation exception to prevent infinite remediation attempts. If `MaximumAutomaticAttempts` remediation attempts have been made under `RetryAttemptSeconds`, a remediation exception will be added to the resource. If you do not select a number, the default is 60 seconds.
         *
         * For example, if you specify `RetryAttemptSeconds` as 50 seconds and `MaximumAutomaticAttempts` as 5, Config will run auto-remediations 5 times within 50 seconds before adding a remediation exception to the resource.
         */
        public var retryAttemptSeconds: kotlin.Long? = null
        /**
         * Target ID is the name of the SSM document.
         */
        public var targetId: kotlin.String? = null
        /**
         * The type of the target. Target executes remediation. For example, SSM document.
         */
        public var targetType: aws.sdk.kotlin.services.configservice.model.RemediationTargetType? = null
        /**
         * Version of the target. For example, version of the SSM document.
         *
         * If you make backward incompatible changes to the SSM document, you must call PutRemediationConfiguration API again to ensure the remediations can run.
         */
        public var targetVersion: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.configservice.model.RemediationConfiguration) : this() {
            this.arn = x.arn
            this.automatic = x.automatic
            this.configRuleName = x.configRuleName
            this.createdByService = x.createdByService
            this.executionControls = x.executionControls
            this.maximumAutomaticAttempts = x.maximumAutomaticAttempts
            this.parameters = x.parameters
            this.resourceType = x.resourceType
            this.retryAttemptSeconds = x.retryAttemptSeconds
            this.targetId = x.targetId
            this.targetType = x.targetType
            this.targetVersion = x.targetVersion
        }

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

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

        internal fun correctErrors(): Builder {
            if (configRuleName == null) configRuleName = ""
            if (targetId == null) targetId = ""
            if (targetType == null) targetType = RemediationTargetType.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy