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

commonMain.aws.sdk.kotlin.services.cloudwatchlogs.serde.LogGroupDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.77
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.cloudwatchlogs.serde

import aws.sdk.kotlin.services.cloudwatchlogs.model.DataProtectionStatus
import aws.sdk.kotlin.services.cloudwatchlogs.model.InheritedProperty
import aws.sdk.kotlin.services.cloudwatchlogs.model.LogGroup
import aws.sdk.kotlin.services.cloudwatchlogs.model.LogGroupClass
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 deserializeLogGroupDocument(deserializer: Deserializer): LogGroup {
    val builder = LogGroup.Builder()
    val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("arn"))
    val CREATIONTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("creationTime"))
    val DATAPROTECTIONSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("dataProtectionStatus"))
    val INHERITEDPROPERTIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("inheritedProperties"))
    val KMSKEYID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("kmsKeyId"))
    val LOGGROUPARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("logGroupArn"))
    val LOGGROUPCLASS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("logGroupClass"))
    val LOGGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("logGroupName"))
    val METRICFILTERCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("metricFilterCount"))
    val RETENTIONINDAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("retentionInDays"))
    val STOREDBYTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("storedBytes"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ARN_DESCRIPTOR)
        field(CREATIONTIME_DESCRIPTOR)
        field(DATAPROTECTIONSTATUS_DESCRIPTOR)
        field(INHERITEDPROPERTIES_DESCRIPTOR)
        field(KMSKEYID_DESCRIPTOR)
        field(LOGGROUPARN_DESCRIPTOR)
        field(LOGGROUPCLASS_DESCRIPTOR)
        field(LOGGROUPNAME_DESCRIPTOR)
        field(METRICFILTERCOUNT_DESCRIPTOR)
        field(RETENTIONINDAYS_DESCRIPTOR)
        field(STOREDBYTES_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ARN_DESCRIPTOR.index -> builder.arn = deserializeString()
                CREATIONTIME_DESCRIPTOR.index -> builder.creationTime = deserializeLong()
                DATAPROTECTIONSTATUS_DESCRIPTOR.index -> builder.dataProtectionStatus = deserializeString().let { DataProtectionStatus.fromValue(it) }
                INHERITEDPROPERTIES_DESCRIPTOR.index -> builder.inheritedProperties =
                    deserializer.deserializeList(INHERITEDPROPERTIES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { InheritedProperty.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                KMSKEYID_DESCRIPTOR.index -> builder.kmsKeyId = deserializeString()
                LOGGROUPARN_DESCRIPTOR.index -> builder.logGroupArn = deserializeString()
                LOGGROUPCLASS_DESCRIPTOR.index -> builder.logGroupClass = deserializeString().let { LogGroupClass.fromValue(it) }
                LOGGROUPNAME_DESCRIPTOR.index -> builder.logGroupName = deserializeString()
                METRICFILTERCOUNT_DESCRIPTOR.index -> builder.metricFilterCount = deserializeInt()
                RETENTIONINDAYS_DESCRIPTOR.index -> builder.retentionInDays = deserializeInt()
                STOREDBYTES_DESCRIPTOR.index -> builder.storedBytes = deserializeLong()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy