commonMain.aws.sdk.kotlin.services.resiliencehub.serde.TestRecommendationDocumentDeserializer.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.RecommendationItem
import aws.sdk.kotlin.services.resiliencehub.model.RecommendationStatus
import aws.sdk.kotlin.services.resiliencehub.model.TestRecommendation
import aws.sdk.kotlin.services.resiliencehub.model.TestRisk
import aws.sdk.kotlin.services.resiliencehub.model.TestType
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 deserializeTestRecommendationDocument(deserializer: Deserializer): TestRecommendation {
val builder = TestRecommendation.Builder()
val APPCOMPONENTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("appComponentName"))
val DEPENDSONALARMS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("dependsOnAlarms"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val INTENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("intent"))
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 RISK_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("risk"))
val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("type"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(APPCOMPONENTNAME_DESCRIPTOR)
field(DEPENDSONALARMS_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(INTENT_DESCRIPTOR)
field(ITEMS_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(PREREQUISITE_DESCRIPTOR)
field(RECOMMENDATIONID_DESCRIPTOR)
field(RECOMMENDATIONSTATUS_DESCRIPTOR)
field(REFERENCEID_DESCRIPTOR)
field(RISK_DESCRIPTOR)
field(TYPE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
APPCOMPONENTNAME_DESCRIPTOR.index -> builder.appComponentName = deserializeString()
DEPENDSONALARMS_DESCRIPTOR.index -> builder.dependsOnAlarms =
deserializer.deserializeList(DEPENDSONALARMS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
INTENT_DESCRIPTOR.index -> builder.intent = 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()
RISK_DESCRIPTOR.index -> builder.risk = deserializeString().let { TestRisk.fromValue(it) }
TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { TestType.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}