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

commonMain.aws.sdk.kotlin.services.glacier.transform.S3LocationDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.glacier.transform

import aws.sdk.kotlin.services.glacier.model.CannedAcl
import aws.sdk.kotlin.services.glacier.model.Grant
import aws.sdk.kotlin.services.glacier.model.S3Location
import aws.sdk.kotlin.services.glacier.model.StorageClass
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 deserializeS3LocationDocument(deserializer: Deserializer): S3Location {
    val builder = S3Location.Builder()
    val ACCESSCONTROLLIST_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AccessControlList"))
    val BUCKETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("BucketName"))
    val CANNEDACL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("CannedACL"))
    val ENCRYPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Encryption"))
    val PREFIX_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Prefix"))
    val STORAGECLASS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StorageClass"))
    val TAGGING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Tagging"))
    val USERMETADATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("UserMetadata"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACCESSCONTROLLIST_DESCRIPTOR)
        field(BUCKETNAME_DESCRIPTOR)
        field(CANNEDACL_DESCRIPTOR)
        field(ENCRYPTION_DESCRIPTOR)
        field(PREFIX_DESCRIPTOR)
        field(STORAGECLASS_DESCRIPTOR)
        field(TAGGING_DESCRIPTOR)
        field(USERMETADATA_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACCESSCONTROLLIST_DESCRIPTOR.index -> builder.accessControlList =
                    deserializer.deserializeList(ACCESSCONTROLLIST_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeGrantDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                BUCKETNAME_DESCRIPTOR.index -> builder.bucketName = deserializeString()
                CANNEDACL_DESCRIPTOR.index -> builder.cannedAcl = deserializeString().let { CannedAcl.fromValue(it) }
                ENCRYPTION_DESCRIPTOR.index -> builder.encryption = deserializeEncryptionDocument(deserializer)
                PREFIX_DESCRIPTOR.index -> builder.prefix = deserializeString()
                STORAGECLASS_DESCRIPTOR.index -> builder.storageClass = deserializeString().let { StorageClass.fromValue(it) }
                TAGGING_DESCRIPTOR.index -> builder.tagging =
                    deserializer.deserializeMap(TAGGING_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                USERMETADATA_DESCRIPTOR.index -> builder.userMetadata =
                    deserializer.deserializeMap(USERMETADATA_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy