AWS SDK

AWS SDK

rev. 32b1b3c3761061baed26023be3219639e42d7d12

Files changed:

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_async_invoke_s3_output_data_config.rs

@@ -1,0 +74,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_async_invoke_s3_output_data_config<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::AsyncInvokeS3OutputDataConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   12         -
            #[allow(unused_mut)]
   13         -
            let mut builder = crate::types::builders::AsyncInvokeS3OutputDataConfigBuilder::default();
   14         -
            loop {
   15         -
                match tokens.next().transpose()? {
   16         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   17         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   18         -
                        "s3Uri" => {
   19         -
                            builder = builder.set_s3_uri(
   20         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   21         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   22         -
                                    .transpose()?,
   23         -
                            );
   24         -
                        }
   25         -
                        "kmsKeyId" => {
   26         -
                            builder = builder.set_kms_key_id(
   27         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   28         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   29         -
                                    .transpose()?,
   30         -
                            );
   31         -
                        }
   32         -
                        "bucketOwner" => {
   33         -
                            builder = builder.set_bucket_owner(
   34         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   35         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   36         -
                                    .transpose()?,
   37         -
                            );
   38         -
                        }
   39         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   40         -
                    },
   41         -
                    other => {
   42         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   43         -
                            "expected object key or end object, found: {other:?}"
   44         -
                        )))
   45         -
                    }
   46         -
                }
   47         -
            }
   48         -
            Ok(Some(
   49         -
                crate::serde_util::async_invoke_s3_output_data_config_correct_errors(builder)
   50         -
                    .build()
   51         -
                    .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
   52         -
            ))
   53         -
        }
   54         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   55         -
            "expected start object or null",
   56         -
        )),
   57         -
    }
   58         -
}
   59         -
   60         -
pub fn ser_async_invoke_s3_output_data_config(
   61         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   62         -
    input: &crate::types::AsyncInvokeS3OutputDataConfig,
   63         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
   64         -
    {
   65         -
        object.key("s3Uri").string(input.s3_uri.as_str());
   66         -
    }
   67         -
    if let Some(var_1) = &input.kms_key_id {
   68         -
        object.key("kmsKeyId").string(var_1.as_str());
   69         -
    }
   70         -
    if let Some(var_2) = &input.bucket_owner {
   71         -
        object.key("bucketOwner").string(var_2.as_str());
   72         -
    }
   73         -
    Ok(())
   74         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_async_invoke_summaries.rs

@@ -1,0 +37,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_async_invoke_summaries<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::AsyncInvokeSummary>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
   12         -
            let mut items = Vec::new();
   13         -
            loop {
   14         -
                match tokens.peek() {
   15         -
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
   16         -
                        tokens.next().transpose().unwrap();
   17         -
                        break;
   18         -
                    }
   19         -
                    _ => {
   20         -
                        let value = crate::protocol_serde::shape_async_invoke_summary::de_async_invoke_summary(tokens, _value)?;
   21         -
                        if let Some(value) = value {
   22         -
                            items.push(value);
   23         -
                        } else {
   24         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   25         -
                                "dense list cannot contain null values",
   26         -
                            ));
   27         -
                        }
   28         -
                    }
   29         -
                }
   30         -
            }
   31         -
            Ok(Some(items))
   32         -
        }
   33         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   34         -
            "expected start array or null",
   35         -
        )),
   36         -
    }
   37         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_async_invoke_summary.rs

@@ -1,0 +93,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_async_invoke_summary<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::AsyncInvokeSummary>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   12         -
            #[allow(unused_mut)]
   13         -
            let mut builder = crate::types::builders::AsyncInvokeSummaryBuilder::default();
   14         -
            loop {
   15         -
                match tokens.next().transpose()? {
   16         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   17         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   18         -
                        "invocationArn" => {
   19         -
                            builder = builder.set_invocation_arn(
   20         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   21         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   22         -
                                    .transpose()?,
   23         -
                            );
   24         -
                        }
   25         -
                        "modelArn" => {
   26         -
                            builder = builder.set_model_arn(
   27         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   28         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   29         -
                                    .transpose()?,
   30         -
                            );
   31         -
                        }
   32         -
                        "clientRequestToken" => {
   33         -
                            builder = builder.set_client_request_token(
   34         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   35         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   36         -
                                    .transpose()?,
   37         -
                            );
   38         -
                        }
   39         -
                        "status" => {
   40         -
                            builder = builder.set_status(
   41         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   42         -
                                    .map(|s| s.to_unescaped().map(|u| crate::types::AsyncInvokeStatus::from(u.as_ref())))
   43         -
                                    .transpose()?,
   44         -
                            );
   45         -
                        }
   46         -
                        "failureMessage" => {
   47         -
                            builder = builder.set_failure_message(
   48         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   49         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   50         -
                                    .transpose()?,
   51         -
                            );
   52         -
                        }
   53         -
                        "submitTime" => {
   54         -
                            builder = builder.set_submit_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   55         -
                                tokens.next(),
   56         -
                                ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
   57         -
                            )?);
   58         -
                        }
   59         -
                        "lastModifiedTime" => {
   60         -
                            builder = builder.set_last_modified_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   61         -
                                tokens.next(),
   62         -
                                ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
   63         -
                            )?);
   64         -
                        }
   65         -
                        "endTime" => {
   66         -
                            builder = builder.set_end_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
   67         -
                                tokens.next(),
   68         -
                                ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
   69         -
                            )?);
   70         -
                        }
   71         -
                        "outputDataConfig" => {
   72         -
                            builder = builder.set_output_data_config(
   73         -
                                crate::protocol_serde::shape_async_invoke_output_data_config::de_async_invoke_output_data_config(tokens, _value)?,
   74         -
                            );
   75         -
                        }
   76         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   77         -
                    },
   78         -
                    other => {
   79         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   80         -
                            "expected object key or end object, found: {other:?}"
   81         -
                        )))
   82         -
                    }
   83         -
                }
   84         -
            }
   85         -
            Ok(Some(crate::serde_util::async_invoke_summary_correct_errors(builder).build().map_err(
   86         -
                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
   87         -
            )?))
   88         -
        }
   89         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   90         -
            "expected start object or null",
   91         -
        )),
   92         -
    }
   93         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_auto_tool_choice.rs

@@ -1,0 +7,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_auto_tool_choice(
    3         -
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    #[allow(unused_variables)] input: &crate::types::AutoToolChoice,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    Ok(())
    7         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_cache_point_block.rs

@@ -1,0 +52,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_cache_point_block(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::CachePointBlock,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    {
    7         -
        object.key("type").string(input.r#type.as_str());
    8         -
    }
    9         -
    Ok(())
   10         -
}
   11         -
   12         -
pub(crate) fn de_cache_point_block<'a, I>(
   13         -
    tokens: &mut ::std::iter::Peekable<I>,
   14         -
    _value: &'a [u8],
   15         -
) -> ::std::result::Result<Option<crate::types::CachePointBlock>, ::aws_smithy_json::deserialize::error::DeserializeError>
   16         -
where
   17         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   18         -
{
   19         -
    match tokens.next().transpose()? {
   20         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   21         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   22         -
            #[allow(unused_mut)]
   23         -
            let mut builder = crate::types::builders::CachePointBlockBuilder::default();
   24         -
            loop {
   25         -
                match tokens.next().transpose()? {
   26         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   27         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   28         -
                        "type" => {
   29         -
                            builder = builder.set_type(
   30         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   31         -
                                    .map(|s| s.to_unescaped().map(|u| crate::types::CachePointType::from(u.as_ref())))
   32         -
                                    .transpose()?,
   33         -
                            );
   34         -
                        }
   35         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   36         -
                    },
   37         -
                    other => {
   38         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   39         -
                            "expected object key or end object, found: {other:?}"
   40         -
                        )))
   41         -
                    }
   42         -
                }
   43         -
            }
   44         -
            Ok(Some(crate::serde_util::cache_point_block_correct_errors(builder).build().map_err(
   45         -
                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
   46         -
            )?))
   47         -
        }
   48         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   49         -
            "expected start object or null",
   50         -
        )),
   51         -
    }
   52         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_citation.rs

@@ -1,0 +76,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_citation(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::Citation,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.title {
    7         -
        object.key("title").string(var_1.as_str());
    8         -
    }
    9         -
    if let Some(var_2) = &input.source_content {
   10         -
        let mut array_3 = object.key("sourceContent").start_array();
   11         -
        for item_4 in var_2 {
   12         -
            {
   13         -
                #[allow(unused_mut)]
   14         -
                let mut object_5 = array_3.value().start_object();
   15         -
                crate::protocol_serde::shape_citation_source_content::ser_citation_source_content(&mut object_5, item_4)?;
   16         -
                object_5.finish();
   17         -
            }
   18         -
        }
   19         -
        array_3.finish();
   20         -
    }
   21         -
    if let Some(var_6) = &input.location {
   22         -
        #[allow(unused_mut)]
   23         -
        let mut object_7 = object.key("location").start_object();
   24         -
        crate::protocol_serde::shape_citation_location::ser_citation_location(&mut object_7, var_6)?;
   25         -
        object_7.finish();
   26         -
    }
   27         -
    Ok(())
   28         -
}
   29         -
   30         -
pub(crate) fn de_citation<'a, I>(
   31         -
    tokens: &mut ::std::iter::Peekable<I>,
   32         -
    _value: &'a [u8],
   33         -
) -> ::std::result::Result<Option<crate::types::Citation>, ::aws_smithy_json::deserialize::error::DeserializeError>
   34         -
where
   35         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   36         -
{
   37         -
    match tokens.next().transpose()? {
   38         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   39         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   40         -
            #[allow(unused_mut)]
   41         -
            let mut builder = crate::types::builders::CitationBuilder::default();
   42         -
            loop {
   43         -
                match tokens.next().transpose()? {
   44         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   45         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   46         -
                        "title" => {
   47         -
                            builder = builder.set_title(
   48         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   49         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   50         -
                                    .transpose()?,
   51         -
                            );
   52         -
                        }
   53         -
                        "sourceContent" => {
   54         -
                            builder = builder.set_source_content(
   55         -
                                crate::protocol_serde::shape_citation_source_content_list::de_citation_source_content_list(tokens, _value)?,
   56         -
                            );
   57         -
                        }
   58         -
                        "location" => {
   59         -
                            builder = builder.set_location(crate::protocol_serde::shape_citation_location::de_citation_location(tokens, _value)?);
   60         -
                        }
   61         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   62         -
                    },
   63         -
                    other => {
   64         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   65         -
                            "expected object key or end object, found: {other:?}"
   66         -
                        )))
   67         -
                    }
   68         -
                }
   69         -
            }
   70         -
            Ok(Some(builder.build()))
   71         -
        }
   72         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   73         -
            "expected start object or null",
   74         -
        )),
   75         -
    }
   76         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_citation_generated_content.rs

@@ -1,0 +81,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_citation_generated_content(
    3         -
    object_4: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::CitationGeneratedContent,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    match input {
    7         -
        crate::types::CitationGeneratedContent::Text(inner) => {
    8         -
            object_4.key("text").string(inner.as_str());
    9         -
        }
   10         -
        crate::types::CitationGeneratedContent::Unknown => {
   11         -
            return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
   12         -
                "CitationGeneratedContent",
   13         -
            ))
   14         -
        }
   15         -
    }
   16         -
    Ok(())
   17         -
}
   18         -
   19         -
pub(crate) fn de_citation_generated_content<'a, I>(
   20         -
    tokens: &mut ::std::iter::Peekable<I>,
   21         -
    _value: &'a [u8],
   22         -
) -> ::std::result::Result<Option<crate::types::CitationGeneratedContent>, ::aws_smithy_json::deserialize::error::DeserializeError>
   23         -
where
   24         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   25         -
{
   26         -
    let mut variant = None;
   27         -
    match tokens.next().transpose()? {
   28         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   29         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
   30         -
            match tokens.next().transpose()? {
   31         -
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   32         -
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   33         -
                    if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
   34         -
                        tokens.peek()
   35         -
                    {
   36         -
                        let _ = tokens.next().expect("peek returned a token")?;
   37         -
                        continue;
   38         -
                    }
   39         -
                    let key = key.to_unescaped()?;
   40         -
                    if key == "__type" {
   41         -
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   42         -
                        continue;
   43         -
                    }
   44         -
                    if variant.is_some() {
   45         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   46         -
                            "encountered mixed variants in union",
   47         -
                        ));
   48         -
                    }
   49         -
                    variant = match key.as_ref() {
   50         -
                        "text" => Some(crate::types::CitationGeneratedContent::Text(
   51         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   52         -
                                .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   53         -
                                .transpose()?
   54         -
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'text' cannot be null"))?,
   55         -
                        )),
   56         -
                        _ => {
   57         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   58         -
                            Some(crate::types::CitationGeneratedContent::Unknown)
   59         -
                        }
   60         -
                    };
   61         -
                }
   62         -
                other => {
   63         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   64         -
                        "expected object key or end object, found: {other:?}"
   65         -
                    )))
   66         -
                }
   67         -
            }
   68         -
        },
   69         -
        _ => {
   70         -
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   71         -
                "expected start object or null",
   72         -
            ))
   73         -
        }
   74         -
    }
   75         -
    if variant.is_none() {
   76         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   77         -
            "Union did not contain a valid variant.",
   78         -
        ));
   79         -
    }
   80         -
    Ok(variant)
   81         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_citation_generated_content_list.rs

@@ -1,0 +37,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_citation_generated_content_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::CitationGeneratedContent>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
   12         -
            let mut items = Vec::new();
   13         -
            loop {
   14         -
                match tokens.peek() {
   15         -
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
   16         -
                        tokens.next().transpose().unwrap();
   17         -
                        break;
   18         -
                    }
   19         -
                    _ => {
   20         -
                        let value = crate::protocol_serde::shape_citation_generated_content::de_citation_generated_content(tokens, _value)?;
   21         -
                        if let Some(value) = value {
   22         -
                            items.push(value);
   23         -
                        } else {
   24         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   25         -
                                "dense list cannot contain null values",
   26         -
                            ));
   27         -
                        }
   28         -
                    }
   29         -
                }
   30         -
            }
   31         -
            Ok(Some(items))
   32         -
        }
   33         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   34         -
            "expected start array or null",
   35         -
        )),
   36         -
    }
   37         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_citation_location.rs

@@ -1,1 +63,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_citation_location(
    3         -
    object_7: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::CitationLocation,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    match input {
    7         -
        crate::types::CitationLocation::DocumentChar(inner) => {
    8         -
            #[allow(unused_mut)]
    9         -
            let mut object_1 = object_7.key("documentChar").start_object();
   10         -
            crate::protocol_serde::shape_document_char_location::ser_document_char_location(&mut object_1, inner)?;
   11         -
            object_1.finish();
   12         -
        }
   13         -
        crate::types::CitationLocation::DocumentPage(inner) => {
   14         -
            #[allow(unused_mut)]
   15         -
            let mut object_2 = object_7.key("documentPage").start_object();
   16         -
            crate::protocol_serde::shape_document_page_location::ser_document_page_location(&mut object_2, inner)?;
   17         -
            object_2.finish();
   18         -
        }
   19         -
        crate::types::CitationLocation::DocumentChunk(inner) => {
   20         -
            #[allow(unused_mut)]
   21         -
            let mut object_3 = object_7.key("documentChunk").start_object();
   22         -
            crate::protocol_serde::shape_document_chunk_location::ser_document_chunk_location(&mut object_3, inner)?;
   23         -
            object_3.finish();
   24         -
        }
   25         -
        crate::types::CitationLocation::Unknown => {
   26         -
            return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
   27         -
                "CitationLocation",
   28         -
            ))
   29         -
        }
   30         -
    }
   31         -
    Ok(())
   32         -
}
   33         -
   34      2   
pub(crate) fn de_citation_location<'a, I>(
   35      3   
    tokens: &mut ::std::iter::Peekable<I>,
   36      4   
    _value: &'a [u8],
   37      5   
) -> ::std::result::Result<Option<crate::types::CitationLocation>, ::aws_smithy_json::deserialize::error::DeserializeError>
   38      6   
where
   39      7   
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   40      8   
{
   41      9   
    let mut variant = None;
   42     10   
    match tokens.next().transpose()? {
   43     11   
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_citation_source_content.rs

@@ -1,0 +81,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_citation_source_content(
    3         -
    object_5: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::CitationSourceContent,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    match input {
    7         -
        crate::types::CitationSourceContent::Text(inner) => {
    8         -
            object_5.key("text").string(inner.as_str());
    9         -
        }
   10         -
        crate::types::CitationSourceContent::Unknown => {
   11         -
            return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
   12         -
                "CitationSourceContent",
   13         -
            ))
   14         -
        }
   15         -
    }
   16         -
    Ok(())
   17         -
}
   18         -
   19         -
pub(crate) fn de_citation_source_content<'a, I>(
   20         -
    tokens: &mut ::std::iter::Peekable<I>,
   21         -
    _value: &'a [u8],
   22         -
) -> ::std::result::Result<Option<crate::types::CitationSourceContent>, ::aws_smithy_json::deserialize::error::DeserializeError>
   23         -
where
   24         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   25         -
{
   26         -
    let mut variant = None;
   27         -
    match tokens.next().transpose()? {
   28         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   29         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
   30         -
            match tokens.next().transpose()? {
   31         -
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   32         -
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   33         -
                    if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
   34         -
                        tokens.peek()
   35         -
                    {
   36         -
                        let _ = tokens.next().expect("peek returned a token")?;
   37         -
                        continue;
   38         -
                    }
   39         -
                    let key = key.to_unescaped()?;
   40         -
                    if key == "__type" {
   41         -
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   42         -
                        continue;
   43         -
                    }
   44         -
                    if variant.is_some() {
   45         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   46         -
                            "encountered mixed variants in union",
   47         -
                        ));
   48         -
                    }
   49         -
                    variant = match key.as_ref() {
   50         -
                        "text" => Some(crate::types::CitationSourceContent::Text(
   51         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   52         -
                                .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   53         -
                                .transpose()?
   54         -
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'text' cannot be null"))?,
   55         -
                        )),
   56         -
                        _ => {
   57         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   58         -
                            Some(crate::types::CitationSourceContent::Unknown)
   59         -
                        }
   60         -
                    };
   61         -
                }
   62         -
                other => {
   63         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   64         -
                        "expected object key or end object, found: {other:?}"
   65         -
                    )))
   66         -
                }
   67         -
            }
   68         -
        },
   69         -
        _ => {
   70         -
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   71         -
                "expected start object or null",
   72         -
            ))
   73         -
        }
   74         -
    }
   75         -
    if variant.is_none() {
   76         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   77         -
            "Union did not contain a valid variant.",
   78         -
        ));
   79         -
    }
   80         -
    Ok(variant)
   81         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_citation_source_content_list.rs

@@ -1,0 +37,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_citation_source_content_list<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::CitationSourceContent>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
   12         -
            let mut items = Vec::new();
   13         -
            loop {
   14         -
                match tokens.peek() {
   15         -
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
   16         -
                        tokens.next().transpose().unwrap();
   17         -
                        break;
   18         -
                    }
   19         -
                    _ => {
   20         -
                        let value = crate::protocol_serde::shape_citation_source_content::de_citation_source_content(tokens, _value)?;
   21         -
                        if let Some(value) = value {
   22         -
                            items.push(value);
   23         -
                        } else {
   24         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   25         -
                                "dense list cannot contain null values",
   26         -
                            ));
   27         -
                        }
   28         -
                    }
   29         -
                }
   30         -
            }
   31         -
            Ok(Some(items))
   32         -
        }
   33         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   34         -
            "expected start array or null",
   35         -
        )),
   36         -
    }
   37         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_citations.rs

@@ -1,0 +37,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_citations<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::Citation>>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
   12         -
            let mut items = Vec::new();
   13         -
            loop {
   14         -
                match tokens.peek() {
   15         -
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
   16         -
                        tokens.next().transpose().unwrap();
   17         -
                        break;
   18         -
                    }
   19         -
                    _ => {
   20         -
                        let value = crate::protocol_serde::shape_citation::de_citation(tokens, _value)?;
   21         -
                        if let Some(value) = value {
   22         -
                            items.push(value);
   23         -
                        } else {
   24         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   25         -
                                "dense list cannot contain null values",
   26         -
                            ));
   27         -
                        }
   28         -
                    }
   29         -
                }
   30         -
            }
   31         -
            Ok(Some(items))
   32         -
        }
   33         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   34         -
            "expected start array or null",
   35         -
        )),
   36         -
    }
   37         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_citations_config.rs

@@ -1,0 +48,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_citations_config(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::CitationsConfig,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    {
    7         -
        object.key("enabled").boolean(input.enabled);
    8         -
    }
    9         -
    Ok(())
   10         -
}
   11         -
   12         -
pub(crate) fn de_citations_config<'a, I>(
   13         -
    tokens: &mut ::std::iter::Peekable<I>,
   14         -
    _value: &'a [u8],
   15         -
) -> ::std::result::Result<Option<crate::types::CitationsConfig>, ::aws_smithy_json::deserialize::error::DeserializeError>
   16         -
where
   17         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   18         -
{
   19         -
    match tokens.next().transpose()? {
   20         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   21         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   22         -
            #[allow(unused_mut)]
   23         -
            let mut builder = crate::types::builders::CitationsConfigBuilder::default();
   24         -
            loop {
   25         -
                match tokens.next().transpose()? {
   26         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   27         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   28         -
                        "enabled" => {
   29         -
                            builder = builder.set_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
   30         -
                        }
   31         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   32         -
                    },
   33         -
                    other => {
   34         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   35         -
                            "expected object key or end object, found: {other:?}"
   36         -
                        )))
   37         -
                    }
   38         -
                }
   39         -
            }
   40         -
            Ok(Some(crate::serde_util::citations_config_correct_errors(builder).build().map_err(
   41         -
                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
   42         -
            )?))
   43         -
        }
   44         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   45         -
            "expected start object or null",
   46         -
        )),
   47         -
    }
   48         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_citations_content_block.rs

@@ -1,0 +72,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_citations_content_block(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::CitationsContentBlock,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.content {
    7         -
        let mut array_2 = object.key("content").start_array();
    8         -
        for item_3 in var_1 {
    9         -
            {
   10         -
                #[allow(unused_mut)]
   11         -
                let mut object_4 = array_2.value().start_object();
   12         -
                crate::protocol_serde::shape_citation_generated_content::ser_citation_generated_content(&mut object_4, item_3)?;
   13         -
                object_4.finish();
   14         -
            }
   15         -
        }
   16         -
        array_2.finish();
   17         -
    }
   18         -
    if let Some(var_5) = &input.citations {
   19         -
        let mut array_6 = object.key("citations").start_array();
   20         -
        for item_7 in var_5 {
   21         -
            {
   22         -
                #[allow(unused_mut)]
   23         -
                let mut object_8 = array_6.value().start_object();
   24         -
                crate::protocol_serde::shape_citation::ser_citation(&mut object_8, item_7)?;
   25         -
                object_8.finish();
   26         -
            }
   27         -
        }
   28         -
        array_6.finish();
   29         -
    }
   30         -
    Ok(())
   31         -
}
   32         -
   33         -
pub(crate) fn de_citations_content_block<'a, I>(
   34         -
    tokens: &mut ::std::iter::Peekable<I>,
   35         -
    _value: &'a [u8],
   36         -
) -> ::std::result::Result<Option<crate::types::CitationsContentBlock>, ::aws_smithy_json::deserialize::error::DeserializeError>
   37         -
where
   38         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   39         -
{
   40         -
    match tokens.next().transpose()? {
   41         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   42         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   43         -
            #[allow(unused_mut)]
   44         -
            let mut builder = crate::types::builders::CitationsContentBlockBuilder::default();
   45         -
            loop {
   46         -
                match tokens.next().transpose()? {
   47         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   48         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   49         -
                        "content" => {
   50         -
                            builder = builder.set_content(
   51         -
                                crate::protocol_serde::shape_citation_generated_content_list::de_citation_generated_content_list(tokens, _value)?,
   52         -
                            );
   53         -
                        }
   54         -
                        "citations" => {
   55         -
                            builder = builder.set_citations(crate::protocol_serde::shape_citations::de_citations(tokens, _value)?);
   56         -
                        }
   57         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   58         -
                    },
   59         -
                    other => {
   60         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   61         -
                            "expected object key or end object, found: {other:?}"
   62         -
                        )))
   63         -
                    }
   64         -
                }
   65         -
            }
   66         -
            Ok(Some(builder.build()))
   67         -
        }
   68         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   69         -
            "expected start object or null",
   70         -
        )),
   71         -
    }
   72         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_conflict_exception.rs

@@ -1,0 +35,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_conflict_exception_json_err(
    3         -
    _value: &[u8],
    4         -
    mut builder: crate::types::error::builders::ConflictExceptionBuilder,
    5         -
) -> ::std::result::Result<crate::types::error::builders::ConflictExceptionBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
    6         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
    7         -
    let tokens = &mut tokens_owned;
    8         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
    9         -
    loop {
   10         -
        match tokens.next().transpose()? {
   11         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   12         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   13         -
                "message" => {
   14         -
                    builder = builder.set_message(
   15         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   16         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   17         -
                            .transpose()?,
   18         -
                    );
   19         -
                }
   20         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   21         -
            },
   22         -
            other => {
   23         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   24         -
                    "expected object key or end object, found: {other:?}"
   25         -
                )))
   26         -
            }
   27         -
        }
   28         -
    }
   29         -
    if tokens.next().is_some() {
   30         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   31         -
            "found more JSON tokens after completing parsing",
   32         -
        ));
   33         -
    }
   34         -
    Ok(builder)
   35         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_content_block.rs

@@ -1,0 +175,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_content_block(
    3         -
    object_3: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::ContentBlock,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    match input {
    7         -
        crate::types::ContentBlock::Text(inner) => {
    8         -
            object_3.key("text").string(inner.as_str());
    9         -
        }
   10         -
        crate::types::ContentBlock::Image(inner) => {
   11         -
            #[allow(unused_mut)]
   12         -
            let mut object_1 = object_3.key("image").start_object();
   13         -
            crate::protocol_serde::shape_image_block::ser_image_block(&mut object_1, inner)?;
   14         -
            object_1.finish();
   15         -
        }
   16         -
        crate::types::ContentBlock::Document(inner) => {
   17         -
            #[allow(unused_mut)]
   18         -
            let mut object_2 = object_3.key("document").start_object();
   19         -
            crate::protocol_serde::shape_document_block::ser_document_block(&mut object_2, inner)?;
   20         -
            object_2.finish();
   21         -
        }
   22         -
        crate::types::ContentBlock::Video(inner) => {
   23         -
            #[allow(unused_mut)]
   24         -
            let mut object_3 = object_3.key("video").start_object();
   25         -
            crate::protocol_serde::shape_video_block::ser_video_block(&mut object_3, inner)?;
   26         -
            object_3.finish();
   27         -
        }
   28         -
        crate::types::ContentBlock::ToolUse(inner) => {
   29         -
            #[allow(unused_mut)]
   30         -
            let mut object_4 = object_3.key("toolUse").start_object();
   31         -
            crate::protocol_serde::shape_tool_use_block::ser_tool_use_block(&mut object_4, inner)?;
   32         -
            object_4.finish();
   33         -
        }
   34         -
        crate::types::ContentBlock::ToolResult(inner) => {
   35         -
            #[allow(unused_mut)]
   36         -
            let mut object_5 = object_3.key("toolResult").start_object();
   37         -
            crate::protocol_serde::shape_tool_result_block::ser_tool_result_block(&mut object_5, inner)?;
   38         -
            object_5.finish();
   39         -
        }
   40         -
        crate::types::ContentBlock::GuardContent(inner) => {
   41         -
            #[allow(unused_mut)]
   42         -
            let mut object_6 = object_3.key("guardContent").start_object();
   43         -
            crate::protocol_serde::shape_guardrail_converse_content_block::ser_guardrail_converse_content_block(&mut object_6, inner)?;
   44         -
            object_6.finish();
   45         -
        }
   46         -
        crate::types::ContentBlock::CachePoint(inner) => {
   47         -
            #[allow(unused_mut)]
   48         -
            let mut object_7 = object_3.key("cachePoint").start_object();
   49         -
            crate::protocol_serde::shape_cache_point_block::ser_cache_point_block(&mut object_7, inner)?;
   50         -
            object_7.finish();
   51         -
        }
   52         -
        crate::types::ContentBlock::ReasoningContent(inner) => {
   53         -
            #[allow(unused_mut)]
   54         -
            let mut object_8 = object_3.key("reasoningContent").start_object();
   55         -
            crate::protocol_serde::shape_reasoning_content_block::ser_reasoning_content_block(&mut object_8, inner)?;
   56         -
            object_8.finish();
   57         -
        }
   58         -
        crate::types::ContentBlock::CitationsContent(inner) => {
   59         -
            #[allow(unused_mut)]
   60         -
            let mut object_9 = object_3.key("citationsContent").start_object();
   61         -
            crate::protocol_serde::shape_citations_content_block::ser_citations_content_block(&mut object_9, inner)?;
   62         -
            object_9.finish();
   63         -
        }
   64         -
        crate::types::ContentBlock::Unknown => return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant("ContentBlock")),
   65         -
    }
   66         -
    Ok(())
   67         -
}
   68         -
   69         -
pub(crate) fn de_content_block<'a, I>(
   70         -
    tokens: &mut ::std::iter::Peekable<I>,
   71         -
    _value: &'a [u8],
   72         -
) -> ::std::result::Result<Option<crate::types::ContentBlock>, ::aws_smithy_json::deserialize::error::DeserializeError>
   73         -
