aws_sdk_sagemaker/protocol_serde/
shape_get_device_fleet_report.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_device_fleet_report_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::get_device_fleet_report::GetDeviceFleetReportOutput,
9 crate::operation::get_device_fleet_report::GetDeviceFleetReportError,
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::get_device_fleet_report::GetDeviceFleetReportError::unhandled)?;
14 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15 let generic = generic_builder.build();
16 Err(crate::operation::get_device_fleet_report::GetDeviceFleetReportError::generic(generic))
17}
18
19#[allow(clippy::unnecessary_wraps)]
20pub fn de_get_device_fleet_report_http_response(
21 _response_status: u16,
22 _response_headers: &::aws_smithy_runtime_api::http::Headers,
23 _response_body: &[u8],
24) -> std::result::Result<
25 crate::operation::get_device_fleet_report::GetDeviceFleetReportOutput,
26 crate::operation::get_device_fleet_report::GetDeviceFleetReportError,
27> {
28 Ok({
29 #[allow(unused_mut)]
30 let mut output = crate::operation::get_device_fleet_report::builders::GetDeviceFleetReportOutputBuilder::default();
31 output = crate::protocol_serde::shape_get_device_fleet_report::de_get_device_fleet_report(_response_body, output)
32 .map_err(crate::operation::get_device_fleet_report::GetDeviceFleetReportError::unhandled)?;
33 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
34 crate::serde_util::get_device_fleet_report_output_output_correct_errors(output).build()
35 })
36}
37
38pub fn ser_get_device_fleet_report_input(
39 input: &crate::operation::get_device_fleet_report::GetDeviceFleetReportInput,
40) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
41 let mut out = String::new();
42 let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
43 crate::protocol_serde::shape_get_device_fleet_report_input::ser_get_device_fleet_report_input_input(&mut object, input)?;
44 object.finish();
45 Ok(::aws_smithy_types::body::SdkBody::from(out))
46}
47
48pub(crate) fn de_get_device_fleet_report(
49 value: &[u8],
50 mut builder: crate::operation::get_device_fleet_report::builders::GetDeviceFleetReportOutputBuilder,
51) -> ::std::result::Result<
52 crate::operation::get_device_fleet_report::builders::GetDeviceFleetReportOutputBuilder,
53 ::aws_smithy_json::deserialize::error::DeserializeError,
54> {
55 let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
56 let tokens = &mut tokens_owned;
57 ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
58 loop {
59 match tokens.next().transpose()? {
60 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
61 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
62 "DeviceFleetArn" => {
63 builder = builder.set_device_fleet_arn(
64 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
65 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
66 .transpose()?,
67 );
68 }
69 "DeviceFleetName" => {
70 builder = builder.set_device_fleet_name(
71 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
72 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
73 .transpose()?,
74 );
75 }
76 "OutputConfig" => {
77 builder = builder.set_output_config(crate::protocol_serde::shape_edge_output_config::de_edge_output_config(tokens)?);
78 }
79 "Description" => {
80 builder = builder.set_description(
81 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
82 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
83 .transpose()?,
84 );
85 }
86 "ReportGenerated" => {
87 builder = builder.set_report_generated(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
88 tokens.next(),
89 ::aws_smithy_types::date_time::Format::EpochSeconds,
90 )?);
91 }
92 "DeviceStats" => {
93 builder = builder.set_device_stats(crate::protocol_serde::shape_device_stats::de_device_stats(tokens)?);
94 }
95 "AgentVersions" => {
96 builder = builder.set_agent_versions(crate::protocol_serde::shape_agent_versions::de_agent_versions(tokens)?);
97 }
98 "ModelStats" => {
99 builder = builder.set_model_stats(crate::protocol_serde::shape_edge_model_stats::de_edge_model_stats(tokens)?);
100 }
101 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
102 },
103 other => {
104 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
105 "expected object key or end object, found: {:?}",
106 other
107 )))
108 }
109 }
110 }
111 if tokens.next().is_some() {
112 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
113 "found more JSON tokens after completing parsing",
114 ));
115 }
116 Ok(builder)
117}