commonMain.aws.sdk.kotlin.services.resiliencehub.serde.ConfigRecommendationDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of resiliencehub-jvm Show documentation
Show all versions of resiliencehub-jvm Show documentation
The AWS SDK for Kotlin client for resiliencehub
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.resiliencehub.serde
import aws.sdk.kotlin.services.resiliencehub.model.ConfigRecommendation
import aws.sdk.kotlin.services.resiliencehub.model.ConfigRecommendationOptimizationType
import aws.sdk.kotlin.services.resiliencehub.model.DisruptionCompliance
import aws.sdk.kotlin.services.resiliencehub.model.DisruptionType
import aws.sdk.kotlin.services.resiliencehub.model.HaArchitecture
import aws.sdk.kotlin.services.resiliencehub.model.RecommendationDisruptionCompliance
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 deserializeConfigRecommendationDocument(deserializer: Deserializer): ConfigRecommendation {
val builder = ConfigRecommendation.Builder()
val APPCOMPONENTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("appComponentName"))
val COMPLIANCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("compliance"))
val COST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("cost"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val HAARCHITECTURE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("haArchitecture"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
val OPTIMIZATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("optimizationType"))
val RECOMMENDATIONCOMPLIANCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("recommendationCompliance"))
val REFERENCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("referenceId"))
val SUGGESTEDCHANGES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("suggestedChanges"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(APPCOMPONENTNAME_DESCRIPTOR)
field(COMPLIANCE_DESCRIPTOR)
field(COST_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(HAARCHITECTURE_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(OPTIMIZATIONTYPE_DESCRIPTOR)
field(RECOMMENDATIONCOMPLIANCE_DESCRIPTOR)
field(REFERENCEID_DESCRIPTOR)
field(SUGGESTEDCHANGES_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
APPCOMPONENTNAME_DESCRIPTOR.index -> builder.appComponentName = deserializeString()
COMPLIANCE_DESCRIPTOR.index -> builder.compliance =
deserializer.deserializeMap(COMPLIANCE_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = DisruptionType.fromValue(key())
val v0 = if (nextHasValue()) { deserializeDisruptionComplianceDocument(deserializer) } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
COST_DESCRIPTOR.index -> builder.cost = deserializeCostDocument(deserializer)
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
HAARCHITECTURE_DESCRIPTOR.index -> builder.haArchitecture = deserializeString().let { HaArchitecture.fromValue(it) }
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
OPTIMIZATIONTYPE_DESCRIPTOR.index -> builder.optimizationType = deserializeString().let { ConfigRecommendationOptimizationType.fromValue(it) }
RECOMMENDATIONCOMPLIANCE_DESCRIPTOR.index -> builder.recommendationCompliance =
deserializer.deserializeMap(RECOMMENDATIONCOMPLIANCE_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = DisruptionType.fromValue(key())
val v0 = if (nextHasValue()) { deserializeRecommendationDisruptionComplianceDocument(deserializer) } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
REFERENCEID_DESCRIPTOR.index -> builder.referenceId = deserializeString()
SUGGESTEDCHANGES_DESCRIPTOR.index -> builder.suggestedChanges =
deserializer.deserializeList(SUGGESTEDCHANGES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}