commonMain.aws.sdk.kotlin.services.bedrockagent.serde.AgentVersionDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bedrockagent-jvm Show documentation
Show all versions of bedrockagent-jvm Show documentation
The AWS SDK for Kotlin client for Bedrock Agent
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrockagent.serde
import aws.sdk.kotlin.services.bedrockagent.model.AgentStatus
import aws.sdk.kotlin.services.bedrockagent.model.AgentVersion
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
import aws.smithy.kotlin.runtime.time.Instant
import aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf
internal fun deserializeAgentVersionDocument(deserializer: Deserializer): AgentVersion {
val builder = AgentVersion.Builder()
val AGENTARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentArn"))
val AGENTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentId"))
val AGENTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentName"))
val AGENTRESOURCEROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentResourceRoleArn"))
val AGENTSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("agentStatus"))
val CREATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("createdAt"))
val CUSTOMERENCRYPTIONKEYARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("customerEncryptionKeyArn"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val FAILUREREASONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("failureReasons"))
val FOUNDATIONMODEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("foundationModel"))
val GUARDRAILCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("guardrailConfiguration"))
val IDLESESSIONTTLINSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("idleSessionTTLInSeconds"))
val INSTRUCTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("instruction"))
val MEMORYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("memoryConfiguration"))
val PROMPTOVERRIDECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("promptOverrideConfiguration"))
val RECOMMENDEDACTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("recommendedActions"))
val UPDATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("updatedAt"))
val VERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("version"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AGENTARN_DESCRIPTOR)
field(AGENTID_DESCRIPTOR)
field(AGENTNAME_DESCRIPTOR)
field(AGENTRESOURCEROLEARN_DESCRIPTOR)
field(AGENTSTATUS_DESCRIPTOR)
field(CREATEDAT_DESCRIPTOR)
field(CUSTOMERENCRYPTIONKEYARN_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(FAILUREREASONS_DESCRIPTOR)
field(FOUNDATIONMODEL_DESCRIPTOR)
field(GUARDRAILCONFIGURATION_DESCRIPTOR)
field(IDLESESSIONTTLINSECONDS_DESCRIPTOR)
field(INSTRUCTION_DESCRIPTOR)
field(MEMORYCONFIGURATION_DESCRIPTOR)
field(PROMPTOVERRIDECONFIGURATION_DESCRIPTOR)
field(RECOMMENDEDACTIONS_DESCRIPTOR)
field(UPDATEDAT_DESCRIPTOR)
field(VERSION_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
AGENTARN_DESCRIPTOR.index -> builder.agentArn = deserializeString()
AGENTID_DESCRIPTOR.index -> builder.agentId = deserializeString()
AGENTNAME_DESCRIPTOR.index -> builder.agentName = deserializeString()
AGENTRESOURCEROLEARN_DESCRIPTOR.index -> builder.agentResourceRoleArn = deserializeString()
AGENTSTATUS_DESCRIPTOR.index -> builder.agentStatus = deserializeString().let { AgentStatus.fromValue(it) }
CREATEDAT_DESCRIPTOR.index -> builder.createdAt = deserializeInstant(TimestampFormat.ISO_8601)
CUSTOMERENCRYPTIONKEYARN_DESCRIPTOR.index -> builder.customerEncryptionKeyArn = deserializeString()
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
FAILUREREASONS_DESCRIPTOR.index -> builder.failureReasons =
deserializer.deserializeList(FAILUREREASONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
FOUNDATIONMODEL_DESCRIPTOR.index -> builder.foundationModel = deserializeString()
GUARDRAILCONFIGURATION_DESCRIPTOR.index -> builder.guardrailConfiguration = deserializeGuardrailConfigurationDocument(deserializer)
IDLESESSIONTTLINSECONDS_DESCRIPTOR.index -> builder.idleSessionTtlInSeconds = deserializeInt()
INSTRUCTION_DESCRIPTOR.index -> builder.instruction = deserializeString()
MEMORYCONFIGURATION_DESCRIPTOR.index -> builder.memoryConfiguration = deserializeMemoryConfigurationDocument(deserializer)
PROMPTOVERRIDECONFIGURATION_DESCRIPTOR.index -> builder.promptOverrideConfiguration = deserializePromptOverrideConfigurationDocument(deserializer)
RECOMMENDEDACTIONS_DESCRIPTOR.index -> builder.recommendedActions =
deserializer.deserializeList(RECOMMENDEDACTIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
UPDATEDAT_DESCRIPTOR.index -> builder.updatedAt = deserializeInstant(TimestampFormat.ISO_8601)
VERSION_DESCRIPTOR.index -> builder.version = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}