1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_json_timestamps_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::json_timestamps::JsonTimestampsOutput, crate::operation::json_timestamps::JsonTimestampsError> {
|
8 - | #[allow(unused_mut)]
|
9 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
10 - | .map_err(crate::operation::json_timestamps::JsonTimestampsError::unhandled)?;
|
11 - | let generic = generic_builder.build();
|
12 - | Err(crate::operation::json_timestamps::JsonTimestampsError::generic(generic))
|
13 - | }
|
14 - |
|
15 - | #[allow(clippy::unnecessary_wraps)]
|
16 - | pub fn de_json_timestamps_http_response(
|
17 - | _response_status: u16,
|
18 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
19 - | _response_body: &[u8],
|
20 - | ) -> std::result::Result<crate::operation::json_timestamps::JsonTimestampsOutput, crate::operation::json_timestamps::JsonTimestampsError> {
|
21 - | Ok({
|
22 - | #[allow(unused_mut)]
|
23 - | let mut output = crate::operation::json_timestamps::builders::JsonTimestampsOutputBuilder::default();
|
24 - | output = crate::protocol_serde::shape_json_timestamps::de_json_timestamps(_response_body, output)
|
25 - | .map_err(crate::operation::json_timestamps::JsonTimestampsError::unhandled)?;
|
26 - | output.build()
|
27 - | })
|
28 - | }
|
29 - |
|
30 - | pub fn ser_json_timestamps_input(
|
31 - | input: &crate::operation::json_timestamps::JsonTimestampsInput,
|
32 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
33 - | let mut out = String::new();
|
34 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
35 - | crate::protocol_serde::shape_json_timestamps_input::ser_json_timestamps_input_input(&mut object, input)?;
|
36 - | object.finish();
|
37 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
38 - | }
|
39 - |
|
40 - | pub(crate) fn de_json_timestamps(
|
41 - | _value: &[u8],
|
42 - | mut builder: crate::operation::json_timestamps::builders::JsonTimestampsOutputBuilder,
|
43 - | ) -> ::std::result::Result<
|
44 - | crate::operation::json_timestamps::builders::JsonTimestampsOutputBuilder,
|
45 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
46 - | > {
|
47 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
48 - | let tokens = &mut tokens_owned;
|
49 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
50 - | loop {
|
51 - | match tokens.next().transpose()? {
|
52 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
53 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
54 - | "dateTime" => {
|
55 - | builder = builder.set_date_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
56 - | tokens.next(),
|
57 - | ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
|
58 - | )?);
|
59 - | }
|
60 - | "dateTimeOnTarget" => {
|
61 - | builder = builder.set_date_time_on_target(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
62 - | tokens.next(),
|
63 - | ::aws_smithy_types::date_time::Format::DateTimeWithOffset,
|
64 - | )?);
|
65 - | }
|
66 - | "epochSeconds" => {
|
67 - | builder = builder.set_epoch_seconds(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
68 - | tokens.next(),
|
69 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
70 - | )?);
|
71 - | }
|
72 - | "epochSecondsOnTarget" => {
|
73 - | builder = builder.set_epoch_seconds_on_target(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
74 - | tokens.next(),
|
75 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
76 - | )?);
|
77 - | }
|
78 - | "httpDate" => {
|
79 - | builder = builder.set_http_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
80 - | tokens.next(),
|
81 - | ::aws_smithy_types::date_time::Format::HttpDate,
|
82 - | )?);
|
83 - | }
|
84 - | "httpDateOnTarget" => {
|
85 - | builder = builder.set_http_date_on_target(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
86 - | tokens.next(),
|
87 - | ::aws_smithy_types::date_time::Format::HttpDate,
|
88 - | )?);
|
89 - | }
|
90 - | "normal" => {
|
91 - | builder = builder.set_normal(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
|
92 - | tokens.next(),
|
93 - | ::aws_smithy_types::date_time::Format::EpochSeconds,
|
94 - | )?);
|
95 - | }
|
96 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
97 - | },
|
98 - | other => {
|
99 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
100 - | "expected object key or end object, found: {other:?}"
|
101 - | )))
|
102 - | }
|
103 - | }
|
104 - | }
|
105 - | if tokens.next().is_some() {
|
106 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
107 - | "found more JSON tokens after completing parsing",
|
108 - | ));
|
109 - | }
|
110 - | Ok(builder)
|
111 - | }
|