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

commonMain.aws.sdk.kotlin.services.codegurusecurity.model.ThrottlingException.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.codegurusecurity.model

import aws.smithy.kotlin.runtime.ErrorMetadata
import aws.smithy.kotlin.runtime.SdkDsl
import aws.smithy.kotlin.runtime.ServiceErrorMetadata

/**
 * The request was denied due to request throttling.
 */
public class ThrottlingException private constructor(builder: Builder) : CodeGuruSecurityException(builder.message) {

    /**
     * The identifier for the error.
     */
    public val errorCode: kotlin.String = requireNotNull(builder.errorCode) { "A non-null value must be provided for errorCode" }
    /**
     * The identifier for the originating quota.
     */
    public val quotaCode: kotlin.String? = builder.quotaCode
    /**
     * The identifier for the originating service.
     */
    public val serviceCode: kotlin.String? = builder.serviceCode

    init {
        sdkErrorMetadata.attributes[ErrorMetadata.Retryable] = true
        sdkErrorMetadata.attributes[ErrorMetadata.ThrottlingError] = true
        sdkErrorMetadata.attributes[ServiceErrorMetadata.ErrorType] = ErrorType.Client
    }

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

    override fun toString(): kotlin.String = buildString {
        append("ThrottlingException(")
        append("errorCode=$errorCode,")
        append("message=$message,")
        append("quotaCode=$quotaCode,")
        append("serviceCode=$serviceCode")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = errorCode.hashCode()
        result = 31 * result + (message.hashCode())
        result = 31 * result + (quotaCode?.hashCode() ?: 0)
        result = 31 * result + (serviceCode?.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 ThrottlingException

        if (errorCode != other.errorCode) return false
        if (message != other.message) return false
        if (quotaCode != other.quotaCode) return false
        if (serviceCode != other.serviceCode) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The identifier for the error.
         */
        public var errorCode: kotlin.String? = null
        /**
         * Description of the error.
         */
        public var message: kotlin.String? = null
        /**
         * The identifier for the originating quota.
         */
        public var quotaCode: kotlin.String? = null
        /**
         * The identifier for the originating service.
         */
        public var serviceCode: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.codegurusecurity.model.ThrottlingException) : this() {
            this.errorCode = x.errorCode
            this.message = x.message
            this.quotaCode = x.quotaCode
            this.serviceCode = x.serviceCode
        }

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

        internal fun correctErrors(): Builder {
            if (errorCode == null) errorCode = ""
            if (message == null) message = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy