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

commonMain.aws.sdk.kotlin.services.directconnect.serde.DirectConnectGatewayDocumentDeserializer.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.directconnect.serde

import aws.sdk.kotlin.services.directconnect.model.DirectConnectGateway
import aws.sdk.kotlin.services.directconnect.model.DirectConnectGatewayState
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

internal fun deserializeDirectConnectGatewayDocument(deserializer: Deserializer): DirectConnectGateway {
    val builder = DirectConnectGateway.Builder()
    val AMAZONSIDEASN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("amazonSideAsn"))
    val DIRECTCONNECTGATEWAYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("directConnectGatewayId"))
    val DIRECTCONNECTGATEWAYNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("directConnectGatewayName"))
    val DIRECTCONNECTGATEWAYSTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("directConnectGatewayState"))
    val OWNERACCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ownerAccount"))
    val STATECHANGEERROR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("stateChangeError"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(AMAZONSIDEASN_DESCRIPTOR)
        field(DIRECTCONNECTGATEWAYID_DESCRIPTOR)
        field(DIRECTCONNECTGATEWAYNAME_DESCRIPTOR)
        field(DIRECTCONNECTGATEWAYSTATE_DESCRIPTOR)
        field(OWNERACCOUNT_DESCRIPTOR)
        field(STATECHANGEERROR_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                AMAZONSIDEASN_DESCRIPTOR.index -> builder.amazonSideAsn = deserializeLong()
                DIRECTCONNECTGATEWAYID_DESCRIPTOR.index -> builder.directConnectGatewayId = deserializeString()
                DIRECTCONNECTGATEWAYNAME_DESCRIPTOR.index -> builder.directConnectGatewayName = deserializeString()
                DIRECTCONNECTGATEWAYSTATE_DESCRIPTOR.index -> builder.directConnectGatewayState = deserializeString().let { DirectConnectGatewayState.fromValue(it) }
                OWNERACCOUNT_DESCRIPTOR.index -> builder.ownerAccount = deserializeString()
                STATECHANGEERROR_DESCRIPTOR.index -> builder.stateChangeError = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy