aws_sdk_ssm/protocol_serde/
shape_command.rs1pub(crate) fn de_command<'a, I>(
3 tokens: &mut ::std::iter::Peekable<I>,
4) -> ::std::result::Result<Option<crate::types::Command>, ::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::CommandBuilder::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 "CommandId" => {
18 builder = builder.set_command_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 "DocumentName" => {
25 builder = builder.set_document_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 "DocumentVersion" => {
32 builder = builder.set_document_version(
33 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
34 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
35 .transpose()?,
36 );
37 }
38 "Comment" => {
39 builder = builder.set_comment(
40 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
41 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
42 .transpose()?,
43 );
44 }
45 "ExpiresAfter" => {
46 builder = builder.set_expires_after(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
47 tokens.next(),
48 ::aws_smithy_types::date_time::Format::EpochSeconds,
49 )?);
50 }
51 "Parameters" => {
52 builder = builder.set_parameters(crate::protocol_serde::shape_parameters::de_parameters(tokens)?);
53 }
54 "InstanceIds" => {
55 builder = builder.set_instance_ids(crate::protocol_serde::shape_instance_id_list::de_instance_id_list(tokens)?);
56 }
57 "Targets" => {
58 builder = builder.set_targets(crate::protocol_serde::shape_targets::de_targets(tokens)?);
59 }
60 "RequestedDateTime" => {
61 builder = builder.set_requested_date_time(::aws_smithy_json::deserialize::token::expect_timestamp_or_null(
62 tokens.next(),
63 ::aws_smithy_types::date_time::Format::EpochSeconds,
64 )?);
65 }
66 "Status" => {
67 builder = builder.set_status(
68 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
69 .map(|s| s.to_unescaped().map(|u| crate::types::CommandStatus::from(u.as_ref())))
70 .transpose()?,
71 );
72 }
73 "StatusDetails" => {
74 builder = builder.set_status_details(
75 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
76 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
77 .transpose()?,
78 );
79 }
80 "OutputS3Region" => {
81 builder = builder.set_output_s3_region(
82 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
83 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
84 .transpose()?,
85 );
86 }
87 "OutputS3BucketName" => {
88 builder = builder.set_output_s3_bucket_name(
89 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
90 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
91 .transpose()?,
92 );
93 }
94 "OutputS3KeyPrefix" => {
95 builder = builder.set_output_s3_key_prefix(
96 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
97 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
98 .transpose()?,
99 );
100 }
101 "MaxConcurrency" => {
102 builder = builder.set_max_concurrency(
103 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
104 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
105 .transpose()?,
106 );
107 }
108 "MaxErrors" => {
109 builder = builder.set_max_errors(
110 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
111 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
112 .transpose()?,
113 );
114 }
115 "TargetCount" => {
116 builder = builder.set_target_count(
117 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
118 .map(i32::try_from)
119 .transpose()?,
120 );
121 }
122 "CompletedCount" => {
123 builder = builder.set_completed_count(
124 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
125 .map(i32::try_from)
126 .transpose()?,
127 );
128 }
129 "ErrorCount" => {
130 builder = builder.set_error_count(
131 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
132 .map(i32::try_from)
133 .transpose()?,
134 );
135 }
136 "DeliveryTimedOutCount" => {
137 builder = builder.set_delivery_timed_out_count(
138 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
139 .map(i32::try_from)
140 .transpose()?,
141 );
142 }
143 "ServiceRole" => {
144 builder = builder.set_service_role(
145 ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
146 .map(|s| s.to_unescaped().map(|u| u.into_owned()))
147 .transpose()?,
148 );
149 }
150 "NotificationConfig" => {
151 builder =
152 builder.set_notification_config(crate::protocol_serde::shape_notification_config::de_notification_config(tokens)?);
153 }
154 "CloudWatchOutputConfig" => {
155 builder = builder.set_cloud_watch_output_config(
156 crate::protocol_serde::shape_cloud_watch_output_config::de_cloud_watch_output_config(tokens)?,
157 );
158 }
159 "TimeoutSeconds" => {
160 builder = builder.set_timeout_seconds(
161 ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
162 .map(i32::try_from)
163 .transpose()?,
164 );
165 }
166 "AlarmConfiguration" => {
167 builder =
168 builder.set_alarm_configuration(crate::protocol_serde::shape_alarm_configuration::de_alarm_configuration(tokens)?);
169 }
170 "TriggeredAlarms" => {
171 builder = builder.set_triggered_alarms(
172 crate::protocol_serde::shape_alarm_state_information_list::de_alarm_state_information_list(tokens)?,
173 );
174 }
175 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
176 },
177 other => {
178 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
179 "expected object key or end object, found: {:?}",
180 other
181 )))
182 }
183 }
184 }
185 Ok(Some(builder.build()))
186 }
187 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
188 "expected start object or null",
189 )),
190 }
191}