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

commonMain.aws.sdk.kotlin.services.applicationinsights.serde.ProblemDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.applicationinsights.serde

import aws.sdk.kotlin.services.applicationinsights.model.FeedbackKey
import aws.sdk.kotlin.services.applicationinsights.model.FeedbackValue
import aws.sdk.kotlin.services.applicationinsights.model.Problem
import aws.sdk.kotlin.services.applicationinsights.model.ResolutionMethod
import aws.sdk.kotlin.services.applicationinsights.model.SeverityLevel
import aws.sdk.kotlin.services.applicationinsights.model.Status
import aws.sdk.kotlin.services.applicationinsights.model.Visibility
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 deserializeProblemDocument(deserializer: Deserializer): Problem {
    val builder = Problem.Builder()
    val ACCOUNTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AccountId"))
    val AFFECTEDRESOURCE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AffectedResource"))
    val ENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("EndTime"))
    val FEEDBACK_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("Feedback"))
    val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Id"))
    val INSIGHTS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Insights"))
    val LASTRECURRENCETIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("LastRecurrenceTime"))
    val RECURRINGCOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("RecurringCount"))
    val RESOLUTIONMETHOD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ResolutionMethod"))
    val RESOURCEGROUPNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResourceGroupName"))
    val SEVERITYLEVEL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("SeverityLevel"))
    val STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("StartTime"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
    val TITLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Title"))
    val VISIBILITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Visibility"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ACCOUNTID_DESCRIPTOR)
        field(AFFECTEDRESOURCE_DESCRIPTOR)
        field(ENDTIME_DESCRIPTOR)
        field(FEEDBACK_DESCRIPTOR)
        field(ID_DESCRIPTOR)
        field(INSIGHTS_DESCRIPTOR)
        field(LASTRECURRENCETIME_DESCRIPTOR)
        field(RECURRINGCOUNT_DESCRIPTOR)
        field(RESOLUTIONMETHOD_DESCRIPTOR)
        field(RESOURCEGROUPNAME_DESCRIPTOR)
        field(SEVERITYLEVEL_DESCRIPTOR)
        field(STARTTIME_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(TITLE_DESCRIPTOR)
        field(VISIBILITY_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ACCOUNTID_DESCRIPTOR.index -> builder.accountId = deserializeString()
                AFFECTEDRESOURCE_DESCRIPTOR.index -> builder.affectedResource = deserializeString()
                ENDTIME_DESCRIPTOR.index -> builder.endTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                FEEDBACK_DESCRIPTOR.index -> builder.feedback =
                    deserializer.deserializeMap(FEEDBACK_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = FeedbackKey.fromValue(key())
                            val v0 = if (nextHasValue()) { deserializeString().let { FeedbackValue.fromValue(it) } } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                ID_DESCRIPTOR.index -> builder.id = deserializeString()
                INSIGHTS_DESCRIPTOR.index -> builder.insights = deserializeString()
                LASTRECURRENCETIME_DESCRIPTOR.index -> builder.lastRecurrenceTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                RECURRINGCOUNT_DESCRIPTOR.index -> builder.recurringCount = deserializeLong()
                RESOLUTIONMETHOD_DESCRIPTOR.index -> builder.resolutionMethod = deserializeString().let { ResolutionMethod.fromValue(it) }
                RESOURCEGROUPNAME_DESCRIPTOR.index -> builder.resourceGroupName = deserializeString()
                SEVERITYLEVEL_DESCRIPTOR.index -> builder.severityLevel = deserializeString().let { SeverityLevel.fromValue(it) }
                STARTTIME_DESCRIPTOR.index -> builder.startTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { Status.fromValue(it) }
                TITLE_DESCRIPTOR.index -> builder.title = deserializeString()
                VISIBILITY_DESCRIPTOR.index -> builder.visibility = deserializeString().let { Visibility.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy