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

commonMain.aws.sdk.kotlin.services.appsync.serde.ApiCacheDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.appsync.serde

import aws.sdk.kotlin.services.appsync.model.ApiCache
import aws.sdk.kotlin.services.appsync.model.ApiCacheStatus
import aws.sdk.kotlin.services.appsync.model.ApiCacheType
import aws.sdk.kotlin.services.appsync.model.ApiCachingBehavior
import aws.sdk.kotlin.services.appsync.model.CacheHealthMetricsConfig
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 deserializeApiCacheDocument(deserializer: Deserializer): ApiCache {
    val builder = ApiCache.Builder()
    val APICACHINGBEHAVIOR_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("apiCachingBehavior"))
    val ATRESTENCRYPTIONENABLED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("atRestEncryptionEnabled"))
    val HEALTHMETRICSCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("healthMetricsConfig"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("status"))
    val TRANSITENCRYPTIONENABLED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("transitEncryptionEnabled"))
    val TTL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("ttl"))
    val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("type"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(APICACHINGBEHAVIOR_DESCRIPTOR)
        field(ATRESTENCRYPTIONENABLED_DESCRIPTOR)
        field(HEALTHMETRICSCONFIG_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(TRANSITENCRYPTIONENABLED_DESCRIPTOR)
        field(TTL_DESCRIPTOR)
        field(TYPE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                APICACHINGBEHAVIOR_DESCRIPTOR.index -> builder.apiCachingBehavior = deserializeString().let { ApiCachingBehavior.fromValue(it) }
                ATRESTENCRYPTIONENABLED_DESCRIPTOR.index -> builder.atRestEncryptionEnabled = deserializeBoolean()
                HEALTHMETRICSCONFIG_DESCRIPTOR.index -> builder.healthMetricsConfig = deserializeString().let { CacheHealthMetricsConfig.fromValue(it) }
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { ApiCacheStatus.fromValue(it) }
                TRANSITENCRYPTIONENABLED_DESCRIPTOR.index -> builder.transitEncryptionEnabled = deserializeBoolean()
                TTL_DESCRIPTOR.index -> builder.ttl = deserializeLong()
                TYPE_DESCRIPTOR.index -> builder.type = deserializeString().let { ApiCacheType.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy