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

commonMain.aws.sdk.kotlin.services.bedrockruntime.serde.GuardrailAssessmentDocumentDeserializer.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.GuardrailAssessment
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 deserializeGuardrailAssessmentDocument(deserializer: Deserializer): GuardrailAssessment {
    val builder = GuardrailAssessment.Builder()
    val CONTENTPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("contentPolicy"))
    val CONTEXTUALGROUNDINGPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("contextualGroundingPolicy"))
    val INVOCATIONMETRICS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("invocationMetrics"))
    val SENSITIVEINFORMATIONPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("sensitiveInformationPolicy"))
    val TOPICPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("topicPolicy"))
    val WORDPOLICY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("wordPolicy"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CONTENTPOLICY_DESCRIPTOR)
        field(CONTEXTUALGROUNDINGPOLICY_DESCRIPTOR)
        field(INVOCATIONMETRICS_DESCRIPTOR)
        field(SENSITIVEINFORMATIONPOLICY_DESCRIPTOR)
        field(TOPICPOLICY_DESCRIPTOR)
        field(WORDPOLICY_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CONTENTPOLICY_DESCRIPTOR.index -> builder.contentPolicy = deserializeGuardrailContentPolicyAssessmentDocument(deserializer)
                CONTEXTUALGROUNDINGPOLICY_DESCRIPTOR.index -> builder.contextualGroundingPolicy = deserializeGuardrailContextualGroundingPolicyAssessmentDocument(deserializer)
                INVOCATIONMETRICS_DESCRIPTOR.index -> builder.invocationMetrics = deserializeGuardrailInvocationMetricsDocument(deserializer)
                SENSITIVEINFORMATIONPOLICY_DESCRIPTOR.index -> builder.sensitiveInformationPolicy = deserializeGuardrailSensitiveInformationPolicyAssessmentDocument(deserializer)
                TOPICPOLICY_DESCRIPTOR.index -> builder.topicPolicy = deserializeGuardrailTopicPolicyAssessmentDocument(deserializer)
                WORDPOLICY_DESCRIPTOR.index -> builder.wordPolicy = deserializeGuardrailWordPolicyAssessmentDocument(deserializer)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy