commonMain.aws.sdk.kotlin.services.computeoptimizer.serde.LambdaFunctionRecommendationDocumentDeserializer.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.LambdaFunctionMemoryRecommendationOption
import aws.sdk.kotlin.services.computeoptimizer.model.LambdaFunctionRecommendation
import aws.sdk.kotlin.services.computeoptimizer.model.LambdaFunctionRecommendationFinding
import aws.sdk.kotlin.services.computeoptimizer.model.LambdaFunctionRecommendationFindingReasonCode
import aws.sdk.kotlin.services.computeoptimizer.model.LambdaFunctionUtilizationMetric
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 deserializeLambdaFunctionRecommendationDocument(deserializer: Deserializer): LambdaFunctionRecommendation {
val builder = LambdaFunctionRecommendation.Builder()
val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("accountId"))
val CURRENTMEMORYSIZE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("currentMemorySize"))
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 FINDINGREASONCODES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("findingReasonCodes"))
val FUNCTIONARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("functionArn"))
val FUNCTIONVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("functionVersion"))
val LASTREFRESHTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("lastRefreshTimestamp"))
val LOOKBACKPERIODINDAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("lookbackPeriodInDays"))
val MEMORYSIZERECOMMENDATIONOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("memorySizeRecommendationOptions"))
val NUMBEROFINVOCATIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("numberOfInvocations"))
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(CURRENTMEMORYSIZE_DESCRIPTOR)
field(CURRENTPERFORMANCERISK_DESCRIPTOR)
field(EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR)
field(FINDING_DESCRIPTOR)
field(FINDINGREASONCODES_DESCRIPTOR)
field(FUNCTIONARN_DESCRIPTOR)
field(FUNCTIONVERSION_DESCRIPTOR)
field(LASTREFRESHTIMESTAMP_DESCRIPTOR)
field(LOOKBACKPERIODINDAYS_DESCRIPTOR)
field(MEMORYSIZERECOMMENDATIONOPTIONS_DESCRIPTOR)
field(NUMBEROFINVOCATIONS_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(UTILIZATIONMETRICS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ACCOUNTID_DESCRIPTOR.index -> builder.accountId = deserializeString()
CURRENTMEMORYSIZE_DESCRIPTOR.index -> builder.currentMemorySize = deserializeInt()
CURRENTPERFORMANCERISK_DESCRIPTOR.index -> builder.currentPerformanceRisk = deserializeString().let { CurrentPerformanceRisk.fromValue(it) }
EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR.index -> builder.effectiveRecommendationPreferences = deserializeLambdaEffectiveRecommendationPreferencesDocument(deserializer)
FINDING_DESCRIPTOR.index -> builder.finding = deserializeString().let { LambdaFunctionRecommendationFinding.fromValue(it) }
FINDINGREASONCODES_DESCRIPTOR.index -> builder.findingReasonCodes =
deserializer.deserializeList(FINDINGREASONCODES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString().let { LambdaFunctionRecommendationFindingReasonCode.fromValue(it) } } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
FUNCTIONARN_DESCRIPTOR.index -> builder.functionArn = deserializeString()
FUNCTIONVERSION_DESCRIPTOR.index -> builder.functionVersion = deserializeString()
LASTREFRESHTIMESTAMP_DESCRIPTOR.index -> builder.lastRefreshTimestamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LOOKBACKPERIODINDAYS_DESCRIPTOR.index -> builder.lookbackPeriodInDays = deserializeDouble()
MEMORYSIZERECOMMENDATIONOPTIONS_DESCRIPTOR.index -> builder.memorySizeRecommendationOptions =
deserializer.deserializeList(MEMORYSIZERECOMMENDATIONOPTIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeLambdaFunctionMemoryRecommendationOptionDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
NUMBEROFINVOCATIONS_DESCRIPTOR.index -> builder.numberOfInvocations = deserializeLong()
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()) { deserializeLambdaFunctionUtilizationMetricDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}