commonMain.aws.sdk.kotlin.services.athena.serde.TableMetadataDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of athena-jvm Show documentation
Show all versions of athena-jvm Show documentation
The AWS SDK for Kotlin client for Athena
The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.athena.serde
import aws.sdk.kotlin.services.athena.model.Column
import aws.sdk.kotlin.services.athena.model.TableMetadata
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 deserializeTableMetadataDocument(deserializer: Deserializer): TableMetadata {
val builder = TableMetadata.Builder()
val COLUMNS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Columns"))
val CREATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreateTime"))
val LASTACCESSTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastAccessTime"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val PARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Parameters"))
val PARTITIONKEYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("PartitionKeys"))
val TABLETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("TableType"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(COLUMNS_DESCRIPTOR)
field(CREATETIME_DESCRIPTOR)
field(LASTACCESSTIME_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(PARAMETERS_DESCRIPTOR)
field(PARTITIONKEYS_DESCRIPTOR)
field(TABLETYPE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
COLUMNS_DESCRIPTOR.index -> builder.columns =
deserializer.deserializeList(COLUMNS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeColumnDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
CREATETIME_DESCRIPTOR.index -> builder.createTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LASTACCESSTIME_DESCRIPTOR.index -> builder.lastAccessTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
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
}
PARTITIONKEYS_DESCRIPTOR.index -> builder.partitionKeys =
deserializer.deserializeList(PARTITIONKEYS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeColumnDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
TABLETYPE_DESCRIPTOR.index -> builder.tableType = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}