commonMain.aws.sdk.kotlin.services.waf.serde.HttpRequestDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of waf-jvm Show documentation
Show all versions of waf-jvm Show documentation
The AWS SDK for Kotlin client for WAF
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.waf.serde
import aws.sdk.kotlin.services.waf.model.HttpHeader
import aws.sdk.kotlin.services.waf.model.HttpRequest
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 deserializeHttpRequestDocument(deserializer: Deserializer): HttpRequest {
val builder = HttpRequest.Builder()
val CLIENTIP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ClientIP"))
val COUNTRY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Country"))
val HTTPVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("HTTPVersion"))
val HEADERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Headers"))
val METHOD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Method"))
val URI_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("URI"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CLIENTIP_DESCRIPTOR)
field(COUNTRY_DESCRIPTOR)
field(HTTPVERSION_DESCRIPTOR)
field(HEADERS_DESCRIPTOR)
field(METHOD_DESCRIPTOR)
field(URI_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CLIENTIP_DESCRIPTOR.index -> builder.clientIp = deserializeString()
COUNTRY_DESCRIPTOR.index -> builder.country = deserializeString()
HTTPVERSION_DESCRIPTOR.index -> builder.httpVersion = deserializeString()
HEADERS_DESCRIPTOR.index -> builder.headers =
deserializer.deserializeList(HEADERS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeHttpHeaderDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
METHOD_DESCRIPTOR.index -> builder.method = deserializeString()
URI_DESCRIPTOR.index -> builder.uri = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}