aws_sdk_ec2/protocol_serde/
shape_disable_fast_launch.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_disable_fast_launch_http_error(
4    _response_status: u16,
5    _response_headers: &::aws_smithy_runtime_api::http::Headers,
6    _response_body: &[u8],
7) -> std::result::Result<crate::operation::disable_fast_launch::DisableFastLaunchOutput, crate::operation::disable_fast_launch::DisableFastLaunchError>
8{
9    #[allow(unused_mut)]
10    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
11        .map_err(crate::operation::disable_fast_launch::DisableFastLaunchError::unhandled)?;
12    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
13    let generic = generic_builder.build();
14    Err(crate::operation::disable_fast_launch::DisableFastLaunchError::generic(generic))
15}
16
17#[allow(clippy::unnecessary_wraps)]
18pub fn de_disable_fast_launch_http_response(
19    _response_status: u16,
20    _response_headers: &::aws_smithy_runtime_api::http::Headers,
21    _response_body: &[u8],
22) -> std::result::Result<crate::operation::disable_fast_launch::DisableFastLaunchOutput, crate::operation::disable_fast_launch::DisableFastLaunchError>
23{
24    Ok({
25        #[allow(unused_mut)]
26        let mut output = crate::operation::disable_fast_launch::builders::DisableFastLaunchOutputBuilder::default();
27        output = crate::protocol_serde::shape_disable_fast_launch::de_disable_fast_launch(_response_body, output)
28            .map_err(crate::operation::disable_fast_launch::DisableFastLaunchError::unhandled)?;
29        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
30        output.build()
31    })
32}
33
34#[allow(unused_mut)]
35pub fn de_disable_fast_launch(
36    inp: &[u8],
37    mut builder: crate::operation::disable_fast_launch::builders::DisableFastLaunchOutputBuilder,
38) -> std::result::Result<crate::operation::disable_fast_launch::builders::DisableFastLaunchOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError> {
39    let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
40
41    #[allow(unused_mut)]
42    let mut decoder = doc.root_element()?;
43    #[allow(unused_variables)]
44    let start_el = decoder.start_el();
45    if !(start_el.matches("DisableFastLaunchResponse")) {
46        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
47            "invalid root, expected DisableFastLaunchResponse got {:?}",
48            start_el
49        )));
50    }
51    while let Some(mut tag) = decoder.next_tag() {
52        match tag.start_el() {
53            s if s.matches("imageId") /* ImageId com.amazonaws.ec2.synthetic#DisableFastLaunchOutput$ImageId */ =>  {
54                let var_1 =
55                    Some(
56                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
57                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
58                            .into()
59                        )
60                        ?
61                    )
62                ;
63                builder = builder.set_image_id(var_1);
64            }
65            ,
66            s if s.matches("resourceType") /* ResourceType com.amazonaws.ec2.synthetic#DisableFastLaunchOutput$ResourceType */ =>  {
67                let var_2 =
68                    Some(
69                        Result::<crate::types::FastLaunchResourceType, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
70                            crate::types::FastLaunchResourceType::from(
71                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
72                            )
73                        )
74                        ?
75                    )
76                ;
77                builder = builder.set_resource_type(var_2);
78            }
79            ,
80            s if s.matches("snapshotConfiguration") /* SnapshotConfiguration com.amazonaws.ec2.synthetic#DisableFastLaunchOutput$SnapshotConfiguration */ =>  {
81                let var_3 =
82                    Some(
83                        crate::protocol_serde::shape_fast_launch_snapshot_configuration_response::de_fast_launch_snapshot_configuration_response(&mut tag)
84                        ?
85                    )
86                ;
87                builder = builder.set_snapshot_configuration(var_3);
88            }
89            ,
90            s if s.matches("launchTemplate") /* LaunchTemplate com.amazonaws.ec2.synthetic#DisableFastLaunchOutput$LaunchTemplate */ =>  {
91                let var_4 =
92                    Some(
93                        crate::protocol_serde::shape_fast_launch_launch_template_specification_response::de_fast_launch_launch_template_specification_response(&mut tag)
94                        ?
95                    )
96                ;
97                builder = builder.set_launch_template(var_4);
98            }
99            ,
100            s if s.matches("maxParallelLaunches") /* MaxParallelLaunches com.amazonaws.ec2.synthetic#DisableFastLaunchOutput$MaxParallelLaunches */ =>  {
101                let var_5 =
102                    Some(
103                         {
104                            <i32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
105                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
106                            )
107                            .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (integer: `com.amazonaws.ec2#Integer`)"))
108                        }
109                        ?
110                    )
111                ;
112                builder = builder.set_max_parallel_launches(var_5);
113            }
114            ,
115            s if s.matches("ownerId") /* OwnerId com.amazonaws.ec2.synthetic#DisableFastLaunchOutput$OwnerId */ =>  {
116                let var_6 =
117                    Some(
118                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
119                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
120                            .into()
121                        )
122                        ?
123                    )
124                ;
125                builder = builder.set_owner_id(var_6);
126            }
127            ,
128            s if s.matches("state") /* State com.amazonaws.ec2.synthetic#DisableFastLaunchOutput$State */ =>  {
129                let var_7 =
130                    Some(
131                        Result::<crate::types::FastLaunchStateCode, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
132                            crate::types::FastLaunchStateCode::from(
133                                ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
134                            )
135                        )
136                        ?
137                    )
138                ;
139                builder = builder.set_state(var_7);
140            }
141            ,
142            s if s.matches("stateTransitionReason") /* StateTransitionReason com.amazonaws.ec2.synthetic#DisableFastLaunchOutput$StateTransitionReason */ =>  {
143                let var_8 =
144                    Some(
145                        Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
146                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
147                            .into()
148                        )
149                        ?
150                    )
151                ;
152                builder = builder.set_state_transition_reason(var_8);
153            }
154            ,
155            s if s.matches("stateTransitionTime") /* StateTransitionTime com.amazonaws.ec2.synthetic#DisableFastLaunchOutput$StateTransitionTime */ =>  {
156                let var_9 =
157                    Some(
158                        ::aws_smithy_types::DateTime::from_str(
159                            ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
160                            , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
161                        )
162                        .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.ec2#MillisecondDateTime`)"))
163                        ?
164                    )
165                ;
166                builder = builder.set_state_transition_time(var_9);
167            }
168            ,
169            _ => {}
170        }
171    }
172    Ok(builder)
173}