commonMain.aws.sdk.kotlin.services.computeoptimizer.serde.AutoScalingGroupRecommendationDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of computeoptimizer-jvm Show documentation
Show all versions of computeoptimizer-jvm Show documentation
The AWS SDK for Kotlin client for Compute Optimizer
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.computeoptimizer.serde
import aws.sdk.kotlin.services.computeoptimizer.model.AutoScalingGroupRecommendation
import aws.sdk.kotlin.services.computeoptimizer.model.AutoScalingGroupRecommendationOption
import aws.sdk.kotlin.services.computeoptimizer.model.CurrentPerformanceRisk
import aws.sdk.kotlin.services.computeoptimizer.model.Finding
import aws.sdk.kotlin.services.computeoptimizer.model.InferredWorkloadType
import aws.sdk.kotlin.services.computeoptimizer.model.UtilizationMetric
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 deserializeAutoScalingGroupRecommendationDocument(deserializer: Deserializer): AutoScalingGroupRecommendation {
val builder = AutoScalingGroupRecommendation.Builder()
val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("accountId"))
val AUTOSCALINGGROUPARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("autoScalingGroupArn"))
val AUTOSCALINGGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("autoScalingGroupName"))
val CURRENTCONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("currentConfiguration"))
val CURRENTINSTANCEGPUINFO_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("currentInstanceGpuInfo"))
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 INFERREDWORKLOADTYPES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("inferredWorkloadTypes"))
val LASTREFRESHTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("lastRefreshTimestamp"))
val LOOKBACKPERIODINDAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("lookBackPeriodInDays"))
val RECOMMENDATIONOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("recommendationOptions"))
val UTILIZATIONMETRICS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("utilizationMetrics"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ACCOUNTID_DESCRIPTOR)
field(AUTOSCALINGGROUPARN_DESCRIPTOR)
field(AUTOSCALINGGROUPNAME_DESCRIPTOR)
field(CURRENTCONFIGURATION_DESCRIPTOR)
field(CURRENTINSTANCEGPUINFO_DESCRIPTOR)
field(CURRENTPERFORMANCERISK_DESCRIPTOR)
field(EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR)
field(FINDING_DESCRIPTOR)
field(INFERREDWORKLOADTYPES_DESCRIPTOR)
field(LASTREFRESHTIMESTAMP_DESCRIPTOR)
field(LOOKBACKPERIODINDAYS_DESCRIPTOR)
field(RECOMMENDATIONOPTIONS_DESCRIPTOR)
field(UTILIZATIONMETRICS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ACCOUNTID_DESCRIPTOR.index -> builder.accountId = deserializeString()
AUTOSCALINGGROUPARN_DESCRIPTOR.index -> builder.autoScalingGroupArn = deserializeString()
AUTOSCALINGGROUPNAME_DESCRIPTOR.index -> builder.autoScalingGroupName = deserializeString()
CURRENTCONFIGURATION_DESCRIPTOR.index -> builder.currentConfiguration = deserializeAutoScalingGroupConfigurationDocument(deserializer)
CURRENTINSTANCEGPUINFO_DESCRIPTOR.index -> builder.currentInstanceGpuInfo = deserializeGpuInfoDocument(deserializer)
CURRENTPERFORMANCERISK_DESCRIPTOR.index -> builder.currentPerformanceRisk = deserializeString().let { CurrentPerformanceRisk.fromValue(it) }
EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR.index -> builder.effectiveRecommendationPreferences = deserializeEffectiveRecommendationPreferencesDocument(deserializer)
FINDING_DESCRIPTOR.index -> builder.finding = deserializeString().let { Finding.fromValue(it) }
INFERREDWORKLOADTYPES_DESCRIPTOR.index -> builder.inferredWorkloadTypes =
deserializer.deserializeList(INFERREDWORKLOADTYPES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString().let { InferredWorkloadType.fromValue(it) } } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
LASTREFRESHTIMESTAMP_DESCRIPTOR.index -> builder.lastRefreshTimestamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LOOKBACKPERIODINDAYS_DESCRIPTOR.index -> builder.lookBackPeriodInDays = deserializeDouble()
RECOMMENDATIONOPTIONS_DESCRIPTOR.index -> builder.recommendationOptions =
deserializer.deserializeList(RECOMMENDATIONOPTIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeAutoScalingGroupRecommendationOptionDocument(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()) { deserializeUtilizationMetricDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}