aws_sdk_redshift/protocol_serde/
shape_modify_integration.rs1#[allow(clippy::unnecessary_wraps)]
3pub fn de_modify_integration_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::modify_integration::ModifyIntegrationOutput, crate::operation::modify_integration::ModifyIntegrationError>
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::modify_integration::ModifyIntegrationError::unhandled)?;
12 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
13 let generic = generic_builder.build();
14 let error_code = match generic.code() {
15 Some(code) => code,
16 None => return Err(crate::operation::modify_integration::ModifyIntegrationError::unhandled(generic)),
17 };
18
19 let _error_message = generic.message().map(|msg| msg.to_owned());
20 Err(match error_code {
21 "IntegrationAlreadyExistsFault" => crate::operation::modify_integration::ModifyIntegrationError::IntegrationAlreadyExistsFault({
22 #[allow(unused_mut)]
23 let mut tmp = {
24 #[allow(unused_mut)]
25 let mut output = crate::types::error::builders::IntegrationAlreadyExistsFaultBuilder::default();
26 output = crate::protocol_serde::shape_integration_already_exists_fault::de_integration_already_exists_fault_xml_err(
27 _response_body,
28 output,
29 )
30 .map_err(crate::operation::modify_integration::ModifyIntegrationError::unhandled)?;
31 let output = output.meta(generic);
32 output.build()
33 };
34 if tmp.message.is_none() {
35 tmp.message = _error_message;
36 }
37 tmp
38 }),
39 "IntegrationConflictOperationFault" => crate::operation::modify_integration::ModifyIntegrationError::IntegrationConflictOperationFault({
40 #[allow(unused_mut)]
41 let mut tmp = {
42 #[allow(unused_mut)]
43 let mut output = crate::types::error::builders::IntegrationConflictOperationFaultBuilder::default();
44 output = crate::protocol_serde::shape_integration_conflict_operation_fault::de_integration_conflict_operation_fault_xml_err(
45 _response_body,
46 output,
47 )
48 .map_err(crate::operation::modify_integration::ModifyIntegrationError::unhandled)?;
49 let output = output.meta(generic);
50 output.build()
51 };
52 if tmp.message.is_none() {
53 tmp.message = _error_message;
54 }
55 tmp
56 }),
57 "IntegrationConflictStateFault" => crate::operation::modify_integration::ModifyIntegrationError::IntegrationConflictStateFault({
58 #[allow(unused_mut)]
59 let mut tmp = {
60 #[allow(unused_mut)]
61 let mut output = crate::types::error::builders::IntegrationConflictStateFaultBuilder::default();
62 output = crate::protocol_serde::shape_integration_conflict_state_fault::de_integration_conflict_state_fault_xml_err(
63 _response_body,
64 output,
65 )
66 .map_err(crate::operation::modify_integration::ModifyIntegrationError::unhandled)?;
67 let output = output.meta(generic);
68 output.build()
69 };
70 if tmp.message.is_none() {
71 tmp.message = _error_message;
72 }
73 tmp
74 }),
75 "IntegrationNotFoundFault" => crate::operation::modify_integration::ModifyIntegrationError::IntegrationNotFoundFault({
76 #[allow(unused_mut)]
77 let mut tmp = {
78 #[allow(unused_mut)]
79 let mut output = crate::types::error::builders::IntegrationNotFoundFaultBuilder::default();
80 output = crate::protocol_serde::shape_integration_not_found_fault::de_integration_not_found_fault_xml_err(_response_body, output)
81 .map_err(crate::operation::modify_integration::ModifyIntegrationError::unhandled)?;
82 let output = output.meta(generic);
83 output.build()
84 };
85 if tmp.message.is_none() {
86 tmp.message = _error_message;
87 }
88 tmp
89 }),
90 "UnsupportedOperation" => crate::operation::modify_integration::ModifyIntegrationError::UnsupportedOperationFault({
91 #[allow(unused_mut)]
92 let mut tmp = {
93 #[allow(unused_mut)]
94 let mut output = crate::types::error::builders::UnsupportedOperationFaultBuilder::default();
95 output = crate::protocol_serde::shape_unsupported_operation_fault::de_unsupported_operation_fault_xml_err(_response_body, output)
96 .map_err(crate::operation::modify_integration::ModifyIntegrationError::unhandled)?;
97 let output = output.meta(generic);
98 output.build()
99 };
100 if tmp.message.is_none() {
101 tmp.message = _error_message;
102 }
103 tmp
104 }),
105 _ => crate::operation::modify_integration::ModifyIntegrationError::generic(generic),
106 })
107}
108
109#[allow(clippy::unnecessary_wraps)]
110pub fn de_modify_integration_http_response(
111 _response_status: u16,
112 _response_headers: &::aws_smithy_runtime_api::http::Headers,
113 _response_body: &[u8],
114) -> std::result::Result<crate::operation::modify_integration::ModifyIntegrationOutput, crate::operation::modify_integration::ModifyIntegrationError>
115{
116 Ok({
117 #[allow(unused_mut)]
118 let mut output = crate::operation::modify_integration::builders::ModifyIntegrationOutputBuilder::default();
119 output = crate::protocol_serde::shape_modify_integration::de_modify_integration(_response_body, output)
120 .map_err(crate::operation::modify_integration::ModifyIntegrationError::unhandled)?;
121 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
122 output.build()
123 })
124}
125
126#[allow(unused_mut)]
127pub fn de_modify_integration(
128 inp: &[u8],
129 mut builder: crate::operation::modify_integration::builders::ModifyIntegrationOutputBuilder,
130) -> std::result::Result<crate::operation::modify_integration::builders::ModifyIntegrationOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError> {
131 let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
132
133 #[allow(unused_mut)]
134 let mut decoder = doc.root_element()?;
135 #[allow(unused_variables)]
136 let start_el = decoder.start_el();
137 if !(start_el.matches("ModifyIntegrationResponse")) {
138 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
139 "invalid root, expected ModifyIntegrationResponse got {:?}",
140 start_el
141 )));
142 }
143 if let Some(mut result_tag) = decoder.next_tag() {
144 let start_el = result_tag.start_el();
145 if !(start_el.matches("ModifyIntegrationResult")) {
146 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
147 "invalid result, expected ModifyIntegrationResult got {:?}",
148 start_el
149 )));
150 }
151 while let Some(mut tag) = result_tag.next_tag() {
152 match tag.start_el() {
153 s if s.matches("IntegrationArn") => {
154 let var_1 =
155 Some(
156 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
157 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
158 .into()
159 )
160 ?
161 )
162 ;
163 builder = builder.set_integration_arn(var_1);
164 }
165 ,
166 s if s.matches("IntegrationName") => {
167 let var_2 =
168 Some(
169 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
170 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
171 .into()
172 )
173 ?
174 )
175 ;
176 builder = builder.set_integration_name(var_2);
177 }
178 ,
179 s if s.matches("SourceArn") => {
180 let var_3 =
181 Some(
182 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
183 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
184 .into()
185 )
186 ?
187 )
188 ;
189 builder = builder.set_source_arn(var_3);
190 }
191 ,
192 s if s.matches("TargetArn") => {
193 let var_4 =
194 Some(
195 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
196 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
197 .into()
198 )
199 ?
200 )
201 ;
202 builder = builder.set_target_arn(var_4);
203 }
204 ,
205 s if s.matches("Status") => {
206 let var_5 =
207 Some(
208 Result::<crate::types::ZeroEtlIntegrationStatus, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
209 crate::types::ZeroEtlIntegrationStatus::from(
210 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
211 )
212 )
213 ?
214 )
215 ;
216 builder = builder.set_status(var_5);
217 }
218 ,
219 s if s.matches("Errors") => {
220 let var_6 =
221 Some(
222 crate::protocol_serde::shape_integration_error_list::de_integration_error_list(&mut tag)
223 ?
224 )
225 ;
226 builder = builder.set_errors(var_6);
227 }
228 ,
229 s if s.matches("CreateTime") => {
230 let var_7 =
231 Some(
232 ::aws_smithy_types::DateTime::from_str(
233 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
234 , ::aws_smithy_types::date_time::Format::DateTimeWithOffset
235 )
236 .map_err(|_|::aws_smithy_xml::decode::XmlDecodeError::custom("expected (timestamp: `com.amazonaws.redshift#TStamp`)"))
237 ?
238 )
239 ;
240 builder = builder.set_create_time(var_7);
241 }
242 ,
243 s if s.matches("Description") => {
244 let var_8 =
245 Some(
246 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
247 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
248 .into()
249 )
250 ?
251 )
252 ;
253 builder = builder.set_description(var_8);
254 }
255 ,
256 s if s.matches("KMSKeyId") => {
257 let var_9 =
258 Some(
259 Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
260 ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
261 .into()
262 )
263 ?
264 )
265 ;
266 builder = builder.set_kms_key_id(var_9);
267 }
268 ,
269 s if s.matches("AdditionalEncryptionContext") => {
270 let var_10 =
271 Some(
272 crate::protocol_serde::shape_encryption_context_map::de_encryption_context_map(&mut tag)
273 ?
274 )
275 ;
276 builder = builder.set_additional_encryption_context(var_10);
277 }
278 ,
279 s if s.matches("Tags") => {
280 let var_11 =
281 Some(
282 crate::protocol_serde::shape_tag_list::de_tag_list(&mut tag)
283 ?
284 )
285 ;
286 builder = builder.set_tags(var_11);
287 }
288 ,
289 _ => {}
290 }
291 }
292 } else {
293 return Err(::aws_smithy_xml::decode::XmlDecodeError::custom("expected ModifyIntegrationResult tag"));
294 };
295 Ok(builder)
296}