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

commonMain.aws.sdk.kotlin.services.cloudwatchlogs.serde.ConfigurationTemplateDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.cloudwatchlogs.serde

import aws.sdk.kotlin.services.cloudwatchlogs.model.ConfigurationTemplate
import aws.sdk.kotlin.services.cloudwatchlogs.model.DeliveryDestinationType
import aws.sdk.kotlin.services.cloudwatchlogs.model.OutputFormat
import aws.sdk.kotlin.services.cloudwatchlogs.model.RecordField
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 deserializeConfigurationTemplateDocument(deserializer: Deserializer): ConfigurationTemplate {
    val builder = ConfigurationTemplate.Builder()
    val ALLOWEDACTIONFORALLOWVENDEDLOGSDELIVERYFORRESOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("allowedActionForAllowVendedLogsDeliveryForResource"))
    val ALLOWEDFIELDDELIMITERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("allowedFieldDelimiters"))
    val ALLOWEDFIELDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("allowedFields"))
    val ALLOWEDOUTPUTFORMATS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("allowedOutputFormats"))
    val ALLOWEDSUFFIXPATHFIELDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("allowedSuffixPathFields"))
    val DEFAULTDELIVERYCONFIGVALUES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("defaultDeliveryConfigValues"))
    val DELIVERYDESTINATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("deliveryDestinationType"))
    val LOGTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("logType"))
    val RESOURCETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("resourceType"))
    val SERVICE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("service"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ALLOWEDACTIONFORALLOWVENDEDLOGSDELIVERYFORRESOURCE_DESCRIPTOR)
        field(ALLOWEDFIELDDELIMITERS_DESCRIPTOR)
        field(ALLOWEDFIELDS_DESCRIPTOR)
        field(ALLOWEDOUTPUTFORMATS_DESCRIPTOR)
        field(ALLOWEDSUFFIXPATHFIELDS_DESCRIPTOR)
        field(DEFAULTDELIVERYCONFIGVALUES_DESCRIPTOR)
        field(DELIVERYDESTINATIONTYPE_DESCRIPTOR)
        field(LOGTYPE_DESCRIPTOR)
        field(RESOURCETYPE_DESCRIPTOR)
        field(SERVICE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ALLOWEDACTIONFORALLOWVENDEDLOGSDELIVERYFORRESOURCE_DESCRIPTOR.index -> builder.allowedActionForAllowVendedLogsDeliveryForResource = deserializeString()
                ALLOWEDFIELDDELIMITERS_DESCRIPTOR.index -> builder.allowedFieldDelimiters =
                    deserializer.deserializeList(ALLOWEDFIELDDELIMITERS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ALLOWEDFIELDS_DESCRIPTOR.index -> builder.allowedFields =
                    deserializer.deserializeList(ALLOWEDFIELDS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeRecordFieldDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ALLOWEDOUTPUTFORMATS_DESCRIPTOR.index -> builder.allowedOutputFormats =
                    deserializer.deserializeList(ALLOWEDOUTPUTFORMATS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { OutputFormat.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ALLOWEDSUFFIXPATHFIELDS_DESCRIPTOR.index -> builder.allowedSuffixPathFields =
                    deserializer.deserializeList(ALLOWEDSUFFIXPATHFIELDS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                DEFAULTDELIVERYCONFIGVALUES_DESCRIPTOR.index -> builder.defaultDeliveryConfigValues = deserializeConfigurationTemplateDeliveryConfigValuesDocument(deserializer)
                DELIVERYDESTINATIONTYPE_DESCRIPTOR.index -> builder.deliveryDestinationType = deserializeString().let { DeliveryDestinationType.fromValue(it) }
                LOGTYPE_DESCRIPTOR.index -> builder.logType = deserializeString()
                RESOURCETYPE_DESCRIPTOR.index -> builder.resourceType = deserializeString()
                SERVICE_DESCRIPTOR.index -> builder.service = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy