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

commonMain.aws.sdk.kotlin.services.bedrockruntime.serde.GuardrailUsageDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.bedrockruntime.serde

import aws.sdk.kotlin.services.bedrockruntime.model.GuardrailUsage
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 deserializeGuardrailUsageDocument(deserializer: Deserializer): GuardrailUsage {
    val builder = GuardrailUsage.Builder()
    val CONTENTPOLICYUNITS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("contentPolicyUnits"))
    val CONTEXTUALGROUNDINGPOLICYUNITS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("contextualGroundingPolicyUnits"))
    val SENSITIVEINFORMATIONPOLICYFREEUNITS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("sensitiveInformationPolicyFreeUnits"))
    val SENSITIVEINFORMATIONPOLICYUNITS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("sensitiveInformationPolicyUnits"))
    val TOPICPOLICYUNITS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("topicPolicyUnits"))
    val WORDPOLICYUNITS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("wordPolicyUnits"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CONTENTPOLICYUNITS_DESCRIPTOR)
        field(CONTEXTUALGROUNDINGPOLICYUNITS_DESCRIPTOR)
        field(SENSITIVEINFORMATIONPOLICYFREEUNITS_DESCRIPTOR)
        field(SENSITIVEINFORMATIONPOLICYUNITS_DESCRIPTOR)
        field(TOPICPOLICYUNITS_DESCRIPTOR)
        field(WORDPOLICYUNITS_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CONTENTPOLICYUNITS_DESCRIPTOR.index -> builder.contentPolicyUnits = deserializeInt()
                CONTEXTUALGROUNDINGPOLICYUNITS_DESCRIPTOR.index -> builder.contextualGroundingPolicyUnits = deserializeInt()
                SENSITIVEINFORMATIONPOLICYFREEUNITS_DESCRIPTOR.index -> builder.sensitiveInformationPolicyFreeUnits = deserializeInt()
                SENSITIVEINFORMATIONPOLICYUNITS_DESCRIPTOR.index -> builder.sensitiveInformationPolicyUnits = deserializeInt()
                TOPICPOLICYUNITS_DESCRIPTOR.index -> builder.topicPolicyUnits = deserializeInt()
                WORDPOLICYUNITS_DESCRIPTOR.index -> builder.wordPolicyUnits = deserializeInt()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy