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