aws-sdk-bedrockagent 1.112.0

AWS SDK for Agents for Amazon Bedrock
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_vector_ingestion_configuration(
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    input: &crate::types::VectorIngestionConfiguration,
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    if let Some(var_1) = &input.chunking_configuration {
        #[allow(unused_mut)]
        let mut object_2 = object.key("chunkingConfiguration").start_object();
        crate::protocol_serde::shape_chunking_configuration::ser_chunking_configuration(&mut object_2, var_1)?;
        object_2.finish();
    }
    if let Some(var_3) = &input.custom_transformation_configuration {
        #[allow(unused_mut)]
        let mut object_4 = object.key("customTransformationConfiguration").start_object();
        crate::protocol_serde::shape_custom_transformation_configuration::ser_custom_transformation_configuration(&mut object_4, var_3)?;
        object_4.finish();
    }
    if let Some(var_5) = &input.parsing_configuration {
        #[allow(unused_mut)]
        let mut object_6 = object.key("parsingConfiguration").start_object();
        crate::protocol_serde::shape_parsing_configuration::ser_parsing_configuration(&mut object_6, var_5)?;
        object_6.finish();
    }
    if let Some(var_7) = &input.context_enrichment_configuration {
        #[allow(unused_mut)]
        let mut object_8 = object.key("contextEnrichmentConfiguration").start_object();
        crate::protocol_serde::shape_context_enrichment_configuration::ser_context_enrichment_configuration(&mut object_8, var_7)?;
        object_8.finish();
    }
    Ok(())
}

pub(crate) fn de_vector_ingestion_configuration<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
) -> ::std::result::Result<Option<crate::types::VectorIngestionConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
    match tokens.next().transpose()? {
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
            #[allow(unused_mut)]
            let mut builder = crate::types::builders::VectorIngestionConfigurationBuilder::default();
            loop {
                match tokens.next().transpose()? {
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
                        "chunkingConfiguration" => {
                            builder = builder
                                .set_chunking_configuration(crate::protocol_serde::shape_chunking_configuration::de_chunking_configuration(tokens)?);
                        }
                        "customTransformationConfiguration" => {
                            builder = builder.set_custom_transformation_configuration(
                                crate::protocol_serde::shape_custom_transformation_configuration::de_custom_transformation_configuration(tokens)?,
                            );
                        }
                        "parsingConfiguration" => {
                            builder = builder
                                .set_parsing_configuration(crate::protocol_serde::shape_parsing_configuration::de_parsing_configuration(tokens)?);
                        }
                        "contextEnrichmentConfiguration" => {
                            builder = builder.set_context_enrichment_configuration(
                                crate::protocol_serde::shape_context_enrichment_configuration::de_context_enrichment_configuration(tokens)?,
                            );
                        }
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
                    },
                    other => {
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
                            "expected object key or end object, found: {:?}",
                            other
                        )))
                    }
                }
            }
            Ok(Some(builder.build()))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}