1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_test_body_structure_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::test_body_structure::TestBodyStructureOutput, crate::operation::test_body_structure::TestBodyStructureError>
|
8 - | {
|
9 - | #[allow(unused_mut)]
|
10 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
11 - | .map_err(crate::operation::test_body_structure::TestBodyStructureError::unhandled)?;
|
12 - | let generic = generic_builder.build();
|
13 - | Err(crate::operation::test_body_structure::TestBodyStructureError::generic(generic))
|
14 - | }
|
15 - |
|
16 - | #[allow(clippy::unnecessary_wraps)]
|
17 - | pub fn de_test_body_structure_http_response(
|
18 - | _response_status: u16,
|
19 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
20 - | _response_body: &[u8],
|
21 - | ) -> std::result::Result<crate::operation::test_body_structure::TestBodyStructureOutput, crate::operation::test_body_structure::TestBodyStructureError>
|
22 - | {
|
23 - | Ok({
|
24 - | #[allow(unused_mut)]
|
25 - | let mut output = crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder::default();
|
26 - | output = crate::protocol_serde::shape_test_body_structure::de_test_body_structure(_response_body, output)
|
27 - | .map_err(crate::operation::test_body_structure::TestBodyStructureError::unhandled)?;
|
28 - | output = output.set_test_id(
|
29 - | crate::protocol_serde::shape_test_body_structure_output::de_test_id_header(_response_headers).map_err(|_| {
|
30 - | crate::operation::test_body_structure::TestBodyStructureError::unhandled("Failed to parse testId from header `x-amz-test-id")
|
31 - | })?,
|
32 - | );
|
33 - | output.build()
|
34 - | })
|
35 - | }
|
36 - |
|
37 - | pub fn ser_test_body_structure_headers(
|
38 - | input: &crate::operation::test_body_structure::TestBodyStructureInput,
|
39 - | mut builder: ::http_1x::request::Builder,
|
40 - | ) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
41 - | if let ::std::option::Option::Some(inner_1) = &input.test_id {
|
42 - | let formatted_2 = inner_1.as_str();
|
43 - | let header_value = formatted_2;
|
44 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
45 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
46 - | "test_id",
|
47 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
48 - | )
|
49 - | })?;
|
50 - | builder = builder.header("x-amz-test-id", header_value);
|
51 - | }
|
52 - | Ok(builder)
|
53 - | }
|
54 - |
|
55 - | pub fn ser_test_body_structure_input(
|
56 - | input: &crate::operation::test_body_structure::TestBodyStructureInput,
|
57 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
58 - | let mut out = String::new();
|
59 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
60 - | crate::protocol_serde::shape_test_body_structure_input::ser_test_body_structure_input_input(&mut object, input)?;
|
61 - | object.finish();
|
62 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
63 - | }
|
64 - |
|
65 - | pub(crate) fn de_test_body_structure(
|
66 - | _value: &[u8],
|
67 - | mut builder: crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder,
|
68 - | ) -> ::std::result::Result<
|
69 - | crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder,
|
70 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
71 - | > {
|
72 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
73 - | let tokens = &mut tokens_owned;
|
74 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
75 - | loop {
|
76 - | match tokens.next().transpose()? {
|
77 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
78 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
79 - | "testConfig" => {
|
80 - | builder = builder.set_test_config(crate::protocol_serde::shape_test_config::de_test_config(tokens, _value)?);
|
81 - | }
|
82 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
83 - | },
|
84 - | other => {
|
85 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
86 - | "expected object key or end object, found: {other:?}"
|
87 - | )))
|
88 - | }
|
89 - | }
|
90 - | }
|
91 - | if tokens.next().is_some() {
|
92 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
93 - | "found more JSON tokens after completing parsing",
|
94 - | ));
|
95 - | }
|
96 - | Ok(builder)
|
97 - | }
|