All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.glue.serde.UserDefinedFunctionDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.glue.serde

import aws.sdk.kotlin.services.glue.model.PrincipalType
import aws.sdk.kotlin.services.glue.model.ResourceUri
import aws.sdk.kotlin.services.glue.model.UserDefinedFunction
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

internal fun deserializeUserDefinedFunctionDocument(deserializer: Deserializer): UserDefinedFunction {
    val builder = UserDefinedFunction.Builder()
    val CATALOGID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CatalogId"))
    val CLASSNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ClassName"))
    val CREATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreateTime"))
    val DATABASENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DatabaseName"))
    val FUNCTIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FunctionName"))
    val OWNERNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OwnerName"))
    val OWNERTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("OwnerType"))
    val RESOURCEURIS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ResourceUris"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CATALOGID_DESCRIPTOR)
        field(CLASSNAME_DESCRIPTOR)
        field(CREATETIME_DESCRIPTOR)
        field(DATABASENAME_DESCRIPTOR)
        field(FUNCTIONNAME_DESCRIPTOR)
        field(OWNERNAME_DESCRIPTOR)
        field(OWNERTYPE_DESCRIPTOR)
        field(RESOURCEURIS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CATALOGID_DESCRIPTOR.index -> builder.catalogId = deserializeString()
                CLASSNAME_DESCRIPTOR.index -> builder.className = deserializeString()
                CREATETIME_DESCRIPTOR.index -> builder.createTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                DATABASENAME_DESCRIPTOR.index -> builder.databaseName = deserializeString()
                FUNCTIONNAME_DESCRIPTOR.index -> builder.functionName = deserializeString()
                OWNERNAME_DESCRIPTOR.index -> builder.ownerName = deserializeString()
                OWNERTYPE_DESCRIPTOR.index -> builder.ownerType = deserializeString().let { PrincipalType.fromValue(it) }
                RESOURCEURIS_DESCRIPTOR.index -> builder.resourceUris =
                    deserializer.deserializeList(RESOURCEURIS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeResourceUriDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy