All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.datazone.serde.SubscribedAssetDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.76
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.datazone.serde

import aws.sdk.kotlin.services.datazone.model.SubscribedAsset
import aws.sdk.kotlin.services.datazone.model.SubscriptionGrantStatus
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

internal fun deserializeSubscribedAssetDocument(deserializer: Deserializer): SubscribedAsset {
    val builder = SubscribedAsset.Builder()
    val ASSETID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("assetId"))
    val ASSETREVISION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("assetRevision"))
    val FAILURECAUSE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("failureCause"))
    val FAILURETIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("failureTimestamp"))
    val GRANTEDTIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("grantedTimestamp"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("status"))
    val TARGETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("targetName"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ASSETID_DESCRIPTOR)
        field(ASSETREVISION_DESCRIPTOR)
        field(FAILURECAUSE_DESCRIPTOR)
        field(FAILURETIMESTAMP_DESCRIPTOR)
        field(GRANTEDTIMESTAMP_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(TARGETNAME_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ASSETID_DESCRIPTOR.index -> builder.assetId = deserializeString()
                ASSETREVISION_DESCRIPTOR.index -> builder.assetRevision = deserializeString()
                FAILURECAUSE_DESCRIPTOR.index -> builder.failureCause = deserializeFailureCauseDocument(deserializer)
                FAILURETIMESTAMP_DESCRIPTOR.index -> builder.failureTimestamp = deserializeString().let { Instant.fromEpochSeconds(it) }
                GRANTEDTIMESTAMP_DESCRIPTOR.index -> builder.grantedTimestamp = deserializeString().let { Instant.fromEpochSeconds(it) }
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { SubscriptionGrantStatus.fromValue(it) }
                TARGETNAME_DESCRIPTOR.index -> builder.targetName = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy