aws_sdk_databrew/protocol_serde/
shape_project.rs1pub(crate) fn de_project<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::Project>, ::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::ProjectBuilder::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 "CreateDate" => {
25 builder = builder.set_create_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
26 tokens.next(),
27 ::aws_smithy_types::date_time::Format::EpochSeconds,
28 )?);
29 }
30 "CreatedBy" => {
31 builder = builder.set_created_by(
32 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
33 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
34 .transpose()?,
35 );
36 }
37 "DatasetName" => {
38 builder = builder.set_dataset_name(
39 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
40 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
41 .transpose()?,
42 );
43 }
44 "LastModifiedDate" => {
45 builder = builder.set_last_modified_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
46 tokens.next(),
47 ::aws_smithy_types::date_time::Format::EpochSeconds,
48 )?);
49 }
50 "LastModifiedBy" => {
51 builder = builder.set_last_modified_by(
52 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
53 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
54 .transpose()?,
55 );
56 }
57 "Name" => {
58 builder = builder.set_name(
59 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
60 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
61 .transpose()?,
62 );
63 }
64 "RecipeName" => {
65 builder = builder.set_recipe_name(
66 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
67 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
68 .transpose()?,
69 );
70 }
71 "ResourceArn" => {
72 builder = builder.set_resource_arn(
73 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
74 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
75 .transpose()?,
76 );
77 }
78 "Sample" => {
79 builder = builder.set_sample(crate::protocol_serde::shape_sample::de_sample(tokens)?);
80 }
81 "Tags" => {
82 builder = builder.set_tags(crate::protocol_serde::shape_tag_map::de_tag_map(tokens)?);
83 }
84 "RoleArn" => {
85 builder = builder.set_role_arn(
86 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
87 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
88 .transpose()?,
89 );
90 }
91 "OpenedBy" => {
92 builder = builder.set_opened_by(
93 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
94 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
95 .transpose()?,
96 );
97 }
98 "OpenDate" => {
99 builder = builder.set_open_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
100 tokens.next(),
101 ::aws_smithy_types::date_time::Format::EpochSeconds,
102 )?);
103 }
104 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
105 },
106 other => {
107 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
108 "expected object key or end object, found: {:?}",
109 other
110 )))
111 }
112 }
113 }
114 Ok(Some(crate::serde_util::project_correct_errors(builder).build().map_err(|err| {
115 ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
116 })?))
117 }
118 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
119 "expected start object or null",
120 )),
121 }
122}