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