commonMain.aws.sdk.kotlin.services.devopsguru.serde.EventDocumentDeserializer.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
The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.devopsguru.serde
import aws.sdk.kotlin.services.devopsguru.model.Event
import aws.sdk.kotlin.services.devopsguru.model.EventClass
import aws.sdk.kotlin.services.devopsguru.model.EventDataSource
import aws.sdk.kotlin.services.devopsguru.model.EventResource
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 aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf
internal fun deserializeEventDocument(deserializer: Deserializer): Event {
val builder = Event.Builder()
val DATASOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("DataSource"))
val EVENTCLASS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("EventClass"))
val EVENTSOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("EventSource"))
val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Id"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val RESOURCECOLLECTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ResourceCollection"))
val RESOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Resources"))
val TIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("Time"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(DATASOURCE_DESCRIPTOR)
field(EVENTCLASS_DESCRIPTOR)
field(EVENTSOURCE_DESCRIPTOR)
field(ID_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(RESOURCECOLLECTION_DESCRIPTOR)
field(RESOURCES_DESCRIPTOR)
field(TIME_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
DATASOURCE_DESCRIPTOR.index -> builder.dataSource = deserializeString().let { EventDataSource.fromValue(it) }
EVENTCLASS_DESCRIPTOR.index -> builder.eventClass = deserializeString().let { EventClass.fromValue(it) }
EVENTSOURCE_DESCRIPTOR.index -> builder.eventSource = deserializeString()
ID_DESCRIPTOR.index -> builder.id = deserializeString()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
RESOURCECOLLECTION_DESCRIPTOR.index -> builder.resourceCollection = deserializeResourceCollectionDocument(deserializer)
RESOURCES_DESCRIPTOR.index -> builder.resources =
deserializer.deserializeList(RESOURCES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeEventResourceDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
TIME_DESCRIPTOR.index -> builder.time = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy