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

commonMain.aws.sdk.kotlin.services.glue.serde.SessionDocumentDeserializer.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.Session
import aws.sdk.kotlin.services.glue.model.SessionStatus
import aws.sdk.kotlin.services.glue.model.WorkerType
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.mutableMapOf

internal fun deserializeSessionDocument(deserializer: Deserializer): Session {
    val builder = Session.Builder()
    val COMMAND_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Command"))
    val COMPLETEDON_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CompletedOn"))
    val CONNECTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Connections"))
    val CREATEDON_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreatedOn"))
    val DPUSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("DPUSeconds"))
    val DEFAULTARGUMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("DefaultArguments"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val ERRORMESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ErrorMessage"))
    val EXECUTIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("ExecutionTime"))
    val GLUEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("GlueVersion"))
    val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Id"))
    val IDLETIMEOUT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("IdleTimeout"))
    val MAXCAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("MaxCapacity"))
    val NUMBEROFWORKERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("NumberOfWorkers"))
    val PROFILENAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ProfileName"))
    val PROGRESS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("Progress"))
    val ROLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Role"))
    val SECURITYCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SecurityConfiguration"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
    val WORKERTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("WorkerType"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(COMMAND_DESCRIPTOR)
        field(COMPLETEDON_DESCRIPTOR)
        field(CONNECTIONS_DESCRIPTOR)
        field(CREATEDON_DESCRIPTOR)
        field(DPUSECONDS_DESCRIPTOR)
        field(DEFAULTARGUMENTS_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(ERRORMESSAGE_DESCRIPTOR)
        field(EXECUTIONTIME_DESCRIPTOR)
        field(GLUEVERSION_DESCRIPTOR)
        field(ID_DESCRIPTOR)
        field(IDLETIMEOUT_DESCRIPTOR)
        field(MAXCAPACITY_DESCRIPTOR)
        field(NUMBEROFWORKERS_DESCRIPTOR)
        field(PROFILENAME_DESCRIPTOR)
        field(PROGRESS_DESCRIPTOR)
        field(ROLE_DESCRIPTOR)
        field(SECURITYCONFIGURATION_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(WORKERTYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                COMMAND_DESCRIPTOR.index -> builder.command = deserializeSessionCommandDocument(deserializer)
                COMPLETEDON_DESCRIPTOR.index -> builder.completedOn = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                CONNECTIONS_DESCRIPTOR.index -> builder.connections = deserializeConnectionsListDocument(deserializer)
                CREATEDON_DESCRIPTOR.index -> builder.createdOn = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                DPUSECONDS_DESCRIPTOR.index -> builder.dpuSeconds = deserializeDouble()
                DEFAULTARGUMENTS_DESCRIPTOR.index -> builder.defaultArguments =
                    deserializer.deserializeMap(DEFAULTARGUMENTS_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                ERRORMESSAGE_DESCRIPTOR.index -> builder.errorMessage = deserializeString()
                EXECUTIONTIME_DESCRIPTOR.index -> builder.executionTime = deserializeDouble()
                GLUEVERSION_DESCRIPTOR.index -> builder.glueVersion = deserializeString()
                ID_DESCRIPTOR.index -> builder.id = deserializeString()
                IDLETIMEOUT_DESCRIPTOR.index -> builder.idleTimeout = deserializeInt()
                MAXCAPACITY_DESCRIPTOR.index -> builder.maxCapacity = deserializeDouble()
                NUMBEROFWORKERS_DESCRIPTOR.index -> builder.numberOfWorkers = deserializeInt()
                PROFILENAME_DESCRIPTOR.index -> builder.profileName = deserializeString()
                PROGRESS_DESCRIPTOR.index -> builder.progress = deserializeDouble()
                ROLE_DESCRIPTOR.index -> builder.role = deserializeString()
                SECURITYCONFIGURATION_DESCRIPTOR.index -> builder.securityConfiguration = deserializeString()
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { SessionStatus.fromValue(it) }
                WORKERTYPE_DESCRIPTOR.index -> builder.workerType = deserializeString().let { WorkerType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy