AWS SDK

AWS SDK

rev. ba98f30b52e51c6e715b0ae469e7a2e988c27d9a (ignoring whitespace)

Files changed:

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

@@ -1,0 +63,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_guardrail_assessment<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
) -> ::std::result::Result<Option<crate::types::GuardrailAssessment>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5         -
where
    6         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7         -
{
    8         -
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   11         -
            #[allow(unused_mut)]
   12         -
            let mut builder = crate::types::builders::GuardrailAssessmentBuilder::default();
   13         -
            loop {
   14         -
                match tokens.next().transpose()? {
   15         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   16         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   17         -
                        "topicPolicy" => {
   18         -
                            builder = builder.set_topic_policy(
   19         -
                                crate::protocol_serde::shape_guardrail_topic_policy_assessment::de_guardrail_topic_policy_assessment(tokens)?,
   20         -
                            );
   21         -
                        }
   22         -
                        "contentPolicy" => {
   23         -
                            builder = builder.set_content_policy(
   24         -
                                crate::protocol_serde::shape_guardrail_content_policy_assessment::de_guardrail_content_policy_assessment(tokens)?,
   25         -
                            );
   26         -
                        }
   27         -
                        "wordPolicy" => {
   28         -
                            builder = builder.set_word_policy(
   29         -
                                crate::protocol_serde::shape_guardrail_word_policy_assessment::de_guardrail_word_policy_assessment(tokens)?,
   30         -
                            );
   31         -
                        }
   32         -
                        "sensitiveInformationPolicy" => {
   33         -
                            builder = builder.set_sensitive_information_policy(
   34         -
                                    crate::protocol_serde::shape_guardrail_sensitive_information_policy_assessment::de_guardrail_sensitive_information_policy_assessment(tokens)?
   35         -
                                );
   36         -
                        }
   37         -
                        "contextualGroundingPolicy" => {
   38         -
                            builder = builder.set_contextual_grounding_policy(
   39         -
                                    crate::protocol_serde::shape_guardrail_contextual_grounding_policy_assessment::de_guardrail_contextual_grounding_policy_assessment(tokens)?
   40         -
                                );
   41         -
                        }
   42         -
                        "invocationMetrics" => {
   43         -
                            builder = builder.set_invocation_metrics(
   44         -
                                crate::protocol_serde::shape_guardrail_invocation_metrics::de_guardrail_invocation_metrics(tokens)?,
   45         -
                            );
   46         -
                        }
   47         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   48         -
                    },
   49         -
                    other => {
   50         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   51         -
                            "expected object key or end object, found: {:?}",
   52         -
                            other
   53         -
                        )))
   54         -
                    }
   55         -
                }
   56         -
            }
   57         -
            Ok(Some(builder.build()))
   58         -
        }
   59         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   60         -
            "expected start object or null",
   61         -
        )),
   62         -
    }
   63         -
}

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

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

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

@@ -1,0 +39,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_guardrail_assessment_list_map<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
) -> ::std::result::Result<
    5         -
    Option<::std::collections::HashMap<::std::string::String, ::std::vec::Vec<crate::types::GuardrailAssessment>>>,
    6         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7         -
>
    8         -
where
    9         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   10         -
{
   11         -
    match tokens.next().transpose()? {
   12         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   13         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   14         -
            let mut map = ::std::collections::HashMap::new();
   15         -
            loop {
   16         -
                match tokens.next().transpose()? {
   17         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   18         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   19         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   20         -
                        let value = crate::protocol_serde::shape_guardrail_assessment_list::de_guardrail_assessment_list(tokens)?;
   21         -
                        if let Some(value) = value {
   22         -
                            map.insert(key, value);
   23         -
                        }
   24         -
                    }
   25         -
                    other => {
   26         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   27         -
                            "expected object key or end object, found: {:?}",
   28         -
                            other
   29         -
                        )))
   30         -
                    }
   31         -
                }
   32         -
            }
   33         -
            Ok(Some(map))
   34         -
        }
   35         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   36         -
            "expected start object or null",
   37         -
        )),
   38         -
    }
   39         -
}

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

@@ -1,0 +39,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_guardrail_assessment_map<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
) -> ::std::result::Result<
    5         -
    Option<::std::collections::HashMap<::std::string::String, crate::types::GuardrailAssessment>>,
    6         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7         -
>
    8         -
where
    9         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   10         -
{
   11         -
    match tokens.next().transpose()? {
   12         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   13         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   14         -
            let mut map = ::std::collections::HashMap::new();
   15         -
            loop {
   16         -
                match tokens.next().transpose()? {
   17         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   18         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   19         -
                        let key = key.to_unescaped().map(|u| u.into_owned())?;
   20         -
                        let value = crate::protocol_serde::shape_guardrail_assessment::de_guardrail_assessment(tokens)?;
   21         -
                        if let Some(value) = value {
   22         -
                            map.insert(key, value);
   23         -
                        }
   24         -
                    }
   25         -
                    other => {
   26         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   27         -
                            "expected object key or end object, found: {:?}",
   28         -
                            other
   29         -
                        )))
   30         -
                    }
   31         -
                }
   32         -
            }
   33         -
            Ok(Some(map))
   34         -
        }
   35         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   36         -
            "expected start object or null",
   37         -
        )),
   38         -
    }
   39         -
}

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

@@ -1,0 +16,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_guardrail_configuration(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::GuardrailConfiguration,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    {
    7         -
        object.key("guardrailIdentifier").string(input.guardrail_identifier.as_str());
    8         -
    }
    9         -
    {
   10         -
        object.key("guardrailVersion").string(input.guardrail_version.as_str());
   11         -
    }
   12         -
    {
   13         -
        object.key("trace").string(input.trace.as_str());
   14         -
    }
   15         -
    Ok(())
   16         -
}

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

@@ -1,0 +26,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_guardrail_content_block(
    3         -
    object_4: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::GuardrailContentBlock,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    match input {
    7         -
        crate::types::GuardrailContentBlock::Text(inner) => {
    8         -
            #[allow(unused_mut)]
    9         -
            let mut object_1 = object_4.key("text").start_object();
   10         -
            crate::protocol_serde::shape_guardrail_text_block::ser_guardrail_text_block(&mut object_1, inner)?;
   11         -
            object_1.finish();
   12         -
        }
   13         -
        crate::types::GuardrailContentBlock::Image(inner) => {
   14         -
            #[allow(unused_mut)]
   15         -
            let mut object_2 = object_4.key("image").start_object();
   16         -
            crate::protocol_serde::shape_guardrail_image_block::ser_guardrail_image_block(&mut object_2, inner)?;
   17         -
            object_2.finish();
   18         -
        }
   19         -
        crate::types::GuardrailContentBlock::Unknown => {
   20         -
            return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
   21         -
                "GuardrailContentBlock",
   22         -
            ))
   23         -
        }
   24         -
    }
   25         -
    Ok(())
   26         -
}

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

@@ -1,0 +68,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_guardrail_content_filter<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
) -> ::std::result::Result<Option<crate::types::GuardrailContentFilter>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5         -
where
    6         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7         -
{
    8         -
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   11         -
            #[allow(unused_mut)]
   12         -
            let mut builder = crate::types::builders::GuardrailContentFilterBuilder::default();
   13         -
            loop {
   14         -
                match tokens.next().transpose()? {
   15         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   16         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   17         -
                        "type" => {
   18         -
                            builder = builder.set_type(
   19         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   20         -
                                    .map(|s| s.to_unescaped().map(|u| crate::types::GuardrailContentFilterType::from(u.as_ref())))
   21         -
                                    .transpose()?,
   22         -
                            );
   23         -
                        }
   24         -
                        "confidence" => {
   25         -
                            builder = builder.set_confidence(
   26         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   27         -
                                    .map(|s| s.to_unescaped().map(|u| crate::types::GuardrailContentFilterConfidence::from(u.as_ref())))
   28         -
                                    .transpose()?,
   29         -
                            );
   30         -
                        }
   31         -
                        "filterStrength" => {
   32         -
                            builder = builder.set_filter_strength(
   33         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   34         -
                                    .map(|s| s.to_unescaped().map(|u| crate::types::GuardrailContentFilterStrength::from(u.as_ref())))
   35         -
                                    .transpose()?,
   36         -
                            );
   37         -
                        }
   38         -
                        "action" => {
   39         -
                            builder = builder.set_action(
   40         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   41         -
                                    .map(|s| s.to_unescaped().map(|u| crate::types::GuardrailContentPolicyAction::from(u.as_ref())))
   42         -
                                    .transpose()?,
   43         -
                            );
   44         -
                        }
   45         -
                        "detected" => {
   46         -
                            builder = builder.set_detected(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
   47         -
                        }
   48         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   49         -
                    },
   50         -
                    other => {
   51         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   52         -
                            "expected object key or end object, found: {:?}",
   53         -
                            other
   54         -
                        )))
   55         -
                    }
   56         -
                }
   57         -
            }
   58         -
            Ok(Some(
   59         -
                crate::serde_util::guardrail_content_filter_correct_errors(builder)
   60         -
                    .build()
   61         -
                    .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
   62         -
            ))
   63         -
        }
   64         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   65         -
            "expected start object or null",
   66         -
        )),
   67         -
    }
   68         -
}

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

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

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

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

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

