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

commonMain.aws.sdk.kotlin.services.wafv2.serde.RuleGroupDocumentDeserializer.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.wafv2.serde

import aws.sdk.kotlin.services.wafv2.model.CustomResponseBody
import aws.sdk.kotlin.services.wafv2.model.LabelSummary
import aws.sdk.kotlin.services.wafv2.model.Rule
import aws.sdk.kotlin.services.wafv2.model.RuleGroup
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
import kotlin.collections.mutableMapOf

internal fun deserializeRuleGroupDocument(deserializer: Deserializer): RuleGroup {
    val builder = RuleGroup.Builder()
    val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ARN"))
    val AVAILABLELABELS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AvailableLabels"))
    val CAPACITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("Capacity"))
    val CONSUMEDLABELS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ConsumedLabels"))
    val CUSTOMRESPONSEBODIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("CustomResponseBodies"))
    val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
    val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Id"))
    val LABELNAMESPACE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LabelNamespace"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
    val RULES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Rules"))
    val VISIBILITYCONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("VisibilityConfig"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ARN_DESCRIPTOR)
        field(AVAILABLELABELS_DESCRIPTOR)
        field(CAPACITY_DESCRIPTOR)
        field(CONSUMEDLABELS_DESCRIPTOR)
        field(CUSTOMRESPONSEBODIES_DESCRIPTOR)
        field(DESCRIPTION_DESCRIPTOR)
        field(ID_DESCRIPTOR)
        field(LABELNAMESPACE_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(RULES_DESCRIPTOR)
        field(VISIBILITYCONFIG_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ARN_DESCRIPTOR.index -> builder.arn = deserializeString()
                AVAILABLELABELS_DESCRIPTOR.index -> builder.availableLabels =
                    deserializer.deserializeList(AVAILABLELABELS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLabelSummaryDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                CAPACITY_DESCRIPTOR.index -> builder.capacity = deserializeLong()
                CONSUMEDLABELS_DESCRIPTOR.index -> builder.consumedLabels =
                    deserializer.deserializeList(CONSUMEDLABELS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLabelSummaryDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                CUSTOMRESPONSEBODIES_DESCRIPTOR.index -> builder.customResponseBodies =
                    deserializer.deserializeMap(CUSTOMRESPONSEBODIES_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeCustomResponseBodyDocument(deserializer) } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
                ID_DESCRIPTOR.index -> builder.id = deserializeString()
                LABELNAMESPACE_DESCRIPTOR.index -> builder.labelNamespace = deserializeString()
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                RULES_DESCRIPTOR.index -> builder.rules =
                    deserializer.deserializeList(RULES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeRuleDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                VISIBILITYCONFIG_DESCRIPTOR.index -> builder.visibilityConfig = deserializeVisibilityConfigDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy