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

commonMain.aws.sdk.kotlin.services.iottwinmaker.serde.FunctionResponseDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.iottwinmaker.serde

import aws.sdk.kotlin.services.iottwinmaker.model.FunctionResponse
import aws.sdk.kotlin.services.iottwinmaker.model.Scope
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 deserializeFunctionResponseDocument(deserializer: Deserializer): FunctionResponse {
    val builder = FunctionResponse.Builder()
    val IMPLEMENTEDBY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("implementedBy"))
    val ISINHERITED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("isInherited"))
    val REQUIREDPROPERTIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("requiredProperties"))
    val SCOPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("scope"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(IMPLEMENTEDBY_DESCRIPTOR)
        field(ISINHERITED_DESCRIPTOR)
        field(REQUIREDPROPERTIES_DESCRIPTOR)
        field(SCOPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                IMPLEMENTEDBY_DESCRIPTOR.index -> builder.implementedBy = deserializeDataConnectorDocument(deserializer)
                ISINHERITED_DESCRIPTOR.index -> builder.isInherited = deserializeBoolean()
                REQUIREDPROPERTIES_DESCRIPTOR.index -> builder.requiredProperties =
                    deserializer.deserializeList(REQUIREDPROPERTIES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                SCOPE_DESCRIPTOR.index -> builder.scope = deserializeString().let { Scope.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy