commonMain.aws.sdk.kotlin.services.waf.serde.RuleGroupDocumentDeserializer.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.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
internal fun deserializeRuleGroupDocument(deserializer: Deserializer): RuleGroup {
val builder = RuleGroup.Builder()
val METRICNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MetricName"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val RULEGROUPID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("RuleGroupId"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(METRICNAME_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(RULEGROUPID_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
METRICNAME_DESCRIPTOR.index -> builder.metricName = deserializeString()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
RULEGROUPID_DESCRIPTOR.index -> builder.ruleGroupId = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}