aws_sdk_databrew/protocol_serde/
shape_job.rs1pub(crate) fn de_job<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::Job>, ::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::JobBuilder::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 "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 "EncryptionKeyArn" => {
45 builder = builder.set_encryption_key_arn(
46 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
47 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
48 .transpose()?,
49 );
50 }
51 "EncryptionMode" => {
52 builder = builder.set_encryption_mode(
53 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
54 .map(|s| s.to_unescaped().map(|u| crate::types::EncryptionMode::from(u.as_ref())))
55 .transpose()?,
56 );
57 }
58 "Name" => {
59 builder = builder.set_name(
60 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
61 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
62 .transpose()?,
63 );
64 }
65 "Type" => {
66 builder = builder.set_type(
67 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
68 .map(|s| s.to_unescaped().map(|u| crate::types::JobType::from(u.as_ref())))
69 .transpose()?,
70 );
71 }
72 "LastModifiedBy" => {
73 builder = builder.set_last_modified_by(
74 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
75 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
76 .transpose()?,
77 );
78 }
79 "LastModifiedDate" => {
80 builder = builder.set_last_modified_date(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
81 tokens.next(),
82 ::aws_smithy_types::date_time::Format::EpochSeconds,
83 )?);
84 }
85 "LogSubscription" => {
86 builder = builder.set_log_subscription(
87 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
88 .map(|s| s.to_unescaped().map(|u| crate::types::LogSubscription::from(u.as_ref())))
89 .transpose()?,
90 );
91 }
92 "MaxCapacity" => {
93 builder = builder.set_max_capacity(
94 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
95 .map(i32::try_from)
96 .transpose()?,
97 );
98 }
99 "MaxRetries" => {
100 builder = builder.set_max_retries(
101 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
102 .map(i32::try_from)
103 .transpose()?,
104 );
105 }
106 "Outputs" => {
107 builder = builder.set_outputs(crate::protocol_serde::shape_output_list::de_output_list(tokens)?);
108 }
109 "DataCatalogOutputs" => {
110 builder = builder.set_data_catalog_outputs(
111 crate::protocol_serde::shape_data_catalog_output_list::de_data_catalog_output_list(tokens)?,
112 );
113 }
114 "DatabaseOutputs" => {
115 builder =
116 builder.set_database_outputs(crate::protocol_serde::shape_database_output_list::de_database_output_list(tokens)?);
117 }
118 "ProjectName" => {
119 builder = builder.set_project_name(
120 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
121 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
122 .transpose()?,
123 );
124 }
125 "RecipeReference" => {
126 builder = builder.set_recipe_reference(crate::protocol_serde::shape_recipe_reference::de_recipe_reference(tokens)?);
127 }
128 "ResourceArn" => {
129 builder = builder.set_resource_arn(
130 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
131 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
132 .transpose()?,
133 );
134 }
135 "RoleArn" => {
136 builder = builder.set_role_arn(
137 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
138 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
139 .transpose()?,
140 );
141 }
142 "Timeout" => {
143 builder = builder.set_timeout(
144 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
145 .map(i32::try_from)
146 .transpose()?,
147 );
148 }
149 "Tags" => {
150 builder = builder.set_tags(crate::protocol_serde::shape_tag_map::de_tag_map(tokens)?);
151 }
152 "JobSample" => {
153 builder = builder.set_job_sample(crate::protocol_serde::shape_job_sample::de_job_sample(tokens)?);
154 }
155 "ValidationConfigurations" => {
156 builder = builder.set_validation_configurations(
157 crate::protocol_serde::shape_validation_configuration_list::de_validation_configuration_list(tokens)?,
158 );
159 }
160 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
161 },
162 other => {
163 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
164 "expected object key or end object, found: {:?}",
165 other
166 )))
167 }
168 }
169 }
170 Ok(Some(crate::serde_util::job_correct_errors(builder).build().map_err(|err| {
171 ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err)
172 })?))
173 }
174 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
175 "expected start object or null",
176 )),
177 }
178}