aws-sdk-ec2 1.218.0

AWS SDK for Amazon Elastic Compute Cloud
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub fn ser_create_fleet_input_input_input(
    input: &crate::operation::create_fleet::CreateFleetInput,
) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
    let mut out = String::new();
    #[allow(unused_mut)]
    let mut writer = ::aws_smithy_query::QueryWriter::new(&mut out, "CreateFleet", "2016-11-15");
    #[allow(unused_mut)]
    let mut scope_1 = writer.prefix("DryRun");
    if let Some(var_2) = &input.dry_run {
        scope_1.boolean(*var_2);
    }
    #[allow(unused_mut)]
    let mut scope_3 = writer.prefix("ClientToken");
    if let Some(var_4) = &input.client_token {
        scope_3.string(var_4);
    }
    #[allow(unused_mut)]
    let mut scope_5 = writer.prefix("SpotOptions");
    if let Some(var_6) = &input.spot_options {
        crate::protocol_serde::shape_spot_options_request::ser_spot_options_request(scope_5, var_6)?;
    }
    #[allow(unused_mut)]
    let mut scope_7 = writer.prefix("OnDemandOptions");
    if let Some(var_8) = &input.on_demand_options {
        crate::protocol_serde::shape_on_demand_options_request::ser_on_demand_options_request(scope_7, var_8)?;
    }
    #[allow(unused_mut)]
    let mut scope_9 = writer.prefix("ExcessCapacityTerminationPolicy");
    if let Some(var_10) = &input.excess_capacity_termination_policy {
        scope_9.string(var_10.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_11 = writer.prefix("LaunchTemplateConfigs");
    if let Some(var_12) = &input.launch_template_configs {
        if !var_12.is_empty() {
            let mut list_14 = scope_11.start_list(true, Some("item"));
            for item_13 in var_12 {
                #[allow(unused_mut)]
                let mut entry_15 = list_14.entry();
                crate::protocol_serde::shape_fleet_launch_template_config_request::ser_fleet_launch_template_config_request(entry_15, item_13)?;
            }
            list_14.finish();
        }
    }
    #[allow(unused_mut)]
    let mut scope_16 = writer.prefix("TargetCapacitySpecification");
    if let Some(var_17) = &input.target_capacity_specification {
        crate::protocol_serde::shape_target_capacity_specification_request::ser_target_capacity_specification_request(scope_16, var_17)?;
    }
    #[allow(unused_mut)]
    let mut scope_18 = writer.prefix("TerminateInstancesWithExpiration");
    if let Some(var_19) = &input.terminate_instances_with_expiration {
        scope_18.boolean(*var_19);
    }
    #[allow(unused_mut)]
    let mut scope_20 = writer.prefix("Type");
    if let Some(var_21) = &input.r#type {
        scope_20.string(var_21.as_str());
    }
    #[allow(unused_mut)]
    let mut scope_22 = writer.prefix("ValidFrom");
    if let Some(var_23) = &input.valid_from {
        scope_22.date_time(var_23, ::aws_smithy_types::date_time::Format::DateTime)?;
    }
    #[allow(unused_mut)]
    let mut scope_24 = writer.prefix("ValidUntil");
    if let Some(var_25) = &input.valid_until {
        scope_24.date_time(var_25, ::aws_smithy_types::date_time::Format::DateTime)?;
    }
    #[allow(unused_mut)]
    let mut scope_26 = writer.prefix("ReplaceUnhealthyInstances");
    if let Some(var_27) = &input.replace_unhealthy_instances {
        scope_26.boolean(*var_27);
    }
    #[allow(unused_mut)]
    let mut scope_28 = writer.prefix("TagSpecification");
    if let Some(var_29) = &input.tag_specifications {
        if !var_29.is_empty() {
            let mut list_31 = scope_28.start_list(true, Some("item"));
            for item_30 in var_29 {
                #[allow(unused_mut)]
                let mut entry_32 = list_31.entry();
                crate::protocol_serde::shape_tag_specification::ser_tag_specification(entry_32, item_30)?;
            }
            list_31.finish();
        }
    }
    #[allow(unused_mut)]
    let mut scope_33 = writer.prefix("Context");
    if let Some(var_34) = &input.context {
        scope_33.string(var_34);
    }
    writer.finish();
    Ok(::aws_smithy_types::body::SdkBody::from(out))
}