commonMain.aws.sdk.kotlin.services.cloudwatchevents.serde.ConnectionDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cloudwatchevents-jvm Show documentation
Show all versions of cloudwatchevents-jvm Show documentation
The AWS SDK for Kotlin client for CloudWatch Events
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.cloudwatchevents.serde
import aws.sdk.kotlin.services.cloudwatchevents.model.Connection
import aws.sdk.kotlin.services.cloudwatchevents.model.ConnectionAuthorizationType
import aws.sdk.kotlin.services.cloudwatchevents.model.ConnectionState
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
internal fun deserializeConnectionDocument(deserializer: Deserializer): Connection {
val builder = Connection.Builder()
val AUTHORIZATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("AuthorizationType"))
val CONNECTIONARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ConnectionArn"))
val CONNECTIONSTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ConnectionState"))
val CREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreationTime"))
val LASTAUTHORIZEDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastAuthorizedTime"))
val LASTMODIFIEDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastModifiedTime"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val STATEREASON_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StateReason"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AUTHORIZATIONTYPE_DESCRIPTOR)
field(CONNECTIONARN_DESCRIPTOR)
field(CONNECTIONSTATE_DESCRIPTOR)
field(CREATIONTIME_DESCRIPTOR)
field(LASTAUTHORIZEDTIME_DESCRIPTOR)
field(LASTMODIFIEDTIME_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(STATEREASON_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
AUTHORIZATIONTYPE_DESCRIPTOR.index -> builder.authorizationType = deserializeString().let { ConnectionAuthorizationType.fromValue(it) }
CONNECTIONARN_DESCRIPTOR.index -> builder.connectionArn = deserializeString()
CONNECTIONSTATE_DESCRIPTOR.index -> builder.connectionState = deserializeString().let { ConnectionState.fromValue(it) }
CREATIONTIME_DESCRIPTOR.index -> builder.creationTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LASTAUTHORIZEDTIME_DESCRIPTOR.index -> builder.lastAuthorizedTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LASTMODIFIEDTIME_DESCRIPTOR.index -> builder.lastModifiedTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
STATEREASON_DESCRIPTOR.index -> builder.stateReason = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}