142 146 | crate::operation::upload_multipart_part::UploadMultipartPartError,
|
143 147 | >::new());
|
144 148 |
|
145 149 | ::std::borrow::Cow::Owned(rcb)
|
146 150 | }
|
147 151 | }
|
148 152 |
|
149 153 | #[derive(Debug)]
|
150 154 | struct UploadMultipartPartResponseDeserializer;
|
151 155 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for UploadMultipartPartResponseDeserializer {
|
152 - | fn deserialize_nonstreaming(
|
156 + | fn deserialize_nonstreaming_with_config(
|
153 157 | &self,
|
154 158 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
159 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
155 160 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
156 161 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
157 - | let headers = response.headers();
|
158 - | let body = response.body().bytes().expect("body loaded");
|
159 162 | #[allow(unused_mut)]
|
160 163 | let mut force_error = false;
|
161 164 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
162 - | let parse_result = if !success && status != 204 || force_error {
|
163 - | crate::protocol_serde::shape_upload_multipart_part::de_upload_multipart_part_http_error(status, headers, body)
|
165 + | if !success && status != 204 || force_error {
|
166 + | let headers = response.headers();
|
167 + | let body = response.body().bytes().expect("body loaded");
|
168 + | #[allow(unused_mut)]
|
169 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
170 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
171 + | })?;
|
172 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
173 + | let generic = generic_builder.build();
|
174 + | let error_code = match generic.code() {
|
175 + | ::std::option::Option::Some(code) => code,
|
176 + | ::std::option::Option::None => {
|
177 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
178 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
179 + | crate::operation::upload_multipart_part::UploadMultipartPartError::unhandled(generic),
|
180 + | ),
|
181 + | ))
|
182 + | }
|
183 + | };
|
184 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
185 + | let protocol = _cfg
|
186 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
187 + | .expect("a SharedClientProtocol is required");
|
188 + | let err = match error_code {
|
189 + | "InvalidParameterValueException" => {
|
190 + | crate::operation::upload_multipart_part::UploadMultipartPartError::InvalidParameterValueException({
|
191 + | let mut tmp = match protocol
|
192 + | .deserialize_response(response, crate::types::error::InvalidParameterValueException::SCHEMA, _cfg)
|
193 + | .and_then(|mut deser| {
|
194 + | crate::types::error::InvalidParameterValueException::deserialize_with_response(
|
195 + | &mut *deser,
|
196 + | response.headers(),
|
197 + | response.status().into(),
|
198 + | body,
|
199 + | )
|
200 + | }) {
|
201 + | ::std::result::Result::Ok(val) => val,
|
202 + | ::std::result::Result::Err(e) => {
|
203 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
204 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
205 + | ))
|
206 + | }
|
207 + | };
|
208 + | tmp.meta = generic;
|
209 + | if tmp.message.is_none() {
|
210 + | tmp.message = _error_message;
|
211 + | }
|
212 + | tmp
|
213 + | })
|
214 + | }
|
215 + | "MissingParameterValueException" => {
|
216 + | crate::operation::upload_multipart_part::UploadMultipartPartError::MissingParameterValueException({
|
217 + | let mut tmp = match protocol
|
218 + | .deserialize_response(response, crate::types::error::MissingParameterValueException::SCHEMA, _cfg)
|
219 + | .and_then(|mut deser| {
|
220 + | crate::types::error::MissingParameterValueException::deserialize_with_response(
|
221 + | &mut *deser,
|
222 + | response.headers(),
|
223 + | response.status().into(),
|
224 + | body,
|
225 + | )
|
226 + | }) {
|
227 + | ::std::result::Result::Ok(val) => val,
|
228 + | ::std::result::Result::Err(e) => {
|
229 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
230 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
231 + | ))
|
232 + | }
|
233 + | };
|
234 + | tmp.meta = generic;
|
235 + | if tmp.message.is_none() {
|
236 + | tmp.message = _error_message;
|
237 + | }
|
238 + | tmp
|
239 + | })
|
240 + | }
|
241 + | "RequestTimeoutException" => crate::operation::upload_multipart_part::UploadMultipartPartError::RequestTimeoutException({
|
242 + | let mut tmp = match protocol
|
243 + | .deserialize_response(response, crate::types::error::RequestTimeoutException::SCHEMA, _cfg)
|
244 + | .and_then(|mut deser| {
|
245 + | crate::types::error::RequestTimeoutException::deserialize_with_response(
|
246 + | &mut *deser,
|
247 + | response.headers(),
|
248 + | response.status().into(),
|
249 + | body,
|
250 + | )
|
251 + | }) {
|
252 + | ::std::result::Result::Ok(val) => val,
|
253 + | ::std::result::Result::Err(e) => {
|
254 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
255 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
256 + | ))
|
257 + | }
|
258 + | };
|
259 + | tmp.meta = generic;
|
260 + | if tmp.message.is_none() {
|
261 + | tmp.message = _error_message;
|
262 + | }
|
263 + | tmp
|
264 + | }),
|
265 + | "ResourceNotFoundException" => crate::operation::upload_multipart_part::UploadMultipartPartError::ResourceNotFoundException({
|
266 + | let mut tmp = match protocol
|
267 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
268 + | .and_then(|mut deser| {
|
269 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
270 + | &mut *deser,
|
271 + | response.headers(),
|
272 + | response.status().into(),
|
273 + | body,
|
274 + | )
|
275 + | }) {
|
276 + | ::std::result::Result::Ok(val) => val,
|
277 + | ::std::result::Result::Err(e) => {
|
278 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
279 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
280 + | ))
|
281 + | }
|
282 + | };
|
283 + | tmp.meta = generic;
|
284 + | if tmp.message.is_none() {
|
285 + | tmp.message = _error_message;
|
286 + | }
|
287 + | tmp
|
288 + | }),
|
289 + | "ServiceUnavailableException" => crate::operation::upload_multipart_part::UploadMultipartPartError::ServiceUnavailableException({
|
290 + | let mut tmp = match protocol
|
291 + | .deserialize_response(response, crate::types::error::ServiceUnavailableException::SCHEMA, _cfg)
|
292 + | .and_then(|mut deser| {
|
293 + | crate::types::error::ServiceUnavailableException::deserialize_with_response(
|
294 + | &mut *deser,
|
295 + | response.headers(),
|
296 + | response.status().into(),
|
297 + | body,
|
298 + | )
|
299 + | }) {
|
300 + | ::std::result::Result::Ok(val) => val,
|
301 + | ::std::result::Result::Err(e) => {
|
302 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
303 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
304 + | ))
|
305 + | }
|
306 + | };
|
307 + | tmp.meta = generic;
|
308 + | if tmp.message.is_none() {
|
309 + | tmp.message = _error_message;
|
310 + | }
|
311 + | tmp
|
312 + | }),
|
313 + | _ => crate::operation::upload_multipart_part::UploadMultipartPartError::generic(generic),
|
314 + | };
|
315 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
316 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
317 + | ))
|
164 318 | } else {
|
165 - | crate::protocol_serde::shape_upload_multipart_part::de_upload_multipart_part_http_response(status, headers, body)
|
166 - | };
|
167 - | crate::protocol_serde::type_erase_result(parse_result)
|
319 + | let protocol = _cfg
|
320 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
321 + | .expect("a SharedClientProtocol is required");
|
322 + | let mut deser = protocol
|
323 + | .deserialize_response(response, UploadMultipartPart::OUTPUT_SCHEMA, _cfg)
|
324 + | .map_err(|e| {
|
325 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
326 + | })?;
|
327 + | let body = response.body().bytes().expect("body loaded");
|
328 + | let output = crate::operation::upload_multipart_part::UploadMultipartPartOutput::deserialize_with_response(
|
329 + | &mut *deser,
|
330 + | response.headers(),
|
331 + | response.status().into(),
|
332 + | body,
|
333 + | )
|
334 + | .map_err(|e| {
|
335 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
336 + | })?;
|
337 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
338 + | }
|
168 339 | }
|
169 340 | }
|
170 341 | #[derive(Debug)]
|
171 342 | struct UploadMultipartPartRequestSerializer;
|
172 343 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for UploadMultipartPartRequestSerializer {
|
173 344 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
174 345 | fn serialize_input(
|
175 346 | &self,
|
176 347 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
177 348 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
178 349 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
179 350 | let input = input
|
180 351 | .downcast::<crate::operation::upload_multipart_part::UploadMultipartPartInput>()
|
181 352 | .expect("correct type");
|
182 - | let _header_serialization_settings = _cfg
|
183 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
184 - | .cloned()
|
185 - | .unwrap_or_default();
|
186 - | let mut request_builder = {
|
187 - | #[allow(clippy::uninlined_format_args)]
|
188 - | fn uri_base(
|
189 - | _input: &crate::operation::upload_multipart_part::UploadMultipartPartInput,
|
190 - | output: &mut ::std::string::String,
|
191 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
192 - | use ::std::fmt::Write as _;
|
193 - | let input_1 = &_input.account_id;
|
194 - | let input_1 = input_1
|
195 - | .as_ref()
|
196 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("account_id", "cannot be empty or unset"))?;
|
197 - | let account_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
|
198 - | if account_id.is_empty() {
|
199 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
200 - | "account_id",
|
201 - | "cannot be empty or unset",
|
202 - | ));
|
203 - | }
|
204 - | let input_2 = &_input.vault_name;
|
205 - | let input_2 = input_2
|
206 - | .as_ref()
|
207 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("vault_name", "cannot be empty or unset"))?;
|
208 - | let vault_name = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
|
209 - | if vault_name.is_empty() {
|
210 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
211 - | "vault_name",
|
212 - | "cannot be empty or unset",
|
213 - | ));
|
214 - | }
|
215 - | let input_3 = &_input.upload_id;
|
216 - | let input_3 = input_3
|
217 - | .as_ref()
|
218 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("upload_id", "cannot be empty or unset"))?;
|
219 - | let upload_id = ::aws_smithy_http::label::fmt_string(input_3, ::aws_smithy_http::label::EncodingStrategy::Default);
|
220 - | if upload_id.is_empty() {
|
221 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
222 - | "upload_id",
|
223 - | "cannot be empty or unset",
|
224 - | ));
|
225 - | }
|
226 - | ::std::write!(
|
227 - | output,
|
228 - | "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}",
|
229 - | accountId = account_id,
|
230 - | vaultName = vault_name,
|
231 - | uploadId = upload_id
|
232 - | )
|
233 - | .expect("formatting should succeed");
|
234 - | ::std::result::Result::Ok(())
|
235 - | }
|
236 - | #[allow(clippy::unnecessary_wraps)]
|
237 - | fn update_http_builder(
|
238 - | input: &crate::operation::upload_multipart_part::UploadMultipartPartInput,
|
239 - | builder: ::http_1x::request::Builder,
|
240 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
241 - | let mut uri = ::std::string::String::new();
|
242 - | uri_base(input, &mut uri)?;
|
243 - | let builder = crate::protocol_serde::shape_upload_multipart_part::ser_upload_multipart_part_headers(input, builder)?;
|
244 - | ::std::result::Result::Ok(builder.method("PUT").uri(uri))
|
245 - | }
|
246 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
247 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/octet-stream");
|
248 - | builder
|
249 - | };
|
250 - | let body = crate::protocol_serde::shape_upload_multipart_part_input::ser_body_http_payload(input.body)?.into_inner();
|
251 - | if let Some(content_length) = body.content_length() {
|
252 - | let content_length = content_length.to_string();
|
253 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
353 + | let protocol = _cfg
|
354 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
355 + | .expect("a SharedClientProtocol is required");
|
356 + | let mut request = protocol
|
357 + | .serialize_request(&input, UploadMultipartPart::INPUT_SCHEMA, "", _cfg)
|
358 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
359 + | // Streaming blob payload: replace the body with the raw ByteStream.
|
360 + | *request.body_mut() = input.body.into_inner();
|
361 + | request.headers_mut().insert("Content-Type", "application/octet-stream");
|
362 + | if let ::std::option::Option::Some(content_length) = request.body().content_length() {
|
363 + | request.headers_mut().insert("Content-Length", content_length.to_string());
|
254 364 | }
|
255 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
365 + |
|
366 + | return ::std::result::Result::Ok(request);
|
256 367 | }
|
257 368 | }
|
258 369 | #[derive(Debug)]
|
259 370 | struct UploadMultipartPartEndpointParamsInterceptor;
|
260 371 |
|
261 372 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UploadMultipartPartEndpointParamsInterceptor {
|
262 373 | fn name(&self) -> &'static str {
|
263 374 | "UploadMultipartPartEndpointParamsInterceptor"
|
264 375 | }
|
265 376 |
|