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

commonMain.aws.sdk.kotlin.services.redshift.serde.UsageLimitDocumentDeserializer.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.redshift.serde

import aws.sdk.kotlin.services.redshift.model.UsageLimit
import aws.sdk.kotlin.services.redshift.model.UsageLimitBreachAction
import aws.sdk.kotlin.services.redshift.model.UsageLimitFeatureType
import aws.sdk.kotlin.services.redshift.model.UsageLimitLimitType
import aws.sdk.kotlin.services.redshift.model.UsageLimitPeriod
import aws.smithy.kotlin.runtime.serde.getOrDeserializeErr
import aws.smithy.kotlin.runtime.serde.parse
import aws.smithy.kotlin.runtime.serde.parseLong
import aws.smithy.kotlin.runtime.serde.xml.XmlTagReader
import aws.smithy.kotlin.runtime.serde.xml.tryData

internal fun deserializeUsageLimitDocument(reader: XmlTagReader): UsageLimit {
    val builder = UsageLimit.Builder()

    loop@while (true) {
        val curr = reader.nextTag() ?: break@loop
        when (curr.tagName) {
            // UsageLimitId com.amazonaws.redshift#UsageLimit$UsageLimitId
            "UsageLimitId" -> builder.usageLimitId = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.redshift#String`)" }
            // ClusterIdentifier com.amazonaws.redshift#UsageLimit$ClusterIdentifier
            "ClusterIdentifier" -> builder.clusterIdentifier = curr.tryData()
                .getOrDeserializeErr { "expected (string: `com.amazonaws.redshift#String`)" }
            // FeatureType com.amazonaws.redshift#UsageLimit$FeatureType
            "FeatureType" -> builder.featureType = curr.tryData()
                .parse { UsageLimitFeatureType.fromValue(it) }
                .getOrDeserializeErr { "expected (enum: `com.amazonaws.redshift#UsageLimitFeatureType`)" }
            // LimitType com.amazonaws.redshift#UsageLimit$LimitType
            "LimitType" -> builder.limitType = curr.tryData()
                .parse { UsageLimitLimitType.fromValue(it) }
                .getOrDeserializeErr { "expected (enum: `com.amazonaws.redshift#UsageLimitLimitType`)" }
            // Amount com.amazonaws.redshift#UsageLimit$Amount
            "Amount" -> builder.amount = curr.tryData()
                .parseLong()
                .getOrDeserializeErr { "expected (long: `com.amazonaws.redshift#Long`)" }
            // Period com.amazonaws.redshift#UsageLimit$Period
            "Period" -> builder.period = curr.tryData()
                .parse { UsageLimitPeriod.fromValue(it) }
                .getOrDeserializeErr { "expected (enum: `com.amazonaws.redshift#UsageLimitPeriod`)" }
            // BreachAction com.amazonaws.redshift#UsageLimit$BreachAction
            "BreachAction" -> builder.breachAction = curr.tryData()
                .parse { UsageLimitBreachAction.fromValue(it) }
                .getOrDeserializeErr { "expected (enum: `com.amazonaws.redshift#UsageLimitBreachAction`)" }
            // Tags com.amazonaws.redshift#UsageLimit$Tags
            "Tags" -> builder.tags = deserializeTagListShape(curr)
            else -> {}
        }
        curr.drop()
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy