aws_sdk_ssooidc/protocol_serde/
shape_invalid_request_region_exception.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub(crate) fn de_invalid_request_region_exception_json_err(
3    value: &[u8],
4    mut builder: crate::types::error::builders::InvalidRequestRegionExceptionBuilder,
5) -> ::std::result::Result<crate::types::error::builders::InvalidRequestRegionExceptionBuilder, ::aws_smithy_json::deserialize::error::DeserializeError>
6{
7    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
8    let tokens = &mut tokens_owned;
9    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
10    loop {
11        match tokens.next().transpose()? {
12            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
13            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
14                "error" => {
15                    builder = builder.set_error(
16                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
17                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
18                            .transpose()?,
19                    );
20                }
21                "error_description" => {
22                    builder = builder.set_error_description(
23                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
24                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
25                            .transpose()?,
26                    );
27                }
28                "endpoint" => {
29                    builder = builder.set_endpoint(
30                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
31                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
32                            .transpose()?,
33                    );
34                }
35                "region" => {
36                    builder = builder.set_region(
37                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
38                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
39                            .transpose()?,
40                    );
41                }
42                "Message" => {
43                    builder = builder.set_message(
44                        ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
45                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
46                            .transpose()?,
47                    );
48                }
49                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
50            },
51            other => {
52                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
53                    "expected object key or end object, found: {:?}",
54                    other
55                )))
56            }
57        }
58    }
59    if tokens.next().is_some() {
60        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
61            "found more JSON tokens after completing parsing",
62        ));
63    }
64    Ok(builder)
65}