aws_sdk_databrew/protocol_serde/
shape_schedule.rs1pub(crate) fn de_schedule<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::Schedule>, ::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::ScheduleBuilder::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 "AccountId" => {
18 builder = builder.set_account_id(
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 "CreatedBy" => {
25 builder = builder.set_created_by(
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 "CreateDate" => {
32 builder = builder.set_create_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
33 tokens.next(),
34 ::aws_smithy_types::date_time::Format::EpochSeconds,
35 )?);
36 }
37 "JobNames" => {
38 builder = builder.set_job_names(crate::protocol_serde::shape_job_name_list::de_job_name_list(tokens)?);
39 }
40 "LastModifiedBy" => {
41 builder = builder.set_last_modified_by(
42 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
43 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
44 .transpose()?,
45 );
46 }
47 "LastModifiedDate" => {
48 builder = builder.set_last_modified_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
49 tokens.next(),
50 ::aws_smithy_types::date_time::Format::EpochSeconds,
51 )?);
52 }
53 "ResourceArn" => {
54 builder = builder.set_resource_arn(
55 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
56 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
57 .transpose()?,
58 );
59 }
60 "CronExpression" => {
61 builder = builder.set_cron_expression(
62 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
63 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
64 .transpose()?,
65 );
66 }
67 "Tags" => {
68 builder = builder.set_tags(crate::protocol_serde::shape_tag_map::de_tag_map(tokens)?);
69 }
70 "Name" => {
71 builder = builder.set_name(
72 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
73 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
74 .transpose()?,
75 );
76 }
77 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
78 },
79 other => {
80 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
81 "expected object key or end object, found: {:?}",
82 other
83 )))
84 }
85 }
86 }
87 Ok(Some(crate::serde_util::schedule_correct_errors(builder).build().map_err(|err| {
88 ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
89 })?))
90 }
91 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
92 "expected start object or null",
93 )),
94 }
95}