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

commonMain.aws.sdk.kotlin.services.autoscalingplans.model.ScalingPolicy.kt Maven / Gradle / Ivy

There is a newer version: 1.3.77
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.autoscalingplans.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Represents a scaling policy.
 */
public class ScalingPolicy private constructor(builder: Builder) {
    /**
     * The name of the scaling policy.
     */
    public val policyName: kotlin.String = requireNotNull(builder.policyName) { "A non-null value must be provided for policyName" }
    /**
     * The type of scaling policy.
     */
    public val policyType: aws.sdk.kotlin.services.autoscalingplans.model.PolicyType = requireNotNull(builder.policyType) { "A non-null value must be provided for policyType" }
    /**
     * The target tracking scaling policy. Includes support for predefined or customized metrics.
     */
    public val targetTrackingConfiguration: aws.sdk.kotlin.services.autoscalingplans.model.TargetTrackingConfiguration? = builder.targetTrackingConfiguration

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

    override fun toString(): kotlin.String = buildString {
        append("ScalingPolicy(")
        append("policyName=$policyName,")
        append("policyType=$policyType,")
        append("targetTrackingConfiguration=$targetTrackingConfiguration")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = policyName.hashCode()
        result = 31 * result + (policyType.hashCode())
        result = 31 * result + (targetTrackingConfiguration?.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 ScalingPolicy

        if (policyName != other.policyName) return false
        if (policyType != other.policyType) return false
        if (targetTrackingConfiguration != other.targetTrackingConfiguration) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The name of the scaling policy.
         */
        public var policyName: kotlin.String? = null
        /**
         * The type of scaling policy.
         */
        public var policyType: aws.sdk.kotlin.services.autoscalingplans.model.PolicyType? = null
        /**
         * The target tracking scaling policy. Includes support for predefined or customized metrics.
         */
        public var targetTrackingConfiguration: aws.sdk.kotlin.services.autoscalingplans.model.TargetTrackingConfiguration? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.autoscalingplans.model.ScalingPolicy) : this() {
            this.policyName = x.policyName
            this.policyType = x.policyType
            this.targetTrackingConfiguration = x.targetTrackingConfiguration
        }

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

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

        internal fun correctErrors(): Builder {
            if (policyName == null) policyName = ""
            if (policyType == null) policyType = PolicyType.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy