commonMain.aws.sdk.kotlin.services.glue.serde.DatabaseDocumentDeserializer.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.Database
import aws.sdk.kotlin.services.glue.model.PrincipalPermissions
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 deserializeDatabaseDocument(deserializer: Deserializer): Database {
val builder = Database.Builder()
val CATALOGID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CatalogId"))
val CREATETABLEDEFAULTPERMISSIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("CreateTableDefaultPermissions"))
val CREATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreateTime"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val FEDERATEDDATABASE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("FederatedDatabase"))
val LOCATIONURI_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LocationUri"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val PARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Parameters"))
val TARGETDATABASE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("TargetDatabase"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CATALOGID_DESCRIPTOR)
field(CREATETABLEDEFAULTPERMISSIONS_DESCRIPTOR)
field(CREATETIME_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(FEDERATEDDATABASE_DESCRIPTOR)
field(LOCATIONURI_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(PARAMETERS_DESCRIPTOR)
field(TARGETDATABASE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CATALOGID_DESCRIPTOR.index -> builder.catalogId = deserializeString()
CREATETABLEDEFAULTPERMISSIONS_DESCRIPTOR.index -> builder.createTableDefaultPermissions =
deserializer.deserializeList(CREATETABLEDEFAULTPERMISSIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializePrincipalPermissionsDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
CREATETIME_DESCRIPTOR.index -> builder.createTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
FEDERATEDDATABASE_DESCRIPTOR.index -> builder.federatedDatabase = deserializeFederatedDatabaseDocument(deserializer)
LOCATIONURI_DESCRIPTOR.index -> builder.locationUri = deserializeString()
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
}
TARGETDATABASE_DESCRIPTOR.index -> builder.targetDatabase = deserializeDatabaseIdentifierDocument(deserializer)
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}