aws_sdk_codedeploy/protocol_serde/
shape_auto_rollback_configuration.rs1pub fn ser_auto_rollback_configuration(
3 object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
4 input: &crate::types::AutoRollbackConfiguration,
5) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
6 if input.enabled {
7 object.key("enabled").boolean(input.enabled);
8 }
9 if let Some(var_1) = &input.events {
10 let mut array_2 = object.key("events").start_array();
11 for item_3 in var_1 {
12 {
13 array_2.value().string(item_3.as_str());
14 }
15 }
16 array_2.finish();
17 }
18 Ok(())
19}
20
21pub(crate) fn de_auto_rollback_configuration<'a, I>(
22 tokens: &mut ::std::iter::Peekable<I>,
23) -> ::std::result::Result<Option<crate::types::AutoRollbackConfiguration>, ::aws_smithy_json::deserialize::error::DeserializeError>
24where
25 I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
26{
27 match tokens.next().transpose()? {
28 Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
29 Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
30 #[allow(unused_mut)]
31 let mut builder = crate::types::builders::AutoRollbackConfigurationBuilder::default();
32 loop {
33 match tokens.next().transpose()? {
34 Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
35 Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
36 "enabled" => {
37 builder = builder.set_enabled(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
38 }
39 "events" => {
40 builder = builder.set_events(crate::protocol_serde::shape_auto_rollback_events_list::de_auto_rollback_events_list(
41 tokens,
42 )?);
43 }
44 _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
45 },
46 other => {
47 return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
48 "expected object key or end object, found: {:?}",
49 other
50 )))
51 }
52 }
53 }
54 Ok(Some(builder.build()))
55 }
56 _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
57 "expected start object or null",
58 )),
59 }
60}