commonMain.aws.sdk.kotlin.services.personalize.serde.AlgorithmDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of personalize-jvm Show documentation
Show all versions of personalize-jvm Show documentation
The AWS SDK for Kotlin client for Personalize
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.personalize.serde
import aws.sdk.kotlin.services.personalize.model.Algorithm
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.mutableMapOf
internal fun deserializeAlgorithmDocument(deserializer: Deserializer): Algorithm {
val builder = Algorithm.Builder()
val ALGORITHMARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("algorithmArn"))
val ALGORITHMIMAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("algorithmImage"))
val CREATIONDATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("creationDateTime"))
val DEFAULTHYPERPARAMETERRANGES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("defaultHyperParameterRanges"))
val DEFAULTHYPERPARAMETERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("defaultHyperParameters"))
val DEFAULTRESOURCECONFIG_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("defaultResourceConfig"))
val LASTUPDATEDDATETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("lastUpdatedDateTime"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
val ROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("roleArn"))
val TRAININGINPUTMODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("trainingInputMode"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ALGORITHMARN_DESCRIPTOR)
field(ALGORITHMIMAGE_DESCRIPTOR)
field(CREATIONDATETIME_DESCRIPTOR)
field(DEFAULTHYPERPARAMETERRANGES_DESCRIPTOR)
field(DEFAULTHYPERPARAMETERS_DESCRIPTOR)
field(DEFAULTRESOURCECONFIG_DESCRIPTOR)
field(LASTUPDATEDDATETIME_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(ROLEARN_DESCRIPTOR)
field(TRAININGINPUTMODE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ALGORITHMARN_DESCRIPTOR.index -> builder.algorithmArn = deserializeString()
ALGORITHMIMAGE_DESCRIPTOR.index -> builder.algorithmImage = deserializeAlgorithmImageDocument(deserializer)
CREATIONDATETIME_DESCRIPTOR.index -> builder.creationDateTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DEFAULTHYPERPARAMETERRANGES_DESCRIPTOR.index -> builder.defaultHyperParameterRanges = deserializeDefaultHyperParameterRangesDocument(deserializer)
DEFAULTHYPERPARAMETERS_DESCRIPTOR.index -> builder.defaultHyperParameters =
deserializer.deserializeMap(DEFAULTHYPERPARAMETERS_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = key()
val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
DEFAULTRESOURCECONFIG_DESCRIPTOR.index -> builder.defaultResourceConfig =
deserializer.deserializeMap(DEFAULTRESOURCECONFIG_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = key()
val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
LASTUPDATEDDATETIME_DESCRIPTOR.index -> builder.lastUpdatedDateTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
ROLEARN_DESCRIPTOR.index -> builder.roleArn = deserializeString()
TRAININGINPUTMODE_DESCRIPTOR.index -> builder.trainingInputMode = deserializeString()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}