1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | pub fn ser_auto_scaling_group_provider(
|
3 - | object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
|
4 - | input: &crate::types::AutoScalingGroupProvider,
|
5 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
|
6 - | {
|
7 - | object.key("autoScalingGroupArn").string(input.auto_scaling_group_arn.as_str());
|
8 - | }
|
9 - | if let Some(var_1) = &input.managed_scaling {
|
10 - | #[allow(unused_mut)]
|
11 - | let mut object_2 = object.key("managedScaling").start_object();
|
12 - | crate::protocol_serde::shape_managed_scaling::ser_managed_scaling(&mut object_2, var_1)?;
|
13 - | object_2.finish();
|
14 - | }
|
15 - | if let Some(var_3) = &input.managed_termination_protection {
|
16 - | object.key("managedTerminationProtection").string(var_3.as_str());
|
17 - | }
|
18 - | if let Some(var_4) = &input.managed_draining {
|
19 - | object.key("managedDraining").string(var_4.as_str());
|
20 - | }
|
21 - | Ok(())
|
22 - | }
|
23 - |
|
24 - | pub(crate) fn de_auto_scaling_group_provider<'a, I>(
|
25 - | tokens: &mut ::std::iter::Peekable<I>,
|
26 - | _value: &'a [u8],
|
27 - | ) -> ::std::result::Result<Option<crate::types::AutoScalingGroupProvider>, ::aws_smithy_json::deserialize::error::DeserializeError>
|
28 - | where
|
29 - | I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
|
30 - | {
|
31 - | match tokens.next().transpose()? {
|
32 - | Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
|
33 - | Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
|
34 - | #[allow(unused_mut)]
|
35 - | let mut builder = crate::types::builders::AutoScalingGroupProviderBuilder::default();
|
36 - | loop {
|
37 - | match tokens.next().transpose()? {
|
38 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
39 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
40 - | "autoScalingGroupArn" => {
|
41 - | builder = builder.set_auto_scaling_group_arn(
|
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 - | "managedScaling" => {
|
48 - | builder = builder.set_managed_scaling(crate::protocol_serde::shape_managed_scaling::de_managed_scaling(tokens, _value)?);
|
49 - | }
|
50 - | "managedTerminationProtection" => {
|
51 - | builder = builder.set_managed_termination_protection(
|
52 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
53 - | .map(|s| s.to_unescaped().map(|u| crate::types::ManagedTerminationProtection::from(u.as_ref())))
|
54 - | .transpose()?,
|
55 - | );
|
56 - | }
|
57 - | "managedDraining" => {
|
58 - | builder = builder.set_managed_draining(
|
59 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
60 - | .map(|s| s.to_unescaped().map(|u| crate::types::ManagedDraining::from(u.as_ref())))
|
61 - | .transpose()?,
|
62 - | );
|
63 - | }
|
64 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
65 - | },
|
66 - | other => {
|
67 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
68 - | "expected object key or end object, found: {other:?}"
|
69 - | )))
|
70 - | }
|
71 - | }
|
72 - | }
|
73 - | Ok(Some(
|
74 - | crate::serde_util::auto_scaling_group_provider_correct_errors(builder)
|
75 - | .build()
|
76 - | .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
|
77 - | ))
|
78 - | }
|
79 - | _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
80 - | "expected start object or null",
|
81 - | )),
|
82 - | }
|
83 - | }
|