where
   74         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   75         -
{
   76         -
    let mut variant = None;
   77         -
    match tokens.next().transpose()? {
   78         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   79         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
   80         -
            match tokens.next().transpose()? {
   81         -
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   82         -
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   83         -
                    if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
   84         -
                        tokens.peek()
   85         -
                    {
   86         -
                        let _ = tokens.next().expect("peek returned a token")?;
   87         -
                        continue;
   88         -
                    }
   89         -
                    let key = key.to_unescaped()?;
   90         -
                    if key == "__type" {
   91         -
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   92         -
                        continue;
   93         -
                    }
   94         -
                    if variant.is_some() {
   95         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   96         -
                            "encountered mixed variants in union",
   97         -
                        ));
   98         -
                    }
   99         -
                    variant = match key.as_ref() {
  100         -
                        "text" => Some(crate::types::ContentBlock::Text(
  101         -
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  102         -
                                .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  103         -
                                .transpose()?
  104         -
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'text' cannot be null"))?,
  105         -
                        )),
  106         -
                        "image" => Some(crate::types::ContentBlock::Image(
  107         -
                            crate::protocol_serde::shape_image_block::de_image_block(tokens, _value)?
  108         -
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'image' cannot be null"))?,
  109         -
                        )),
  110         -
                        "document" => Some(crate::types::ContentBlock::Document(
  111         -
                            crate::protocol_serde::shape_document_block::de_document_block(tokens, _value)?.ok_or_else(|| {
  112         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'document' cannot be null")
  113         -
                            })?,
  114         -
                        )),
  115         -
                        "video" => Some(crate::types::ContentBlock::Video(
  116         -
                            crate::protocol_serde::shape_video_block::de_video_block(tokens, _value)?
  117         -
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'video' cannot be null"))?,
  118         -
                        )),
  119         -
                        "toolUse" => Some(crate::types::ContentBlock::ToolUse(
  120         -
                            crate::protocol_serde::shape_tool_use_block::de_tool_use_block(tokens, _value)?.ok_or_else(|| {
  121         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'toolUse' cannot be null")
  122         -
                            })?,
  123         -
                        )),
  124         -
                        "toolResult" => Some(crate::types::ContentBlock::ToolResult(
  125         -
                            crate::protocol_serde::shape_tool_result_block::de_tool_result_block(tokens, _value)?.ok_or_else(|| {
  126         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'toolResult' cannot be null")
  127         -
                            })?,
  128         -
                        )),
  129         -
                        "guardContent" => Some(crate::types::ContentBlock::GuardContent(
  130         -
                            crate::protocol_serde::shape_guardrail_converse_content_block::de_guardrail_converse_content_block(tokens, _value)?
  131         -
                                .ok_or_else(|| {
  132         -
                                    ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'guardContent' cannot be null")
  133         -
                                })?,
  134         -
                        )),
  135         -
                        "cachePoint" => Some(crate::types::ContentBlock::CachePoint(
  136         -
                            crate::protocol_serde::shape_cache_point_block::de_cache_point_block(tokens, _value)?.ok_or_else(|| {
  137         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'cachePoint' cannot be null")
  138         -
                            })?,
  139         -
                        )),
  140         -
                        "reasoningContent" => Some(crate::types::ContentBlock::ReasoningContent(
  141         -
                            crate::protocol_serde::shape_reasoning_content_block::de_reasoning_content_block(tokens, _value)?.ok_or_else(|| {
  142         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'reasoningContent' cannot be null")
  143         -
                            })?,
  144         -
                        )),
  145         -
                        "citationsContent" => Some(crate::types::ContentBlock::CitationsContent(
  146         -
                            crate::protocol_serde::shape_citations_content_block::de_citations_content_block(tokens, _value)?.ok_or_else(|| {
  147         -
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'citationsContent' cannot be null")
  148         -
                            })?,
  149         -
                        )),
  150         -
                        _ => {
  151         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
  152         -
                            Some(crate::types::ContentBlock::Unknown)
  153         -
                        }
  154         -
                    };
  155         -
                }
  156         -
                other => {
  157         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  158         -
                        "expected object key or end object, found: {other:?}"
  159         -
                    )))
  160         -
                }
  161         -
            }
  162         -
        },
  163         -
        _ => {
  164         -
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  165         -
                "expected start object or null",
  166         -
            ))
  167         -
        }
  168         -
    }
  169         -
    if variant.is_none() {
  170         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  171         -
            "Union did not contain a valid variant.",
  172         -
        ));
  173         -
    }
  174         -
    Ok(variant)
  175         -
}