aws_sdk_ivsrealtime/protocol_serde/
shape_internal_server_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_internal_server_exception_json_err(
3    value: &[u8],
4    mut builder: crate::types::error::builders::InternalServerExceptionBuilder,
5) -> ::std::result::Result<crate::types::error::builders::InternalServerExceptionBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
6    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
7    let tokens = &mut tokens_owned;
8    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
9    loop {
10        match tokens.next().transpose()? {
11            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
12            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
13                "accessControlAllowOrigin" => {
14                    builder = builder.set_access_control_allow_origin(
15                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
16                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
17                            .transpose()?,
18                    );
19                }
20                "accessControlExposeHeaders" => {
21                    builder = builder.set_access_control_expose_headers(
22                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
23                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
24                            .transpose()?,
25                    );
26                }
27                "cacheControl" => {
28                    builder = builder.set_cache_control(
29                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
30                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
31                            .transpose()?,
32                    );
33                }
34                "contentSecurityPolicy" => {
35                    builder = builder.set_content_security_policy(
36                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
37                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
38                            .transpose()?,
39                    );
40                }
41                "strictTransportSecurity" => {
42                    builder = builder.set_strict_transport_security(
43                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
44                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
45                            .transpose()?,
46                    );
47                }
48                "xContentTypeOptions" => {
49                    builder = builder.set_x_content_type_options(
50                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
51                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
52                            .transpose()?,
53                    );
54                }
55                "xFrameOptions" => {
56                    builder = builder.set_x_frame_options(
57                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
58                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
59                            .transpose()?,
60                    );
61                }
62                "xAmznErrorType" => {
63                    builder = builder.set_x_amzn_error_type(
64                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
65                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
66                            .transpose()?,
67                    );
68                }
69                "exceptionMessage" => {
70                    builder = builder.set_exception_message(
71                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
72                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
73                            .transpose()?,
74                    );
75                }
76                "Message" => {
77                    builder = builder.set_message(
78                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
79                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
80                            .transpose()?,
81                    );
82                }
83                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
84            },
85            other => {
86                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
87                    "expected object key or end object, found: {:?}",
88                    other
89                )))
90            }
91        }
92    }
93    if tokens.next().is_some() {
94        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
95            "found more JSON tokens after completing parsing",
96        ));
97    }
98    Ok(builder)
99}
100
101pub(crate) fn de_access_control_allow_origin_header(
102    header_map: &::aws_smithy_runtime_api::http::Headers,
103) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
104    let headers = header_map.get_all("Access-Control-Allow-Origin");
105    ::aws_smithy_http::header::one_or_none(headers)
106}
107
108pub(crate) fn de_access_control_expose_headers_header(
109    header_map: &::aws_smithy_runtime_api::http::Headers,
110) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
111    let headers = header_map.get_all("Access-Control-Expose-Headers");
112    ::aws_smithy_http::header::one_or_none(headers)
113}
114
115pub(crate) fn de_cache_control_header(
116    header_map: &::aws_smithy_runtime_api::http::Headers,
117) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
118    let headers = header_map.get_all("Cache-Control");
119    ::aws_smithy_http::header::one_or_none(headers)
120}
121
122pub(crate) fn de_content_security_policy_header(
123    header_map: &::aws_smithy_runtime_api::http::Headers,
124) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
125    let headers = header_map.get_all("Content-Security-Policy");
126    ::aws_smithy_http::header::one_or_none(headers)
127}
128
129pub(crate) fn de_strict_transport_security_header(
130    header_map: &::aws_smithy_runtime_api::http::Headers,
131) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
132    let headers = header_map.get_all("Strict-Transport-Security");
133    ::aws_smithy_http::header::one_or_none(headers)
134}
135
136pub(crate) fn de_x_amzn_error_type_header(
137    header_map: &::aws_smithy_runtime_api::http::Headers,
138) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
139    let headers = header_map.get_all("x-amzn-ErrorType");
140    ::aws_smithy_http::header::one_or_none(headers)
141}
142
143pub(crate) fn de_x_content_type_options_header(
144    header_map: &::aws_smithy_runtime_api::http::Headers,
145) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
146    let headers = header_map.get_all("X-Content-Type-Options");
147    ::aws_smithy_http::header::one_or_none(headers)
148}
149
150pub(crate) fn de_x_frame_options_header(
151    header_map: &::aws_smithy_runtime_api::http::Headers,
152) -> ::std::result::Result<::std::option::Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
153    let headers = header_map.get_all("X-Frame-Options");
154    ::aws_smithy_http::header::one_or_none(headers)
155}