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

commonMain.aws.sdk.kotlin.services.computeoptimizer.serde.VolumeRecommendationDocumentDeserializer.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.computeoptimizer.serde

import aws.sdk.kotlin.services.computeoptimizer.model.CurrentPerformanceRisk
import aws.sdk.kotlin.services.computeoptimizer.model.EbsFinding
import aws.sdk.kotlin.services.computeoptimizer.model.EbsUtilizationMetric
import aws.sdk.kotlin.services.computeoptimizer.model.Tag
import aws.sdk.kotlin.services.computeoptimizer.model.VolumeRecommendation
import aws.sdk.kotlin.services.computeoptimizer.model.VolumeRecommendationOption
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 deserializeVolumeRecommendationDocument(deserializer: Deserializer): VolumeRecommendation {
    val builder = VolumeRecommendation.Builder()
    val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("accountId"))
    val CURRENTCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("currentConfiguration"))
    val CURRENTPERFORMANCERISK_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("currentPerformanceRisk"))
    val EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("effectiveRecommendationPreferences"))
    val FINDING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("finding"))
    val LASTREFRESHTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("lastRefreshTimestamp"))
    val LOOKBACKPERIODINDAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("lookBackPeriodInDays"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("tags"))
    val UTILIZATIONMETRICS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("utilizationMetrics"))
    val VOLUMEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("volumeArn"))
    val VOLUMERECOMMENDATIONOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("volumeRecommendationOptions"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACCOUNTID_DESCRIPTOR)
        field(CURRENTCONFIGURATION_DESCRIPTOR)
        field(CURRENTPERFORMANCERISK_DESCRIPTOR)
        field(EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR)
        field(FINDING_DESCRIPTOR)
        field(LASTREFRESHTIMESTAMP_DESCRIPTOR)
        field(LOOKBACKPERIODINDAYS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(UTILIZATIONMETRICS_DESCRIPTOR)
        field(VOLUMEARN_DESCRIPTOR)
        field(VOLUMERECOMMENDATIONOPTIONS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACCOUNTID_DESCRIPTOR.index -> builder.accountId = deserializeString()
                CURRENTCONFIGURATION_DESCRIPTOR.index -> builder.currentConfiguration = deserializeVolumeConfigurationDocument(deserializer)
                CURRENTPERFORMANCERISK_DESCRIPTOR.index -> builder.currentPerformanceRisk = deserializeString().let { CurrentPerformanceRisk.fromValue(it) }
                EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR.index -> builder.effectiveRecommendationPreferences = deserializeEbsEffectiveRecommendationPreferencesDocument(deserializer)
                FINDING_DESCRIPTOR.index -> builder.finding = deserializeString().let { EbsFinding.fromValue(it) }
                LASTREFRESHTIMESTAMP_DESCRIPTOR.index -> builder.lastRefreshTimestamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                LOOKBACKPERIODINDAYS_DESCRIPTOR.index -> builder.lookBackPeriodInDays = deserializeDouble()
                TAGS_DESCRIPTOR.index -> builder.tags =
                    deserializer.deserializeList(TAGS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeTagDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                UTILIZATIONMETRICS_DESCRIPTOR.index -> builder.utilizationMetrics =
                    deserializer.deserializeList(UTILIZATIONMETRICS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeEbsUtilizationMetricDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                VOLUMEARN_DESCRIPTOR.index -> builder.volumeArn = deserializeString()
                VOLUMERECOMMENDATIONOPTIONS_DESCRIPTOR.index -> builder.volumeRecommendationOptions =
                    deserializer.deserializeList(VOLUMERECOMMENDATIONOPTIONS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeVolumeRecommendationOptionDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy