All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.shield.serde.SubscriptionDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.shield.serde

import aws.sdk.kotlin.services.shield.model.AutoRenew
import aws.sdk.kotlin.services.shield.model.Limit
import aws.sdk.kotlin.services.shield.model.ProactiveEngagementStatus
import aws.sdk.kotlin.services.shield.model.Subscription
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 deserializeSubscriptionDocument(deserializer: Deserializer): Subscription {
    val builder = Subscription.Builder()
    val AUTORENEW_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("AutoRenew"))
    val ENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("EndTime"))
    val LIMITS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Limits"))
    val PROACTIVEENGAGEMENTSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ProactiveEngagementStatus"))
    val STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StartTime"))
    val SUBSCRIPTIONARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SubscriptionArn"))
    val SUBSCRIPTIONLIMITS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("SubscriptionLimits"))
    val TIMECOMMITMENTINSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("TimeCommitmentInSeconds"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(AUTORENEW_DESCRIPTOR)
        field(ENDTIME_DESCRIPTOR)
        field(LIMITS_DESCRIPTOR)
        field(PROACTIVEENGAGEMENTSTATUS_DESCRIPTOR)
        field(STARTTIME_DESCRIPTOR)
        field(SUBSCRIPTIONARN_DESCRIPTOR)
        field(SUBSCRIPTIONLIMITS_DESCRIPTOR)
        field(TIMECOMMITMENTINSECONDS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                AUTORENEW_DESCRIPTOR.index -> builder.autoRenew = deserializeString().let { AutoRenew.fromValue(it) }
                ENDTIME_DESCRIPTOR.index -> builder.endTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                LIMITS_DESCRIPTOR.index -> builder.limits =
                    deserializer.deserializeList(LIMITS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLimitDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                PROACTIVEENGAGEMENTSTATUS_DESCRIPTOR.index -> builder.proactiveEngagementStatus = deserializeString().let { ProactiveEngagementStatus.fromValue(it) }
                STARTTIME_DESCRIPTOR.index -> builder.startTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                SUBSCRIPTIONARN_DESCRIPTOR.index -> builder.subscriptionArn = deserializeString()
                SUBSCRIPTIONLIMITS_DESCRIPTOR.index -> builder.subscriptionLimits = deserializeSubscriptionLimitsDocument(deserializer)
                TIMECOMMITMENTINSECONDS_DESCRIPTOR.index -> builder.timeCommitmentInSeconds = deserializeLong()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy