AWS SDK

AWS SDK

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c

Files changed:

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         -
}

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

@@ -1,0 +37,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_content_blocks<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::ContentBlock>>, ::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_content_block::de_content_block(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_converse.rs

@@ -1,0 +241,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_converse_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<crate::operation::converse::ConverseOutput, crate::operation::converse::ConverseError> {
    8         -
    #[allow(unused_mut)]
    9         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   10         -
        .map_err(crate::operation::converse::ConverseError::unhandled)?;
   11         -
    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
   12         -
    let generic = generic_builder.build();
   13         -
    let error_code = match generic.code() {
   14         -
        Some(code) => code,
   15         -
        None => return Err(crate::operation::converse::ConverseError::unhandled(generic)),
   16         -
    };
   17         -
   18         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   19         -
    Err(match error_code {
   20         -
        "AccessDeniedException" => crate::operation::converse::ConverseError::AccessDeniedException({
   21         -
            #[allow(unused_mut)]
   22         -
            let mut tmp = {
   23         -
                #[allow(unused_mut)]
   24         -
                let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
   25         -
                output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
   26         -
                    .map_err(crate::operation::converse::ConverseError::unhandled)?;
   27         -
                let output = output.meta(generic);
   28         -
                output.build()
   29         -
            };
   30         -
            if tmp.message.is_none() {
   31         -
                tmp.message = _error_message;
   32         -
            }
   33         -
            tmp
   34         -
        }),
   35         -
        "InternalServerException" => crate::operation::converse::ConverseError::InternalServerException({
   36         -
            #[allow(unused_mut)]
   37         -
            let mut tmp = {
   38         -
                #[allow(unused_mut)]
   39         -
                let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
   40         -
                output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
   41         -
                    .map_err(crate::operation::converse::ConverseError::unhandled)?;
   42         -
                let output = output.meta(generic);
   43         -
                output.build()
   44         -
            };
   45         -
            if tmp.message.is_none() {
   46         -
                tmp.message = _error_message;
   47         -
            }
   48         -
            tmp
   49         -
        }),
   50         -
        "ModelErrorException" => crate::operation::converse::ConverseError::ModelErrorException({
   51         -
            #[allow(unused_mut)]
   52         -
            let mut tmp = {
   53         -
                #[allow(unused_mut)]
   54         -
                let mut output = crate::types::error::builders::ModelErrorExceptionBuilder::default();
   55         -
                output = crate::protocol_serde::shape_model_error_exception::de_model_error_exception_json_err(_response_body, output)
   56         -
                    .map_err(crate::operation::converse::ConverseError::unhandled)?;
   57         -
                let output = output.meta(generic);
   58         -
                output.build()
   59         -
            };
   60         -
            if tmp.message.is_none() {
   61         -
                tmp.message = _error_message;
   62         -
            }
   63         -
            tmp
   64         -
        }),
   65         -
        "ModelNotReadyException" => crate::operation::converse::ConverseError::ModelNotReadyException({
   66         -
            #[allow(unused_mut)]
   67         -
            let mut tmp = {
   68         -
                #[allow(unused_mut)]
   69         -
                let mut output = crate::types::error::builders::ModelNotReadyExceptionBuilder::default();
   70         -
                output = crate::protocol_serde::shape_model_not_ready_exception::de_model_not_ready_exception_json_err(_response_body, output)
   71         -
                    .map_err(crate::operation::converse::ConverseError::unhandled)?;
   72         -
                let output = output.meta(generic);
   73         -
                output.build()
   74         -
            };
   75         -
            if tmp.message.is_none() {
   76         -
                tmp.message = _error_message;
   77         -
            }
   78         -
            tmp
   79         -
        }),
   80         -
        "ModelTimeoutException" => crate::operation::converse::ConverseError::ModelTimeoutException({
   81         -
            #[allow(unused_mut)]
   82         -
            let mut tmp = {
   83         -
                #[allow(unused_mut)]
   84         -
                let mut output = crate::types::error::builders::ModelTimeoutExceptionBuilder::default();
   85         -
                output = crate::protocol_serde::shape_model_timeout_exception::de_model_timeout_exception_json_err(_response_body, output)
   86         -
                    .map_err(crate::operation::converse::ConverseError::unhandled)?;
   87         -
                let output = output.meta(generic);
   88         -
                output.build()
   89         -
            };
   90         -
            if tmp.message.is_none() {
   91         -
                tmp.message = _error_message;
   92         -
            }
   93         -
            tmp
   94         -
        }),
   95         -
        "ResourceNotFoundException" => crate::operation::converse::ConverseError::ResourceNotFoundException({
   96         -
            #[allow(unused_mut)]
   97         -
            let mut tmp = {
   98         -
                #[allow(unused_mut)]
   99         -
                let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
  100         -
                output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
  101         -
                    .map_err(crate::operation::converse::ConverseError::unhandled)?;
  102         -
                let output = output.meta(generic);
  103         -
                output.build()
  104         -
            };
  105         -
            if tmp.message.is_none() {
  106         -
                tmp.message = _error_message;
  107         -
            }
  108         -
            tmp
  109         -
        }),
  110         -
        "ServiceUnavailableException" => crate::operation::converse::ConverseError::ServiceUnavailableException({
  111         -
            #[allow(unused_mut)]
  112         -
            let mut tmp = {
  113         -
                #[allow(unused_mut)]
  114         -
                let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
  115         -
                output =
  116         -
                    crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
  117         -
                        .map_err(crate::operation::converse::ConverseError::unhandled)?;
  118         -
                let output = output.meta(generic);
  119         -
                output.build()
  120         -
            };
  121         -
            if tmp.message.is_none() {
  122         -
                tmp.message = _error_message;
  123         -
            }
  124         -
            tmp
  125         -
        }),
  126         -
        "ThrottlingException" => crate::operation::converse::ConverseError::ThrottlingException({
  127         -
            #[allow(unused_mut)]
  128         -
            let mut tmp = {
  129         -
                #[allow(unused_mut)]
  130         -
                let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
  131         -
                output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
  132         -
                    .map_err(crate::operation::converse::ConverseError::unhandled)?;
  133         -
                let output = output.meta(generic);
  134         -
                output.build()
  135         -
            };
  136         -
            if tmp.message.is_none() {
  137         -
                tmp.message = _error_message;
  138         -
            }
  139         -
            tmp
  140         -
        }),
  141         -
        "ValidationException" => crate::operation::converse::ConverseError::ValidationException({
  142         -
            #[allow(unused_mut)]
  143         -
            let mut tmp = {
  144         -
                #[allow(unused_mut)]
  145         -
                let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
  146         -
                output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
  147         -
                    .map_err(crate::operation::converse::ConverseError::unhandled)?;
  148         -
                let output = output.meta(generic);
  149         -
                output.build()
  150         -
            };
  151         -
            if tmp.message.is_none() {
  152         -
                tmp.message = _error_message;
  153         -
            }
  154         -
            tmp
  155         -
        }),
  156         -
        _ => crate::operation::converse::ConverseError::generic(generic),
  157         -
    })
  158         -
}
  159         -
  160         -
#[allow(clippy::unnecessary_wraps)]
  161         -
pub fn de_converse_http_response(
  162         -
    _response_status: u16,
  163         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
  164         -
    _response_body: &[u8],
  165         -
) -> std::result::Result<crate::operation::converse::ConverseOutput, crate::operation::converse::ConverseError> {
  166         -
    Ok({
  167         -
        #[allow(unused_mut)]
  168         -
        let mut output = crate::operation::converse::builders::ConverseOutputBuilder::default();
  169         -
        output = crate::protocol_serde::shape_converse::de_converse(_response_body, output)
  170         -
            .map_err(crate::operation::converse::ConverseError::unhandled)?;
  171         -
        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
  172         -
        crate::serde_util::converse_output_output_correct_errors(output)
  173         -
            .build()
  174         -
            .map_err(crate::operation::converse::ConverseError::unhandled)?
  175         -
    })
  176         -
}
  177         -
  178         -
pub fn ser_converse_input(
  179         -
    input: &crate::operation::converse::ConverseInput,
  180         -
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
  181         -
    let mut out = String::new();
  182         -
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
  183         -
    crate::protocol_serde::shape_converse_input::ser_converse_input_input(&mut object, input)?;
  184         -
    object.finish();
  185         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
  186         -
}
  187         -
  188         -
pub(crate) fn de_converse(
  189         -
    _value: &[u8],
  190         -
    mut builder: crate::operation::converse::builders::ConverseOutputBuilder,
  191         -
) -> ::std::result::Result<crate::operation::converse::builders::ConverseOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
  192         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
  193         -
    let tokens = &mut tokens_owned;
  194         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
  195         -
    loop {
  196         -
        match tokens.next().transpose()? {
  197         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  198         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
  199         -
                "additionalModelResponseFields" => {
  200         -
                    builder = builder.set_additional_model_response_fields(Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?));
  201         -
                }
  202         -
                "metrics" => {
  203         -
                    builder = builder.set_metrics(crate::protocol_serde::shape_converse_metrics::de_converse_metrics(tokens, _value)?);
  204         -
                }
  205         -
                "output" => {
  206         -
                    builder = builder.set_output(crate::protocol_serde::shape_converse_output::de_converse_output(tokens, _value)?);
  207         -
                }
  208         -
                "performanceConfig" => {
  209         -
                    builder = builder.set_performance_config(crate::protocol_serde::shape_performance_configuration::de_performance_configuration(
  210         -
                        tokens, _value,
  211         -
                    )?);
  212         -
                }
  213         -
                "stopReason" => {
  214         -
                    builder = builder.set_stop_reason(
  215         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  216         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::StopReason::from(u.as_ref())))
  217         -
                            .transpose()?,
  218         -
                    );
  219         -
                }
  220         -
                "trace" => {
  221         -
                    builder = builder.set_trace(crate::protocol_serde::shape_converse_trace::de_converse_trace(tokens, _value)?);
  222         -
                }
  223         -
                "usage" => {
  224         -
                    builder = builder.set_usage(crate::protocol_serde::shape_token_usage::de_token_usage(tokens, _value)?);
  225         -
                }
  226         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
  227         -
            },
  228         -
            other => {
  229         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  230         -
                    "expected object key or end object, found: {other:?}"
  231         -
                )))
  232         -
            }
  233         -
        }
  234         -
    }
  235         -
    if tokens.next().is_some() {
  236         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  237         -
            "found more JSON tokens after completing parsing",
  238         -
        ));
  239         -
    }
  240         -
    Ok(builder)
  241         -
}

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

@@ -1,0 +90,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_converse_input_input(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::operation::converse::ConverseInput,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    if let Some(var_1) = &input.additional_model_request_fields {
    7         -
        object.key("additionalModelRequestFields").document(var_1);
    8         -
    }
    9         -
    if let Some(var_2) = &input.additional_model_response_field_paths {
   10         -
        let mut array_3 = object.key("additionalModelResponseFieldPaths").start_array();
   11         -
        for item_4 in var_2 {
   12         -
            {
   13         -
                array_3.value().string(item_4.as_str());
   14         -
            }
   15         -
        }
   16         -
        array_3.finish();
   17         -
    }
   18         -
    if let Some(var_5) = &input.guardrail_config {
   19         -
        #[allow(unused_mut)]
   20         -
        let mut object_6 = object.key("guardrailConfig").start_object();
   21         -
        crate::protocol_serde::shape_guardrail_configuration::ser_guardrail_configuration(&mut object_6, var_5)?;
   22         -
        object_6.finish();
   23         -
    }
   24         -
    if let Some(var_7) = &input.inference_config {
   25         -
        #[allow(unused_mut)]
   26         -
        let mut object_8 = object.key("inferenceConfig").start_object();
   27         -
        crate::protocol_serde::shape_inference_configuration::ser_inference_configuration(&mut object_8, var_7)?;
   28         -
        object_8.finish();
   29         -
    }
   30         -
    if let Some(var_9) = &input.messages {
   31         -
        let mut array_10 = object.key("messages").start_array();
   32         -
        for item_11 in var_9 {
   33         -
            {
   34         -
                #[allow(unused_mut)]
   35         -
                let mut object_12 = array_10.value().start_object();
   36         -
                crate::protocol_serde::shape_message::ser_message(&mut object_12, item_11)?;
   37         -
                object_12.finish();
   38         -
            }
   39         -
        }
   40         -
        array_10.finish();
   41         -
    }
   42         -
    if let Some(var_13) = &input.performance_config {
   43         -
        #[allow(unused_mut)]
   44         -
        let mut object_14 = object.key("performanceConfig").start_object();
   45         -
        crate::protocol_serde::shape_performance_configuration::ser_performance_configuration(&mut object_14, var_13)?;
   46         -
        object_14.finish();
   47         -
    }
   48         -
    if let Some(var_15) = &input.prompt_variables {
   49         -
        #[allow(unused_mut)]
   50         -
        let mut object_16 = object.key("promptVariables").start_object();
   51         -
        for (key_17, value_18) in var_15 {
   52         -
            {
   53         -
                #[allow(unused_mut)]
   54         -
                let mut object_19 = object_16.key(key_17.as_str()).start_object();
   55         -
                crate::protocol_serde::shape_prompt_variable_values::ser_prompt_variable_values(&mut object_19, value_18)?;
   56         -
                object_19.finish();
   57         -
            }
   58         -
        }
   59         -
        object_16.finish();
   60         -
    }
   61         -
    if let Some(var_20) = &input.request_metadata {
   62         -
        #[allow(unused_mut)]
   63         -
        let mut object_21 = object.key("requestMetadata").start_object();
   64         -
        for (key_22, value_23) in var_20 {
   65         -
            {
   66         -
                object_21.key(key_22.as_str()).string(value_23.as_str());
   67         -
            }
   68         -
        }
   69         -
        object_21.finish();
   70         -
    }
   71         -
    if let Some(var_24) = &input.system {
   72         -
        let mut array_25 = object.key("system").start_array();
   73         -
        for item_26 in var_24 {
   74         -
            {
   75         -
                #[allow(unused_mut)]
   76         -
                let mut object_27 = array_25.value().start_object();
   77         -
                crate::protocol_serde::shape_system_content_block::ser_system_content_block(&mut object_27, item_26)?;
   78         -
                object_27.finish();
   79         -
            }
   80         -
        }
   81         -
        array_25.finish();
   82         -
    }
   83         -
    if let Some(var_28) = &input.tool_config {
   84         -
        #[allow(unused_mut)]
   85         -
        let mut object_29 = object.key("toolConfig").start_object();
   86         -
        crate::protocol_serde::shape_tool_configuration::ser_tool_configuration(&mut object_29, var_28)?;
   87         -
        object_29.finish();
   88         -
    }
   89         -
    Ok(())
   90         -
}