commonMain.aws.sdk.kotlin.services.ssmincidents.serde.TimelineEventDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ssmincidents-jvm Show documentation
Show all versions of ssmincidents-jvm Show documentation
The AWS SDK for Kotlin client for SSM Incidents
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.ssmincidents.serde
import aws.sdk.kotlin.services.ssmincidents.model.EventReference
import aws.sdk.kotlin.services.ssmincidents.model.TimelineEvent
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 deserializeTimelineEventDocument(deserializer: Deserializer): TimelineEvent {
val builder = TimelineEvent.Builder()
val EVENTDATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("eventData"))
val EVENTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("eventId"))
val EVENTREFERENCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("eventReferences"))
val EVENTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("eventTime"))
val EVENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("eventType"))
val EVENTUPDATEDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("eventUpdatedTime"))
val INCIDENTRECORDARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("incidentRecordArn"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(EVENTDATA_DESCRIPTOR)
field(EVENTID_DESCRIPTOR)
field(EVENTREFERENCES_DESCRIPTOR)
field(EVENTTIME_DESCRIPTOR)
field(EVENTTYPE_DESCRIPTOR)
field(EVENTUPDATEDTIME_DESCRIPTOR)
field(INCIDENTRECORDARN_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
EVENTDATA_DESCRIPTOR.index -> builder.eventData = deserializeString()
EVENTID_DESCRIPTOR.index -> builder.eventId = deserializeString()
EVENTREFERENCES_DESCRIPTOR.index -> builder.eventReferences =
deserializer.deserializeList(EVENTREFERENCES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeEventReferenceDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
EVENTTIME_DESCRIPTOR.index -> builder.eventTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
EVENTTYPE_DESCRIPTOR.index -> builder.eventType = deserializeString()
EVENTUPDATEDTIME_DESCRIPTOR.index -> builder.eventUpdatedTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
INCIDENTRECORDARN_DESCRIPTOR.index -> builder.incidentRecordArn = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}