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

commonMain.aws.sdk.kotlin.services.codepipeline.serde.PipelineDeclarationDocumentDeserializer.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.codepipeline.serde

import aws.sdk.kotlin.services.codepipeline.model.ArtifactStore
import aws.sdk.kotlin.services.codepipeline.model.ExecutionMode
import aws.sdk.kotlin.services.codepipeline.model.PipelineDeclaration
import aws.sdk.kotlin.services.codepipeline.model.PipelineTriggerDeclaration
import aws.sdk.kotlin.services.codepipeline.model.PipelineType
import aws.sdk.kotlin.services.codepipeline.model.PipelineVariableDeclaration
import aws.sdk.kotlin.services.codepipeline.model.StageDeclaration
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 deserializePipelineDeclarationDocument(deserializer: Deserializer): PipelineDeclaration {
    val builder = PipelineDeclaration.Builder()
    val ARTIFACTSTORE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("artifactStore"))
    val ARTIFACTSTORES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("artifactStores"))
    val EXECUTIONMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("executionMode"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val PIPELINETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("pipelineType"))
    val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("roleArn"))
    val STAGES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("stages"))
    val TRIGGERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("triggers"))
    val VARIABLES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("variables"))
    val VERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("version"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ARTIFACTSTORE_DESCRIPTOR)
        field(ARTIFACTSTORES_DESCRIPTOR)
        field(EXECUTIONMODE_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(PIPELINETYPE_DESCRIPTOR)
        field(ROLEARN_DESCRIPTOR)
        field(STAGES_DESCRIPTOR)
        field(TRIGGERS_DESCRIPTOR)
        field(VARIABLES_DESCRIPTOR)
        field(VERSION_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ARTIFACTSTORE_DESCRIPTOR.index -> builder.artifactStore = deserializeArtifactStoreDocument(deserializer)
                ARTIFACTSTORES_DESCRIPTOR.index -> builder.artifactStores =
                    deserializer.deserializeMap(ARTIFACTSTORES_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeArtifactStoreDocument(deserializer) } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                EXECUTIONMODE_DESCRIPTOR.index -> builder.executionMode = deserializeString().let { ExecutionMode.fromValue(it) }
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                PIPELINETYPE_DESCRIPTOR.index -> builder.pipelineType = deserializeString().let { PipelineType.fromValue(it) }
                ROLEARN_DESCRIPTOR.index -> builder.roleArn = deserializeString()
                STAGES_DESCRIPTOR.index -> builder.stages =
                    deserializer.deserializeList(STAGES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeStageDeclarationDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                TRIGGERS_DESCRIPTOR.index -> builder.triggers =
                    deserializer.deserializeList(TRIGGERS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializePipelineTriggerDeclarationDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                VARIABLES_DESCRIPTOR.index -> builder.variables =
                    deserializer.deserializeList(VARIABLES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializePipelineVariableDeclarationDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                VERSION_DESCRIPTOR.index -> builder.version = deserializeInt()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy