1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:516 */
|
2 3 | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ProtocolParserGenerator.kt:99 */
|
3 5 | pub fn de_test_body_structure_http_error(
|
4 6 | _response_status: u16,
|
5 7 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 8 | _response_body: &[u8],
|
7 9 | ) -> std::result::Result<crate::operation::test_body_structure::TestBodyStructureOutput, crate::operation::test_body_structure::TestBodyStructureError>
|
8 10 | {
|
11 + | /* RustType.kt:516 */
|
9 12 | #[allow(unused_mut)]
|
13 + | /* ProtocolParserGenerator.kt:106 */
|
10 14 | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
11 15 | .map_err(crate::operation::test_body_structure::TestBodyStructureError::unhandled)?;
|
16 + | /* ProtocolParserGenerator.kt:120 */
|
12 17 | let generic = generic_builder.build();
|
18 + | /* ProtocolParserGenerator.kt:185 */
|
13 19 | Err(crate::operation::test_body_structure::TestBodyStructureError::generic(generic))
|
20 + | /* ProtocolParserGenerator.kt:99 */
|
14 21 | }
|
15 22 |
|
23 + | /* RustType.kt:516 */
|
16 24 | #[allow(clippy::unnecessary_wraps)]
|
25 + | /* ProtocolParserGenerator.kt:71 */
|
17 26 | pub fn de_test_body_structure_http_response(
|
18 27 | _response_status: u16,
|
19 28 | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
20 29 | _response_body: &[u8],
|
21 30 | ) -> std::result::Result<crate::operation::test_body_structure::TestBodyStructureOutput, crate::operation::test_body_structure::TestBodyStructureError>
|
22 31 | {
|
32 + | /* ProtocolParserGenerator.kt:77 */
|
23 33 | Ok({
|
34 + | /* RustType.kt:516 */
|
24 35 | #[allow(unused_mut)]
|
36 + | /* ProtocolParserGenerator.kt:240 */
|
25 37 | let mut output = crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder::default();
|
38 + | /* ProtocolParserGenerator.kt:247 */
|
26 39 | output = crate::protocol_serde::shape_test_body_structure::de_test_body_structure(_response_body, output)
|
27 40 | .map_err(crate::operation::test_body_structure::TestBodyStructureError::unhandled)?;
|
41 + | /* ProtocolParserGenerator.kt:267 */
|
28 42 | output = output.set_test_id(
|
43 + | /* ProtocolParserGenerator.kt:302 */
|
29 44 | crate::protocol_serde::shape_test_body_structure_output::de_test_id_header(_response_headers).map_err(|_| {
|
30 45 | crate::operation::test_body_structure::TestBodyStructureError::unhandled("Failed to parse testId from header `x-amz-test-id")
|
31 - | })?,
|
46 + | })?, /* ProtocolParserGenerator.kt:267 */
|
32 47 | );
|
48 + | /* ClientBuilderInstantiator.kt:56 */
|
33 49 | output.build()
|
50 + | /* ProtocolParserGenerator.kt:77 */
|
34 51 | })
|
52 + | /* ProtocolParserGenerator.kt:71 */
|
35 53 | }
|
36 54 |
|
55 + | /* HttpBindingGenerator.kt:542 */
|
37 56 | pub fn ser_test_body_structure_headers(
|
38 57 | input: &crate::operation::test_body_structure::TestBodyStructureInput,
|
39 58 | mut builder: ::http::request::Builder,
|
40 59 | ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
60 + | /* HttpBindingGenerator.kt:592 */
|
41 61 | if let ::std::option::Option::Some(inner_1) = &input.test_id {
|
62 + | /* HttpBindingGenerator.kt:704 */
|
42 63 | let formatted_2 = inner_1.as_str();
|
64 + | /* HttpBindingGenerator.kt:706 */
|
43 65 | let header_value = formatted_2;
|
44 66 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
45 67 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
46 68 | "test_id",
|
47 69 | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
48 70 | )
|
49 71 | })?;
|
50 72 | builder = builder.header("x-amz-test-id", header_value);
|
73 + | /* HttpBindingGenerator.kt:592 */
|
51 74 | }
|
75 + | /* HttpBindingGenerator.kt:555 */
|
52 76 | Ok(builder)
|
77 + | /* HttpBindingGenerator.kt:542 */
|
53 78 | }
|
54 79 |
|
80 + | /* JsonSerializerGenerator.kt:287 */
|
55 81 | pub fn ser_test_body_structure_input(
|
56 82 | input: &crate::operation::test_body_structure::TestBodyStructureInput,
|
57 83 | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
84 + | /* JsonSerializerGenerator.kt:291 */
|
58 85 | let mut out = String::new();
|
86 + | /* JsonSerializerGenerator.kt:292 */
|
59 87 | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
88 + | /* JsonSerializerGenerator.kt:375 */
|
60 89 | crate::protocol_serde::shape_test_body_structure_input::ser_test_body_structure_input_input(&mut object, input)?;
|
90 + | /* JsonSerializerGenerator.kt:295 */
|
61 91 | object.finish();
|
92 + | /* JsonSerializerGenerator.kt:296 */
|
62 93 | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
94 + | /* JsonSerializerGenerator.kt:287 */
|
63 95 | }
|
64 96 |
|
97 + | /* JsonParserGenerator.kt:148 */
|
65 98 | pub(crate) fn de_test_body_structure(
|
66 99 | value: &[u8],
|
67 100 | mut builder: crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder,
|
68 101 | ) -> ::std::result::Result<
|
69 102 | crate::operation::test_body_structure::builders::TestBodyStructureOutputBuilder,
|
70 103 | ::aws_smithy_json::deserialize::error::DeserializeError,
|
71 104 | > {
|
105 + | /* JsonParserGenerator.kt:153 */
|
72 106 | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
|
73 107 | let tokens = &mut tokens_owned;
|
74 108 | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
109 + | /* JsonParserGenerator.kt:684 */
|
75 110 | loop {
|
111 + | /* JsonParserGenerator.kt:685 */
|
76 112 | 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() {
|
113 + | /* JsonParserGenerator.kt:686 */ Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
114 + | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
|
115 + | /* JsonParserGenerator.kt:260 */
|
116 + | match key.to_unescaped()?.as_ref() {
|
117 + | /* JsonParserGenerator.kt:262 */
|
79 118 | "testConfig" => {
|
80 - | builder = builder.set_test_config(crate::protocol_serde::shape_test_config::de_test_config(tokens)?);
|
119 + | /* JsonParserGenerator.kt:265 */
|
120 + | builder = builder.set_test_config(
|
121 + | /* JsonParserGenerator.kt:544 */
|
122 + | crate::protocol_serde::shape_test_config::de_test_config(tokens)?, /* JsonParserGenerator.kt:265 */
|
123 + | );
|
124 + | /* JsonParserGenerator.kt:262 */
|
125 + | }
|
126 + | /* JsonParserGenerator.kt:290 */
|
127 + | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
|
81 128 | }
|
82 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
83 - | },
|
129 + | /* JsonParserGenerator.kt:686 */
|
130 + | }
|
131 + | /* JsonParserGenerator.kt:695 */
|
84 132 | other => {
|
85 133 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
86 134 | "expected object key or end object, found: {:?}",
|
87 135 | other
|
88 136 | )))
|
137 + | } /* JsonParserGenerator.kt:685 */
|
89 138 | }
|
139 + | /* JsonParserGenerator.kt:684 */
|
90 140 | }
|
91 - | }
|
141 + | /* JsonParserGenerator.kt:250 */
|
92 142 | if tokens.next().is_some() {
|
143 + | /* JsonParserGenerator.kt:251 */
|
93 144 | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
94 145 | "found more JSON tokens after completing parsing",
|
95 146 | ));
|
147 + | /* JsonParserGenerator.kt:250 */
|
96 148 | }
|
149 + | /* JsonParserGenerator.kt:163 */
|
97 150 | Ok(builder)
|
151 + | /* JsonParserGenerator.kt:148 */
|
98 152 | }
|