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

commonMain.aws.sdk.kotlin.services.appstream.transform.ImageDocumentDeserializer.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.transform

import aws.sdk.kotlin.services.appstream.model.Application
import aws.sdk.kotlin.services.appstream.model.Image
import aws.sdk.kotlin.services.appstream.model.ImageState
import aws.sdk.kotlin.services.appstream.model.PlatformType
import aws.sdk.kotlin.services.appstream.model.ResourceError
import aws.sdk.kotlin.services.appstream.model.VisibilityType
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

internal fun deserializeImageDocument(deserializer: Deserializer): Image {
    val builder = Image.Builder()
    val APPLICATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Applications"))
    val APPSTREAMAGENTVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AppstreamAgentVersion"))
    val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Arn"))
    val BASEIMAGEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("BaseImageArn"))
    val CREATEDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreatedTime"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val DISPLAYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DisplayName"))
    val IMAGEBUILDERNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ImageBuilderName"))
    val IMAGEBUILDERSUPPORTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("ImageBuilderSupported"))
    val IMAGEERRORS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ImageErrors"))
    val IMAGEPERMISSIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ImagePermissions"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val PLATFORM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Platform"))
    val PUBLICBASEIMAGERELEASEDDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("PublicBaseImageReleasedDate"))
    val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("State"))
    val STATECHANGEREASON_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("StateChangeReason"))
    val VISIBILITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Visibility"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(APPLICATIONS_DESCRIPTOR)
        field(APPSTREAMAGENTVERSION_DESCRIPTOR)
        field(ARN_DESCRIPTOR)
        field(BASEIMAGEARN_DESCRIPTOR)
        field(CREATEDTIME_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(DISPLAYNAME_DESCRIPTOR)
        field(IMAGEBUILDERNAME_DESCRIPTOR)
        field(IMAGEBUILDERSUPPORTED_DESCRIPTOR)
        field(IMAGEERRORS_DESCRIPTOR)
        field(IMAGEPERMISSIONS_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(PLATFORM_DESCRIPTOR)
        field(PUBLICBASEIMAGERELEASEDDATE_DESCRIPTOR)
        field(STATE_DESCRIPTOR)
        field(STATECHANGEREASON_DESCRIPTOR)
        field(VISIBILITY_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                APPLICATIONS_DESCRIPTOR.index -> builder.applications =
                    deserializer.deserializeList(APPLICATIONS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeApplicationDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                APPSTREAMAGENTVERSION_DESCRIPTOR.index -> builder.appstreamAgentVersion = deserializeString()
                ARN_DESCRIPTOR.index -> builder.arn = deserializeString()
                BASEIMAGEARN_DESCRIPTOR.index -> builder.baseImageArn = deserializeString()
                CREATEDTIME_DESCRIPTOR.index -> builder.createdTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                DISPLAYNAME_DESCRIPTOR.index -> builder.displayName = deserializeString()
                IMAGEBUILDERNAME_DESCRIPTOR.index -> builder.imageBuilderName = deserializeString()
                IMAGEBUILDERSUPPORTED_DESCRIPTOR.index -> builder.imageBuilderSupported = deserializeBoolean()
                IMAGEERRORS_DESCRIPTOR.index -> builder.imageErrors =
                    deserializer.deserializeList(IMAGEERRORS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeResourceErrorDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                IMAGEPERMISSIONS_DESCRIPTOR.index -> builder.imagePermissions = deserializeImagePermissionsDocument(deserializer)
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                PLATFORM_DESCRIPTOR.index -> builder.platform = deserializeString().let { PlatformType.fromValue(it) }
                PUBLICBASEIMAGERELEASEDDATE_DESCRIPTOR.index -> builder.publicBaseImageReleasedDate = deserializeString().let { Instant.fromEpochSeconds(it) }
                STATE_DESCRIPTOR.index -> builder.state = deserializeString().let { ImageState.fromValue(it) }
                STATECHANGEREASON_DESCRIPTOR.index -> builder.stateChangeReason = deserializeImageStateChangeReasonDocument(deserializer)
                VISIBILITY_DESCRIPTOR.index -> builder.visibility = deserializeString().let { VisibilityType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy