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

commonMain.aws.sdk.kotlin.services.appstream.serde.SessionDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.appstream.serde

import aws.sdk.kotlin.services.appstream.model.AuthenticationType
import aws.sdk.kotlin.services.appstream.model.Session
import aws.sdk.kotlin.services.appstream.model.SessionConnectionState
import aws.sdk.kotlin.services.appstream.model.SessionState
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 deserializeSessionDocument(deserializer: Deserializer): Session {
    val builder = Session.Builder()
    val AUTHENTICATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("AuthenticationType"))
    val CONNECTIONSTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ConnectionState"))
    val FLEETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FleetName"))
    val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Id"))
    val INSTANCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("InstanceId"))
    val MAXEXPIRATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("MaxExpirationTime"))
    val NETWORKACCESSCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("NetworkAccessConfiguration"))
    val STACKNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StackName"))
    val STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StartTime"))
    val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("State"))
    val USERID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("UserId"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(AUTHENTICATIONTYPE_DESCRIPTOR)
        field(CONNECTIONSTATE_DESCRIPTOR)
        field(FLEETNAME_DESCRIPTOR)
        field(ID_DESCRIPTOR)
        field(INSTANCEID_DESCRIPTOR)
        field(MAXEXPIRATIONTIME_DESCRIPTOR)
        field(NETWORKACCESSCONFIGURATION_DESCRIPTOR)
        field(STACKNAME_DESCRIPTOR)
        field(STARTTIME_DESCRIPTOR)
        field(STATE_DESCRIPTOR)
        field(USERID_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                AUTHENTICATIONTYPE_DESCRIPTOR.index -> builder.authenticationType = deserializeString().let { AuthenticationType.fromValue(it) }
                CONNECTIONSTATE_DESCRIPTOR.index -> builder.connectionState = deserializeString().let { SessionConnectionState.fromValue(it) }
                FLEETNAME_DESCRIPTOR.index -> builder.fleetName = deserializeString()
                ID_DESCRIPTOR.index -> builder.id = deserializeString()
                INSTANCEID_DESCRIPTOR.index -> builder.instanceId = deserializeString()
                MAXEXPIRATIONTIME_DESCRIPTOR.index -> builder.maxExpirationTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                NETWORKACCESSCONFIGURATION_DESCRIPTOR.index -> builder.networkAccessConfiguration = deserializeNetworkAccessConfigurationDocument(deserializer)
                STACKNAME_DESCRIPTOR.index -> builder.stackName = deserializeString()
                STARTTIME_DESCRIPTOR.index -> builder.startTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                STATE_DESCRIPTOR.index -> builder.state = deserializeString().let { SessionState.fromValue(it) }
                USERID_DESCRIPTOR.index -> builder.userId = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy