aws_sdk_sagemaker/protocol_serde/
shape_action_summary.rs1pub(crate) fn de_action_summary<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::ActionSummary>, ::aws_smithy_json::deserialize::error::DeserializeError>
5where
6 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
7{
8 match tokens.next().transpose()? {
9 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
10 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
11 #[allow(unused_mut)]
12 let mut builder = crate::types::builders::ActionSummaryBuilder::default();
13 loop {
14 match tokens.next().transpose()? {
15 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
16 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
17 "ActionArn" => {
18 builder = builder.set_action_arn(
19 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
20 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
21 .transpose()?,
22 );
23 }
24 "ActionName" => {
25 builder = builder.set_action_name(
26 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
27 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
28 .transpose()?,
29 );
30 }
31 "Source" => {
32 builder = builder.set_source(crate::protocol_serde::shape_action_source::de_action_source(tokens)?);
33 }
34 "ActionType" => {
35 builder = builder.set_action_type(
36 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
37 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
38 .transpose()?,
39 );
40 }
41 "Status" => {
42 builder = builder.set_status(
43 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
44 .map(|s| s.to_unescaped().map(|u| crate::types::ActionStatus::from(u.as_ref())))
45 .transpose()?,
46 );
47 }
48 "CreationTime" => {
49 builder = builder.set_creation_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
50 tokens.next(),
51 ::aws_smithy_types::date_time::Format::EpochSeconds,
52 )?);
53 }
54 "LastModifiedTime" => {
55 builder = builder.set_last_modified_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
56 tokens.next(),
57 ::aws_smithy_types::date_time::Format::EpochSeconds,
58 )?);
59 }
60 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
61 },
62 other => {
63 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
64 "expected object key or end object, found: {:?}",
65 other
66 )))
67 }
68 }
69 }
70 Ok(Some(builder.build()))
71 }
72 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
73 "expected start object or null",
74 )),
75 }
76}