commonMain.aws.sdk.kotlin.services.glue.serde.PiiDetectionDocumentDeserializer.kt Maven / Gradle / Ivy
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.glue.serde
import aws.sdk.kotlin.services.glue.model.PiiDetection
import aws.sdk.kotlin.services.glue.model.PiiType
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 deserializePiiDetectionDocument(deserializer: Deserializer): PiiDetection {
val builder = PiiDetection.Builder()
val ENTITYTYPESTODETECT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("EntityTypesToDetect"))
val INPUTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Inputs"))
val MASKVALUE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("MaskValue"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val OUTPUTCOLUMNNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OutputColumnName"))
val PIITYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("PiiType"))
val SAMPLEFRACTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("SampleFraction"))
val THRESHOLDFRACTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("ThresholdFraction"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ENTITYTYPESTODETECT_DESCRIPTOR)
field(INPUTS_DESCRIPTOR)
field(MASKVALUE_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(OUTPUTCOLUMNNAME_DESCRIPTOR)
field(PIITYPE_DESCRIPTOR)
field(SAMPLEFRACTION_DESCRIPTOR)
field(THRESHOLDFRACTION_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ENTITYTYPESTODETECT_DESCRIPTOR.index -> builder.entityTypesToDetect =
deserializer.deserializeList(ENTITYTYPESTODETECT_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
INPUTS_DESCRIPTOR.index -> builder.inputs =
deserializer.deserializeList(INPUTS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
MASKVALUE_DESCRIPTOR.index -> builder.maskValue = deserializeString()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
OUTPUTCOLUMNNAME_DESCRIPTOR.index -> builder.outputColumnName = deserializeString()
PIITYPE_DESCRIPTOR.index -> builder.piiType = deserializeString().let { PiiType.fromValue(it) }
SAMPLEFRACTION_DESCRIPTOR.index -> builder.sampleFraction = deserializeDouble()
THRESHOLDFRACTION_DESCRIPTOR.index -> builder.thresholdFraction = deserializeDouble()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}