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

commonMain.aws.sdk.kotlin.services.resiliencehub.serde.RecommendationTemplateDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.resiliencehub.serde

import aws.sdk.kotlin.services.resiliencehub.model.RecommendationTemplate
import aws.sdk.kotlin.services.resiliencehub.model.RecommendationTemplateStatus
import aws.sdk.kotlin.services.resiliencehub.model.RenderRecommendationType
import aws.sdk.kotlin.services.resiliencehub.model.TemplateFormat
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 kotlin.collections.mutableListOf
import kotlin.collections.mutableMapOf

internal fun deserializeRecommendationTemplateDocument(deserializer: Deserializer): RecommendationTemplate {
    val builder = RecommendationTemplate.Builder()
    val APPARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("appArn"))
    val ASSESSMENTARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("assessmentArn"))
    val ENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("endTime"))
    val FORMAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("format"))
    val MESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("message"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val NEEDSREPLACEMENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("needsReplacements"))
    val RECOMMENDATIONIDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("recommendationIds"))
    val RECOMMENDATIONTEMPLATEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("recommendationTemplateArn"))
    val RECOMMENDATIONTYPES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("recommendationTypes"))
    val STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("startTime"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("status"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("tags"))
    val TEMPLATESLOCATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("templatesLocation"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(APPARN_DESCRIPTOR)
        field(ASSESSMENTARN_DESCRIPTOR)
        field(ENDTIME_DESCRIPTOR)
        field(FORMAT_DESCRIPTOR)
        field(MESSAGE_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(NEEDSREPLACEMENTS_DESCRIPTOR)
        field(RECOMMENDATIONIDS_DESCRIPTOR)
        field(RECOMMENDATIONTEMPLATEARN_DESCRIPTOR)
        field(RECOMMENDATIONTYPES_DESCRIPTOR)
        field(STARTTIME_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(TEMPLATESLOCATION_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                APPARN_DESCRIPTOR.index -> builder.appArn = deserializeString()
                ASSESSMENTARN_DESCRIPTOR.index -> builder.assessmentArn = deserializeString()
                ENDTIME_DESCRIPTOR.index -> builder.endTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                FORMAT_DESCRIPTOR.index -> builder.format = deserializeString().let { TemplateFormat.fromValue(it) }
                MESSAGE_DESCRIPTOR.index -> builder.message = deserializeString()
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                NEEDSREPLACEMENTS_DESCRIPTOR.index -> builder.needsReplacements = deserializeBoolean()
                RECOMMENDATIONIDS_DESCRIPTOR.index -> builder.recommendationIds =
                    deserializer.deserializeList(RECOMMENDATIONIDS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                RECOMMENDATIONTEMPLATEARN_DESCRIPTOR.index -> builder.recommendationTemplateArn = deserializeString()
                RECOMMENDATIONTYPES_DESCRIPTOR.index -> builder.recommendationTypes =
                    deserializer.deserializeList(RECOMMENDATIONTYPES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { RenderRecommendationType.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                STARTTIME_DESCRIPTOR.index -> builder.startTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { RecommendationTemplateStatus.fromValue(it) }
                TAGS_DESCRIPTOR.index -> builder.tags =
                    deserializer.deserializeMap(TAGS_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                TEMPLATESLOCATION_DESCRIPTOR.index -> builder.templatesLocation = deserializeS3LocationDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy