AWS SDK

AWS SDK

rev. 96f5a1b4ad139d2f1ad1e8e40f300e1cd1ff574c (ignoring whitespace)

Files changed:

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

@@ -1,0 +189,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_get_async_invoke_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::get_async_invoke::GetAsyncInvokeOutput, crate::operation::get_async_invoke::GetAsyncInvokeError> {
    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::get_async_invoke::GetAsyncInvokeError::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::get_async_invoke::GetAsyncInvokeError::unhandled(generic)),
   16         -
    };
   17         -
   18         -
    let _error_message = generic.message().map(|msg| msg.to_owned());
   19         -
    Err(match error_code {
   20         -
        "AccessDeniedException" => crate::operation::get_async_invoke::GetAsyncInvokeError::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::get_async_invoke::GetAsyncInvokeError::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::get_async_invoke::GetAsyncInvokeError::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::get_async_invoke::GetAsyncInvokeError::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         -
        "ThrottlingException" => crate::operation::get_async_invoke::GetAsyncInvokeError::ThrottlingException({
   51         -
            #[allow(unused_mut)]
   52         -
            let mut tmp = {
   53         -
                #[allow(unused_mut)]
   54         -
                let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
   55         -
                output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
   56         -
                    .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::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         -
        "ValidationException" => crate::operation::get_async_invoke::GetAsyncInvokeError::ValidationException({
   66         -
            #[allow(unused_mut)]
   67         -
            let mut tmp = {
   68         -
                #[allow(unused_mut)]
   69         -
                let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
   70         -
                output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
   71         -
                    .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::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         -
        _ => crate::operation::get_async_invoke::GetAsyncInvokeError::generic(generic),
   81         -
    })
   82         -
}
   83         -
   84         -
#[allow(clippy::unnecessary_wraps)]
   85         -
pub fn de_get_async_invoke_http_response(
   86         -
    _response_status: u16,
   87         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   88         -
    _response_body: &[u8],
   89         -
) -> std::result::Result<crate::operation::get_async_invoke::GetAsyncInvokeOutput, crate::operation::get_async_invoke::GetAsyncInvokeError> {
   90         -
    Ok({
   91         -
        #[allow(unused_mut)]
   92         -
        let mut output = crate::operation::get_async_invoke::builders::GetAsyncInvokeOutputBuilder::default();
   93         -
        output = crate::protocol_serde::shape_get_async_invoke::de_get_async_invoke(_response_body, output)
   94         -
            .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled)?;
   95         -
        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
   96         -
        crate::serde_util::get_async_invoke_output_output_correct_errors(output)
   97         -
            .build()
   98         -
            .map_err(crate::operation::get_async_invoke::GetAsyncInvokeError::unhandled)?
   99         -
    })
  100         -
}
  101         -
  102         -
pub(crate) fn de_get_async_invoke(
  103         -
    _value: &[u8],
  104         -
    mut builder: crate::operation::get_async_invoke::builders::GetAsyncInvokeOutputBuilder,
  105         -
) -> ::std::result::Result<
  106         -
    crate::operation::get_async_invoke::builders::GetAsyncInvokeOutputBuilder,
  107         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
  108         -
> {
  109         -
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
  110         -
    let tokens = &mut tokens_owned;
  111         -
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
  112         -
    loop {
  113         -
        match tokens.next().transpose()? {
  114         -
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
  115         -
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
  116         -
                "clientRequestToken" => {
  117         -
                    builder = builder.set_client_request_token(
  118         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  119         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  120         -
                            .transpose()?,
  121         -
                    );
  122         -
                }
  123         -
                "endTime" => {
  124         -
                    builder = builder.set_end_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  125         -
                        tokens.next(),
  126         -
                        ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
  127         -
                    )?);
  128         -
                }
  129         -
                "failureMessage" => {
  130         -
                    builder = builder.set_failure_message(
  131         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  132         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  133         -
                            .transpose()?,
  134         -
                    );
  135         -
                }
  136         -
                "invocationArn" => {
  137         -
                    builder = builder.set_invocation_arn(
  138         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  139         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  140         -
                            .transpose()?,
  141         -
                    );
  142         -
                }
  143         -
                "lastModifiedTime" => {
  144         -
                    builder = builder.set_last_modified_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  145         -
                        tokens.next(),
  146         -
                        ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
  147         -
                    )?);
  148         -
                }
  149         -
                "modelArn" => {
  150         -
                    builder = builder.set_model_arn(
  151         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  152         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
  153         -
                            .transpose()?,
  154         -
                    );
  155         -
                }
  156         -
                "outputDataConfig" => {
  157         -
                    builder = builder.set_output_data_config(
  158         -
                        crate::protocol_serde::shape_async_invoke_output_data_config::de_async_invoke_output_data_config(tokens, _value)?,
  159         -
                    );
  160         -
                }
  161         -
                "status" => {
  162         -
                    builder = builder.set_status(
  163         -
                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
  164         -
                            .map(|s| s.to_unescaped().map(|u| crate::types::AsyncInvokeStatus::from(u.as_ref())))
  165         -
                            .transpose()?,
  166         -
                    );
  167         -
                }
  168         -
                "submitTime" => {
  169         -
                    builder = builder.set_submit_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
  170         -
                        tokens.next(),
  171         -
                        ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
  172         -
                    )?);
  173         -
                }
  174         -
                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
  175         -
            },
  176         -
            other => {
  177         -
                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  178         -
                    "expected object key or end object, found: {other:?}"
  179         -
                )))
  180         -
            }
  181         -
        }
  182         -
    }
  183         -
    if tokens.next().is_some() {
  184         -
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
  185         -
            "found more JSON tokens after completing parsing",
  186         -
        ));
  187         -
    }
  188         -
    Ok(builder)
  189         -
}

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_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         -
    _value: &'a [u8],
   31         -
) -> ::std::result::Result<Option<crate::types::GuardrailConverseContentBlock>, ::aws_smithy_json::deserialize::error::DeserializeError>
   32         -
where
   33         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   34         -
{
   35         -
    let mut variant = None;
   36         -
    match tokens.next().transpose()? {
   37         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
   38         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
   39         -
            match tokens.next().transpose()? {
   40         -
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   41         -
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
   42         -
                    if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
   43         -
                        tokens.peek()
   44         -
                    {
   45         -
                        let _ = tokens.next().expect("peek returned a token")?;
   46         -
                        continue;
   47         -
                    }
   48         -
                    let key = key.to_unescaped()?;
   49         -
                    if key == "__type" {
   50         -
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   51         -
                        continue;
   52         -
                    }
   53         -
                    if variant.is_some() {
   54         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   55         -
                            "encountered mixed variants in union",
   56         -
                        ));
   57         -
                    }
   58         -
                    variant = match key.as_ref() {
   59         -
                        "text" => Some(crate::types::GuardrailConverseContentBlock::Text(
   60         -
                            crate::protocol_serde::shape_guardrail_converse_text_block::de_guardrail_converse_text_block(tokens, _value)?
   61         -
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'text' cannot be null"))?,
   62         -
                        )),
   63         -
                        "image" => Some(crate::types::GuardrailConverseContentBlock::Image(
   64         -
                            crate::protocol_serde::shape_guardrail_converse_image_block::de_guardrail_converse_image_block(tokens, _value)?
   65         -
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'image' cannot be null"))?,
   66         -
                        )),
   67         -
                        _ => {
   68         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   69         -
                            Some(crate::types::GuardrailConverseContentBlock::Unknown)
   70         -
                        }
   71         -
                    };
   72         -
                }
   73         -
                other => {
   74         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   75         -
                        "expected object key or end object, found: {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 +45,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         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<
    6         -
    Option<::std::vec::Vec<crate::types::GuardrailConverseContentQualifier>>,
    7         -
    ::aws_smithy_json::deserialize::error::DeserializeError,
    8         -
>
    9         -
where
   10         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
   11         -
{
   12         -
    match tokens.next().transpose()? {
   13         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   14         -
        Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => {
   15         -
            let mut items = Vec::new();
   16         -
            loop {
   17         -
                match tokens.peek() {
   18         -
                    Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => {
   19         -
                        tokens.next().transpose().unwrap();
   20         -
                        break;
   21         -
                    }
   22         -
                    _ => {
   23         -
                        let value = ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   24         -
                            .map(|s| {
   25         -
                                s.to_unescaped()
   26         -
                                    .map(|u| crate::types::GuardrailConverseContentQualifier::from(u.as_ref()))
   27         -
                            })
   28         -
                            .transpose()?;
   29         -
                        if let Some(value) = value {
   30         -
                            items.push(value);
   31         -
                        } else {
   32         -
                            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   33         -
                                "dense list cannot contain null values",
   34         -
                            ));
   35         -
                        }
   36         -
                    }
   37         -
                }
   38         -
            }
   39         -
            Ok(Some(items))
   40         -
        }
   41         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   42         -
            "expected start array or null",
   43         -
        )),
   44         -
    }
   45         -
}

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         -
    _value: &'a [u8],
   21         -
) -> ::std::result::Result<Option<crate::types::GuardrailConverseImageBlock>, ::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         -
    match tokens.next().transpose()? {
   26         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   27         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   28         -
            #[allow(unused_mut)]
   29         -
            let mut builder = crate::types::builders::GuardrailConverseImageBlockBuilder::default();
   30         -
            loop {
   31         -
                match tokens.next().transpose()? {
   32         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   33         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   34         -
                        "format" => {
   35         -
                            builder = builder.set_format(
   36         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   37         -
                                    .map(|s| s.to_unescaped().map(|u| crate::types::GuardrailConverseImageFormat::from(u.as_ref())))
   38         -
                                    .transpose()?,
   39         -
                            );
   40         -
                        }
   41         -
                        "source" => {
   42         -
                            builder = builder.set_source(
   43         -
                                crate::protocol_serde::shape_guardrail_converse_image_source::de_guardrail_converse_image_source(tokens, _value)?,
   44         -
                            );
   45         -
                        }
   46         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   47         -
                    },
   48         -
                    other => {
   49         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   50         -
                            "expected object key or end object, found: {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         -
    _value: &'a [u8],
   22         -
) -> ::std::result::Result<Option<crate::types::GuardrailConverseImageSource>, ::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         -
                        "bytes" => Some(crate::types::GuardrailConverseImageSource::Bytes(
   51         -
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
   52         -
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'bytes' cannot be null"))?,
   53         -
                        )),
   54         -
                        _ => {
   55         -
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
   56         -
                            Some(crate::types::GuardrailConverseImageSource::Unknown)
   57         -
                        }
   58         -
                    };
   59         -
                }
   60         -
                other => {
   61         -
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   62         -
                        "expected object key or end object, found: {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         -
}

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

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

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

@@ -1,0 +16,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_guardrail_image_block(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::GuardrailImageBlock,
    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_image_source::ser_guardrail_image_source(&mut object_2, var_1)?;
   13         -
        object_2.finish();
   14         -
    }
   15         -
    Ok(())
   16         -
}

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

@@ -1,0 +17,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_guardrail_image_source(
    3         -
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::GuardrailImageSource,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    match input {
    7         -
        crate::types::GuardrailImageSource::Bytes(inner) => {
    8         -
            object_2.key("bytes").string_unchecked(&::aws_smithy_types::base64::encode(inner));
    9         -
        }
   10         -
        crate::types::GuardrailImageSource::Unknown => {
   11         -
            return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
   12         -
                "GuardrailImageSource",
   13         -
            ))
   14         -
        }
   15         -
    }
   16         -
    Ok(())
   17         -
}

tmp-codegen-diff/aws-sdk/sdk/bedrockruntime/src/protocol_serde/shape_guardrail_output_content.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_output_content<'a, I>(
    3         -
    tokens: &mut ::std::iter::Peekable<I>,
    4         -
    _value: &'a [u8],
    5         -
) -> ::std::result::Result<Option<crate::types::GuardrailOutputContent>, ::aws_smithy_json::deserialize::error::DeserializeError>
    6         -
where
    7         -
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
    8         -
{
    9         -
    match tokens.next().transpose()? {
   10         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   11         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   12         -
            #[allow(unused_mut)]
   13         -
            let mut builder = crate::types::builders::GuardrailOutputContentBuilder::default();
   14         -
            loop {
   15         -
                match tokens.next().transpose()? {
   16         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   17         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   18         -
                        "text" => {
   19         -
                            builder = builder.set_text(
   20         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   21         -
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   22         -
                                    .transpose()?,
   23         -
                            );
   24         -
                        }
   25         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   26         -
                    },
   27         -
                    other => {
   28         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   29         -
                            "expected object key or end object, found: {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_output_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_guardrail_output_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::GuardrailOutputContent>>, ::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_guardrail_output_content::de_guardrail_output_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_guardrail_stream_configuration.rs

@@ -1,0 +19,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_guardrail_stream_configuration(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::GuardrailStreamConfiguration,
    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         -
    {
   16         -
        object.key("streamProcessingMode").string(input.stream_processing_mode.as_str());
   17         -
    }
   18         -
    Ok(())
   19         -
}

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

@@ -1,0 +19,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_guardrail_text_block(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::GuardrailTextBlock,
    5         -
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    {
    7         -
        object.key("text").string(input.text.as_str());
    8         -
    }
    9         -
    if let Some(var_1) = &input.qualifiers {
   10         -
        let mut array_2 = object.key("qualifiers").start_array();
   11         -
        for item_3 in var_1 {
   12         -
            {
   13         -
                array_2.value().string(item_3.as_str());
   14         -
            }
   15         -
        }
   16         -
        array_2.finish();
   17         -
    }
   18         -
    Ok(())
   19         -
}

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

@@ -1,0 +61,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_image_block(
    3         -
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
    4         -
    input: &crate::types::ImageBlock,
    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_image_source::ser_image_source(&mut object_2, var_1)?;
   13         -
        object_2.finish();
   14         -
    }
   15         -
    Ok(())
   16         -
}
   17         -
   18         -
pub(crate) fn de_image_block<'a, I>(
   19         -
    tokens: &mut ::std::iter::Peekable<I>,
   20         -
    _value: &'a [u8],
   21         -
) -> ::std::result::Result<Option<crate::types::ImageBlock>, ::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         -
    match tokens.next().transpose()? {
   26         -
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
   27         -
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
   28         -
            #[allow(unused_mut)]
   29         -
            let mut builder = crate::types::builders::ImageBlockBuilder::default();
   30         -
            loop {
   31         -
                match tokens.next().transpose()? {
   32         -
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   33         -
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   34         -
                        "format" => {
   35         -
                            builder = builder.set_format(
   36         -
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
   37         -
                                    .map(|s| s.to_unescaped().map(|u| crate::types::ImageFormat::from(u.as_ref())))
   38         -
                                    .transpose()?,
   39         -
                            );
   40         -
                        }
   41         -
                        "source" => {
   42         -
                            builder = builder.set_source(crate::protocol_serde::shape_image_source::de_image_source(tokens, _value)?);
   43         -
                        }
   44         -
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   45         -
                    },
   46         -
                    other => {
   47         -
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   48         -
                            "expected object key or end object, found: {other:?}"
   49         -
                        )))
   50         -
                    }
   51         -
                }
   52         -
            }
   53         -
            Ok(Some(crate::serde_util::image_block_correct_errors(builder).build().map_err(|err| {
   54         -
                ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
   55         -
            })?))
   56         -
        }
   57         -
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
   58         -
            "expected start object or null",
   59         -
        )),
   60         -
    }
   61         -
}

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

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