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

commonMain.aws.sdk.kotlin.services.verifiedpermissions.model.IsAuthorizedResponse.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.verifiedpermissions.model



public class IsAuthorizedResponse private constructor(builder: Builder) {
    /**
     * An authorization decision that indicates if the authorization request should be allowed or denied.
     */
    public val decision: aws.sdk.kotlin.services.verifiedpermissions.model.Decision = requireNotNull(builder.decision) { "A non-null value must be provided for decision" }
    /**
     * The list of determining policies used to make the authorization decision. For example, if there are two matching policies, where one is a forbid and the other is a permit, then the forbid policy will be the determining policy. In the case of multiple matching permit policies then there would be multiple determining policies. In the case that no policies match, and hence the response is DENY, there would be no determining policies.
     */
    public val determiningPolicies: List = requireNotNull(builder.determiningPolicies) { "A non-null value must be provided for determiningPolicies" }
    /**
     * Errors that occurred while making an authorization decision, for example, a policy references an Entity or entity Attribute that does not exist in the slice.
     */
    public val errors: List = requireNotNull(builder.errors) { "A non-null value must be provided for errors" }

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

    override fun toString(): kotlin.String = buildString {
        append("IsAuthorizedResponse(")
        append("decision=$decision,")
        append("determiningPolicies=$determiningPolicies,")
        append("errors=$errors")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = decision.hashCode()
        result = 31 * result + (determiningPolicies.hashCode())
        result = 31 * result + (errors.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 IsAuthorizedResponse

        if (decision != other.decision) return false
        if (determiningPolicies != other.determiningPolicies) return false
        if (errors != other.errors) return false

        return true
    }

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

    public class Builder {
        /**
         * An authorization decision that indicates if the authorization request should be allowed or denied.
         */
        public var decision: aws.sdk.kotlin.services.verifiedpermissions.model.Decision? = null
        /**
         * The list of determining policies used to make the authorization decision. For example, if there are two matching policies, where one is a forbid and the other is a permit, then the forbid policy will be the determining policy. In the case of multiple matching permit policies then there would be multiple determining policies. In the case that no policies match, and hence the response is DENY, there would be no determining policies.
         */
        public var determiningPolicies: List? = null
        /**
         * Errors that occurred while making an authorization decision, for example, a policy references an Entity or entity Attribute that does not exist in the slice.
         */
        public var errors: List? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.verifiedpermissions.model.IsAuthorizedResponse) : this() {
            this.decision = x.decision
            this.determiningPolicies = x.determiningPolicies
            this.errors = x.errors
        }

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

        internal fun correctErrors(): Builder {
            if (decision == null) decision = Decision.SdkUnknown("no value provided")
            if (determiningPolicies == null) determiningPolicies = emptyList()
            if (errors == null) errors = emptyList()
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy