141 146 | crate::operation::complete_multipart_upload::CompleteMultipartUploadError,
|
142 147 | >::new());
|
143 148 |
|
144 149 | ::std::borrow::Cow::Owned(rcb)
|
145 150 | }
|
146 151 | }
|
147 152 |
|
148 153 | #[derive(Debug)]
|
149 154 | struct CompleteMultipartUploadResponseDeserializer;
|
150 155 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CompleteMultipartUploadResponseDeserializer {
|
151 - | fn deserialize_nonstreaming(
|
156 + | fn deserialize_nonstreaming_with_config(
|
152 157 | &self,
|
153 158 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
159 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
154 160 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
155 161 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
156 - | let headers = response.headers();
|
157 - | let body = response.body().bytes().expect("body loaded");
|
158 162 | #[allow(unused_mut)]
|
159 163 | let mut force_error = false;
|
160 164 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
161 - | let parse_result = if !success && status != 201 || force_error {
|
162 - | crate::protocol_serde::shape_complete_multipart_upload::de_complete_multipart_upload_http_error(status, headers, body)
|
163 - | } else {
|
164 - | crate::protocol_serde::shape_complete_multipart_upload::de_complete_multipart_upload_http_response(status, headers, body)
|
165 + | if !success && status != 201 || 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::complete_multipart_upload::CompleteMultipartUploadError::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::complete_multipart_upload::CompleteMultipartUploadError::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::complete_multipart_upload::CompleteMultipartUploadError::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 + | "ResourceNotFoundException" => {
|
242 + | crate::operation::complete_multipart_upload::CompleteMultipartUploadError::ResourceNotFoundException({
|
243 + | let mut tmp = match protocol
|
244 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
245 + | .and_then(|mut deser| {
|
246 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
247 + | &mut *deser,
|
248 + | response.headers(),
|
249 + | response.status().into(),
|
250 + | body,
|
251 + | )
|
252 + | }) {
|
253 + | ::std::result::Result::Ok(val) => val,
|
254 + | ::std::result::Result::Err(e) => {
|
255 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
256 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
257 + | ))
|
258 + | }
|
259 + | };
|
260 + | tmp.meta = generic;
|
261 + | if tmp.message.is_none() {
|
262 + | tmp.message = _error_message;
|
263 + | }
|
264 + | tmp
|
265 + | })
|
266 + | }
|
267 + | "ServiceUnavailableException" => {
|
268 + | crate::operation::complete_multipart_upload::CompleteMultipartUploadError::ServiceUnavailableException({
|
269 + | let mut tmp = match protocol
|
270 + | .deserialize_response(response, crate::types::error::ServiceUnavailableException::SCHEMA, _cfg)
|
271 + | .and_then(|mut deser| {
|
272 + | crate::types::error::ServiceUnavailableException::deserialize_with_response(
|
273 + | &mut *deser,
|
274 + | response.headers(),
|
275 + | response.status().into(),
|
276 + | body,
|
277 + | )
|
278 + | }) {
|
279 + | ::std::result::Result::Ok(val) => val,
|
280 + | ::std::result::Result::Err(e) => {
|
281 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
282 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
283 + | ))
|
284 + | }
|
165 285 | };
|
166 - | crate::protocol_serde::type_erase_result(parse_result)
|
286 + | tmp.meta = generic;
|
287 + | if tmp.message.is_none() {
|
288 + | tmp.message = _error_message;
|
289 + | }
|
290 + | tmp
|
291 + | })
|
292 + | }
|
293 + | _ => crate::operation::complete_multipart_upload::CompleteMultipartUploadError::generic(generic),
|
294 + | };
|
295 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
296 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
297 + | ))
|
298 + | } else {
|
299 + | let protocol = _cfg
|
300 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
301 + | .expect("a SharedClientProtocol is required");
|
302 + | let mut deser = protocol
|
303 + | .deserialize_response(response, CompleteMultipartUpload::OUTPUT_SCHEMA, _cfg)
|
304 + | .map_err(|e| {
|
305 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
306 + | })?;
|
307 + | let body = response.body().bytes().expect("body loaded");
|
308 + | let output = crate::operation::complete_multipart_upload::CompleteMultipartUploadOutput::deserialize_with_response(
|
309 + | &mut *deser,
|
310 + | response.headers(),
|
311 + | response.status().into(),
|
312 + | body,
|
313 + | )
|
314 + | .map_err(|e| {
|
315 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
316 + | })?;
|
317 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
318 + | }
|
167 319 | }
|
168 320 | }
|
169 321 | #[derive(Debug)]
|
170 322 | struct CompleteMultipartUploadRequestSerializer;
|
171 323 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CompleteMultipartUploadRequestSerializer {
|
172 324 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
173 325 | fn serialize_input(
|
174 326 | &self,
|
175 327 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
176 328 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
177 329 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
178 330 | let input = input
|
179 331 | .downcast::<crate::operation::complete_multipart_upload::CompleteMultipartUploadInput>()
|
180 332 | .expect("correct type");
|
181 - | let _header_serialization_settings = _cfg
|
182 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
183 - | .cloned()
|
184 - | .unwrap_or_default();
|
185 - | let mut request_builder = {
|
186 - | #[allow(clippy::uninlined_format_args)]
|
187 - | fn uri_base(
|
188 - | _input: &crate::operation::complete_multipart_upload::CompleteMultipartUploadInput,
|
189 - | output: &mut ::std::string::String,
|
190 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
191 - | use ::std::fmt::Write as _;
|
192 - | let input_1 = &_input.account_id;
|
193 - | let input_1 = input_1
|
194 - | .as_ref()
|
195 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("account_id", "cannot be empty or unset"))?;
|
196 - | let account_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
|
197 - | if account_id.is_empty() {
|
198 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
199 - | "account_id",
|
200 - | "cannot be empty or unset",
|
201 - | ));
|
202 - | }
|
203 - | let input_2 = &_input.vault_name;
|
204 - | let input_2 = input_2
|
205 - | .as_ref()
|
206 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("vault_name", "cannot be empty or unset"))?;
|
207 - | let vault_name = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
|
208 - | if vault_name.is_empty() {
|
209 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
210 - | "vault_name",
|
211 - | "cannot be empty or unset",
|
212 - | ));
|
213 - | }
|
214 - | let input_3 = &_input.upload_id;
|
215 - | let input_3 = input_3
|
216 - | .as_ref()
|
217 - | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("upload_id", "cannot be empty or unset"))?;
|
218 - | let upload_id = ::aws_smithy_http::label::fmt_string(input_3, ::aws_smithy_http::label::EncodingStrategy::Default);
|
219 - | if upload_id.is_empty() {
|
220 - | return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
|
221 - | "upload_id",
|
222 - | "cannot be empty or unset",
|
223 - | ));
|
224 - | }
|
225 - | ::std::write!(
|
226 - | output,
|
227 - | "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}",
|
228 - | accountId = account_id,
|
229 - | vaultName = vault_name,
|
230 - | uploadId = upload_id
|
333 + | let protocol = _cfg
|
334 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
335 + | .expect("a SharedClientProtocol is required");
|
336 + | if protocol.supports_http_bindings() {
|
337 + | let mut request = protocol
|
338 + | .serialize_body(&input, CompleteMultipartUpload::INPUT_SCHEMA, "", _cfg)
|
339 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
340 + | {
|
341 + | let mut uri = "/{accountId}/vaults/{vaultName}/multipart-uploads/{uploadId}".to_string();
|
342 + | let mut query_params: Vec<(String, String)> = Vec::new();
|
343 + | if let Some(ref val) = input.account_id {
|
344 + | uri = uri.replace("{accountId}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
|
345 + | }
|
346 + | if let Some(ref val) = input.vault_name {
|
347 + | uri = uri.replace("{vaultName}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
|
348 + | }
|
349 + | if let Some(ref val) = input.upload_id {
|
350 + | uri = uri.replace("{uploadId}", &::aws_smithy_schema::http_protocol::percent_encode(&val.to_string()));
|
351 + | }
|
352 + | if let Some(ref val) = input.archive_size {
|
353 + | request.headers_mut().insert("x-amz-archive-size", val.to_string());
|
354 + | }
|
355 + | if let Some(ref val) = input.checksum {
|
356 + | request.headers_mut().insert("x-amz-sha256-tree-hash", val.to_string());
|
357 + | }
|
358 + | if !query_params.is_empty() {
|
359 + | uri.push(if uri.contains('?') { '&' } else { '?' });
|
360 + | let pairs: Vec<String> = query_params
|
361 + | .iter()
|
362 + | .map(|(k, v)| {
|
363 + | format!(
|
364 + | "{}={}",
|
365 + | ::aws_smithy_schema::http_protocol::percent_encode(k),
|
366 + | ::aws_smithy_schema::http_protocol::percent_encode(v)
|
231 367 | )
|
232 - | .expect("formatting should succeed");
|
233 - | ::std::result::Result::Ok(())
|
368 + | })
|
369 + | .collect();
|
370 + | uri.push_str(&pairs.join("&"));
|
371 + | }
|
372 + | request.set_uri(uri.as_str()).expect("valid URI");
|
234 373 | }
|
235 - | #[allow(clippy::unnecessary_wraps)]
|
236 - | fn update_http_builder(
|
237 - | input: &crate::operation::complete_multipart_upload::CompleteMultipartUploadInput,
|
238 - | builder: ::http_1x::request::Builder,
|
239 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
240 - | let mut uri = ::std::string::String::new();
|
241 - | uri_base(input, &mut uri)?;
|
242 - | let builder = crate::protocol_serde::shape_complete_multipart_upload::ser_complete_multipart_upload_headers(input, builder)?;
|
243 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
244 - | }
|
245 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
246 - | builder
|
247 - | };
|
248 - | let body = ::aws_smithy_types::body::SdkBody::from("");
|
249 374 |
|
250 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
375 + | return ::std::result::Result::Ok(request);
|
376 + | } else {
|
377 + | let mut request = protocol
|
378 + | .serialize_request(&input, CompleteMultipartUpload::INPUT_SCHEMA, "", _cfg)
|
379 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
380 + |
|
381 + | return ::std::result::Result::Ok(request);
|
382 + | }
|
251 383 | }
|
252 384 | }
|
253 385 | #[derive(Debug)]
|
254 386 | struct CompleteMultipartUploadEndpointParamsInterceptor;
|
255 387 |
|
256 388 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CompleteMultipartUploadEndpointParamsInterceptor {
|
257 389 | fn name(&self) -> &'static str {
|
258 390 | "CompleteMultipartUploadEndpointParamsInterceptor"
|
259 391 | }
|
260 392 |
|