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

commonMain.aws.sdk.kotlin.services.snowball.serde.JobResourceDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.snowball.serde

import aws.sdk.kotlin.services.snowball.model.Ec2AmiResource
import aws.sdk.kotlin.services.snowball.model.JobResource
import aws.sdk.kotlin.services.snowball.model.LambdaResource
import aws.sdk.kotlin.services.snowball.model.S3Resource
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 deserializeJobResourceDocument(deserializer: Deserializer): JobResource {
    val builder = JobResource.Builder()
    val EC2AMIRESOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Ec2AmiResources"))
    val LAMBDARESOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("LambdaResources"))
    val S3RESOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("S3Resources"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(EC2AMIRESOURCES_DESCRIPTOR)
        field(LAMBDARESOURCES_DESCRIPTOR)
        field(S3RESOURCES_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                EC2AMIRESOURCES_DESCRIPTOR.index -> builder.ec2AmiResources =
                    deserializer.deserializeList(EC2AMIRESOURCES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeEc2AmiResourceDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                LAMBDARESOURCES_DESCRIPTOR.index -> builder.lambdaResources =
                    deserializer.deserializeList(LAMBDARESOURCES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLambdaResourceDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                S3RESOURCES_DESCRIPTOR.index -> builder.s3Resources =
                    deserializer.deserializeList(S3RESOURCES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeS3ResourceDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy