commonMain.aws.sdk.kotlin.services.grafana.model.PermissionEntry.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grafana-jvm Show documentation
Show all versions of grafana-jvm Show documentation
The AWS SDK for Kotlin client for grafana
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.grafana.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* A structure containing the identity of one user or group and the `Admin`, `Editor`, or `Viewer` role that they have.
*/
public class PermissionEntry private constructor(builder: Builder) {
/**
* Specifies whether the user or group has the `Admin`, `Editor`, or `Viewer` role.
*/
public val role: aws.sdk.kotlin.services.grafana.model.Role = requireNotNull(builder.role) { "A non-null value must be provided for role" }
/**
* A structure with the ID of the user or group with this role.
*/
public val user: aws.sdk.kotlin.services.grafana.model.User? = builder.user
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.grafana.model.PermissionEntry = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("PermissionEntry(")
append("role=$role,")
append("user=$user")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = role.hashCode()
result = 31 * result + (user?.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 PermissionEntry
if (role != other.role) return false
if (user != other.user) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.grafana.model.PermissionEntry = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* Specifies whether the user or group has the `Admin`, `Editor`, or `Viewer` role.
*/
public var role: aws.sdk.kotlin.services.grafana.model.Role? = null
/**
* A structure with the ID of the user or group with this role.
*/
public var user: aws.sdk.kotlin.services.grafana.model.User? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.grafana.model.PermissionEntry) : this() {
this.role = x.role
this.user = x.user
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.grafana.model.PermissionEntry = PermissionEntry(this)
/**
* construct an [aws.sdk.kotlin.services.grafana.model.User] inside the given [block]
*/
public fun user(block: aws.sdk.kotlin.services.grafana.model.User.Builder.() -> kotlin.Unit) {
this.user = aws.sdk.kotlin.services.grafana.model.User.invoke(block)
}
internal fun correctErrors(): Builder {
if (role == null) role = Role.SdkUnknown("no value provided")
return this
}
}
}