aws_sdk_ec2/protocol_serde/
shape_purchase_host_reservation_input.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub fn ser_purchase_host_reservation_input_input_input(
3    input: &crate::operation::purchase_host_reservation::PurchaseHostReservationInput,
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, "PurchaseHostReservation", "2016-11-15");
8    #[allow(unused_mut)]
9    let mut scope_1 = writer.prefix("ClientToken");
10    if let Some(var_2) = &input.client_token {
11        scope_1.string(var_2);
12    }
13    #[allow(unused_mut)]
14    let mut scope_3 = writer.prefix("CurrencyCode");
15    if let Some(var_4) = &input.currency_code {
16        scope_3.string(var_4.as_str());
17    }
18    #[allow(unused_mut)]
19    let mut scope_5 = writer.prefix("HostIdSet");
20    if let Some(var_6) = &input.host_id_set {
21        if !var_6.is_empty() {
22            let mut list_8 = scope_5.start_list(true, Some("item"));
23            for item_7 in var_6 {
24                #[allow(unused_mut)]
25                let mut entry_9 = list_8.entry();
26                entry_9.string(item_7);
27            }
28            list_8.finish();
29        }
30    }
31    #[allow(unused_mut)]
32    let mut scope_10 = writer.prefix("LimitPrice");
33    if let Some(var_11) = &input.limit_price {
34        scope_10.string(var_11);
35    }
36    #[allow(unused_mut)]
37    let mut scope_12 = writer.prefix("OfferingId");
38    if let Some(var_13) = &input.offering_id {
39        scope_12.string(var_13);
40    }
41    #[allow(unused_mut)]
42    let mut scope_14 = writer.prefix("TagSpecification");
43    if let Some(var_15) = &input.tag_specifications {
44        if !var_15.is_empty() {
45            let mut list_17 = scope_14.start_list(true, Some("item"));
46            for item_16 in var_15 {
47                #[allow(unused_mut)]
48                let mut entry_18 = list_17.entry();
49                crate::protocol_serde::shape_tag_specification::ser_tag_specification(entry_18, item_16)?;
50            }
51            list_17.finish();
52        }
53    }
54    writer.finish();
55    Ok(::aws_smithy_types::body::SdkBody::from(out))
56}