commonMain.aws.sdk.kotlin.services.bedrockagent.serde.AgentDocumentDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrockagent.serde
import aws.sdk.kotlin.services.bedrockagent.model.Agent
import aws.sdk.kotlin.services.bedrockagent.model.AgentStatus
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 deserializeAgentDocument(deserializer: Deserializer): Agent {
val builder = Agent.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 AGENTVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentVersion"))
val CLIENTTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("clientToken"))
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 PREPAREDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("preparedAt"))
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 OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AGENTARN_DESCRIPTOR)
field(AGENTID_DESCRIPTOR)
field(AGENTNAME_DESCRIPTOR)
field(AGENTRESOURCEROLEARN_DESCRIPTOR)
field(AGENTSTATUS_DESCRIPTOR)
field(AGENTVERSION_DESCRIPTOR)
field(CLIENTTOKEN_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(PREPAREDAT_DESCRIPTOR)
field(PROMPTOVERRIDECONFIGURATION_DESCRIPTOR)
field(RECOMMENDEDACTIONS_DESCRIPTOR)
field(UPDATEDAT_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) }
AGENTVERSION_DESCRIPTOR.index -> builder.agentVersion = deserializeString()
CLIENTTOKEN_DESCRIPTOR.index -> builder.clientToken = deserializeString()
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)
PREPAREDAT_DESCRIPTOR.index -> builder.preparedAt = deserializeInstant(TimestampFormat.ISO_8601)
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)
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}