commonMain.aws.sdk.kotlin.services.computeoptimizer.serde.EcsServiceRecommendationDocumentDeserializer.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.CurrentPerformanceRisk
import aws.sdk.kotlin.services.computeoptimizer.model.EcsServiceLaunchType
import aws.sdk.kotlin.services.computeoptimizer.model.EcsServiceRecommendation
import aws.sdk.kotlin.services.computeoptimizer.model.EcsServiceRecommendationFinding
import aws.sdk.kotlin.services.computeoptimizer.model.EcsServiceRecommendationFindingReasonCode
import aws.sdk.kotlin.services.computeoptimizer.model.EcsServiceRecommendationOption
import aws.sdk.kotlin.services.computeoptimizer.model.EcsServiceUtilizationMetric
import aws.sdk.kotlin.services.computeoptimizer.model.Tag
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 deserializeEcsServiceRecommendationDocument(deserializer: Deserializer): EcsServiceRecommendation {
val builder = EcsServiceRecommendation.Builder()
val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("accountId"))
val CURRENTPERFORMANCERISK_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("currentPerformanceRisk"))
val CURRENTSERVICECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("currentServiceConfiguration"))
val EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("effectiveRecommendationPreferences"))
val FINDING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("finding"))
val FINDINGREASONCODES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("findingReasonCodes"))
val LASTREFRESHTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("lastRefreshTimestamp"))
val LAUNCHTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("launchType"))
val LOOKBACKPERIODINDAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("lookbackPeriodInDays"))
val SERVICEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("serviceArn"))
val SERVICERECOMMENDATIONOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("serviceRecommendationOptions"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("tags"))
val UTILIZATIONMETRICS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("utilizationMetrics"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ACCOUNTID_DESCRIPTOR)
field(CURRENTPERFORMANCERISK_DESCRIPTOR)
field(CURRENTSERVICECONFIGURATION_DESCRIPTOR)
field(EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR)
field(FINDING_DESCRIPTOR)
field(FINDINGREASONCODES_DESCRIPTOR)
field(LASTREFRESHTIMESTAMP_DESCRIPTOR)
field(LAUNCHTYPE_DESCRIPTOR)
field(LOOKBACKPERIODINDAYS_DESCRIPTOR)
field(SERVICEARN_DESCRIPTOR)
field(SERVICERECOMMENDATIONOPTIONS_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(UTILIZATIONMETRICS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ACCOUNTID_DESCRIPTOR.index -> builder.accountId = deserializeString()
CURRENTPERFORMANCERISK_DESCRIPTOR.index -> builder.currentPerformanceRisk = deserializeString().let { CurrentPerformanceRisk.fromValue(it) }
CURRENTSERVICECONFIGURATION_DESCRIPTOR.index -> builder.currentServiceConfiguration = deserializeServiceConfigurationDocument(deserializer)
EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR.index -> builder.effectiveRecommendationPreferences = deserializeEcsEffectiveRecommendationPreferencesDocument(deserializer)
FINDING_DESCRIPTOR.index -> builder.finding = deserializeString().let { EcsServiceRecommendationFinding.fromValue(it) }
FINDINGREASONCODES_DESCRIPTOR.index -> builder.findingReasonCodes =
deserializer.deserializeList(FINDINGREASONCODES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString().let { EcsServiceRecommendationFindingReasonCode.fromValue(it) } } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
LASTREFRESHTIMESTAMP_DESCRIPTOR.index -> builder.lastRefreshTimestamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LAUNCHTYPE_DESCRIPTOR.index -> builder.launchType = deserializeString().let { EcsServiceLaunchType.fromValue(it) }
LOOKBACKPERIODINDAYS_DESCRIPTOR.index -> builder.lookbackPeriodInDays = deserializeDouble()
SERVICEARN_DESCRIPTOR.index -> builder.serviceArn = deserializeString()
SERVICERECOMMENDATIONOPTIONS_DESCRIPTOR.index -> builder.serviceRecommendationOptions =
deserializer.deserializeList(SERVICERECOMMENDATIONOPTIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeEcsServiceRecommendationOptionDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
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()) { deserializeEcsServiceUtilizationMetricDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}