commonMain.aws.sdk.kotlin.services.computeoptimizer.serde.LicenseRecommendationDocumentDeserializer.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.LicenseFinding
import aws.sdk.kotlin.services.computeoptimizer.model.LicenseFindingReasonCode
import aws.sdk.kotlin.services.computeoptimizer.model.LicenseRecommendation
import aws.sdk.kotlin.services.computeoptimizer.model.LicenseRecommendationOption
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 deserializeLicenseRecommendationDocument(deserializer: Deserializer): LicenseRecommendation {
val builder = LicenseRecommendation.Builder()
val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("accountId"))
val CURRENTLICENSECONFIGURATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("currentLicenseConfiguration"))
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 LICENSERECOMMENDATIONOPTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("licenseRecommendationOptions"))
val LOOKBACKPERIODINDAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("lookbackPeriodInDays"))
val RESOURCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("resourceArn"))
val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("tags"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ACCOUNTID_DESCRIPTOR)
field(CURRENTLICENSECONFIGURATION_DESCRIPTOR)
field(FINDING_DESCRIPTOR)
field(FINDINGREASONCODES_DESCRIPTOR)
field(LASTREFRESHTIMESTAMP_DESCRIPTOR)
field(LICENSERECOMMENDATIONOPTIONS_DESCRIPTOR)
field(LOOKBACKPERIODINDAYS_DESCRIPTOR)
field(RESOURCEARN_DESCRIPTOR)
field(TAGS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ACCOUNTID_DESCRIPTOR.index -> builder.accountId = deserializeString()
CURRENTLICENSECONFIGURATION_DESCRIPTOR.index -> builder.currentLicenseConfiguration = deserializeLicenseConfigurationDocument(deserializer)
FINDING_DESCRIPTOR.index -> builder.finding = deserializeString().let { LicenseFinding.fromValue(it) }
FINDINGREASONCODES_DESCRIPTOR.index -> builder.findingReasonCodes =
deserializer.deserializeList(FINDINGREASONCODES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString().let { LicenseFindingReasonCode.fromValue(it) } } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
LASTREFRESHTIMESTAMP_DESCRIPTOR.index -> builder.lastRefreshTimestamp = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
LICENSERECOMMENDATIONOPTIONS_DESCRIPTOR.index -> builder.licenseRecommendationOptions =
deserializer.deserializeList(LICENSERECOMMENDATIONOPTIONS_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeLicenseRecommendationOptionDocument(deserializer) } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
LOOKBACKPERIODINDAYS_DESCRIPTOR.index -> builder.lookbackPeriodInDays = deserializeDouble()
RESOURCEARN_DESCRIPTOR.index -> builder.resourceArn = deserializeString()
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
}
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}