commonMain.aws.sdk.kotlin.services.devicefarm.serde.DevicePoolDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devicefarm-jvm Show documentation
Show all versions of devicefarm-jvm Show documentation
The AWS SDK for Kotlin client for Device Farm
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.devicefarm.serde
import aws.sdk.kotlin.services.devicefarm.model.DevicePool
import aws.sdk.kotlin.services.devicefarm.model.DevicePoolType
import aws.sdk.kotlin.services.devicefarm.model.Rule
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 deserializeDevicePoolDocument(deserializer: Deserializer): DevicePool {
val builder = DevicePool.Builder()
val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("arn"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val MAXDEVICES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("maxDevices"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
val RULES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("rules"))
val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("type"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ARN_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(MAXDEVICES_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(RULES_DESCRIPTOR)
field(TYPE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ARN_DESCRIPTOR.index -> builder.arn = deserializeString()
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
MAXDEVICES_DESCRIPTOR.index -> builder.maxDevices = deserializeInt()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
RULES_DESCRIPTOR.index -> builder.rules =
deserializer.deserializeList(RULES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeRuleDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { DevicePoolType.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}