commonMain.aws.sdk.kotlin.services.translate.serde.TerminologyPropertiesDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of translate-jvm Show documentation
Show all versions of translate-jvm Show documentation
The AWS SDK for Kotlin client for Translate
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.translate.serde
import aws.sdk.kotlin.services.translate.model.Directionality
import aws.sdk.kotlin.services.translate.model.TerminologyDataFormat
import aws.sdk.kotlin.services.translate.model.TerminologyProperties
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 deserializeTerminologyPropertiesDocument(deserializer: Deserializer): TerminologyProperties {
val builder = TerminologyProperties.Builder()
val ARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Arn"))
val CREATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreatedAt"))
val DESCRIPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Description"))
val DIRECTIONALITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Directionality"))
val ENCRYPTIONKEY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("EncryptionKey"))
val FORMAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Format"))
val LASTUPDATEDAT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastUpdatedAt"))
val MESSAGE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Message"))
val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Name"))
val SIZEBYTES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("SizeBytes"))
val SKIPPEDTERMCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("SkippedTermCount"))
val SOURCELANGUAGECODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("SourceLanguageCode"))
val TARGETLANGUAGECODES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("TargetLanguageCodes"))
val TERMCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("TermCount"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(ARN_DESCRIPTOR)
field(CREATEDAT_DESCRIPTOR)
field(DESCRIPTION_DESCRIPTOR)
field(DIRECTIONALITY_DESCRIPTOR)
field(ENCRYPTIONKEY_DESCRIPTOR)
field(FORMAT_DESCRIPTOR)
field(LASTUPDATEDAT_DESCRIPTOR)
field(MESSAGE_DESCRIPTOR)
field(NAME_DESCRIPTOR)
field(SIZEBYTES_DESCRIPTOR)
field(SKIPPEDTERMCOUNT_DESCRIPTOR)
field(SOURCELANGUAGECODE_DESCRIPTOR)
field(TARGETLANGUAGECODES_DESCRIPTOR)
field(TERMCOUNT_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
ARN_DESCRIPTOR.index -> builder.arn = deserializeString()
CREATEDAT_DESCRIPTOR.index -> builder.createdAt = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
DESCRIPTION_DESCRIPTOR.index -> builder.description = deserializeString()
DIRECTIONALITY_DESCRIPTOR.index -> builder.directionality = deserializeString().let { Directionality.fromValue(it) }
ENCRYPTIONKEY_DESCRIPTOR.index -> builder.encryptionKey = deserializeEncryptionKeyDocument(deserializer)
FORMAT_DESCRIPTOR.index -> builder.format = deserializeString().let { TerminologyDataFormat.fromValue(it) }
LASTUPDATEDAT_DESCRIPTOR.index -> builder.lastUpdatedAt = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
MESSAGE_DESCRIPTOR.index -> builder.message = deserializeString()
NAME_DESCRIPTOR.index -> builder.name = deserializeString()
SIZEBYTES_DESCRIPTOR.index -> builder.sizeBytes = deserializeInt()
SKIPPEDTERMCOUNT_DESCRIPTOR.index -> builder.skippedTermCount = deserializeInt()
SOURCELANGUAGECODE_DESCRIPTOR.index -> builder.sourceLanguageCode = deserializeString()
TARGETLANGUAGECODES_DESCRIPTOR.index -> builder.targetLanguageCodes =
deserializer.deserializeList(TARGETLANGUAGECODES_DESCRIPTOR) {
val col0 = mutableListOf()
while (hasNextElement()) {
val el0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
col0.add(el0)
}
col0
}
TERMCOUNT_DESCRIPTOR.index -> builder.termCount = deserializeInt()
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}