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

commonMain.aws.sdk.kotlin.services.directconnect.serde.DirectConnectGatewayAssociationProposalDocumentDeserializer.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.DirectConnectGatewayAssociationProposal
import aws.sdk.kotlin.services.directconnect.model.DirectConnectGatewayAssociationProposalState
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 deserializeDirectConnectGatewayAssociationProposalDocument(deserializer: Deserializer): DirectConnectGatewayAssociationProposal {
    val builder = DirectConnectGatewayAssociationProposal.Builder()
    val ASSOCIATEDGATEWAY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("associatedGateway"))
    val DIRECTCONNECTGATEWAYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("directConnectGatewayId"))
    val DIRECTCONNECTGATEWAYOWNERACCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("directConnectGatewayOwnerAccount"))
    val EXISTINGALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("existingAllowedPrefixesToDirectConnectGateway"))
    val PROPOSALID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("proposalId"))
    val PROPOSALSTATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("proposalState"))
    val REQUESTEDALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("requestedAllowedPrefixesToDirectConnectGateway"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ASSOCIATEDGATEWAY_DESCRIPTOR)
        field(DIRECTCONNECTGATEWAYID_DESCRIPTOR)
        field(DIRECTCONNECTGATEWAYOWNERACCOUNT_DESCRIPTOR)
        field(EXISTINGALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR)
        field(PROPOSALID_DESCRIPTOR)
        field(PROPOSALSTATE_DESCRIPTOR)
        field(REQUESTEDALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ASSOCIATEDGATEWAY_DESCRIPTOR.index -> builder.associatedGateway = deserializeAssociatedGatewayDocument(deserializer)
                DIRECTCONNECTGATEWAYID_DESCRIPTOR.index -> builder.directConnectGatewayId = deserializeString()
                DIRECTCONNECTGATEWAYOWNERACCOUNT_DESCRIPTOR.index -> builder.directConnectGatewayOwnerAccount = deserializeString()
                EXISTINGALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR.index -> builder.existingAllowedPrefixesToDirectConnectGateway =
                    deserializer.deserializeList(EXISTINGALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeRouteFilterPrefixDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                PROPOSALID_DESCRIPTOR.index -> builder.proposalId = deserializeString()
                PROPOSALSTATE_DESCRIPTOR.index -> builder.proposalState = deserializeString().let { DirectConnectGatewayAssociationProposalState.fromValue(it) }
                REQUESTEDALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR.index -> builder.requestedAllowedPrefixesToDirectConnectGateway =
                    deserializer.deserializeList(REQUESTEDALLOWEDPREFIXESTODIRECTCONNECTGATEWAY_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeRouteFilterPrefixDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy