commonMain.aws.sdk.kotlin.services.codegurusecurity.serde.FindingDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codegurusecurity-jvm Show documentation
Show all versions of codegurusecurity-jvm Show documentation
The AWS SDK for Kotlin client for CodeGuru Security
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.codegurusecurity.serde
import aws.sdk.kotlin.services.codegurusecurity.model.Finding
import aws.sdk.kotlin.services.codegurusecurity.model.Severity
import aws.sdk.kotlin.services.codegurusecurity.model.Status
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 aws.smithy.kotlin.runtime.time.Instant
import aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableListOf
internal fun deserializeFindingDocument(deserializer: Deserializer): Finding {
val builder = Finding.Builder()
val CREATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("createdAt"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("description"))
val DETECTORID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("detectorId"))
val DETECTORNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("detectorName"))
val DETECTORTAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("detectorTags"))
val GENERATORID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("generatorId"))
val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("id"))
val REMEDIATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("remediation"))
val RESOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("resource"))
val RULEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ruleId"))
val SEVERITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("severity"))
val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("status"))
val TITLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("title"))
val TYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("type"))
val UPDATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("updatedAt"))
val VULNERABILITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("vulnerability"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(CREATEDAT_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(DETECTORID_DESCRIPTOR)
field(DETECTORNAME_DESCRIPTOR)
field(DETECTORTAGS_DESCRIPTOR)
field(GENERATORID_DESCRIPTOR)
field(ID_DESCRIPTOR)
field(REMEDIATION_DESCRIPTOR)
field(RESOURCE_DESCRIPTOR)
field(RULEID_DESCRIPTOR)
field(SEVERITY_DESCRIPTOR)
field(STATUS_DESCRIPTOR)
field(TITLE_DESCRIPTOR)
field(TYPE_DESCRIPTOR)
field(UPDATEDAT_DESCRIPTOR)
field(VULNERABILITY_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
CREATEDAT_DESCRIPTOR.index -> builder.createdAt = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
DETECTORID_DESCRIPTOR.index -> builder.detectorId = deserializeString()
DETECTORNAME_DESCRIPTOR.index -> builder.detectorName = deserializeString()
DETECTORTAGS_DESCRIPTOR.index -> builder.detectorTags =
deserializer.deserializeList(DETECTORTAGS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
GENERATORID_DESCRIPTOR.index -> builder.generatorId = deserializeString()
ID_DESCRIPTOR.index -> builder.id = deserializeString()
REMEDIATION_DESCRIPTOR.index -> builder.remediation = deserializeRemediationDocument(deserializer)
RESOURCE_DESCRIPTOR.index -> builder.resource = deserializeResourceDocument(deserializer)
RULEID_DESCRIPTOR.index -> builder.ruleId = deserializeString()
SEVERITY_DESCRIPTOR.index -> builder.severity = deserializeString().let { Severity.fromValue(it) }
STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { Status.fromValue(it) }
TITLE_DESCRIPTOR.index -> builder.title = deserializeString()
TYPE_DESCRIPTOR.index -> builder.type = deserializeString()
UPDATEDAT_DESCRIPTOR.index -> builder.updatedAt = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
VULNERABILITY_DESCRIPTOR.index -> builder.vulnerability = deserializeVulnerabilityDocument(deserializer)
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}