aws_sdk_sagemaker/protocol_serde/
shape_stop_processing_job.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_stop_processing_job_http_error(
4 _response_status: u16,
5 _response_headers: &::aws_smithy_runtime_api::http::Headers,
6 _response_body: &[u8],
7) -> std::result::Result<crate::operation::stop_processing_job::StopProcessingJobOutput, crate::operation::stop_processing_job::StopProcessingJobError>
8{
9 #[allow(unused_mut)]
10 let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
11 .map_err(crate::operation::stop_processing_job::StopProcessingJobError::unhandled)?;
12 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
13 let generic = generic_builder.build();
14 let error_code = match generic.code() {
15 Some(code) => code,
16 None => return Err(crate::operation::stop_processing_job::StopProcessingJobError::unhandled(generic)),
17 };
18
19 let _error_message = generic.message().map(|msg| msg.to_owned());
20 Err(match error_code {
21 "ResourceNotFound" => crate::operation::stop_processing_job::StopProcessingJobError::ResourceNotFound({
22 #[allow(unused_mut)]
23 let mut tmp = {
24 #[allow(unused_mut)]
25 let mut output = crate::types::error::builders::ResourceNotFoundBuilder::default();
26 output = crate::protocol_serde::shape_resource_not_found::de_resource_not_found_json_err(_response_body, output)
27 .map_err(crate::operation::stop_processing_job::StopProcessingJobError::unhandled)?;
28 let output = output.meta(generic);
29 output.build()
30 };
31 if tmp.message.is_none() {
32 tmp.message = _error_message;
33 }
34 tmp
35 }),
36 _ => crate::operation::stop_processing_job::StopProcessingJobError::generic(generic),
37 })
38}
39
40#[allow(clippy::unnecessary_wraps)]
41pub fn de_stop_processing_job_http_response(
42 _response_status: u16,
43 _response_headers: &::aws_smithy_runtime_api::http::Headers,
44 _response_body: &[u8],
45) -> std::result::Result<crate::operation::stop_processing_job::StopProcessingJobOutput, crate::operation::stop_processing_job::StopProcessingJobError>
46{
47 Ok({
48 #[allow(unused_mut)]
49 let mut output = crate::operation::stop_processing_job::builders::StopProcessingJobOutputBuilder::default();
50 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
51 output.build()
52 })
53}
54
55pub fn ser_stop_processing_job_input(
56 input: &crate::operation::stop_processing_job::StopProcessingJobInput,
57) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
58 let mut out = String::new();
59 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
60 crate::protocol_serde::shape_stop_processing_job_input::ser_stop_processing_job_input_input(&mut object, input)?;
61 object.finish();
62 Ok(::aws_smithy_types::body::SdkBody::from(out))
63}