aws-sdk-mgn 1.102.0

AWS SDK for Application Migration Service
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub(crate) fn de_launch_configuration_template<'a, I>(
    tokens: &mut ::std::iter::Peekable<I>,
    _value: &'a [u8],
) -> ::std::result::Result<Option<crate::types::LaunchConfigurationTemplate>, ::aws_smithy_json::deserialize::error::DeserializeError>
where
    I: Iterator<Item = Result<::aws_smithy_json::deserialize::Token<'a>, ::aws_smithy_json::deserialize::error::DeserializeError>>,
{
    match tokens.next().transpose()? {
        Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None),
        Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => {
            #[allow(unused_mut)]
            let mut builder = crate::types::builders::LaunchConfigurationTemplateBuilder::default();
            loop {
                match tokens.next().transpose()? {
                    Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
                    Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
                        "launchConfigurationTemplateID" => {
                            builder = builder.set_launch_configuration_template_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "arn" => {
                            builder = builder.set_arn(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "postLaunchActions" => {
                            builder = builder
                                .set_post_launch_actions(crate::protocol_serde::shape_post_launch_actions::de_post_launch_actions(tokens, _value)?);
                        }
                        "enableMapAutoTagging" => {
                            builder = builder.set_enable_map_auto_tagging(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "mapAutoTaggingMpeID" => {
                            builder = builder.set_map_auto_tagging_mpe_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "tags" => {
                            builder = builder.set_tags(crate::protocol_serde::shape_tags_map::de_tags_map(tokens, _value)?);
                        }
                        "ec2LaunchTemplateID" => {
                            builder = builder.set_ec2_launch_template_id(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        "launchDisposition" => {
                            builder = builder.set_launch_disposition(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| crate::types::LaunchDisposition::from(u.as_ref())))
                                    .transpose()?,
                            );
                        }
                        "targetInstanceTypeRightSizingMethod" => {
                            builder = builder.set_target_instance_type_right_sizing_method(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| {
                                        s.to_unescaped()
                                            .map(|u| crate::types::TargetInstanceTypeRightSizingMethod::from(u.as_ref()))
                                    })
                                    .transpose()?,
                            );
                        }
                        "copyPrivateIp" => {
                            builder = builder.set_copy_private_ip(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "associatePublicIpAddress" => {
                            builder =
                                builder.set_associate_public_ip_address(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "copyTags" => {
                            builder = builder.set_copy_tags(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "licensing" => {
                            builder = builder.set_licensing(crate::protocol_serde::shape_licensing::de_licensing(tokens, _value)?);
                        }
                        "bootMode" => {
                            builder = builder.set_boot_mode(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| crate::types::BootMode::from(u.as_ref())))
                                    .transpose()?,
                            );
                        }
                        "smallVolumeMaxSize" => {
                            builder = builder.set_small_volume_max_size(
                                ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())?
                                    .map(i64::try_from)
                                    .transpose()?,
                            );
                        }
                        "smallVolumeConf" => {
                            builder = builder.set_small_volume_conf(
                                crate::protocol_serde::shape_launch_template_disk_conf::de_launch_template_disk_conf(tokens, _value)?,
                            );
                        }
                        "largeVolumeConf" => {
                            builder = builder.set_large_volume_conf(
                                crate::protocol_serde::shape_launch_template_disk_conf::de_launch_template_disk_conf(tokens, _value)?,
                            );
                        }
                        "enableParametersEncryption" => {
                            builder =
                                builder.set_enable_parameters_encryption(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
                        }
                        "parametersEncryptionKey" => {
                            builder = builder.set_parameters_encryption_key(
                                ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
                                    .map(|s| s.to_unescaped().map(|u| u.into_owned()))
                                    .transpose()?,
                            );
                        }
                        _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
                    },
                    other => {
                        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
                            "expected object key or end object, found: {other:?}"
                        )))
                    }
                }
            }
            Ok(Some(
                crate::serde_util::launch_configuration_template_correct_errors(builder)
                    .build()
                    .map_err(|err| ::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?,
            ))
        }
        _ => Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
            "expected start object or null",
        )),
    }
}