commonMain.aws.sdk.kotlin.services.redshiftserverless.serde.UsageLimitDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of redshiftserverless-jvm Show documentation
Show all versions of redshiftserverless-jvm Show documentation
The AWS SDK for Kotlin client for Redshift Serverless
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.redshiftserverless.serde
import aws.sdk.kotlin.services.redshiftserverless.model.UsageLimit
import aws.sdk.kotlin.services.redshiftserverless.model.UsageLimitBreachAction
import aws.sdk.kotlin.services.redshiftserverless.model.UsageLimitPeriod
import aws.sdk.kotlin.services.redshiftserverless.model.UsageLimitUsageType
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
internal fun deserializeUsageLimitDocument(deserializer: Deserializer): UsageLimit {
val builder = UsageLimit.Builder()
val AMOUNT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("amount"))
val BREACHACTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("breachAction"))
val PERIOD_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("period"))
val RESOURCEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("resourceArn"))
val USAGELIMITARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("usageLimitArn"))
val USAGELIMITID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("usageLimitId"))
val USAGETYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("usageType"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(AMOUNT_DESCRIPTOR)
field(BREACHACTION_DESCRIPTOR)
field(PERIOD_DESCRIPTOR)
field(RESOURCEARN_DESCRIPTOR)
field(USAGELIMITARN_DESCRIPTOR)
field(USAGELIMITID_DESCRIPTOR)
field(USAGETYPE_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
AMOUNT_DESCRIPTOR.index -> builder.amount = deserializeLong()
BREACHACTION_DESCRIPTOR.index -> builder.breachAction = deserializeString().let { UsageLimitBreachAction.fromValue(it) }
PERIOD_DESCRIPTOR.index -> builder.period = deserializeString().let { UsageLimitPeriod.fromValue(it) }
RESOURCEARN_DESCRIPTOR.index -> builder.resourceArn = deserializeString()
USAGELIMITARN_DESCRIPTOR.index -> builder.usageLimitArn = deserializeString()
USAGELIMITID_DESCRIPTOR.index -> builder.usageLimitId = deserializeString()
USAGETYPE_DESCRIPTOR.index -> builder.usageType = deserializeString().let { UsageLimitUsageType.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}