commonMain.aws.sdk.kotlin.services.glue.serde.PartitionDocumentDeserializer.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.Partition
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
import kotlin.collections.mutableMapOf
internal fun deserializePartitionDocument(deserializer: Deserializer): Partition {
val builder = Partition.Builder()
val CATALOGID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CatalogId"))
val CREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreationTime"))
val DATABASENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DatabaseName"))
val LASTACCESSTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastAccessTime"))
val LASTANALYZEDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastAnalyzedTime"))
val PARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Parameters"))
val STORAGEDESCRIPTOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("StorageDescriptor"))
val TABLENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("TableName"))
val VALUES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Values"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CATALOGID_DESCRIPTOR)
field(CREATIONTIME_DESCRIPTOR)
field(DATABASENAME_DESCRIPTOR)
field(LASTACCESSTIME_DESCRIPTOR)
field(LASTANALYZEDTIME_DESCRIPTOR)
field(PARAMETERS_DESCRIPTOR)
field(STORAGEDESCRIPTOR_DESCRIPTOR)
field(TABLENAME_DESCRIPTOR)
field(VALUES_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CATALOGID_DESCRIPTOR.index -> builder.catalogId = deserializeString()
CREATIONTIME_DESCRIPTOR.index -> builder.creationTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DATABASENAME_DESCRIPTOR.index -> builder.databaseName = deserializeString()
LASTACCESSTIME_DESCRIPTOR.index -> builder.lastAccessTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LASTANALYZEDTIME_DESCRIPTOR.index -> builder.lastAnalyzedTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
PARAMETERS_DESCRIPTOR.index -> builder.parameters =
deserializer.deserializeMap(PARAMETERS_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = key()
val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
STORAGEDESCRIPTOR_DESCRIPTOR.index -> builder.storageDescriptor = deserializeStorageDescriptorDocument(deserializer)
TABLENAME_DESCRIPTOR.index -> builder.tableName = deserializeString()
VALUES_DESCRIPTOR.index -> builder.values =
deserializer.deserializeList(VALUES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}