
commonMain.aws.sdk.kotlin.services.qbusiness.serde.DocumentAttributeValueDocumentDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.qbusiness.serde
import aws.sdk.kotlin.services.qbusiness.model.DocumentAttributeValue
import aws.smithy.kotlin.runtime.serde.DeserializationException
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.IgnoreKey
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 kotlin.collections.mutableListOf
internal fun deserializeDocumentAttributeValueDocument(deserializer: Deserializer): DocumentAttributeValue {
var value: DocumentAttributeValue? = null
val DATEVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("dateValue"))
val LONGVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("longValue"))
val STRINGLISTVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("stringListValue"))
val STRINGVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("stringValue"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
trait(IgnoreKey("__type"))
field(DATEVALUE_DESCRIPTOR)
field(LONGVALUE_DESCRIPTOR)
field(STRINGLISTVALUE_DESCRIPTOR)
field(STRINGVALUE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while(true) {
when(findNextFieldIndex()) {
DATEVALUE_DESCRIPTOR.index -> value = DocumentAttributeValue.DateValue(deserializeString().let { Instant.fromEpochSeconds(it) })
LONGVALUE_DESCRIPTOR.index -> value = DocumentAttributeValue.LongValue(deserializeLong())
STRINGLISTVALUE_DESCRIPTOR.index -> value =
deserializer.deserializeList(STRINGLISTVALUE_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
DocumentAttributeValue.StringListValue(col0)
}
STRINGVALUE_DESCRIPTOR.index -> value = DocumentAttributeValue.StringValue(deserializeString())
null -> break@loop
else -> value = DocumentAttributeValue.SdkUnknown.also { skipValue() }
}
}
}
return value ?: throw DeserializationException("Deserialized union value unexpectedly null: DocumentAttributeValue")
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy