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

commonMain.aws.sdk.kotlin.services.athena.serde.QueryExecutionDocumentDeserializer.kt Maven / Gradle / Ivy

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.QueryExecution
import aws.sdk.kotlin.services.athena.model.StatementType
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 kotlin.collections.mutableListOf

internal fun deserializeQueryExecutionDocument(deserializer: Deserializer): QueryExecution {
    val builder = QueryExecution.Builder()
    val ENGINEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("EngineVersion"))
    val EXECUTIONPARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ExecutionParameters"))
    val QUERY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Query"))
    val QUERYEXECUTIONCONTEXT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("QueryExecutionContext"))
    val QUERYEXECUTIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("QueryExecutionId"))
    val QUERYRESULTSS3ACCESSGRANTSCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("QueryResultsS3AccessGrantsConfiguration"))
    val RESULTCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ResultConfiguration"))
    val RESULTREUSECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ResultReuseConfiguration"))
    val STATEMENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("StatementType"))
    val STATISTICS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Statistics"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Status"))
    val SUBSTATEMENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SubstatementType"))
    val WORKGROUP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("WorkGroup"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ENGINEVERSION_DESCRIPTOR)
        field(EXECUTIONPARAMETERS_DESCRIPTOR)
        field(QUERY_DESCRIPTOR)
        field(QUERYEXECUTIONCONTEXT_DESCRIPTOR)
        field(QUERYEXECUTIONID_DESCRIPTOR)
        field(QUERYRESULTSS3ACCESSGRANTSCONFIGURATION_DESCRIPTOR)
        field(RESULTCONFIGURATION_DESCRIPTOR)
        field(RESULTREUSECONFIGURATION_DESCRIPTOR)
        field(STATEMENTTYPE_DESCRIPTOR)
        field(STATISTICS_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(SUBSTATEMENTTYPE_DESCRIPTOR)
        field(WORKGROUP_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ENGINEVERSION_DESCRIPTOR.index -> builder.engineVersion = deserializeEngineVersionDocument(deserializer)
                EXECUTIONPARAMETERS_DESCRIPTOR.index -> builder.executionParameters =
                    deserializer.deserializeList(EXECUTIONPARAMETERS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                QUERY_DESCRIPTOR.index -> builder.query = deserializeString()
                QUERYEXECUTIONCONTEXT_DESCRIPTOR.index -> builder.queryExecutionContext = deserializeQueryExecutionContextDocument(deserializer)
                QUERYEXECUTIONID_DESCRIPTOR.index -> builder.queryExecutionId = deserializeString()
                QUERYRESULTSS3ACCESSGRANTSCONFIGURATION_DESCRIPTOR.index -> builder.queryResultsS3AccessGrantsConfiguration = deserializeQueryResultsS3AccessGrantsConfigurationDocument(deserializer)
                RESULTCONFIGURATION_DESCRIPTOR.index -> builder.resultConfiguration = deserializeResultConfigurationDocument(deserializer)
                RESULTREUSECONFIGURATION_DESCRIPTOR.index -> builder.resultReuseConfiguration = deserializeResultReuseConfigurationDocument(deserializer)
                STATEMENTTYPE_DESCRIPTOR.index -> builder.statementType = deserializeString().let { StatementType.fromValue(it) }
                STATISTICS_DESCRIPTOR.index -> builder.statistics = deserializeQueryExecutionStatisticsDocument(deserializer)
                STATUS_DESCRIPTOR.index -> builder.status = deserializeQueryExecutionStatusDocument(deserializer)
                SUBSTATEMENTTYPE_DESCRIPTOR.index -> builder.substatementType = deserializeString()
                WORKGROUP_DESCRIPTOR.index -> builder.workGroup = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy