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

aws.sdk.kotlin.services.sagemaker.model.RetryStrategy.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.sagemaker.model



/**
 * The retry strategy to use when a training job fails due to an
 * InternalServerError. RetryStrategy is specified as part of
 * the CreateTrainingJob and CreateHyperParameterTuningJob
 * requests. You can add the StoppingCondition parameter to the request to
 * limit the training time for the complete job.
 */
class RetryStrategy private constructor(builder: BuilderImpl) {
    /**
     * The number of times to retry the job. When the job is retried, it's
     * SecondaryStatus is changed to STARTING.
     */
    val maximumRetryAttempts: Int = builder.maximumRetryAttempts

    companion object {
        @JvmStatic
        fun fluentBuilder(): FluentBuilder = BuilderImpl()

        internal fun builder(): DslBuilder = BuilderImpl()

        operator fun invoke(block: DslBuilder.() -> kotlin.Unit): RetryStrategy = BuilderImpl().apply(block).build()

    }

    override fun toString(): kotlin.String = buildString {
        append("RetryStrategy(")
        append("maximumRetryAttempts=$maximumRetryAttempts)")
    }

    override fun hashCode(): kotlin.Int {
        var result = maximumRetryAttempts
        return result
    }

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

        other as RetryStrategy

        if (maximumRetryAttempts != other.maximumRetryAttempts) return false

        return true
    }

    fun copy(block: DslBuilder.() -> kotlin.Unit = {}): RetryStrategy = BuilderImpl(this).apply(block).build()

    interface FluentBuilder {
        fun build(): RetryStrategy
        /**
         * The number of times to retry the job. When the job is retried, it's
         * SecondaryStatus is changed to STARTING.
         */
        fun maximumRetryAttempts(maximumRetryAttempts: Int): FluentBuilder
    }

    interface DslBuilder {
        /**
         * The number of times to retry the job. When the job is retried, it's
         * SecondaryStatus is changed to STARTING.
         */
        var maximumRetryAttempts: Int

        fun build(): RetryStrategy
    }

    private class BuilderImpl() : FluentBuilder, DslBuilder {
        override var maximumRetryAttempts: Int = 0

        constructor(x: RetryStrategy) : this() {
            this.maximumRetryAttempts = x.maximumRetryAttempts
        }

        override fun build(): RetryStrategy = RetryStrategy(this)
        override fun maximumRetryAttempts(maximumRetryAttempts: Int): FluentBuilder = apply { this.maximumRetryAttempts = maximumRetryAttempts }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy