commonMain.aws.sdk.kotlin.services.autoscalingplans.model.ScalingPolicy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of autoscalingplans-jvm Show documentation
Show all versions of autoscalingplans-jvm Show documentation
The AWS SDK for Kotlin client for Auto Scaling Plans
// 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
}
}
}