commonMain.aws.sdk.kotlin.services.resourcegroups.serde.ResourceQueryDocumentDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.resourcegroups.serde
import aws.sdk.kotlin.services.resourcegroups.model.QueryType
import aws.sdk.kotlin.services.resourcegroups.model.ResourceQuery
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
internal fun deserializeResourceQueryDocument(deserializer: Deserializer): ResourceQuery {
val builder = ResourceQuery.Builder()
val QUERY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Query"))
val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Type"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(QUERY_DESCRIPTOR)
field(TYPE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
QUERY_DESCRIPTOR.index -> builder.query = deserializeString()
TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { QueryType.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}