commonMain.aws.sdk.kotlin.services.computeoptimizer.serde.RdsdbRecommendationDocumentDeserializer.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.Idle
import aws.sdk.kotlin.services.computeoptimizer.model.RdsInstanceFinding
import aws.sdk.kotlin.services.computeoptimizer.model.RdsInstanceFindingReasonCode
import aws.sdk.kotlin.services.computeoptimizer.model.RdsStorageFinding
import aws.sdk.kotlin.services.computeoptimizer.model.RdsStorageFindingReasonCode
import aws.sdk.kotlin.services.computeoptimizer.model.RdsdbInstanceRecommendationOption
import aws.sdk.kotlin.services.computeoptimizer.model.RdsdbRecommendation
import aws.sdk.kotlin.services.computeoptimizer.model.RdsdbStorageRecommendationOption
import aws.sdk.kotlin.services.computeoptimizer.model.RdsdbUtilizationMetric
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 deserializeRdsdbRecommendationDocument(deserializer: Deserializer): RdsdbRecommendation {
val builder = RdsdbRecommendation.Builder()
val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("accountId"))
val CURRENTDBINSTANCECLASS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("currentDBInstanceClass"))
val CURRENTSTORAGECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("currentStorageConfiguration"))
val EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("effectiveRecommendationPreferences"))
val ENGINE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("engine"))
val ENGINEVERSION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("engineVersion"))
val IDLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("idle"))
val INSTANCEFINDING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("instanceFinding"))
val INSTANCEFINDINGREASONCODES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("instanceFindingReasonCodes"))
val INSTANCERECOMMENDATIONOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("instanceRecommendationOptions"))
val LASTREFRESHTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("lastRefreshTimestamp"))
val LOOKBACKPERIODINDAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("lookbackPeriodInDays"))
val RESOURCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("resourceArn"))
val STORAGEFINDING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("storageFinding"))
val STORAGEFINDINGREASONCODES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("storageFindingReasonCodes"))
val STORAGERECOMMENDATIONOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("storageRecommendationOptions"))
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(CURRENTDBINSTANCECLASS_DESCRIPTOR)
field(CURRENTSTORAGECONFIGURATION_DESCRIPTOR)
field(EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR)
field(ENGINE_DESCRIPTOR)
field(ENGINEVERSION_DESCRIPTOR)
field(IDLE_DESCRIPTOR)
field(INSTANCEFINDING_DESCRIPTOR)
field(INSTANCEFINDINGREASONCODES_DESCRIPTOR)
field(INSTANCERECOMMENDATIONOPTIONS_DESCRIPTOR)
field(LASTREFRESHTIMESTAMP_DESCRIPTOR)
field(LOOKBACKPERIODINDAYS_DESCRIPTOR)
field(RESOURCEARN_DESCRIPTOR)
field(STORAGEFINDING_DESCRIPTOR)
field(STORAGEFINDINGREASONCODES_DESCRIPTOR)
field(STORAGERECOMMENDATIONOPTIONS_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
field(UTILIZATIONMETRICS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ACCOUNTID_DESCRIPTOR.index -> builder.accountId = deserializeString()
CURRENTDBINSTANCECLASS_DESCRIPTOR.index -> builder.currentDbInstanceClass = deserializeString()
CURRENTSTORAGECONFIGURATION_DESCRIPTOR.index -> builder.currentStorageConfiguration = deserializeDbStorageConfigurationDocument(deserializer)
EFFECTIVERECOMMENDATIONPREFERENCES_DESCRIPTOR.index -> builder.effectiveRecommendationPreferences = deserializeRdsEffectiveRecommendationPreferencesDocument(deserializer)
ENGINE_DESCRIPTOR.index -> builder.engine = deserializeString()
ENGINEVERSION_DESCRIPTOR.index -> builder.engineVersion = deserializeString()
IDLE_DESCRIPTOR.index -> builder.idle = deserializeString().let { Idle.fromValue(it) }
INSTANCEFINDING_DESCRIPTOR.index -> builder.instanceFinding = deserializeString().let { RdsInstanceFinding.fromValue(it) }
INSTANCEFINDINGREASONCODES_DESCRIPTOR.index -> builder.instanceFindingReasonCodes =
deserializer.deserializeList(INSTANCEFINDINGREASONCODES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString().let { RdsInstanceFindingReasonCode.fromValue(it) } } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
INSTANCERECOMMENDATIONOPTIONS_DESCRIPTOR.index -> builder.instanceRecommendationOptions =
deserializer.deserializeList(INSTANCERECOMMENDATIONOPTIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeRdsdbInstanceRecommendationOptionDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
LASTREFRESHTIMESTAMP_DESCRIPTOR.index -> builder.lastRefreshTimestamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LOOKBACKPERIODINDAYS_DESCRIPTOR.index -> builder.lookbackPeriodInDays = deserializeDouble()
RESOURCEARN_DESCRIPTOR.index -> builder.resourceArn = deserializeString()
STORAGEFINDING_DESCRIPTOR.index -> builder.storageFinding = deserializeString().let { RdsStorageFinding.fromValue(it) }
STORAGEFINDINGREASONCODES_DESCRIPTOR.index -> builder.storageFindingReasonCodes =
deserializer.deserializeList(STORAGEFINDINGREASONCODES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString().let { RdsStorageFindingReasonCode.fromValue(it) } } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
STORAGERECOMMENDATIONOPTIONS_DESCRIPTOR.index -> builder.storageRecommendationOptions =
deserializer.deserializeList(STORAGERECOMMENDATIONOPTIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeRdsdbStorageRecommendationOptionDocument(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()) { deserializeRdsdbUtilizationMetricDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}