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

commonMain.aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelObjectiveBudgetReport.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.applicationsignals.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * A structure containing an SLO budget report that you have requested.
 */
public class ServiceLevelObjectiveBudgetReport private constructor(builder: Builder) {
    /**
     * The ARN of the SLO that this report is for.
     */
    public val arn: kotlin.String = requireNotNull(builder.arn) { "A non-null value must be provided for arn" }
    /**
     * A number between 0 and 100 that represents the success percentage of your application compared to the goal set by the SLO.
     *
     * If this is a period-based SLO, the number is the percentage of time periods that the service has attained the SLO's attainment goal, as of the time of the request.
     *
     * If this is a request-based SLO, the number is the number of successful requests divided by the number of total requests, multiplied by 100, during the time range that you specified in your request.
     */
    public val attainment: kotlin.Double? = builder.attainment
    /**
     * This field is displayed only for request-based SLOs. It displays the number of failed requests that can be tolerated before any more successful requests occur, and still have the application meet its SLO goal.
     *
     * This number can go up and down between different reports, based on both how many successful requests and how many failed requests occur in that time.
     */
    public val budgetRequestsRemaining: kotlin.Int? = builder.budgetRequestsRemaining
    /**
     * The budget amount remaining before the SLO status becomes `BREACHING`, at the time specified in the `Timestemp` parameter of the request. If this value is negative, then the SLO is already in `BREACHING` status.
     *
     *  This field is included only if the SLO is a period-based SLO.
     */
    public val budgetSecondsRemaining: kotlin.Int? = builder.budgetSecondsRemaining
    /**
     * The status of this SLO, as it relates to the error budget for the entire time interval.
     * + `OK` means that the SLO had remaining budget above the warning threshold, as of the time that you specified in `TimeStamp`.
     * + `WARNING` means that the SLO's remaining budget was below the warning threshold, as of the time that you specified in `TimeStamp`.
     * + `BREACHED` means that the SLO's budget was exhausted, as of the time that you specified in `TimeStamp`.
     * + `INSUFFICIENT_DATA` means that the specified start and end times were before the SLO was created, or that attainment data is missing.
     */
    public val budgetStatus: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelObjectiveBudgetStatus = requireNotNull(builder.budgetStatus) { "A non-null value must be provided for budgetStatus" }
    /**
     * Displays whether this budget report is for a period-based SLO or a request-based SLO.
     */
    public val evaluationType: aws.sdk.kotlin.services.applicationsignals.model.EvaluationType? = builder.evaluationType
    /**
     * This structure contains the attributes that determine the goal of an SLO. This includes the time period for evaluation and the attainment threshold.
     */
    public val goal: aws.sdk.kotlin.services.applicationsignals.model.Goal? = builder.goal
    /**
     * The name of the SLO that this report is for.
     */
    public val name: kotlin.String = requireNotNull(builder.name) { "A non-null value must be provided for name" }
    /**
     * This structure contains information about the performance metric that a request-based SLO monitors.
     */
    public val requestBasedSli: aws.sdk.kotlin.services.applicationsignals.model.RequestBasedServiceLevelIndicator? = builder.requestBasedSli
    /**
     * A structure that contains information about the performance metric that this SLO monitors.
     */
    public val sli: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicator? = builder.sli
    /**
     * This field is displayed only for request-based SLOs. It displays the total number of failed requests that can be tolerated during the time range between the start of the interval and the time stamp supplied in the budget report request. It is based on the total number of requests that occurred, and the percentage specified in the attainment goal. If the number of failed requests matches this number or is higher, then this SLO is currently breaching.
     *
     * This number can go up and down between reports with different time stamps, based on both how many total requests occur.
     */
    public val totalBudgetRequests: kotlin.Int? = builder.totalBudgetRequests
    /**
     * The total number of seconds in the error budget for the interval. This field is included only if the SLO is a period-based SLO.
     */
    public val totalBudgetSeconds: kotlin.Int? = builder.totalBudgetSeconds

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

