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

commonMain.aws.sdk.kotlin.services.codeartifact.serde.PackageGroupOriginRestrictionDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.codeartifact.serde

import aws.sdk.kotlin.services.codeartifact.model.PackageGroupOriginRestriction
import aws.sdk.kotlin.services.codeartifact.model.PackageGroupOriginRestrictionMode
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 deserializePackageGroupOriginRestrictionDocument(deserializer: Deserializer): PackageGroupOriginRestriction {
    val builder = PackageGroupOriginRestriction.Builder()
    val EFFECTIVEMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("effectiveMode"))
    val INHERITEDFROM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("inheritedFrom"))
    val MODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("mode"))
    val REPOSITORIESCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("repositoriesCount"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(EFFECTIVEMODE_DESCRIPTOR)
        field(INHERITEDFROM_DESCRIPTOR)
        field(MODE_DESCRIPTOR)
        field(REPOSITORIESCOUNT_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                EFFECTIVEMODE_DESCRIPTOR.index -> builder.effectiveMode = deserializeString().let { PackageGroupOriginRestrictionMode.fromValue(it) }
                INHERITEDFROM_DESCRIPTOR.index -> builder.inheritedFrom = deserializePackageGroupReferenceDocument(deserializer)
                MODE_DESCRIPTOR.index -> builder.mode = deserializeString().let { PackageGroupOriginRestrictionMode.fromValue(it) }
                REPOSITORIESCOUNT_DESCRIPTOR.index -> builder.repositoriesCount = deserializeLong()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy