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