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

commonMain.aws.sdk.kotlin.services.codedeploy.serde.CloudFormationTargetDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.codedeploy.serde

import aws.sdk.kotlin.services.codedeploy.model.CloudFormationTarget
import aws.sdk.kotlin.services.codedeploy.model.LifecycleEvent
import aws.sdk.kotlin.services.codedeploy.model.TargetStatus
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
import aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf

internal fun deserializeCloudFormationTargetDocument(deserializer: Deserializer): CloudFormationTarget {
    val builder = CloudFormationTarget.Builder()
    val DEPLOYMENTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("deploymentId"))
    val LASTUPDATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("lastUpdatedAt"))
    val LIFECYCLEEVENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("lifecycleEvents"))
    val RESOURCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("resourceType"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("status"))
    val TARGETID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("targetId"))
    val TARGETVERSIONWEIGHT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("targetVersionWeight"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DEPLOYMENTID_DESCRIPTOR)
        field(LASTUPDATEDAT_DESCRIPTOR)
        field(LIFECYCLEEVENTS_DESCRIPTOR)
        field(RESOURCETYPE_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(TARGETID_DESCRIPTOR)
        field(TARGETVERSIONWEIGHT_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                DEPLOYMENTID_DESCRIPTOR.index -> builder.deploymentId = deserializeString()
                LASTUPDATEDAT_DESCRIPTOR.index -> builder.lastUpdatedAt = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                LIFECYCLEEVENTS_DESCRIPTOR.index -> builder.lifecycleEvents =
                    deserializer.deserializeList(LIFECYCLEEVENTS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLifecycleEventDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                RESOURCETYPE_DESCRIPTOR.index -> builder.resourceType = deserializeString()
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { TargetStatus.fromValue(it) }
                TARGETID_DESCRIPTOR.index -> builder.targetId = deserializeString()
                TARGETVERSIONWEIGHT_DESCRIPTOR.index -> builder.targetVersionWeight = deserializeDouble()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy