127 131 | ::std::borrow::Cow::Owned(rcb)
|
128 132 | }
|
129 133 | }
|
130 134 |
|
131 135 | #[derive(Debug)]
|
132 136 | struct StringPayloadResponseDeserializer;
|
133 137 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StringPayloadResponseDeserializer {
|
134 138 | fn deserialize_nonstreaming(
|
135 139 | &self,
|
136 140 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
141 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
137 142 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
138 143 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
139 - | let headers = response.headers();
|
140 - | let body = response.body().bytes().expect("body loaded");
|
141 144 | #[allow(unused_mut)]
|
142 145 | let mut force_error = false;
|
143 146 |
|
144 - | let parse_result = if !success && status != 200 || force_error {
|
145 - | crate::protocol_serde::shape_string_payload::de_string_payload_http_error(status, headers, body)
|
147 + | if !success && status != 200 || force_error {
|
148 + | let headers = response.headers();
|
149 + | let body = response.body().bytes().expect("body loaded");
|
150 + | #[allow(unused_mut)]
|
151 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
152 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
153 + | })?;
|
154 + |
|
155 + | let generic = generic_builder.build();
|
156 + | let error_code = match generic.code() {
|
157 + | ::std::option::Option::Some(code) => code,
|
158 + | ::std::option::Option::None => {
|
159 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
160 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::string_payload::StringPayloadError::unhandled(generic)),
|
161 + | ))
|
162 + | }
|
163 + | };
|
164 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
165 + | let protocol = _cfg
|
166 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
167 + | .expect("a SharedClientProtocol is required");
|
168 + | let err = match error_code {
|
169 + | "ExtraError" => crate::operation::string_payload::StringPayloadError::ExtraError({
|
170 + | let mut tmp = match protocol
|
171 + | .deserialize_response(response, crate::types::error::ExtraError::SCHEMA, _cfg)
|
172 + | .and_then(|mut deser| {
|
173 + | crate::types::error::ExtraError::deserialize_with_response(
|
174 + | &mut *deser,
|
175 + | response.headers(),
|
176 + | response.status().into(),
|
177 + | body,
|
178 + | )
|
179 + | }) {
|
180 + | ::std::result::Result::Ok(val) => val,
|
181 + | ::std::result::Result::Err(e) => {
|
182 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
183 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
184 + | ))
|
185 + | }
|
186 + | };
|
187 + | tmp.meta = generic;
|
188 + | if tmp.message.is_none() {
|
189 + | tmp.message = _error_message;
|
190 + | }
|
191 + | tmp
|
192 + | }),
|
193 + | _ => crate::operation::string_payload::StringPayloadError::generic(generic),
|
194 + | };
|
195 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
196 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
197 + | ))
|
146 198 | } else {
|
147 - | crate::protocol_serde::shape_string_payload::de_string_payload_http_response(status, headers, body)
|
148 - | };
|
149 - | crate::protocol_serde::type_erase_result(parse_result)
|
199 + | let protocol = _cfg
|
200 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
201 + | .expect("a SharedClientProtocol is required");
|
202 + | let mut deser = protocol.deserialize_response(response, StringPayload::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
203 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
204 + | })?;
|
205 + | let body = response.body().bytes().expect("body loaded");
|
206 + | let output = crate::operation::string_payload::StringPayloadOutput::deserialize_with_response(
|
207 + | &mut *deser,
|
208 + | response.headers(),
|
209 + | response.status().into(),
|
210 + | body,
|
211 + | )
|
212 + | .map_err(|e| {
|
213 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
214 + | })?;
|
215 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
216 + | }
|
150 217 | }
|
151 218 | }
|
152 219 | #[derive(Debug)]
|
153 220 | struct StringPayloadRequestSerializer;
|
154 221 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StringPayloadRequestSerializer {
|
155 222 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
156 223 | fn serialize_input(
|
157 224 | &self,
|
158 225 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
159 226 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
160 227 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
161 228 | let input = input
|
162 229 | .downcast::<crate::operation::string_payload::StringPayloadInput>()
|
163 230 | .expect("correct type");
|
164 - | let _header_serialization_settings = _cfg
|
165 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
166 - | .cloned()
|
167 - | .unwrap_or_default();
|
168 - | let mut request_builder = {
|
169 - | #[allow(clippy::uninlined_format_args)]
|
170 - | fn uri_base(
|
171 - | _input: &crate::operation::string_payload::StringPayloadInput,
|
172 - | output: &mut ::std::string::String,
|
173 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
174 - | use ::std::fmt::Write as _;
|
175 - | ::std::write!(output, "/StringPayload").expect("formatting should succeed");
|
176 - | ::std::result::Result::Ok(())
|
231 + | let protocol = _cfg
|
232 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
233 + | .expect("a SharedClientProtocol is required");
|
234 + | let mut input = input;
|
235 + | let payload = input.payload.take();
|
236 + | let mut request = protocol
|
237 + | .serialize_request(&input, StringPayload::INPUT_SCHEMA, "", _cfg)
|
238 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
239 + | if let ::std::option::Option::Some(payload) = payload {
|
240 + | *request.body_mut() = ::aws_smithy_types::body::SdkBody::from(payload.into_bytes());
|
241 + | request.headers_mut().insert("Content-Type", "text/plain");
|
242 + | if let ::std::option::Option::Some(content_length) = request.body().content_length() {
|
243 + | request.headers_mut().insert("Content-Length", content_length.to_string());
|
177 244 | }
|
178 - | #[allow(clippy::unnecessary_wraps)]
|
179 - | fn update_http_builder(
|
180 - | input: &crate::operation::string_payload::StringPayloadInput,
|
181 - | builder: ::http_1x::request::Builder,
|
182 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
183 - | let mut uri = ::std::string::String::new();
|
184 - | uri_base(input, &mut uri)?;
|
185 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
186 - | }
|
187 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
188 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "text/plain");
|
189 - | builder
|
190 - | };
|
191 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_string_payload_input::ser_payload_http_payload(
|
192 - | input.payload,
|
193 - | )?);
|
194 - | if let Some(content_length) = body.content_length() {
|
195 - | let content_length = content_length.to_string();
|
196 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
197 245 | }
|
198 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
246 + |
|
247 + | return ::std::result::Result::Ok(request);
|
199 248 | }
|
200 249 | }
|
201 250 | #[derive(Debug)]
|
202 251 | struct StringPayloadEndpointParamsInterceptor;
|
203 252 |
|
204 253 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StringPayloadEndpointParamsInterceptor {
|
205 254 | fn name(&self) -> &'static str {
|
206 255 | "StringPayloadEndpointParamsInterceptor"
|
207 256 | }
|
208 257 |
|