AWS SDK

AWS SDK

rev. 5673a7a38b4a4a6973351c005d572863803729fe

Files changed:

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

@@ -1,1 +55,90 @@
    8      8   
    }
    9      9   
    if let Some(var_2) = &input.additional_model_response_field_paths {
   10     10   
        let mut array_3 = object.key("additionalModelResponseFieldPaths").start_array();
   11     11   
        for item_4 in var_2 {
   12     12   
            {
   13     13   
                array_3.value().string(item_4.as_str());
   14     14   
            }
   15     15   
        }
   16     16   
        array_3.finish();
   17     17   
    }
   18         -
    if let Some(var_5) = &input.inference_config {
          18  +
    if let Some(var_5) = &input.guardrail_config {
   19     19   
        #[allow(unused_mut)]
   20         -
        let mut object_6 = object.key("inferenceConfig").start_object();
   21         -
        crate::protocol_serde::shape_inference_configuration::ser_inference_configuration(&mut object_6, var_5)?;
          20  +
        let mut object_6 = object.key("guardrailConfig").start_object();
          21  +
        crate::protocol_serde::shape_guardrail_configuration::ser_guardrail_configuration(&mut object_6, var_5)?;
   22     22   
        object_6.finish();
   23     23   
    }
   24         -
    if let Some(var_7) = &input.messages {
   25         -
        let mut array_8 = object.key("messages").start_array();
   26         -
        for item_9 in var_7 {
          24  +
    if let Some(var_7) = &input.inference_config {
          25  +
        #[allow(unused_mut)]
          26  +
        let mut object_8 = object.key("inferenceConfig").start_object();
          27  +
        crate::protocol_serde::shape_inference_configuration::ser_inference_configuration(&mut object_8, var_7)?;
          28  +
        object_8.finish();
          29  +
    }
          30  +
    if let Some(var_9) = &input.messages {
          31  +
        let mut array_10 = object.key("messages").start_array();
          32  +
        for item_11 in var_9 {
   27     33   
            {
   28     34   
                #[allow(unused_mut)]
   29         -
                let mut object_10 = array_8.value().start_object();
   30         -
                crate::protocol_serde::shape_message::ser_message(&mut object_10, item_9)?;
   31         -
                object_10.finish();
          35  +
                let mut object_12 = array_10.value().start_object();
          36  +
                crate::protocol_serde::shape_message::ser_message(&mut object_12, item_11)?;
          37  +
                object_12.finish();
   32     38   
            }
   33     39   
        }
   34         -
        array_8.finish();
          40  +
        array_10.finish();
   35     41   
    }
   36         -
    if let Some(var_11) = &input.system {
   37         -
        let mut array_12 = object.key("system").start_array();
   38         -
        for item_13 in var_11 {
          42  +
    if let Some(var_13) = &input.performance_config {
          43  +
        #[allow(unused_mut)]
          44  +
        let mut object_14 = object.key("performanceConfig").start_object();
          45  +
        crate::protocol_serde::shape_performance_configuration::ser_performance_configuration(&mut object_14, var_13)?;
          46  +
        object_14.finish();
          47  +
    }
          48  +
    if let Some(var_15) = &input.prompt_variables {
          49  +
        #[allow(unused_mut)]
          50  +
        let mut object_16 = object.key("promptVariables").start_object();
          51  +
        for (key_17, value_18) in var_15 {
   39     52   
            {
   40     53   
                #[allow(unused_mut)]
   41         -
                let mut object_14 = array_12.value().start_object();
   42         -
                crate::protocol_serde::shape_system_content_block::ser_system_content_block(&mut object_14, item_13)?;
   43         -
                object_14.finish();
          54  +
                let mut object_19 = object_16.key(key_17.as_str()).start_object();
          55  +
                crate::protocol_serde::shape_prompt_variable_values::ser_prompt_variable_values(&mut object_19, value_18)?;
          56  +
                object_19.finish();
   44     57   
            }
   45     58   
        }
   46         -
        array_12.finish();
          59  +
        object_16.finish();
   47     60   
    }
   48         -
    if let Some(var_15) = &input.tool_config {
          61  +
    if let Some(var_20) = &input.request_metadata {
   49     62   
        #[allow(unused_mut)]
   50         -
        let mut object_16 = object.key("toolConfig").start_object();
   51         -
        crate::protocol_serde::shape_tool_configuration::ser_tool_configuration(&mut object_16, var_15)?;
   52         -
        object_16.finish();
          63  +
        let mut object_21 = object.key("requestMetadata").start_object();
          64  +
        for (key_22, value_23) in var_20 {
          65  +
            {
          66  +
                object_21.key(key_22.as_str()).string(value_23.as_str());
          67  +
            }
          68  +
        }
          69  +
        object_21.finish();
          70  +
    }
          71  +
    if let Some(var_24) = &input.system {
          72  +
        let mut array_25 = object.key("system").start_array();
          73  +
        for item_26 in var_24 {
          74  +
            {
          75  +
                #[allow(unused_mut)]
          76  +
                let mut object_27 = array_25.value().start_object();
          77  +
                crate::protocol_serde::shape_system_content_block::ser_system_content_block(&mut object_27, item_26)?;
          78  +
                object_27.finish();
          79  +
            }
          80  +
        }
          81  +
        array_25.finish();
          82  +
    }
          83  +
    if let Some(var_28) = &input.tool_config {
          84  +
        #[allow(unused_mut)]
          85  +
        let mut object_29 = object.key("toolConfig").start_object();
          86  +
        crate::protocol_serde::shape_tool_configuration::ser_tool_configuration(&mut object_29, var_28)?;
          87  +
        object_29.finish();
   53     88   
    }
   54     89   
    Ok(())
   55     90   
}

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

@@ -73,73 +132,148 @@
   93     93   
                output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
   94     94   
                    .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
   95     95   
                let output = output.meta(generic);
   96     96   
                output.build()
   97     97   
            };
   98     98   
            if tmp.message.is_none() {
   99     99   
                tmp.message = _error_message;
  100    100   
            }
  101    101   
            tmp
  102    102   
        }),
         103  +
        "ServiceUnavailableException" => crate::operation::converse_stream::ConverseStreamError::ServiceUnavailableException({
         104  +
            #[allow(unused_mut)]
         105  +
            let mut tmp = {
         106  +
                #[allow(unused_mut)]
         107  +
                let mut output = crate::types::error::builders::ServiceUnavailableExceptionBuilder::default();
         108  +
                output =
         109  +
                    crate::protocol_serde::shape_service_unavailable_exception::de_service_unavailable_exception_json_err(_response_body, output)
         110  +
                        .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
         111  +
                let output = output.meta(generic);
         112  +
                output.build()
         113  +
            };
         114  +
            if tmp.message.is_none() {
         115  +
                tmp.message = _error_message;
         116  +
            }
         117  +
            tmp
         118  +
        }),
  103    119   
        "InternalServerException" => crate::operation::converse_stream::ConverseStreamError::InternalServerException({
  104    120   
            #[allow(unused_mut)]
  105    121   
            let mut tmp = {
  106    122   
                #[allow(unused_mut)]
  107    123   
                let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
  108    124   
                output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
  109    125   
                    .map_err(crate::operation::converse_stream::ConverseStreamError::unhandled)?;
  110    126   
                let output = output.meta(generic);
  111    127   
                output.build()
  112    128   
            };

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

@@ -1,1 +55,90 @@
    8      8   
    }
    9      9   
    if let Some(var_2) = &input.additional_model_response_field_paths {
   10     10   
        let mut array_3 = object.key("additionalModelResponseFieldPaths").start_array();
   11     11   
        for item_4 in var_2 {
   12     12   
            {
   13     13   
                array_3.value().string(item_4.as_str());
   14     14   
            }
   15     15   
        }
   16     16   
        array_3.finish();
   17     17   
    }
   18         -
    if let Some(var_5) = &input.inference_config {
          18  +
    if let Some(var_5) = &input.guardrail_config {
   19     19   
        #[allow(unused_mut)]
   20         -
        let mut object_6 = object.key("inferenceConfig").start_object();
   21         -
        crate::protocol_serde::shape_inference_configuration::ser_inference_configuration(&mut object_6, var_5)?;
          20  +
        let mut object_6 = object.key("guardrailConfig").start_object();
          21  +
        crate::protocol_serde::shape_guardrail_stream_configuration::ser_guardrail_stream_configuration(&mut object_6, var_5)?;
   22     22   
        object_6.finish();
   23     23   
    }
   24         -
    if let Some(var_7) = &input.messages {
   25         -
        let mut array_8 = object.key("messages").start_array();
   26         -
        for item_9 in var_7 {
          24  +
    if let Some(var_7) = &input.inference_config {
          25  +
        #[allow(unused_mut)]
          26  +
        let mut object_8 = object.key("inferenceConfig").start_object();
          27  +
        crate::protocol_serde::shape_inference_configuration::ser_inference_configuration(&mut object_8, var_7)?;
          28  +
        object_8.finish();
          29  +
    }
          30  +
    if let Some(var_9) = &input.messages {
          31  +
        let mut array_10 = object.key("messages").start_array();
          32  +
        for item_11 in var_9 {
   27     33   
            {
   28     34   
                #[allow(unused_mut)]
   29         -
                let mut object_10 = array_8.value().start_object();
   30         -
                crate::protocol_serde::shape_message::ser_message(&mut object_10, item_9)?;
   31         -
                object_10.finish();
          35  +
                let mut object_12 = array_10.value().start_object();
          36  +
                crate::protocol_serde::shape_message::ser_message(&mut object_12, item_11)?;
          37  +
                object_12.finish();
   32     38   
            }
   33     39   
        }
   34         -
        array_8.finish();
          40  +
        array_10.finish();
   35     41   
    }
   36         -
    if let Some(var_11) = &input.system {
   37         -
        let mut array_12 = object.key("system").start_array();
   38         -
        for item_13 in var_11 {
          42  +
    if let Some(var_13) = &input.performance_config {
          43  +
        #[allow(unused_mut)]
          44  +
        let mut object_14 = object.key("performanceConfig").start_object();
          45  +
        crate::protocol_serde::shape_performance_configuration::ser_performance_configuration(&mut object_14, var_13)?;
          46  +
        object_14.finish();
          47  +
    }
          48  +
    if let Some(var_15) = &input.prompt_variables {
          49  +
        #[allow(unused_mut)]
          50  +
        let mut object_16 = object.key("promptVariables").start_object();
          51  +
        for (key_17, value_18) in var_15 {
   39     52   
            {
   40     53   
                #[allow(unused_mut)]
   41         -
                let mut object_14 = array_12.value().start_object();
   42         -
                crate::protocol_serde::shape_system_content_block::ser_system_content_block(&mut object_14, item_13)?;
   43         -
                object_14.finish();
          54  +
                let mut object_19 = object_16.key(key_17.as_str()).start_object();
          55  +
                crate::protocol_serde::shape_prompt_variable_values::ser_prompt_variable_values(&mut object_19, value_18)?;
          56  +
                object_19.finish();
   44     57   
            }
   45     58   
        }
   46         -
        array_12.finish();
          59  +
        object_16.finish();
   47     60   
    }
   48         -
    if let Some(var_15) = &input.tool_config {
          61  +
    if let Some(var_20) = &input.request_metadata {
   49     62   
        #[allow(unused_mut)]
   50         -
        let mut object_16 = object.key("toolConfig").start_object();
   51         -
        crate::protocol_serde::shape_tool_configuration::ser_tool_configuration(&mut object_16, var_15)?;
   52         -
        object_16.finish();
          63  +
        let mut object_21 = object.key("requestMetadata").start_object();
          64  +
        for (key_22, value_23) in var_20 {
          65  +
            {
          66  +
                object_21.key(key_22.as_str()).string(value_23.as_str());
          67  +
            }
          68  +
        }
          69  +
        object_21.finish();
          70  +
    }
          71  +
    if let Some(var_24) = &input.system {
          72  +
        let mut array_25 = object.key("system").start_array();
          73  +
        for item_26 in var_24 {
          74  +
            {
          75  +
                #[allow(unused_mut)]
          76  +
                let mut object_27 = array_25.value().start_object();
          77  +
                crate::protocol_serde::shape_system_content_block::ser_system_content_block(&mut object_27, item_26)?;
          78  +
                object_27.finish();
          79  +
            }
          80  +
        }
          81  +
        array_25.finish();
          82  +
    }
          83  +
    if let Some(var_28) = &input.tool_config {
          84  +
        #[allow(unused_mut)]
          85  +
        let mut object_29 = object.key("toolConfig").start_object();
          86  +
        crate::protocol_serde::shape_tool_configuration::ser_tool_configuration(&mut object_29, var_28)?;
          87  +
        object_29.finish();
   53     88   
    }
   54     89   
    Ok(())
   55     90   
}

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

@@ -8,8 +54,62 @@
   28     28   
            loop {
   29     29   
                match tokens.next().transpose()? {
   30     30   
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   31     31   
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
   32     32   
                        "usage" => {
   33     33   
                            builder = builder.set_usage(crate::protocol_serde::shape_token_usage::de_token_usage(tokens)?);
   34     34   
                        }
   35     35   
                        "metrics" => {
   36     36   
                            builder = builder.set_metrics(crate::protocol_serde::shape_converse_stream_metrics::de_converse_stream_metrics(tokens)?);
   37     37   
                        }
          38  +
                        "trace" => {
          39  +
                            builder = builder.set_trace(crate::protocol_serde::shape_converse_stream_trace::de_converse_stream_trace(tokens)?);
          40  +
                        }
          41  +
                        "performanceConfig" => {
          42  +
                            builder = builder.set_performance_config(
          43  +
                                crate::protocol_serde::shape_performance_configuration::de_performance_configuration(tokens)?,
          44  +
                            );
          45  +
                        }
   38     46   
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
   39     47   
                    },
   40     48   
                    other => {
   41     49   
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
   42     50   
                            "expected object key or end object, found: {:?}",
   43     51   
                            other
   44     52   
                        )))
   45     53   
                    }
   46     54   
                }
   47     55   
            }

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

@@ -0,1 +0,41 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_converse_stream_trace<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<Option<crate::types::ConverseStreamTrace>, ::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::ConverseStreamTraceBuilder::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  +
                        "guardrail" => {
          18  +
                            builder = builder.set_guardrail(crate::protocol_serde::shape_guardrail_trace_assessment::de_guardrail_trace_assessment(
          19  +
                                tokens,
          20  +
                            )?);
          21  +
                        }
          22  +
                        "promptRouter" => {
          23  +
                            builder = builder.set_prompt_router(crate::protocol_serde::shape_prompt_router_trace::de_prompt_router_trace(tokens)?);
          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: {:?}",
          30  +
                            other
          31  +
                        )))
          32  +
                    }
          33  +
                }
          34  +
            }
          35  +
            Ok(Some(builder.build()))
          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_converse_trace.rs

@@ -0,1 +0,41 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_converse_trace<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<Option<crate::types::ConverseTrace>, ::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::ConverseTraceBuilder::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  +
                        "guardrail" => {
          18  +
                            builder = builder.set_guardrail(crate::protocol_serde::shape_guardrail_trace_assessment::de_guardrail_trace_assessment(
          19  +
                                tokens,
          20  +
                            )?);
          21  +
                        }
          22  +
                        "promptRouter" => {
          23  +
                            builder = builder.set_prompt_router(crate::protocol_serde::shape_prompt_router_trace::de_prompt_router_trace(tokens)?);
          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: {:?}",
          30  +
                            other
          31  +
                        )))
          32  +
                    }
          33  +
                }
          34  +
            }
          35  +
            Ok(Some(builder.build()))
          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_document_block.rs

@@ -0,1 +0,90 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_document_block(
           3  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::types::DocumentBlock,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    {
           7  +
        object.key("format").string(input.format.as_str());
           8  +
    }
           9  +
    {
          10  +
        object.key("name").string(input.name.as_str());
          11  +
    }
          12  +
    if let Some(var_1) = &input.source {
          13  +
        #[allow(unused_mut)]
          14  +
        let mut object_2 = object.key("source").start_object();
          15  +
        crate::protocol_serde::shape_document_source::ser_document_source(&mut object_2, var_1)?;
          16  +
        object_2.finish();
          17  +
    }
          18  +
    if let Some(var_3) = &input.context {
          19  +
        object.key("context").string(var_3.as_str());
          20  +
    }
          21  +
    if let Some(var_4) = &input.citations {
          22  +
        #[allow(unused_mut)]
          23  +
        let mut object_5 = object.key("citations").start_object();
          24  +
        crate::protocol_serde::shape_citations_config::ser_citations_config(&mut object_5, var_4)?;
          25  +
        object_5.finish();
          26  +
    }
          27  +
    Ok(())
          28  +
}
          29  +
          30  +
pub(crate) fn de_document_block<'a, I>(
          31  +
    tokens: &mut ::std::iter::Peekable<I>,
          32  +
) -> ::std::result::Result<Option<crate::types::DocumentBlock>, ::aws_smithy_json::deserialize::error::DeserializeError>
          33  +
where
          34  +
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
          35  +
{
          36  +
    match tokens.next().transpose()? {
          37  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          38  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          39  +
            #[allow(unused_mut)]
          40  +
            let mut builder = crate::types::builders::DocumentBlockBuilder::default();
          41  +
            loop {
          42  +
                match tokens.next().transpose()? {
          43  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          44  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          45  +
                        "format" => {
          46  +
                            builder = builder.set_format(
          47  +
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          48  +
                                    .map(|s| s.to_unescaped().map(|u| crate::types::DocumentFormat::from(u.as_ref())))
          49  +
                                    .transpose()?,
          50  +
                            );
          51  +
                        }
          52  +
                        "name" => {
          53  +
                            builder = builder.set_name(
          54  +
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          55  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          56  +
                                    .transpose()?,
          57  +
                            );
          58  +
                        }
          59  +
                        "source" => {
          60  +
                            builder = builder.set_source(crate::protocol_serde::shape_document_source::de_document_source(tokens)?);
          61  +
                        }
          62  +
                        "context" => {
          63  +
                            builder = builder.set_context(
          64  +
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          65  +
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          66  +
                                    .transpose()?,
          67  +
                            );
          68  +
                        }
          69  +
                        "citations" => {
          70  +
                            builder = builder.set_citations(crate::protocol_serde::shape_citations_config::de_citations_config(tokens)?);
          71  +
                        }
          72  +
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          73  +
                    },
          74  +
                    other => {
          75  +
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          76  +
                            "expected object key or end object, found: {:?}",
          77  +
                            other
          78  +
                        )))
          79  +
                    }
          80  +
                }
          81  +
            }
          82  +
            Ok(Some(crate::serde_util::document_block_correct_errors(builder).build().map_err(
          83  +
                |err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err),
          84  +
            )?))
          85  +
        }
          86  +
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          87  +
            "expected start object or null",
          88  +
        )),
          89  +
    }
          90  +
}

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

@@ -0,1 +0,79 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_document_char_location(
           3  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::types::DocumentCharLocation,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    if let Some(var_1) = &input.document_index {
           7  +
        object.key("documentIndex").number(
           8  +
            #[allow(clippy::useless_conversion)]
           9  +
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
          10  +
        );
          11  +
    }
          12  +
    if let Some(var_2) = &input.start {
          13  +
        object.key("start").number(
          14  +
            #[allow(clippy::useless_conversion)]
          15  +
            ::aws_smithy_types::Number::NegInt((*var_2).into()),
          16  +
        );
          17  +
    }
          18  +
    if let Some(var_3) = &input.end {
          19  +
        object.key("end").number(
          20  +
            #[allow(clippy::useless_conversion)]
          21  +
            ::aws_smithy_types::Number::NegInt((*var_3).into()),
          22  +
        );
          23  +
    }
          24  +
    Ok(())
          25  +
}
          26  +
          27  +
pub(crate) fn de_document_char_location<'a, I>(
          28  +
    tokens: &mut ::std::iter::Peekable<I>,
          29  +
) -> ::std::result::Result<Option<crate::types::DocumentCharLocation>, ::aws_smithy_json::deserialize::error::DeserializeError>
          30  +
where
          31  +
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
          32  +
{
          33  +
    match tokens.next().transpose()? {
          34  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          35  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          36  +
            #[allow(unused_mut)]
          37  +
            let mut builder = crate::types::builders::DocumentCharLocationBuilder::default();
          38  +
            loop {
          39  +
                match tokens.next().transpose()? {
          40  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          41  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          42  +
                        "documentIndex" => {
          43  +
                            builder = builder.set_document_index(
          44  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          45  +
                                    .map(i32::try_from)
          46  +
                                    .transpose()?,
          47  +
                            );
          48  +
                        }
          49  +
                        "start" => {
          50  +
                            builder = builder.set_start(
          51  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          52  +
                                    .map(i32::try_from)
          53  +
                                    .transpose()?,
          54  +
                            );
          55  +
                        }
          56  +
                        "end" => {
          57  +
                            builder = builder.set_end(
          58  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          59  +
                                    .map(i32::try_from)
          60  +
                                    .transpose()?,
          61  +
                            );
          62  +
                        }
          63  +
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          64  +
                    },
          65  +
                    other => {
          66  +
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          67  +
                            "expected object key or end object, found: {:?}",
          68  +
                            other
          69  +
                        )))
          70  +
                    }
          71  +
                }
          72  +
            }
          73  +
            Ok(Some(builder.build()))
          74  +
        }
          75  +
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          76  +
            "expected start object or null",
          77  +
        )),
          78  +
    }
          79  +
}

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

@@ -0,1 +0,79 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_document_chunk_location(
           3  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::types::DocumentChunkLocation,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    if let Some(var_1) = &input.document_index {
           7  +
        object.key("documentIndex").number(
           8  +
            #[allow(clippy::useless_conversion)]
           9  +
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
          10  +
        );
          11  +
    }
          12  +
    if let Some(var_2) = &input.start {
          13  +
        object.key("start").number(
          14  +
            #[allow(clippy::useless_conversion)]
          15  +
            ::aws_smithy_types::Number::NegInt((*var_2).into()),
          16  +
        );
          17  +
    }
          18  +
    if let Some(var_3) = &input.end {
          19  +
        object.key("end").number(
          20  +
            #[allow(clippy::useless_conversion)]
          21  +
            ::aws_smithy_types::Number::NegInt((*var_3).into()),
          22  +
        );
          23  +
    }
          24  +
    Ok(())
          25  +
}
          26  +
          27  +
pub(crate) fn de_document_chunk_location<'a, I>(
          28  +
    tokens: &mut ::std::iter::Peekable<I>,
          29  +
) -> ::std::result::Result<Option<crate::types::DocumentChunkLocation>, ::aws_smithy_json::deserialize::error::DeserializeError>
          30  +
where
          31  +
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
          32  +
{
          33  +
    match tokens.next().transpose()? {
          34  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          35  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          36  +
            #[allow(unused_mut)]
          37  +
            let mut builder = crate::types::builders::DocumentChunkLocationBuilder::default();
          38  +
            loop {
          39  +
                match tokens.next().transpose()? {
          40  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          41  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          42  +
                        "documentIndex" => {
          43  +
                            builder = builder.set_document_index(
          44  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          45  +
                                    .map(i32::try_from)
          46  +
                                    .transpose()?,
          47  +
                            );
          48  +
                        }
          49  +
                        "start" => {
          50  +
                            builder = builder.set_start(
          51  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          52  +
                                    .map(i32::try_from)
          53  +
                                    .transpose()?,
          54  +
                            );
          55  +
                        }
          56  +
                        "end" => {
          57  +
                            builder = builder.set_end(
          58  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          59  +
                                    .map(i32::try_from)
          60  +
                                    .transpose()?,
          61  +
                            );
          62  +
                        }
          63  +
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          64  +
                    },
          65  +
                    other => {
          66  +
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          67  +
                            "expected object key or end object, found: {:?}",
          68  +
                            other
          69  +
                        )))
          70  +
                    }
          71  +
                }
          72  +
            }
          73  +
            Ok(Some(builder.build()))
          74  +
        }
          75  +
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          76  +
            "expected start object or null",
          77  +
        )),
          78  +
    }
          79  +
}

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

@@ -0,1 +0,81 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_document_content_block(
           3  +
    object_4: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::types::DocumentContentBlock,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    match input {
           7  +
        crate::types::DocumentContentBlock::Text(inner) => {
           8  +
            object_4.key("text").string(inner.as_str());
           9  +
        }
          10  +
        crate::types::DocumentContentBlock::Unknown => {
          11  +
            return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
          12  +
                "DocumentContentBlock",
          13  +
            ))
          14  +
        }
          15  +
    }
          16  +
    Ok(())
          17  +
}
          18  +
          19  +
pub(crate) fn de_document_content_block<'a, I>(
          20  +
    tokens: &mut ::std::iter::Peekable<I>,
          21  +
) -> ::std::result::Result<Option<crate::types::DocumentContentBlock>, ::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  +
                        "text" => Some(crate::types::DocumentContentBlock::Text(
          50  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          51  +
                                .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          52  +
                                .transpose()?
          53  +
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'text' cannot be null"))?,
          54  +
                        )),
          55  +
                        _ => {
          56  +
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          57  +
                            Some(crate::types::DocumentContentBlock::Unknown)
          58  +
                        }
          59  +
                    };
          60  +
                }
          61  +
                other => {
          62  +
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          63  +
                        "expected object key or end object, found: {:?}",
          64  +
                        other
          65  +
                    )))
          66  +
                }
          67  +
            }
          68  +
        },
          69  +
        _ => {
          70  +
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          71  +
                "expected start object or null",
          72  +
            ))
          73  +
        }
          74  +
    }
          75  +
    if variant.is_none() {
          76  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          77  +
            "Union did not contain a valid variant.",
          78  +
        ));
          79  +
    }
          80  +
    Ok(variant)
          81  +
}

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

@@ -0,1 +0,32 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub(crate) fn de_document_content_blocks<'a, I>(
           3  +
    tokens: &mut ::std::iter::Peekable<I>,
           4  +
) -> ::std::result::Result<Option<::std::vec::Vec<crate::types::DocumentContentBlock>>, ::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_document_content_block::de_document_content_block(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_document_page_location.rs

@@ -0,1 +0,79 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_document_page_location(
           3  +
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::types::DocumentPageLocation,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    if let Some(var_1) = &input.document_index {
           7  +
        object.key("documentIndex").number(
           8  +
            #[allow(clippy::useless_conversion)]
           9  +
            ::aws_smithy_types::Number::NegInt((*var_1).into()),
          10  +
        );
          11  +
    }
          12  +
    if let Some(var_2) = &input.start {
          13  +
        object.key("start").number(
          14  +
            #[allow(clippy::useless_conversion)]
          15  +
            ::aws_smithy_types::Number::NegInt((*var_2).into()),
          16  +
        );
          17  +
    }
          18  +
    if let Some(var_3) = &input.end {
          19  +
        object.key("end").number(
          20  +
            #[allow(clippy::useless_conversion)]
          21  +
            ::aws_smithy_types::Number::NegInt((*var_3).into()),
          22  +
        );
          23  +
    }
          24  +
    Ok(())
          25  +
}
          26  +
          27  +
pub(crate) fn de_document_page_location<'a, I>(
          28  +
    tokens: &mut ::std::iter::Peekable<I>,
          29  +
) -> ::std::result::Result<Option<crate::types::DocumentPageLocation>, ::aws_smithy_json::deserialize::error::DeserializeError>
          30  +
where
          31  +
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
          32  +
{
          33  +
    match tokens.next().transpose()? {
          34  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
          35  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
          36  +
            #[allow(unused_mut)]
          37  +
            let mut builder = crate::types::builders::DocumentPageLocationBuilder::default();
          38  +
            loop {
          39  +
                match tokens.next().transpose()? {
          40  +
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          41  +
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
          42  +
                        "documentIndex" => {
          43  +
                            builder = builder.set_document_index(
          44  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          45  +
                                    .map(i32::try_from)
          46  +
                                    .transpose()?,
          47  +
                            );
          48  +
                        }
          49  +
                        "start" => {
          50  +
                            builder = builder.set_start(
          51  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          52  +
                                    .map(i32::try_from)
          53  +
                                    .transpose()?,
          54  +
                            );
          55  +
                        }
          56  +
                        "end" => {
          57  +
                            builder = builder.set_end(
          58  +
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
          59  +
                                    .map(i32::try_from)
          60  +
                                    .transpose()?,
          61  +
                            );
          62  +
                        }
          63  +
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
          64  +
                    },
          65  +
                    other => {
          66  +
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          67  +
                            "expected object key or end object, found: {:?}",
          68  +
                            other
          69  +
                        )))
          70  +
                    }
          71  +
                }
          72  +
            }
          73  +
            Ok(Some(builder.build()))
          74  +
        }
          75  +
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          76  +
            "expected start object or null",
          77  +
        )),
          78  +
    }
          79  +
}

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

@@ -0,1 +0,116 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub fn ser_document_source(
           3  +
    object_2: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
           4  +
    input: &crate::types::DocumentSource,
           5  +
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    match input {
           7  +
        crate::types::DocumentSource::Bytes(inner) => {
           8  +
            object_2.key("bytes").string_unchecked(&::aws_smithy_types::base64::encode(inner));
           9  +
        }
          10  +
        crate::types::DocumentSource::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::DocumentSource::Text(inner) => {
          17  +
            object_2.key("text").string(inner.as_str());
          18  +
        }
          19  +
        crate::types::DocumentSource::Content(inner) => {
          20  +
            let mut array_2 = object_2.key("content").start_array();
          21  +
            for item_3 in inner {
          22  +
                {
          23  +
                    #[allow(unused_mut)]
          24  +
                    let mut object_4 = array_2.value().start_object();
          25  +
                    crate::protocol_serde::shape_document_content_block::ser_document_content_block(&mut object_4, item_3)?;
          26  +
                    object_4.finish();
          27  +
                }
          28  +
            }
          29  +
            array_2.finish();
          30  +
        }
          31  +
        crate::types::DocumentSource::Unknown => {
          32  +
            return Err(::aws_smithy_types::error::operation::SerializationError::unknown_variant(
          33  +
                "DocumentSource",
          34  +
            ))
          35  +
        }
          36  +
    }
          37  +
    Ok(())
          38  +
}
          39  +
          40  +
pub(crate) fn de_document_source<'a, I>(
          41  +
    tokens: &mut ::std::iter::Peekable<I>,
          42  +
) -> ::std::result::Result<Option<crate::types::DocumentSource>, ::aws_smithy_json::deserialize::error::DeserializeError>
          43  +
where
          44  +
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
          45  +
{
          46  +
    let mut variant = None;
          47  +
    match tokens.next().transpose()? {
          48  +
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => return Ok(None),
          49  +
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => loop {
          50  +
            match tokens.next().transpose()? {
          51  +
                Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
          52  +
                Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
          53  +
                    if let ::std::option::Option::Some(::std::result::Result::Ok(::aws_smithy_json::deserialize::Token::ValueNull { .. })) =
          54  +
                        tokens.peek()
          55  +
                    {
          56  +
                        let _ = tokens.next().expect("peek returned a token")?;
          57  +
                        continue;
          58  +
                    }
          59  +
                    let key = key.to_unescaped()?;
          60  +
                    if key == "__type" {
          61  +
                        ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          62  +
                        continue;
          63  +
                    }
          64  +
                    if variant.is_some() {
          65  +
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
          66  +
                            "encountered mixed variants in union",
          67  +
                        ));
          68  +
                    }
          69  +
                    variant = match key.as_ref() {
          70  +
                        "bytes" => Some(crate::types::DocumentSource::Bytes(
          71  +
                            ::aws_smithy_json::deserialize::token::expect_blob_or_null(tokens.next())?
          72  +
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'bytes' cannot be null"))?,
          73  +
                        )),
          74  +
                        "s3Location" => Some(crate::types::DocumentSource::S3Location(
          75  +
                            crate::protocol_serde::shape_s3_location::de_s3_location(tokens)?.ok_or_else(|| {
          76  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 's3Location' cannot be null")
          77  +
                            })?,
          78  +
                        )),
          79  +
                        "text" => Some(crate::types::DocumentSource::Text(
          80  +
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
          81  +
                                .map(|s| s.to_unescaped().map(|u| u.into_owned()))
          82  +
                                .transpose()?
          83  +
                                .ok_or_else(|| ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'text' cannot be null"))?,
          84  +
                        )),
          85  +
                        "content" => Some(crate::types::DocumentSource::Content(
          86  +
                            crate::protocol_serde::shape_document_content_blocks::de_document_content_blocks(tokens)?.ok_or_else(|| {
          87  +
                                ::aws_smithy_json::deserialize::error::DeserializeError::custom("value for 'content' cannot be null")
          88  +
                            })?,
          89  +
                        )),
          90  +
                        _ => {
          91  +
                            ::aws_smithy_json::deserialize::token::skip_value(tokens)?;
          92  +
                            Some(crate::types::DocumentSource::Unknown)
          93  +
                        }
          94  +
                    };
          95  +
                }
          96  +
                other => {
          97  +
                    return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
          98  +
                        "expected object key or end object, found: {:?}",
          99  +
                        other
         100  +
                    )))
         101  +
                }
         102  +
            }
         103  +
        },
         104  +
        _ => {
         105  +
            return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
         106  +
                "expected start object or null",
         107  +
            ))
         108  +
        }
         109  +
    }
         110  +
    if variant.is_none() {
         111  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
         112  +
            "Union did not contain a valid variant.",
         113  +
        ));
         114  +
    }
         115  +
    Ok(variant)
         116  +
}

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

@@ -0,1 +0,190 @@
           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)?,
         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: {:?}",
         179  +
                    other
         180  +
                )))
         181  +
            }
         182  +
        }
         183  +
    }
         184  +
    if tokens.next().is_some() {
         185  +
        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
         186  +
            "found more JSON tokens after completing parsing",
         187  +
        ));
         188  +
    }
         189  +
    Ok(builder)
         190  +
}