commonMain.aws.sdk.kotlin.services.glue.serde.TableDocumentDeserializer.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.Column
import aws.sdk.kotlin.services.glue.model.Table
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 deserializeTableDocument(deserializer: Deserializer): Table {
val builder = Table.Builder()
val CATALOGID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CatalogId"))
val CREATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreateTime"))
val CREATEDBY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CreatedBy"))
val DATABASENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DatabaseName"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val FEDERATEDTABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("FederatedTable"))
val ISMULTIDIALECTVIEW_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsMultiDialectView"))
val ISREGISTEREDWITHLAKEFORMATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsRegisteredWithLakeFormation"))
val LASTACCESSTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastAccessTime"))
val LASTANALYZEDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastAnalyzedTime"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val OWNER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Owner"))
val PARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Parameters"))
val PARTITIONKEYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("PartitionKeys"))
val RETENTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Retention"))
val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Status"))
val STORAGEDESCRIPTOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("StorageDescriptor"))
val TABLETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("TableType"))
val TARGETTABLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("TargetTable"))
val UPDATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("UpdateTime"))
val VERSIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("VersionId"))
val VIEWDEFINITION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ViewDefinition"))
val VIEWEXPANDEDTEXT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ViewExpandedText"))
val VIEWORIGINALTEXT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ViewOriginalText"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CATALOGID_DESCRIPTOR)
field(CREATETIME_DESCRIPTOR)
field(CREATEDBY_DESCRIPTOR)
field(DATABASENAME_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(FEDERATEDTABLE_DESCRIPTOR)
field(ISMULTIDIALECTVIEW_DESCRIPTOR)
field(ISREGISTEREDWITHLAKEFORMATION_DESCRIPTOR)
field(LASTACCESSTIME_DESCRIPTOR)
field(LASTANALYZEDTIME_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(OWNER_DESCRIPTOR)
field(PARAMETERS_DESCRIPTOR)
field(PARTITIONKEYS_DESCRIPTOR)
field(RETENTION_DESCRIPTOR)
field(STATUS_DESCRIPTOR)
field(STORAGEDESCRIPTOR_DESCRIPTOR)
field(TABLETYPE_DESCRIPTOR)
field(TARGETTABLE_DESCRIPTOR)
field(UPDATETIME_DESCRIPTOR)
field(VERSIONID_DESCRIPTOR)
field(VIEWDEFINITION_DESCRIPTOR)
field(VIEWEXPANDEDTEXT_DESCRIPTOR)
field(VIEWORIGINALTEXT_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CATALOGID_DESCRIPTOR.index -> builder.catalogId = deserializeString()
CREATETIME_DESCRIPTOR.index -> builder.createTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
CREATEDBY_DESCRIPTOR.index -> builder.createdBy = deserializeString()
DATABASENAME_DESCRIPTOR.index -> builder.databaseName = deserializeString()
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
FEDERATEDTABLE_DESCRIPTOR.index -> builder.federatedTable = deserializeFederatedTableDocument(deserializer)
ISMULTIDIALECTVIEW_DESCRIPTOR.index -> builder.isMultiDialectView = deserializeBoolean()
ISREGISTEREDWITHLAKEFORMATION_DESCRIPTOR.index -> builder.isRegisteredWithLakeFormation = deserializeBoolean()
LASTACCESSTIME_DESCRIPTOR.index -> builder.lastAccessTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LASTANALYZEDTIME_DESCRIPTOR.index -> builder.lastAnalyzedTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
OWNER_DESCRIPTOR.index -> builder.owner = 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
}
RETENTION_DESCRIPTOR.index -> builder.retention = deserializeInt()
STATUS_DESCRIPTOR.index -> builder.status = deserializeTableStatusDocument(deserializer)
STORAGEDESCRIPTOR_DESCRIPTOR.index -> builder.storageDescriptor = deserializeStorageDescriptorDocument(deserializer)
TABLETYPE_DESCRIPTOR.index -> builder.tableType = deserializeString()
TARGETTABLE_DESCRIPTOR.index -> builder.targetTable = deserializeTableIdentifierDocument(deserializer)
UPDATETIME_DESCRIPTOR.index -> builder.updateTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
VERSIONID_DESCRIPTOR.index -> builder.versionId = deserializeString()
VIEWDEFINITION_DESCRIPTOR.index -> builder.viewDefinition = deserializeViewDefinitionDocument(deserializer)
VIEWEXPANDEDTEXT_DESCRIPTOR.index -> builder.viewExpandedText = deserializeString()
VIEWORIGINALTEXT_DESCRIPTOR.index -> builder.viewOriginalText = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}