commonMain.aws.sdk.kotlin.services.glue.serde.JdbcConnectorOptionsDocumentDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.glue.serde
import aws.sdk.kotlin.services.glue.model.GlueRecordType
import aws.sdk.kotlin.services.glue.model.JdbcConnectorOptions
import aws.sdk.kotlin.services.glue.model.JdbcDataType
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
import kotlin.collections.mutableMapOf
internal fun deserializeJdbcConnectorOptionsDocument(deserializer: Deserializer): JdbcConnectorOptions {
val builder = JdbcConnectorOptions.Builder()
val DATATYPEMAPPING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("DataTypeMapping"))
val FILTERPREDICATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FilterPredicate"))
val JOBBOOKMARKKEYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("JobBookmarkKeys"))
val JOBBOOKMARKKEYSSORTORDER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("JobBookmarkKeysSortOrder"))
val LOWERBOUND_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("LowerBound"))
val NUMPARTITIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("NumPartitions"))
val PARTITIONCOLUMN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PartitionColumn"))
val UPPERBOUND_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("UpperBound"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(DATATYPEMAPPING_DESCRIPTOR)
field(FILTERPREDICATE_DESCRIPTOR)
field(JOBBOOKMARKKEYS_DESCRIPTOR)
field(JOBBOOKMARKKEYSSORTORDER_DESCRIPTOR)
field(LOWERBOUND_DESCRIPTOR)
field(NUMPARTITIONS_DESCRIPTOR)
field(PARTITIONCOLUMN_DESCRIPTOR)
field(UPPERBOUND_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
DATATYPEMAPPING_DESCRIPTOR.index -> builder.dataTypeMapping =
deserializer.deserializeMap(DATATYPEMAPPING_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = JdbcDataType.fromValue(key())
val v0 = if (nextHasValue()) { deserializeString().let { GlueRecordType.fromValue(it) } } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
FILTERPREDICATE_DESCRIPTOR.index -> builder.filterPredicate = deserializeString()
JOBBOOKMARKKEYS_DESCRIPTOR.index -> builder.jobBookmarkKeys =
deserializer.deserializeList(JOBBOOKMARKKEYS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
JOBBOOKMARKKEYSSORTORDER_DESCRIPTOR.index -> builder.jobBookmarkKeysSortOrder = deserializeString()
LOWERBOUND_DESCRIPTOR.index -> builder.lowerBound = deserializeLong()
NUMPARTITIONS_DESCRIPTOR.index -> builder.numPartitions = deserializeLong()
PARTITIONCOLUMN_DESCRIPTOR.index -> builder.partitionColumn = deserializeString()
UPPERBOUND_DESCRIPTOR.index -> builder.upperBound = deserializeLong()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}