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

commonMain.aws.sdk.kotlin.services.codeartifact.model.PackageOriginRestrictions.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.codeartifact.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Details about the origin restrictions set on the package. The package origin restrictions determine how new versions of a package can be added to a specific repository.
 */
public class PackageOriginRestrictions private constructor(builder: Builder) {
    /**
     * The package origin configuration that determines if new versions of the package can be published directly to the repository.
     */
    public val publish: aws.sdk.kotlin.services.codeartifact.model.AllowPublish = requireNotNull(builder.publish) { "A non-null value must be provided for publish" }
    /**
     * The package origin configuration that determines if new versions of the package can be added to the repository from an external connection or upstream source.
     */
    public val upstream: aws.sdk.kotlin.services.codeartifact.model.AllowUpstream = requireNotNull(builder.upstream) { "A non-null value must be provided for upstream" }

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

    override fun toString(): kotlin.String = buildString {
        append("PackageOriginRestrictions(")
        append("publish=$publish,")
        append("upstream=$upstream")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = publish.hashCode()
        result = 31 * result + (upstream.hashCode())
        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 PackageOriginRestrictions

        if (publish != other.publish) return false
        if (upstream != other.upstream) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The package origin configuration that determines if new versions of the package can be published directly to the repository.
         */
        public var publish: aws.sdk.kotlin.services.codeartifact.model.AllowPublish? = null
        /**
         * The package origin configuration that determines if new versions of the package can be added to the repository from an external connection or upstream source.
         */
        public var upstream: aws.sdk.kotlin.services.codeartifact.model.AllowUpstream? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.codeartifact.model.PackageOriginRestrictions) : this() {
            this.publish = x.publish
            this.upstream = x.upstream
        }

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

        internal fun correctErrors(): Builder {
            if (publish == null) publish = AllowPublish.SdkUnknown("no value provided")
            if (upstream == null) upstream = AllowUpstream.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy