commonMain.aws.sdk.kotlin.services.resiliencehub.serde.AlarmRecommendationDocumentDeserializer.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.AlarmRecommendation
import aws.sdk.kotlin.services.resiliencehub.model.AlarmType
import aws.sdk.kotlin.services.resiliencehub.model.RecommendationItem
import aws.sdk.kotlin.services.resiliencehub.model.RecommendationStatus
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
internal fun deserializeAlarmRecommendationDocument(deserializer: Deserializer): AlarmRecommendation {
val builder = AlarmRecommendation.Builder()
val APPCOMPONENTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("appComponentName"))
val APPCOMPONENTNAMES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("appComponentNames"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val ITEMS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("items"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
val PREREQUISITE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("prerequisite"))
val RECOMMENDATIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("recommendationId"))
val RECOMMENDATIONSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("recommendationStatus"))
val REFERENCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("referenceId"))
val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("type"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(APPCOMPONENTNAME_DESCRIPTOR)
field(APPCOMPONENTNAMES_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(ITEMS_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(PREREQUISITE_DESCRIPTOR)
field(RECOMMENDATIONID_DESCRIPTOR)
field(RECOMMENDATIONSTATUS_DESCRIPTOR)
field(REFERENCEID_DESCRIPTOR)
field(TYPE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
APPCOMPONENTNAME_DESCRIPTOR.index -> builder.appComponentName = deserializeString()
APPCOMPONENTNAMES_DESCRIPTOR.index -> builder.appComponentNames =
deserializer.deserializeList(APPCOMPONENTNAMES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
ITEMS_DESCRIPTOR.index -> builder.items =
deserializer.deserializeList(ITEMS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeRecommendationItemDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
PREREQUISITE_DESCRIPTOR.index -> builder.prerequisite = deserializeString()
RECOMMENDATIONID_DESCRIPTOR.index -> builder.recommendationId = deserializeString()
RECOMMENDATIONSTATUS_DESCRIPTOR.index -> builder.recommendationStatus = deserializeString().let { RecommendationStatus.fromValue(it) }
REFERENCEID_DESCRIPTOR.index -> builder.referenceId = deserializeString()
TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { AlarmType.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}