commonMain.aws.sdk.kotlin.services.applicationdiscoveryservice.transform.AgentInfoDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of applicationdiscoveryservice-jvm Show documentation
Show all versions of applicationdiscoveryservice-jvm Show documentation
The AWS SDK for Kotlin client for Application Discovery Service
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.applicationdiscoveryservice.transform
import aws.sdk.kotlin.services.applicationdiscoveryservice.model.AgentInfo
import aws.sdk.kotlin.services.applicationdiscoveryservice.model.AgentNetworkInfo
import aws.sdk.kotlin.services.applicationdiscoveryservice.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 kotlin.collections.mutableListOf
internal fun deserializeAgentInfoDocument(deserializer: Deserializer): AgentInfo {
val builder = AgentInfo.Builder()
val AGENTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentId"))
val AGENTNETWORKINFOLIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("agentNetworkInfoList"))
val AGENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("agentType"))
val COLLECTIONSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("collectionStatus"))
val CONNECTORID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("connectorId"))
val HEALTH_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("health"))
val HOSTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("hostName"))
val LASTHEALTHPINGTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("lastHealthPingTime"))
val REGISTEREDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("registeredTime"))
val VERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("version"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AGENTID_DESCRIPTOR)
field(AGENTNETWORKINFOLIST_DESCRIPTOR)
field(AGENTTYPE_DESCRIPTOR)
field(COLLECTIONSTATUS_DESCRIPTOR)
field(CONNECTORID_DESCRIPTOR)
field(HEALTH_DESCRIPTOR)
field(HOSTNAME_DESCRIPTOR)
field(LASTHEALTHPINGTIME_DESCRIPTOR)
field(REGISTEREDTIME_DESCRIPTOR)
field(VERSION_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
AGENTID_DESCRIPTOR.index -> builder.agentId = deserializeString()
AGENTNETWORKINFOLIST_DESCRIPTOR.index -> builder.agentNetworkInfoList =
deserializer.deserializeList(AGENTNETWORKINFOLIST_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeAgentNetworkInfoDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
AGENTTYPE_DESCRIPTOR.index -> builder.agentType = deserializeString()
COLLECTIONSTATUS_DESCRIPTOR.index -> builder.collectionStatus = deserializeString()
CONNECTORID_DESCRIPTOR.index -> builder.connectorId = deserializeString()
HEALTH_DESCRIPTOR.index -> builder.health = deserializeString().let { AgentStatus.fromValue(it) }
HOSTNAME_DESCRIPTOR.index -> builder.hostName = deserializeString()
LASTHEALTHPINGTIME_DESCRIPTOR.index -> builder.lastHealthPingTime = deserializeString()
REGISTEREDTIME_DESCRIPTOR.index -> builder.registeredTime = deserializeString()
VERSION_DESCRIPTOR.index -> builder.version = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
return builder.build()
}