@@ -1,0 +69,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_guardrail_contextual_grounding_filter<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
) -> ::std::result::Result<Option<crate::types::GuardrailContextualGroundingFilter>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5         -
where
    6         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7         -
{
    8         -
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   11         -
            #[allow(unused_mut)]
   12         -
            let mut builder = crate::types::builders::GuardrailContextualGroundingFilterBuilder::default();
   13         -
            loop {
   14         -
                match tokens.next().transpose()? {
   15         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   16         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   17         -
                        "type" => {
   18         -
                            builder = builder.set_type(
   19         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   20         -
                                    .map(|s| {
   21         -
                                        s.to_unescaped()
   22         -
                                            .map(|u| crate::types::GuardrailContextualGroundingFilterType::from(u.as_ref()))
   23         -
                                    })
   24         -
                                    .transpose()?,
   25         -
                            );
   26         -
                        }
   27         -
                        "threshold" => {
   28         -
                            builder = builder.set_threshold(
   29         -
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()),
   30         -
                            );
   31         -
                        }
   32         -
                        "score" => {
   33         -
                            builder = builder
   34         -
                                .set_score(::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?.map(|v| v.to_f64_lossy()));
   35         -
                        }
   36         -
                        "action" => {
   37         -
                            builder = builder.set_action(
   38         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   39         -
                                    .map(|s| {
   40         -
                                        s.to_unescaped()
   41         -
                                            .map(|u| crate::types::GuardrailContextualGroundingPolicyAction::from(u.as_ref()))
   42         -
                                    })
   43         -
                                    .transpose()?,
   44         -
                            );
   45         -
                        }
   46         -
                        "detected" => {
   47         -
                            builder = builder.set_detected(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
   48         -
                        }
   49         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   50         -
                    },
   51         -
                    other => {
   52         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   53         -
                            "expected object key or end object, found: {:?}",
   54         -
                            other
   55         -
                        )))
   56         -
                    }
   57         -
                }
   58         -
            }
   59         -
            Ok(Some(
   60         -
                crate::serde_util::guardrail_contextual_grounding_filter_correct_errors(builder)
   61         -
                    .build()
   62         -
                    .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
   63         -
            ))
   64         -
        }
   65         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   66         -
            "expected start object or null",
   67         -
        )),
   68         -
    }
   69         -
}

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

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

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

@@ -1,0 +40,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub(crate) fn de_guardrail_contextual_grounding_policy_assessment<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
) -> ::std::result::Result<Option<crate::types::GuardrailContextualGroundingPolicyAssessment>, ::aws_smithy_json::deserialize::error::DeserializeError>
    5         -
where
    6         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    7         -
{
    8         -
    match tokens.next().transpose()? {
    9         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   10         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   11         -
            #[allow(unused_mut)]
   12         -
            let mut builder = crate::types::builders::GuardrailContextualGroundingPolicyAssessmentBuilder::default();
   13         -
            loop {
   14         -
                match tokens.next().transpose()? {
   15         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   16         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   17         -
                        "filters" => {
   18         -
                            builder = builder.set_filters(
   19         -
                                crate::protocol_serde::shape_guardrail_contextual_grounding_filters::de_guardrail_contextual_grounding_filters(
   20         -
                                    tokens,
   21         -
                                )?,
   22         -
                            );
   23         -
                        }
   24         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   25         -
                    },
   26         -
                    other => {
   27         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   28         -
                            "expected object key or end object, found: {:?}",
   29         -
                            other
   30         -
                        )))
   31         -
                    }
   32         -
                }
   33         -
            }
   34         -
            Ok(Some(builder.build()))
   35         -
        }
   36         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   37         -
            "expected start object or null",
   38         -
        )),
   39         -
    }
   40         -
}

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

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

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

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

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

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

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

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