aws_sdk_ec2/protocol_serde/
shape_create_capacity_reservation_fleet_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_create_capacity_reservation_fleet_input_input_input(
3    input: &crate::operation::create_capacity_reservation_fleet::CreateCapacityReservationFleetInput,
4) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
5    let mut out = String::new();
6    #[allow(unused_mut)]
7    let mut writer = ::aws_smithy_query::QueryWriter::new(&mut out, "CreateCapacityReservationFleet", "2016-11-15");
8    #[allow(unused_mut)]
9    let mut scope_1 = writer.prefix("AllocationStrategy");
10    if let Some(var_2) = &input.allocation_strategy {
11        scope_1.string(var_2);
12    }
13    #[allow(unused_mut)]
14    let mut scope_3 = writer.prefix("ClientToken");
15    if let Some(var_4) = &input.client_token {
16        scope_3.string(var_4);
17    }
18    #[allow(unused_mut)]
19    let mut scope_5 = writer.prefix("InstanceTypeSpecification");
20    if let Some(var_6) = &input.instance_type_specifications {
21        if !var_6.is_empty() {
22            let mut list_8 = scope_5.start_list(true, None);
23            for item_7 in var_6 {
24                #[allow(unused_mut)]
25                let mut entry_9 = list_8.entry();
26                crate::protocol_serde::shape_reservation_fleet_instance_specification::ser_reservation_fleet_instance_specification(entry_9, item_7)?;
27            }
28            list_8.finish();
29        }
30    }
31    #[allow(unused_mut)]
32    let mut scope_10 = writer.prefix("Tenancy");
33    if let Some(var_11) = &input.tenancy {
34        scope_10.string(var_11.as_str());
35    }
36    #[allow(unused_mut)]
37    let mut scope_12 = writer.prefix("TotalTargetCapacity");
38    if let Some(var_13) = &input.total_target_capacity {
39        scope_12.number(
40            #[allow(clippy::useless_conversion)]
41            ::aws_smithy_types::Number::NegInt((*var_13).into()),
42        );
43    }
44    #[allow(unused_mut)]
45    let mut scope_14 = writer.prefix("EndDate");
46    if let Some(var_15) = &input.end_date {
47        scope_14.date_time(var_15, ::aws_smithy_types::date_time::Format::DateTime)?;
48    }
49    #[allow(unused_mut)]
50    let mut scope_16 = writer.prefix("InstanceMatchCriteria");
51    if let Some(var_17) = &input.instance_match_criteria {
52        scope_16.string(var_17.as_str());
53    }
54    #[allow(unused_mut)]
55    let mut scope_18 = writer.prefix("TagSpecification");
56    if let Some(var_19) = &input.tag_specifications {
57        if !var_19.is_empty() {
58            let mut list_21 = scope_18.start_list(true, Some("item"));
59            for item_20 in var_19 {
60                #[allow(unused_mut)]
61                let mut entry_22 = list_21.entry();
62                crate::protocol_serde::shape_tag_specification::ser_tag_specification(entry_22, item_20)?;
63            }
64            list_21.finish();
65        }
66    }
67    #[allow(unused_mut)]
68    let mut scope_23 = writer.prefix("DryRun");
69    if let Some(var_24) = &input.dry_run {
70        scope_23.boolean(*var_24);
71    }
72    writer.finish();
73    Ok(::aws_smithy_types::body::SdkBody::from(out))
74}