commonMain.aws.sdk.kotlin.services.devopsguru.serde.RecommendationDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devopsguru-jvm Show documentation
Show all versions of devopsguru-jvm Show documentation
The AWS SDK for Kotlin client for DevOps Guru
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.devopsguru.serde
import aws.sdk.kotlin.services.devopsguru.model.Recommendation
import aws.sdk.kotlin.services.devopsguru.model.RecommendationRelatedAnomaly
import aws.sdk.kotlin.services.devopsguru.model.RecommendationRelatedEvent
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 deserializeRecommendationDocument(deserializer: Deserializer): Recommendation {
val builder = Recommendation.Builder()
val CATEGORY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Category"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val LINK_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Link"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val REASON_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Reason"))
val RELATEDANOMALIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("RelatedAnomalies"))
val RELATEDEVENTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("RelatedEvents"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CATEGORY_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(LINK_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(REASON_DESCRIPTOR)
field(RELATEDANOMALIES_DESCRIPTOR)
field(RELATEDEVENTS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CATEGORY_DESCRIPTOR.index -> builder.category = deserializeString()
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
LINK_DESCRIPTOR.index -> builder.link = deserializeString()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
REASON_DESCRIPTOR.index -> builder.reason = deserializeString()
RELATEDANOMALIES_DESCRIPTOR.index -> builder.relatedAnomalies =
deserializer.deserializeList(RELATEDANOMALIES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeRecommendationRelatedAnomalyDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
RELATEDEVENTS_DESCRIPTOR.index -> builder.relatedEvents =
deserializer.deserializeList(RELATEDEVENTS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeRecommendationRelatedEventDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}