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

commonMain.aws.sdk.kotlin.services.directconnect.serde.DirectConnectGatewayAssociationDocumentDeserializer.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.DirectConnectGatewayAssociation
import aws.sdk.kotlin.services.directconnect.model.DirectConnectGatewayAssociationState
import aws.sdk.kotlin.services.directconnect.model.RouteFilterPrefix
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 kotlin.collections.mutableListOf

internal fun deserializeDirectConnectGatewayAssociationDocument(deserializer: Deserializer): DirectConnectGatewayAssociation {
    val builder = DirectConnectGatewayAssociation.Builder()
    val ALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("allowedPrefixesToDirectConnectGateway"))
    val ASSOCIATEDGATEWAY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("associatedGateway"))
    val ASSOCIATIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("associationId"))
    val ASSOCIATIONSTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("associationState"))
    val DIRECTCONNECTGATEWAYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("directConnectGatewayId"))
    val DIRECTCONNECTGATEWAYOWNERACCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("directConnectGatewayOwnerAccount"))
    val STATECHANGEERROR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("stateChangeError"))
    val VIRTUALGATEWAYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("virtualGatewayId"))
    val VIRTUALGATEWAYOWNERACCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("virtualGatewayOwnerAccount"))
    val VIRTUALGATEWAYREGION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("virtualGatewayRegion"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR)
        field(ASSOCIATEDGATEWAY_DESCRIPTOR)
        field(ASSOCIATIONID_DESCRIPTOR)
        field(ASSOCIATIONSTATE_DESCRIPTOR)
        field(DIRECTCONNECTGATEWAYID_DESCRIPTOR)
        field(DIRECTCONNECTGATEWAYOWNERACCOUNT_DESCRIPTOR)
        field(STATECHANGEERROR_DESCRIPTOR)
        field(VIRTUALGATEWAYID_DESCRIPTOR)
        field(VIRTUALGATEWAYOWNERACCOUNT_DESCRIPTOR)
        field(VIRTUALGATEWAYREGION_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR.index -> builder.allowedPrefixesToDirectConnectGateway =
                    deserializer.deserializeList(ALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeRouteFilterPrefixDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ASSOCIATEDGATEWAY_DESCRIPTOR.index -> builder.associatedGateway = deserializeAssociatedGatewayDocument(deserializer)
                ASSOCIATIONID_DESCRIPTOR.index -> builder.associationId = deserializeString()
                ASSOCIATIONSTATE_DESCRIPTOR.index -> builder.associationState = deserializeString().let { DirectConnectGatewayAssociationState.fromValue(it) }
                DIRECTCONNECTGATEWAYID_DESCRIPTOR.index -> builder.directConnectGatewayId = deserializeString()
                DIRECTCONNECTGATEWAYOWNERACCOUNT_DESCRIPTOR.index -> builder.directConnectGatewayOwnerAccount = deserializeString()
                STATECHANGEERROR_DESCRIPTOR.index -> builder.stateChangeError = deserializeString()
                VIRTUALGATEWAYID_DESCRIPTOR.index -> builder.virtualGatewayId = deserializeString()
                VIRTUALGATEWAYOWNERACCOUNT_DESCRIPTOR.index -> builder.virtualGatewayOwnerAccount = deserializeString()
                VIRTUALGATEWAYREGION_DESCRIPTOR.index -> builder.virtualGatewayRegion = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy