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

commonMain.aws.sdk.kotlin.services.budgets.serde.ActionDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.budgets.serde

import aws.sdk.kotlin.services.budgets.model.Action
import aws.sdk.kotlin.services.budgets.model.ActionStatus
import aws.sdk.kotlin.services.budgets.model.ActionType
import aws.sdk.kotlin.services.budgets.model.ApprovalModel
import aws.sdk.kotlin.services.budgets.model.NotificationType
import aws.sdk.kotlin.services.budgets.model.Subscriber
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 kotlin.collections.mutableListOf

internal fun deserializeActionDocument(deserializer: Deserializer): Action {
    val builder = Action.Builder()
    val ACTIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ActionId"))
    val ACTIONTHRESHOLD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("ActionThreshold"))
    val ACTIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ActionType"))
    val APPROVALMODEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ApprovalModel"))
    val BUDGETNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("BudgetName"))
    val DEFINITION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("Definition"))
    val EXECUTIONROLEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ExecutionRoleArn"))
    val NOTIFICATIONTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("NotificationType"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
    val SUBSCRIBERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Subscribers"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACTIONID_DESCRIPTOR)
        field(ACTIONTHRESHOLD_DESCRIPTOR)
        field(ACTIONTYPE_DESCRIPTOR)
        field(APPROVALMODEL_DESCRIPTOR)
        field(BUDGETNAME_DESCRIPTOR)
        field(DEFINITION_DESCRIPTOR)
        field(EXECUTIONROLEARN_DESCRIPTOR)
        field(NOTIFICATIONTYPE_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(SUBSCRIBERS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACTIONID_DESCRIPTOR.index -> builder.actionId = deserializeString()
                ACTIONTHRESHOLD_DESCRIPTOR.index -> builder.actionThreshold = deserializeActionThresholdDocument(deserializer)
                ACTIONTYPE_DESCRIPTOR.index -> builder.actionType = deserializeString().let { ActionType.fromValue(it) }
                APPROVALMODEL_DESCRIPTOR.index -> builder.approvalModel = deserializeString().let { ApprovalModel.fromValue(it) }
                BUDGETNAME_DESCRIPTOR.index -> builder.budgetName = deserializeString()
                DEFINITION_DESCRIPTOR.index -> builder.definition = deserializeDefinitionDocument(deserializer)
                EXECUTIONROLEARN_DESCRIPTOR.index -> builder.executionRoleArn = deserializeString()
                NOTIFICATIONTYPE_DESCRIPTOR.index -> builder.notificationType = deserializeString().let { NotificationType.fromValue(it) }
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { ActionStatus.fromValue(it) }
                SUBSCRIBERS_DESCRIPTOR.index -> builder.subscribers =
                    deserializer.deserializeList(SUBSCRIBERS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeSubscriberDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy