commonMain.aws.sdk.kotlin.services.glue.serde.CsvClassifierDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of glue-jvm Show documentation
Show all versions of glue-jvm Show documentation
The AWS SDK for Kotlin client for Glue
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.glue.serde
import aws.sdk.kotlin.services.glue.model.CsvClassifier
import aws.sdk.kotlin.services.glue.model.CsvHeaderOption
import aws.sdk.kotlin.services.glue.model.CsvSerdeOption
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.time.Instant
import aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf
internal fun deserializeCsvClassifierDocument(deserializer: Deserializer): CsvClassifier {
val builder = CsvClassifier.Builder()
val ALLOWSINGLECOLUMN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("AllowSingleColumn"))
val CONTAINSHEADER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ContainsHeader"))
val CREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreationTime"))
val CUSTOMDATATYPECONFIGURED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("CustomDatatypeConfigured"))
val CUSTOMDATATYPES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("CustomDatatypes"))
val DELIMITER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Delimiter"))
val DISABLEVALUETRIMMING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("DisableValueTrimming"))
val HEADER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Header"))
val LASTUPDATED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastUpdated"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val QUOTESYMBOL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("QuoteSymbol"))
val SERDE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Serde"))
val VERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("Version"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ALLOWSINGLECOLUMN_DESCRIPTOR)
field(CONTAINSHEADER_DESCRIPTOR)
field(CREATIONTIME_DESCRIPTOR)
field(CUSTOMDATATYPECONFIGURED_DESCRIPTOR)
field(CUSTOMDATATYPES_DESCRIPTOR)
field(DELIMITER_DESCRIPTOR)
field(DISABLEVALUETRIMMING_DESCRIPTOR)
field(HEADER_DESCRIPTOR)
field(LASTUPDATED_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(QUOTESYMBOL_DESCRIPTOR)
field(SERDE_DESCRIPTOR)
field(VERSION_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ALLOWSINGLECOLUMN_DESCRIPTOR.index -> builder.allowSingleColumn = deserializeBoolean()
CONTAINSHEADER_DESCRIPTOR.index -> builder.containsHeader = deserializeString().let { CsvHeaderOption.fromValue(it) }
CREATIONTIME_DESCRIPTOR.index -> builder.creationTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
CUSTOMDATATYPECONFIGURED_DESCRIPTOR.index -> builder.customDatatypeConfigured = deserializeBoolean()
CUSTOMDATATYPES_DESCRIPTOR.index -> builder.customDatatypes =
deserializer.deserializeList(CUSTOMDATATYPES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
DELIMITER_DESCRIPTOR.index -> builder.delimiter = deserializeString()
DISABLEVALUETRIMMING_DESCRIPTOR.index -> builder.disableValueTrimming = deserializeBoolean()
HEADER_DESCRIPTOR.index -> builder.header =
deserializer.deserializeList(HEADER_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
LASTUPDATED_DESCRIPTOR.index -> builder.lastUpdated = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
QUOTESYMBOL_DESCRIPTOR.index -> builder.quoteSymbol = deserializeString()
SERDE_DESCRIPTOR.index -> builder.serde = deserializeString().let { CsvSerdeOption.fromValue(it) }
VERSION_DESCRIPTOR.index -> builder.version = deserializeLong()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}