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

commonMain.aws.sdk.kotlin.services.appflow.serde.TaskDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.appflow.serde

import aws.sdk.kotlin.services.appflow.model.OperatorPropertiesKeys
import aws.sdk.kotlin.services.appflow.model.Task
import aws.sdk.kotlin.services.appflow.model.TaskType
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
import kotlin.collections.mutableMapOf

internal fun deserializeTaskDocument(deserializer: Deserializer): Task {
    val builder = Task.Builder()
    val CONNECTOROPERATOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("connectorOperator"))
    val DESTINATIONFIELD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("destinationField"))
    val SOURCEFIELDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("sourceFields"))
    val TASKPROPERTIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("taskProperties"))
    val TASKTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("taskType"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CONNECTOROPERATOR_DESCRIPTOR)
        field(DESTINATIONFIELD_DESCRIPTOR)
        field(SOURCEFIELDS_DESCRIPTOR)
        field(TASKPROPERTIES_DESCRIPTOR)
        field(TASKTYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CONNECTOROPERATOR_DESCRIPTOR.index -> builder.connectorOperator = deserializeConnectorOperatorDocument(deserializer)
                DESTINATIONFIELD_DESCRIPTOR.index -> builder.destinationField = deserializeString()
                SOURCEFIELDS_DESCRIPTOR.index -> builder.sourceFields =
                    deserializer.deserializeList(SOURCEFIELDS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                TASKPROPERTIES_DESCRIPTOR.index -> builder.taskProperties =
                    deserializer.deserializeMap(TASKPROPERTIES_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = OperatorPropertiesKeys.fromValue(key())
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                TASKTYPE_DESCRIPTOR.index -> builder.taskType = deserializeString().let { TaskType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy