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

commonMain.aws.sdk.kotlin.services.nimble.serde.StreamConfigurationDocumentDeserializer.kt Maven / Gradle / Ivy

The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.nimble.serde

import aws.sdk.kotlin.services.nimble.model.AutomaticTerminationMode
import aws.sdk.kotlin.services.nimble.model.SessionPersistenceMode
import aws.sdk.kotlin.services.nimble.model.StreamConfiguration
import aws.sdk.kotlin.services.nimble.model.StreamingClipboardMode
import aws.sdk.kotlin.services.nimble.model.StreamingInstanceType
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 deserializeStreamConfigurationDocument(deserializer: Deserializer): StreamConfiguration {
    val builder = StreamConfiguration.Builder()
    val AUTOMATICTERMINATIONMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("automaticTerminationMode"))
    val CLIPBOARDMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("clipboardMode"))
    val EC2INSTANCETYPES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ec2InstanceTypes"))
    val MAXSESSIONLENGTHINMINUTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("maxSessionLengthInMinutes"))
    val MAXSTOPPEDSESSIONLENGTHINMINUTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("maxStoppedSessionLengthInMinutes"))
    val SESSIONBACKUP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("sessionBackup"))
    val SESSIONPERSISTENCEMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("sessionPersistenceMode"))
    val SESSIONSTORAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("sessionStorage"))
    val STREAMINGIMAGEIDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("streamingImageIds"))
    val VOLUMECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("volumeConfiguration"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(AUTOMATICTERMINATIONMODE_DESCRIPTOR)
        field(CLIPBOARDMODE_DESCRIPTOR)
        field(EC2INSTANCETYPES_DESCRIPTOR)
        field(MAXSESSIONLENGTHINMINUTES_DESCRIPTOR)
        field(MAXSTOPPEDSESSIONLENGTHINMINUTES_DESCRIPTOR)
        field(SESSIONBACKUP_DESCRIPTOR)
        field(SESSIONPERSISTENCEMODE_DESCRIPTOR)
        field(SESSIONSTORAGE_DESCRIPTOR)
        field(STREAMINGIMAGEIDS_DESCRIPTOR)
        field(VOLUMECONFIGURATION_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                AUTOMATICTERMINATIONMODE_DESCRIPTOR.index -> builder.automaticTerminationMode = deserializeString().let { AutomaticTerminationMode.fromValue(it) }
                CLIPBOARDMODE_DESCRIPTOR.index -> builder.clipboardMode = deserializeString().let { StreamingClipboardMode.fromValue(it) }
                EC2INSTANCETYPES_DESCRIPTOR.index -> builder.ec2InstanceTypes =
                    deserializer.deserializeList(EC2INSTANCETYPES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { StreamingInstanceType.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                MAXSESSIONLENGTHINMINUTES_DESCRIPTOR.index -> builder.maxSessionLengthInMinutes = deserializeInt()
                MAXSTOPPEDSESSIONLENGTHINMINUTES_DESCRIPTOR.index -> builder.maxStoppedSessionLengthInMinutes = deserializeInt()
                SESSIONBACKUP_DESCRIPTOR.index -> builder.sessionBackup = deserializeStreamConfigurationSessionBackupDocument(deserializer)
                SESSIONPERSISTENCEMODE_DESCRIPTOR.index -> builder.sessionPersistenceMode = deserializeString().let { SessionPersistenceMode.fromValue(it) }
                SESSIONSTORAGE_DESCRIPTOR.index -> builder.sessionStorage = deserializeStreamConfigurationSessionStorageDocument(deserializer)
                STREAMINGIMAGEIDS_DESCRIPTOR.index -> builder.streamingImageIds =
                    deserializer.deserializeList(STREAMINGIMAGEIDS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                VOLUMECONFIGURATION_DESCRIPTOR.index -> builder.volumeConfiguration = deserializeVolumeConfigurationDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy