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

commonMain.aws.sdk.kotlin.services.shield.transform.AttackDetailDocumentDeserializer.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.shield.transform

import aws.sdk.kotlin.services.shield.model.AttackDetail
import aws.sdk.kotlin.services.shield.model.AttackProperty
import aws.sdk.kotlin.services.shield.model.Mitigation
import aws.sdk.kotlin.services.shield.model.SubResourceSummary
import aws.sdk.kotlin.services.shield.model.SummarizedCounter
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

internal fun deserializeAttackDetailDocument(deserializer: Deserializer): AttackDetail {
    val builder = AttackDetail.Builder()
    val ATTACKCOUNTERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AttackCounters"))
    val ATTACKID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AttackId"))
    val ATTACKPROPERTIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("AttackProperties"))
    val ENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("EndTime"))
    val MITIGATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Mitigations"))
    val RESOURCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceArn"))
    val STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StartTime"))
    val SUBRESOURCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("SubResources"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ATTACKCOUNTERS_DESCRIPTOR)
        field(ATTACKID_DESCRIPTOR)
        field(ATTACKPROPERTIES_DESCRIPTOR)
        field(ENDTIME_DESCRIPTOR)
        field(MITIGATIONS_DESCRIPTOR)
        field(RESOURCEARN_DESCRIPTOR)
        field(STARTTIME_DESCRIPTOR)
        field(SUBRESOURCES_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ATTACKCOUNTERS_DESCRIPTOR.index -> builder.attackCounters =
                    deserializer.deserializeList(ATTACKCOUNTERS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeSummarizedCounterDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ATTACKID_DESCRIPTOR.index -> builder.attackId = deserializeString()
                ATTACKPROPERTIES_DESCRIPTOR.index -> builder.attackProperties =
                    deserializer.deserializeList(ATTACKPROPERTIES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeAttackPropertyDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ENDTIME_DESCRIPTOR.index -> builder.endTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                MITIGATIONS_DESCRIPTOR.index -> builder.mitigations =
                    deserializer.deserializeList(MITIGATIONS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeMitigationDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                RESOURCEARN_DESCRIPTOR.index -> builder.resourceArn = deserializeString()
                STARTTIME_DESCRIPTOR.index -> builder.startTime = deserializeString().let { Instant.fromEpochSeconds(it) }
                SUBRESOURCES_DESCRIPTOR.index -> builder.subResources =
                    deserializer.deserializeList(SUBRESOURCES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeSubResourceSummaryDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy