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

commonMain.aws.sdk.kotlin.services.opensearchserverless.model.CreateAccessPolicyRequest.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.opensearchserverless.model



public class CreateAccessPolicyRequest private constructor(builder: Builder) {
    /**
     * Unique, case-sensitive identifier to ensure idempotency of the request.
     */
    public val clientToken: kotlin.String? = builder.clientToken
    /**
     * A description of the policy. Typically used to store information about the permissions defined in the policy.
     */
    public val description: kotlin.String? = builder.description
    /**
     * The name of the policy.
     */
    public val name: kotlin.String = requireNotNull(builder.name) { "A non-null value must be provided for name" }
    /**
     * The JSON policy document to use as the content for the policy.
     */
    public val policy: kotlin.String = requireNotNull(builder.policy) { "A non-null value must be provided for policy" }
    /**
     * The type of policy.
     */
    public val type: aws.sdk.kotlin.services.opensearchserverless.model.AccessPolicyType = requireNotNull(builder.type) { "A non-null value must be provided for type" }

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

    override fun toString(): kotlin.String = buildString {
        append("CreateAccessPolicyRequest(")
        append("clientToken=$clientToken,")
        append("description=$description,")
        append("name=$name,")
        append("policy=$policy,")
        append("type=$type")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = clientToken?.hashCode() ?: 0
        result = 31 * result + (description?.hashCode() ?: 0)
        result = 31 * result + (name.hashCode())
        result = 31 * result + (policy.hashCode())
        result = 31 * result + (type.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 CreateAccessPolicyRequest

        if (clientToken != other.clientToken) return false
        if (description != other.description) return false
        if (name != other.name) return false
        if (policy != other.policy) return false
        if (type != other.type) return false

        return true
    }

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

    public class Builder {
        /**
         * Unique, case-sensitive identifier to ensure idempotency of the request.
         */
        public var clientToken: kotlin.String? = null
        /**
         * A description of the policy. Typically used to store information about the permissions defined in the policy.
         */
        public var description: kotlin.String? = null
        /**
         * The name of the policy.
         */
        public var name: kotlin.String? = null
        /**
         * The JSON policy document to use as the content for the policy.
         */
        public var policy: kotlin.String? = null
        /**
         * The type of policy.
         */
        public var type: aws.sdk.kotlin.services.opensearchserverless.model.AccessPolicyType? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.opensearchserverless.model.CreateAccessPolicyRequest) : this() {
            this.clientToken = x.clientToken
            this.description = x.description
            this.name = x.name
            this.policy = x.policy
            this.type = x.type
        }

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

        internal fun correctErrors(): Builder {
            if (name == null) name = ""
            if (policy == null) policy = ""
            if (type == null) type = AccessPolicyType.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy