aws_sdk_ivsrealtime/protocol_serde/
shape_list_ingest_configurations.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_list_ingest_configurations_http_error(
4    _response_status: u16,
5    _response_headers: &::aws_smithy_runtime_api::http::Headers,
6    _response_body: &[u8],
7) -> std::result::Result<
8    crate::operation::list_ingest_configurations::ListIngestConfigurationsOutput,
9    crate::operation::list_ingest_configurations::ListIngestConfigurationsError,
10> {
11    #[allow(unused_mut)]
12    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
13        .map_err(crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled)?;
14    generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
15    let generic = generic_builder.build();
16    let error_code = match generic.code() {
17        Some(code) => code,
18        None => {
19            return Err(crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
20                generic,
21            ))
22        }
23    };
24
25    let _error_message = generic.message().map(|msg| msg.to_owned());
26    Err(match error_code {
27        "AccessDeniedException" => crate::operation::list_ingest_configurations::ListIngestConfigurationsError::AccessDeniedException({
28            #[allow(unused_mut)]
29            let mut tmp = {
30                #[allow(unused_mut)]
31                let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
32                output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
33                    .map_err(crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled)?;
34                output = output.set_access_control_allow_origin(
35                    crate::protocol_serde::shape_access_denied_exception::de_access_control_allow_origin_header(_response_headers).map_err(|_| {
36                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
37                            "Failed to parse accessControlAllowOrigin from header `Access-Control-Allow-Origin",
38                        )
39                    })?,
40                );
41                output = output.set_access_control_expose_headers(
42                    crate::protocol_serde::shape_access_denied_exception::de_access_control_expose_headers_header(_response_headers).map_err(
43                        |_| {
44                            crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
45                                "Failed to parse accessControlExposeHeaders from header `Access-Control-Expose-Headers",
46                            )
47                        },
48                    )?,
49                );
50                output = output.set_cache_control(
51                    crate::protocol_serde::shape_access_denied_exception::de_cache_control_header(_response_headers).map_err(|_| {
52                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
53                            "Failed to parse cacheControl from header `Cache-Control",
54                        )
55                    })?,
56                );
57                output = output.set_content_security_policy(
58                    crate::protocol_serde::shape_access_denied_exception::de_content_security_policy_header(_response_headers).map_err(|_| {
59                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
60                            "Failed to parse contentSecurityPolicy from header `Content-Security-Policy",
61                        )
62                    })?,
63                );
64                output = output.set_strict_transport_security(
65                    crate::protocol_serde::shape_access_denied_exception::de_strict_transport_security_header(_response_headers).map_err(|_| {
66                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
67                            "Failed to parse strictTransportSecurity from header `Strict-Transport-Security",
68                        )
69                    })?,
70                );
71                output = output.set_x_amzn_error_type(
72                    crate::protocol_serde::shape_access_denied_exception::de_x_amzn_error_type_header(_response_headers).map_err(|_| {
73                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
74                            "Failed to parse xAmznErrorType from header `x-amzn-ErrorType",
75                        )
76                    })?,
77                );
78                output = output.set_x_content_type_options(
79                    crate::protocol_serde::shape_access_denied_exception::de_x_content_type_options_header(_response_headers).map_err(|_| {
80                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
81                            "Failed to parse xContentTypeOptions from header `X-Content-Type-Options",
82                        )
83                    })?,
84                );
85                output = output.set_x_frame_options(
86                    crate::protocol_serde::shape_access_denied_exception::de_x_frame_options_header(_response_headers).map_err(|_| {
87                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
88                            "Failed to parse xFrameOptions from header `X-Frame-Options",
89                        )
90                    })?,
91                );
92                let output = output.meta(generic);
93                output.build()
94            };
95            if tmp.message.is_none() {
96                tmp.message = _error_message;
97            }
98            tmp
99        }),
100        "ValidationException" => crate::operation::list_ingest_configurations::ListIngestConfigurationsError::ValidationException({
101            #[allow(unused_mut)]
102            let mut tmp = {
103                #[allow(unused_mut)]
104                let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
105                output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
106                    .map_err(crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled)?;
107                output = output.set_access_control_allow_origin(
108                    crate::protocol_serde::shape_validation_exception::de_access_control_allow_origin_header(_response_headers).map_err(|_| {
109                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
110                            "Failed to parse accessControlAllowOrigin from header `Access-Control-Allow-Origin",
111                        )
112                    })?,
113                );
114                output = output.set_access_control_expose_headers(
115                    crate::protocol_serde::shape_validation_exception::de_access_control_expose_headers_header(_response_headers).map_err(|_| {
116                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
117                            "Failed to parse accessControlExposeHeaders from header `Access-Control-Expose-Headers",
118                        )
119                    })?,
120                );
121                output = output.set_cache_control(
122                    crate::protocol_serde::shape_validation_exception::de_cache_control_header(_response_headers).map_err(|_| {
123                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
124                            "Failed to parse cacheControl from header `Cache-Control",
125                        )
126                    })?,
127                );
128                output = output.set_content_security_policy(
129                    crate::protocol_serde::shape_validation_exception::de_content_security_policy_header(_response_headers).map_err(|_| {
130                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
131                            "Failed to parse contentSecurityPolicy from header `Content-Security-Policy",
132                        )
133                    })?,
134                );
135                output = output.set_strict_transport_security(
136                    crate::protocol_serde::shape_validation_exception::de_strict_transport_security_header(_response_headers).map_err(|_| {
137                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
138                            "Failed to parse strictTransportSecurity from header `Strict-Transport-Security",
139                        )
140                    })?,
141                );
142                output = output.set_x_amzn_error_type(
143                    crate::protocol_serde::shape_validation_exception::de_x_amzn_error_type_header(_response_headers).map_err(|_| {
144                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
145                            "Failed to parse xAmznErrorType from header `x-amzn-ErrorType",
146                        )
147                    })?,
148                );
149                output = output.set_x_content_type_options(
150                    crate::protocol_serde::shape_validation_exception::de_x_content_type_options_header(_response_headers).map_err(|_| {
151                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
152                            "Failed to parse xContentTypeOptions from header `X-Content-Type-Options",
153                        )
154                    })?,
155                );
156                output = output.set_x_frame_options(
157                    crate::protocol_serde::shape_validation_exception::de_x_frame_options_header(_response_headers).map_err(|_| {
158                        crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled(
159                            "Failed to parse xFrameOptions from header `X-Frame-Options",
160                        )
161                    })?,
162                );
163                let output = output.meta(generic);
164                output.build()
165            };
166            if tmp.message.is_none() {
167                tmp.message = _error_message;
168            }
169            tmp
170        }),
171        _ => crate::operation::list_ingest_configurations::ListIngestConfigurationsError::generic(generic),
172    })
173}
174
175#[allow(clippy::unnecessary_wraps)]
176pub fn de_list_ingest_configurations_http_response(
177    _response_status: u16,
178    _response_headers: &::aws_smithy_runtime_api::http::Headers,
179    _response_body: &[u8],
180) -> std::result::Result<
181    crate::operation::list_ingest_configurations::ListIngestConfigurationsOutput,
182    crate::operation::list_ingest_configurations::ListIngestConfigurationsError,
183> {
184    Ok({
185        #[allow(unused_mut)]
186        let mut output = crate::operation::list_ingest_configurations::builders::ListIngestConfigurationsOutputBuilder::default();
187        output = crate::protocol_serde::shape_list_ingest_configurations::de_list_ingest_configurations(_response_body, output)
188            .map_err(crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled)?;
189        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
190        crate::serde_util::list_ingest_configurations_output_output_correct_errors(output)
191            .build()
192            .map_err(crate::operation::list_ingest_configurations::ListIngestConfigurationsError::unhandled)?
193    })
194}
195
196pub fn ser_list_ingest_configurations_input(
197    input: &crate::operation::list_ingest_configurations::ListIngestConfigurationsInput,
198) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
199    let mut out = String::new();
200    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
201    crate::protocol_serde::shape_list_ingest_configurations_input::ser_list_ingest_configurations_input_input(&mut object, input)?;
202    object.finish();
203    Ok(::aws_smithy_types::body::SdkBody::from(out))
204}
205
206pub(crate) fn de_list_ingest_configurations(
207    value: &[u8],
208    mut builder: crate::operation::list_ingest_configurations::builders::ListIngestConfigurationsOutputBuilder,
209) -> ::std::result::Result<
210    crate::operation::list_ingest_configurations::builders::ListIngestConfigurationsOutputBuilder,
211    ::aws_smithy_json::deserialize::error::DeserializeError,
212> {
213    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
214    let tokens = &mut tokens_owned;
215    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
216    loop {
217        match tokens.next().transpose()? {
218            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
219            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
220                "ingestConfigurations" => {
221                    builder = builder.set_ingest_configurations(
222                        crate::protocol_serde::shape_ingest_configuration_list::de_ingest_configuration_list(tokens)?,
223                    );
224                }
225                "nextToken" => {
226                    builder = builder.set_next_token(
227                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
228                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
229                            .transpose()?,
230                    );
231                }
232                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
233            },
234            other => {
235                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
236                    "expected object key or end object, found: {other:?}"
237                )))
238            }
239        }
240    }
241    if tokens.next().is_some() {
242        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
243            "found more JSON tokens after completing parsing",
244        ));
245    }
246    Ok(builder)
247}