5 5 | ) -> std::result::Result<
|
6 6 | crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
|
7 7 | crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
|
8 8 | > {
|
9 9 | let mut _response_body = ::aws_smithy_types::body::SdkBody::taken();
|
10 10 | std::mem::swap(&mut _response_body, response.body_mut());
|
11 11 | let _response_body = &mut _response_body;
|
12 12 |
|
13 13 | let _response_status = response.status().as_u16();
|
14 14 | let _response_headers = response.headers();
|
15 15 | Ok({
|
16 16 | #[allow(unused_mut)]
|
17 17 | let mut output = crate::operation::duplex_stream_with_initial_messages::builders::DuplexStreamWithInitialMessagesOutputBuilder::default();
|
18 18 | output = output.set_initial_response_member(
|
19 19 | crate::protocol_serde::shape_duplex_stream_with_initial_messages_output::de_initial_response_member_header(_response_headers).map_err(
|
20 20 | |_| {
|
21 21 | crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled(
|
22 22 | "Failed to parse initialResponseMember from header `initial-response-member",
|
23 23 | )
|
24 24 | },
|
25 25 | )?,
|
26 26 | );
|
27 27 | output = output.set_stream(Some(
|
28 28 | crate::protocol_serde::shape_duplex_stream_with_initial_messages_output::de_stream_payload(_response_body)?,
|
29 29 | ));
|
30 30 | crate::serde_util::duplex_stream_with_initial_messages_output_output_correct_errors(output)
|
31 31 | .build()
|
32 32 | .map_err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled)?
|
33 33 | })
|
34 34 | }
|
35 - |
|
36 - | #[allow(clippy::unnecessary_wraps)]
|
37 - | pub fn de_duplex_stream_with_initial_messages_http_error(
|
38 - | _response_status: u16,
|
39 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
40 - | _response_body: &[u8],
|
41 - | ) -> std::result::Result<
|
42 - | crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesOutput,
|
43 - | crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError,
|
44 - | > {
|
45 - | #[allow(unused_mut)]
|
46 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
47 - | .map_err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled)?;
|
48 - | let generic = generic_builder.build();
|
49 - | let error_code = match generic.code() {
|
50 - | Some(code) => code,
|
51 - | None => return Err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled(generic)),
|
52 - | };
|
53 - |
|
54 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
55 - | Err(match error_code {
|
56 - | "ServiceUnavailableError" => {
|
57 - | crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::ServiceUnavailableError({
|
58 - | #[allow(unused_mut)]
|
59 - | let mut tmp = {
|
60 - | #[allow(unused_mut)]
|
61 - | let mut output = crate::types::error::builders::ServiceUnavailableErrorBuilder::default();
|
62 - | output = crate::protocol_serde::shape_service_unavailable_error::de_service_unavailable_error_json_err(_response_body, output)
|
63 - | .map_err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled)?;
|
64 - | let output = output.meta(generic);
|
65 - | output.build()
|
66 - | };
|
67 - | if tmp.message.is_none() {
|
68 - | tmp.message = _error_message;
|
69 - | }
|
70 - | tmp
|
71 - | })
|
72 - | }
|
73 - | "ErrorEvent" => crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::ErrorEvent({
|
74 - | #[allow(unused_mut)]
|
75 - | let mut tmp = {
|
76 - | #[allow(unused_mut)]
|
77 - | let mut output = crate::types::error::builders::ErrorEventBuilder::default();
|
78 - | output = crate::protocol_serde::shape_error_event::de_error_event_json_err(_response_body, output)
|
79 - | .map_err(crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::unhandled)?;
|
80 - | let output = output.meta(generic);
|
81 - | output.build()
|
82 - | };
|
83 - | if tmp.message.is_none() {
|
84 - | tmp.message = _error_message;
|
85 - | }
|
86 - | tmp
|
87 - | }),
|
88 - | _ => crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesError::generic(generic),
|
89 - | })
|
90 - | }
|
91 - |
|
92 - | pub fn ser_duplex_stream_with_initial_messages_headers(
|
93 - | input: &crate::operation::duplex_stream_with_initial_messages::DuplexStreamWithInitialMessagesInput,
|
94 - | mut builder: ::http_1x::request::Builder,
|
95 - | ) -> std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
96 - | if let ::std::option::Option::Some(inner_1) = &input.initial_request_member {
|
97 - | let formatted_2 = inner_1.as_str();
|
98 - | let header_value = formatted_2;
|
99 - | let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
|
100 - | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
101 - | "initial_request_member",
|
102 - | format!("`{}` cannot be used as a header value: {}", &header_value, err),
|
103 - | )
|
104 - | })?;
|
105 - | builder = builder.header("initial-request-member", header_value);
|
106 - | }
|
107 - | Ok(builder)
|
108 - | }
|