    override fun toString(): kotlin.String = buildString {
        append("ServiceLevelObjectiveBudgetReport(")
        append("arn=$arn,")
        append("attainment=$attainment,")
        append("budgetRequestsRemaining=$budgetRequestsRemaining,")
        append("budgetSecondsRemaining=$budgetSecondsRemaining,")
        append("budgetStatus=$budgetStatus,")
        append("evaluationType=$evaluationType,")
        append("goal=$goal,")
        append("name=$name,")
        append("requestBasedSli=$requestBasedSli,")
        append("sli=$sli,")
        append("totalBudgetRequests=$totalBudgetRequests,")
        append("totalBudgetSeconds=$totalBudgetSeconds")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = arn.hashCode()
        result = 31 * result + (attainment?.hashCode() ?: 0)
        result = 31 * result + (budgetRequestsRemaining ?: 0)
        result = 31 * result + (budgetSecondsRemaining ?: 0)
        result = 31 * result + (budgetStatus.hashCode())
        result = 31 * result + (evaluationType?.hashCode() ?: 0)
        result = 31 * result + (goal?.hashCode() ?: 0)
        result = 31 * result + (name.hashCode())
        result = 31 * result + (requestBasedSli?.hashCode() ?: 0)
        result = 31 * result + (sli?.hashCode() ?: 0)
        result = 31 * result + (totalBudgetRequests ?: 0)
        result = 31 * result + (totalBudgetSeconds ?: 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 ServiceLevelObjectiveBudgetReport

        if (arn != other.arn) return false
        if (!(attainment?.equals(other.attainment) ?: (other.attainment == null))) return false
        if (budgetRequestsRemaining != other.budgetRequestsRemaining) return false
        if (budgetSecondsRemaining != other.budgetSecondsRemaining) return false
        if (budgetStatus != other.budgetStatus) return false
        if (evaluationType != other.evaluationType) return false
        if (goal != other.goal) return false
        if (name != other.name) return false
        if (requestBasedSli != other.requestBasedSli) return false
        if (sli != other.sli) return false
        if (totalBudgetRequests != other.totalBudgetRequests) return false
        if (totalBudgetSeconds != other.totalBudgetSeconds) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The ARN of the SLO that this report is for.
         */
        public var arn: kotlin.String? = null
        /**
         * A number between 0 and 100 that represents the success percentage of your application compared to the goal set by the SLO.
         *
         * If this is a period-based SLO, the number is the percentage of time periods that the service has attained the SLO's attainment goal, as of the time of the request.
         *
         * If this is a request-based SLO, the number is the number of successful requests divided by the number of total requests, multiplied by 100, during the time range that you specified in your request.
         */
        public var attainment: kotlin.Double? = null
        /**
         * This field is displayed only for request-based SLOs. It displays the number of failed requests that can be tolerated before any more successful requests occur, and still have the application meet its SLO goal.
         *
         * This number can go up and down between different reports, based on both how many successful requests and how many failed requests occur in that time.
         */
        public var budgetRequestsRemaining: kotlin.Int? = null
        /**
         * The budget amount remaining before the SLO status becomes `BREACHING`, at the time specified in the `Timestemp` parameter of the request. If this value is negative, then the SLO is already in `BREACHING` status.
         *
         *  This field is included only if the SLO is a period-based SLO.
         */
        public var budgetSecondsRemaining: kotlin.Int? = null
        /**
         * The status of this SLO, as it relates to the error budget for the entire time interval.
         * + `OK` means that the SLO had remaining budget above the warning threshold, as of the time that you specified in `TimeStamp`.
         * + `WARNING` means that the SLO's remaining budget was below the warning threshold, as of the time that you specified in `TimeStamp`.
         * + `BREACHED` means that the SLO's budget was exhausted, as of the time that you specified in `TimeStamp`.
         * + `INSUFFICIENT_DATA` means that the specified start and end times were before the SLO was created, or that attainment data is missing.
         */
        public var budgetStatus: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelObjectiveBudgetStatus? = null
        /**
         * Displays whether this budget report is for a period-based SLO or a request-based SLO.
         */
        public var evaluationType: aws.sdk.kotlin.services.applicationsignals.model.EvaluationType? = null
        /**
         * This structure contains the attributes that determine the goal of an SLO. This includes the time period for evaluation and the attainment threshold.
         */
        public var goal: aws.sdk.kotlin.services.applicationsignals.model.Goal? = null
        /**
         * The name of the SLO that this report is for.
         */
        public var name: kotlin.String? = null
        /**
         * This structure contains information about the performance metric that a request-based SLO monitors.
         */
        public var requestBasedSli: aws.sdk.kotlin.services.applicationsignals.model.RequestBasedServiceLevelIndicator? = null
        /**
         * A structure that contains information about the performance metric that this SLO monitors.
         */
        public var sli: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelIndicator? = null
        /**
         * This field is displayed only for request-based SLOs. It displays the total number of failed requests that can be tolerated during the time range between the start of the interval and the time stamp supplied in the budget report request. It is based on the total number of requests that occurred, and the percentage specified in the attainment goal. If the number of failed requests matches this number or is higher, then this SLO is currently breaching.
         *
         * This number can go up and down between reports with different time stamps, based on both how many total requests occur.
         */
        public var totalBudgetRequests: kotlin.Int? = null
        /**
         * The total number of seconds in the error budget for the interval. This field is included only if the SLO is a period-based SLO.
         */
        public var totalBudgetSeconds: kotlin.Int? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.applicationsignals.model.ServiceLevelObjectiveBudgetReport) : this() {
            this.arn = x.arn
            this.attainment = x.attainment
            this.budgetRequestsRemaining = x.budgetRequestsRemaining
            this.budgetSecondsRemaining = x.budgetSecondsRemaining
            this.budgetStatus = x.budgetStatus
            this.evaluationType = x.evaluationType
            this.goal = x.goal
            this.name = x.name
            this.requestBasedSli = x.requestBasedSli
            this.sli = x.sli
            this.totalBudgetRequests = x.totalBudgetRequests
            this.totalBudgetSeconds = x.totalBudgetSeconds
        }

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

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

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

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

        internal fun correctErrors(): Builder {
            if (arn == null) arn = ""
            if (budgetStatus == null) budgetStatus = ServiceLevelObjectiveBudgetStatus.SdkUnknown("no value provided")
            if (name == null) name = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy