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

commonMain.aws.sdk.kotlin.services.proton.model.ResourceSyncAttempt.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.proton.model

import aws.smithy.kotlin.runtime.SdkDsl
import aws.smithy.kotlin.runtime.time.Instant

/**
 * Detail data for a resource sync attempt activated by a push to a repository.
 */
public class ResourceSyncAttempt private constructor(builder: Builder) {
    /**
     * An array of events with detail data.
     */
    public val events: List = requireNotNull(builder.events) { "A non-null value must be provided for events" }
    /**
     * Detail data for the initial repository commit, path and push.
     */
    public val initialRevision: aws.sdk.kotlin.services.proton.model.Revision? = builder.initialRevision
    /**
     * The time when the sync attempt started.
     */
    public val startedAt: aws.smithy.kotlin.runtime.time.Instant = requireNotNull(builder.startedAt) { "A non-null value must be provided for startedAt" }
    /**
     * The status of the sync attempt.
     */
    public val status: aws.sdk.kotlin.services.proton.model.ResourceSyncStatus = requireNotNull(builder.status) { "A non-null value must be provided for status" }
    /**
     * The resource that is synced to.
     */
    public val target: kotlin.String = requireNotNull(builder.target) { "A non-null value must be provided for target" }
    /**
     * Detail data for the target revision.
     */
    public val targetRevision: aws.sdk.kotlin.services.proton.model.Revision? = builder.targetRevision

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

    override fun toString(): kotlin.String = buildString {
        append("ResourceSyncAttempt(")
        append("events=$events,")
        append("initialRevision=$initialRevision,")
        append("startedAt=$startedAt,")
        append("status=$status,")
        append("target=$target,")
        append("targetRevision=$targetRevision")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = events.hashCode()
        result = 31 * result + (initialRevision?.hashCode() ?: 0)
        result = 31 * result + (startedAt.hashCode())
        result = 31 * result + (status.hashCode())
        result = 31 * result + (target.hashCode())
        result = 31 * result + (targetRevision?.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 ResourceSyncAttempt

        if (events != other.events) return false
        if (initialRevision != other.initialRevision) return false
        if (startedAt != other.startedAt) return false
        if (status != other.status) return false
        if (target != other.target) return false
        if (targetRevision != other.targetRevision) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * An array of events with detail data.
         */
        public var events: List? = null
        /**
         * Detail data for the initial repository commit, path and push.
         */
        public var initialRevision: aws.sdk.kotlin.services.proton.model.Revision? = null
        /**
         * The time when the sync attempt started.
         */
        public var startedAt: aws.smithy.kotlin.runtime.time.Instant? = null
        /**
         * The status of the sync attempt.
         */
        public var status: aws.sdk.kotlin.services.proton.model.ResourceSyncStatus? = null
        /**
         * The resource that is synced to.
         */
        public var target: kotlin.String? = null
        /**
         * Detail data for the target revision.
         */
        public var targetRevision: aws.sdk.kotlin.services.proton.model.Revision? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.proton.model.ResourceSyncAttempt) : this() {
            this.events = x.events
            this.initialRevision = x.initialRevision
            this.startedAt = x.startedAt
            this.status = x.status
            this.target = x.target
            this.targetRevision = x.targetRevision
        }

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

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

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

        internal fun correctErrors(): Builder {
            if (events == null) events = emptyList()
            if (startedAt == null) startedAt = Instant.fromEpochSeconds(0)
            if (status == null) status = ResourceSyncStatus.SdkUnknown("no value provided")
            if (target == null) target = ""
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy