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

commonMain.aws.sdk.kotlin.services.grafana.model.CreateWorkspaceApiKeyRequest.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.grafana.model

import aws.smithy.kotlin.runtime.SdkDsl

public class CreateWorkspaceApiKeyRequest private constructor(builder: Builder) {
    /**
     * Specifies the name of the key. Keynames must be unique to the workspace.
     */
    public val keyName: kotlin.String = requireNotNull(builder.keyName) { "A non-null value must be provided for keyName" }
    /**
     * Specifies the permission level of the key.
     *
     *  Valid values: `ADMIN`|`EDITOR`|`VIEWER`
     */
    public val keyRole: kotlin.String = requireNotNull(builder.keyRole) { "A non-null value must be provided for keyRole" }
    /**
     * Specifies the time in seconds until the key expires. Keys can be valid for up to 30 days.
     */
    public val secondsToLive: kotlin.Int = requireNotNull(builder.secondsToLive) { "A non-null value must be provided for secondsToLive" }
    /**
     * The ID of the workspace to create an API key.
     */
    public val workspaceId: kotlin.String = requireNotNull(builder.workspaceId) { "A non-null value must be provided for workspaceId" }

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

    override fun toString(): kotlin.String = buildString {
        append("CreateWorkspaceApiKeyRequest(")
        append("keyName=$keyName,")
        append("keyRole=$keyRole,")
        append("secondsToLive=$secondsToLive,")
        append("workspaceId=$workspaceId")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = keyName.hashCode()
        result = 31 * result + (keyRole.hashCode())
        result = 31 * result + (secondsToLive)
        result = 31 * result + (workspaceId.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 CreateWorkspaceApiKeyRequest

        if (keyName != other.keyName) return false
        if (keyRole != other.keyRole) return false
        if (secondsToLive != other.secondsToLive) return false
        if (workspaceId != other.workspaceId) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Specifies the name of the key. Keynames must be unique to the workspace.
         */
        public var keyName: kotlin.String? = null
        /**
         * Specifies the permission level of the key.
         *
         *  Valid values: `ADMIN`|`EDITOR`|`VIEWER`
         */
        public var keyRole: kotlin.String? = null
        /**
         * Specifies the time in seconds until the key expires. Keys can be valid for up to 30 days.
         */
        public var secondsToLive: kotlin.Int? = null
        /**
         * The ID of the workspace to create an API key.
         */
        public var workspaceId: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.grafana.model.CreateWorkspaceApiKeyRequest) : this() {
            this.keyName = x.keyName
            this.keyRole = x.keyRole
            this.secondsToLive = x.secondsToLive
            this.workspaceId = x.workspaceId
        }

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

        internal fun correctErrors(): Builder {
            if (keyName == null) keyName = ""
            if (keyRole == null) keyRole = ""
            if (secondsToLive == null) secondsToLive = 0
            if (workspaceId == null) workspaceId = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy