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

commonMain.aws.sdk.kotlin.services.redshift.serde.EncryptionContextMapShapeDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.redshift.serde

import aws.smithy.kotlin.runtime.serde.DeserializationException
import aws.smithy.kotlin.runtime.serde.getOrDeserializeErr
import aws.smithy.kotlin.runtime.serde.xml.XmlTagReader
import aws.smithy.kotlin.runtime.serde.xml.tryData
import kotlin.collections.MutableMap

internal fun deserializeEncryptionContextMapShape(reader: XmlTagReader): Map {
    val result = mutableMapOf()
    loop@while (true) {
        val curr = reader.nextTag() ?: break@loop
        when (curr.tagName) {
            "entry" -> {
                deserializeEncryptionContextMapEntry(result, curr)
            }
            else -> {}
        }
        curr.drop()
    }
    return result
}

internal fun deserializeEncryptionContextMapEntry(dest: MutableMap, reader: XmlTagReader) {
    var key: String? = null
    var value: String? = null
    loop@while (true) {
        val curr = reader.nextTag() ?: break@loop
        when (curr.tagName) {
            "key" -> key = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.redshift#String`)" }
            "value" -> value = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.redshift#String`)" }
            else -> {}
        }
        curr.drop()
    }
    if (key == null) throw DeserializationException("missing key map entry")
    if (value == null) throw DeserializationException("missing value map entry")
    dest[key] = value
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy