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

commonMain.aws.sdk.kotlin.services.deadline.serde.WorkerSessionSummaryDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.deadline.serde

import aws.sdk.kotlin.services.deadline.model.SessionLifecycleStatus
import aws.sdk.kotlin.services.deadline.model.SessionLifecycleTargetStatus
import aws.sdk.kotlin.services.deadline.model.WorkerSessionSummary
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

internal fun deserializeWorkerSessionSummaryDocument(deserializer: Deserializer): WorkerSessionSummary {
    val builder = WorkerSessionSummary.Builder()
    val ENDEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("endedAt"))
    val JOBID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("jobId"))
    val LIFECYCLESTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("lifecycleStatus"))
    val QUEUEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("queueId"))
    val SESSIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("sessionId"))
    val STARTEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("startedAt"))
    val TARGETLIFECYCLESTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("targetLifecycleStatus"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ENDEDAT_DESCRIPTOR)
        field(JOBID_DESCRIPTOR)
        field(LIFECYCLESTATUS_DESCRIPTOR)
        field(QUEUEID_DESCRIPTOR)
        field(SESSIONID_DESCRIPTOR)
        field(STARTEDAT_DESCRIPTOR)
        field(TARGETLIFECYCLESTATUS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ENDEDAT_DESCRIPTOR.index -> builder.endedAt = deserializeInstant(TimestampFormat.ISO_8601)
                JOBID_DESCRIPTOR.index -> builder.jobId = deserializeString()
                LIFECYCLESTATUS_DESCRIPTOR.index -> builder.lifecycleStatus = deserializeString().let { SessionLifecycleStatus.fromValue(it) }
                QUEUEID_DESCRIPTOR.index -> builder.queueId = deserializeString()
                SESSIONID_DESCRIPTOR.index -> builder.sessionId = deserializeString()
                STARTEDAT_DESCRIPTOR.index -> builder.startedAt = deserializeInstant(TimestampFormat.ISO_8601)
                TARGETLIFECYCLESTATUS_DESCRIPTOR.index -> builder.targetLifecycleStatus = deserializeString().let { SessionLifecycleTargetStatus.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy