commonMain.aws.sdk.kotlin.services.bedrockagent.serde.AgentAliasDocumentDeserializer.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.AgentAlias
import aws.sdk.kotlin.services.bedrockagent.model.AgentAliasHistoryEvent
import aws.sdk.kotlin.services.bedrockagent.model.AgentAliasRoutingConfigurationListItem
import aws.sdk.kotlin.services.bedrockagent.model.AgentAliasStatus
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 deserializeAgentAliasDocument(deserializer: Deserializer): AgentAlias {
val builder = AgentAlias.Builder()
val AGENTALIASARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentAliasArn"))
val AGENTALIASHISTORYEVENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("agentAliasHistoryEvents"))
val AGENTALIASID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentAliasId"))
val AGENTALIASNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentAliasName"))
val AGENTALIASSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("agentAliasStatus"))
val AGENTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentId"))
val CLIENTTOKEN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("clientToken"))
val CREATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("createdAt"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val FAILUREREASONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("failureReasons"))
val ROUTINGCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("routingConfiguration"))
val UPDATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("updatedAt"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AGENTALIASARN_DESCRIPTOR)
field(AGENTALIASHISTORYEVENTS_DESCRIPTOR)
field(AGENTALIASID_DESCRIPTOR)
field(AGENTALIASNAME_DESCRIPTOR)
field(AGENTALIASSTATUS_DESCRIPTOR)
field(AGENTID_DESCRIPTOR)
field(CLIENTTOKEN_DESCRIPTOR)
field(CREATEDAT_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(FAILUREREASONS_DESCRIPTOR)
field(ROUTINGCONFIGURATION_DESCRIPTOR)
field(UPDATEDAT_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
AGENTALIASARN_DESCRIPTOR.index -> builder.agentAliasArn = deserializeString()
AGENTALIASHISTORYEVENTS_DESCRIPTOR.index -> builder.agentAliasHistoryEvents =
deserializer.deserializeList(AGENTALIASHISTORYEVENTS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeAgentAliasHistoryEventDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
AGENTALIASID_DESCRIPTOR.index -> builder.agentAliasId = deserializeString()
AGENTALIASNAME_DESCRIPTOR.index -> builder.agentAliasName = deserializeString()
AGENTALIASSTATUS_DESCRIPTOR.index -> builder.agentAliasStatus = deserializeString().let { AgentAliasStatus.fromValue(it) }
AGENTID_DESCRIPTOR.index -> builder.agentId = deserializeString()
CLIENTTOKEN_DESCRIPTOR.index -> builder.clientToken = deserializeString()
CREATEDAT_DESCRIPTOR.index -> builder.createdAt = deserializeInstant(TimestampFormat.ISO_8601)
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
}
ROUTINGCONFIGURATION_DESCRIPTOR.index -> builder.routingConfiguration =
deserializer.deserializeList(ROUTINGCONFIGURATION_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeAgentAliasRoutingConfigurationListItemDocument(deserializer) } 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()
}