All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.redshiftdata.transform.FieldDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.100
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.redshiftdata.transform

import aws.sdk.kotlin.services.redshiftdata.model.Field
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.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.util.decodeBase64Bytes

internal fun deserializeFieldDocument(deserializer: Deserializer): Field {
    var value: Field? = null
    val BLOBVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Blob, JsonSerialName("blobValue"))
    val BOOLEANVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("booleanValue"))
    val DOUBLEVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("doubleValue"))
    val ISNULL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("isNull"))
    val LONGVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("longValue"))
    val STRINGVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("stringValue"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(BLOBVALUE_DESCRIPTOR)
        field(BOOLEANVALUE_DESCRIPTOR)
        field(DOUBLEVALUE_DESCRIPTOR)
        field(ISNULL_DESCRIPTOR)
        field(LONGVALUE_DESCRIPTOR)
        field(STRINGVALUE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while(true) {
            when(findNextFieldIndex()) {
                BLOBVALUE_DESCRIPTOR.index -> value = Field.BlobValue(deserializeString().decodeBase64Bytes())
                BOOLEANVALUE_DESCRIPTOR.index -> value = Field.BooleanValue(deserializeBoolean())
                DOUBLEVALUE_DESCRIPTOR.index -> value = Field.DoubleValue(deserializeDouble())
                ISNULL_DESCRIPTOR.index -> value = Field.IsNull(deserializeBoolean())
                LONGVALUE_DESCRIPTOR.index -> value = Field.LongValue(deserializeLong())
                STRINGVALUE_DESCRIPTOR.index -> value = Field.StringValue(deserializeString())
                null -> break@loop
                else -> value = Field.SdkUnknown.also { skipValue() }
            }
        }
    }
    return value ?: throw DeserializationException("Deserialized union value unexpectedly null: Field")
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy