commonMain.aws.sdk.kotlin.services.bedrockruntime.model.ApplyGuardrailResponse.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bedrockruntime-jvm Show documentation
Show all versions of bedrockruntime-jvm Show documentation
The AWS SDK for Kotlin client for Bedrock Runtime
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrockruntime.model
import aws.smithy.kotlin.runtime.SdkDsl
public class ApplyGuardrailResponse private constructor(builder: Builder) {
/**
* The action taken in the response from the guardrail.
*/
public val action: aws.sdk.kotlin.services.bedrockruntime.model.GuardrailAction = requireNotNull(builder.action) { "A non-null value must be provided for action" }
/**
* The assessment details in the response from the guardrail.
*/
public val assessments: List = requireNotNull(builder.assessments) { "A non-null value must be provided for assessments" }
/**
* The output details in the response from the guardrail.
*/
public val outputs: List = requireNotNull(builder.outputs) { "A non-null value must be provided for outputs" }
/**
* The usage details in the response from the guardrail.
*/
public val usage: aws.sdk.kotlin.services.bedrockruntime.model.GuardrailUsage? = builder.usage
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.bedrockruntime.model.ApplyGuardrailResponse = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("ApplyGuardrailResponse(")
append("action=$action,")
append("assessments=$assessments,")
append("outputs=$outputs,")
append("usage=$usage")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = action.hashCode()
result = 31 * result + (assessments.hashCode())
result = 31 * result + (outputs.hashCode())
result = 31 * result + (usage?.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 ApplyGuardrailResponse
if (action != other.action) return false
if (assessments != other.assessments) return false
if (outputs != other.outputs) return false
if (usage != other.usage) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.bedrockruntime.model.ApplyGuardrailResponse = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The action taken in the response from the guardrail.
*/
public var action: aws.sdk.kotlin.services.bedrockruntime.model.GuardrailAction? = null
/**
* The assessment details in the response from the guardrail.
*/
public var assessments: List? = null
/**
* The output details in the response from the guardrail.
*/
public var outputs: List? = null
/**
* The usage details in the response from the guardrail.
*/
public var usage: aws.sdk.kotlin.services.bedrockruntime.model.GuardrailUsage? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.bedrockruntime.model.ApplyGuardrailResponse) : this() {
this.action = x.action
this.assessments = x.assessments
this.outputs = x.outputs
this.usage = x.usage
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.bedrockruntime.model.ApplyGuardrailResponse = ApplyGuardrailResponse(this)
/**
* construct an [aws.sdk.kotlin.services.bedrockruntime.model.GuardrailUsage] inside the given [block]
*/
public fun usage(block: aws.sdk.kotlin.services.bedrockruntime.model.GuardrailUsage.Builder.() -> kotlin.Unit) {
this.usage = aws.sdk.kotlin.services.bedrockruntime.model.GuardrailUsage.invoke(block)
}
internal fun correctErrors(): Builder {
if (action == null) action = GuardrailAction.SdkUnknown("no value provided")
if (assessments == null) assessments = emptyList()
if (outputs == null) outputs = emptyList()
return this
}
}
}