aws_sdk_acm/protocol_serde/
shape_get_account_configuration.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_account_configuration_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::get_account_configuration::GetAccountConfigurationOutput,
9    crate::operation::get_account_configuration::GetAccountConfigurationError,
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::get_account_configuration::GetAccountConfigurationError::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::get_account_configuration::GetAccountConfigurationError::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::get_account_configuration::GetAccountConfigurationError::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::get_account_configuration::GetAccountConfigurationError::unhandled)?;
34                let output = output.meta(generic);
35                output.build()
36            };
37            if tmp.message.is_none() {
38                tmp.message = _error_message;
39            }
40            tmp
41        }),
42        "ThrottlingException" => crate::operation::get_account_configuration::GetAccountConfigurationError::ThrottlingException({
43            #[allow(unused_mut)]
44            let mut tmp = {
45                #[allow(unused_mut)]
46                let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
47                output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
48                    .map_err(crate::operation::get_account_configuration::GetAccountConfigurationError::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        _ => crate::operation::get_account_configuration::GetAccountConfigurationError::generic(generic),
58    })
59}
60
61#[allow(clippy::unnecessary_wraps)]
62pub fn de_get_account_configuration_http_response(
63    _response_status: u16,
64    _response_headers: &::aws_smithy_runtime_api::http::Headers,
65    _response_body: &[u8],
66) -> std::result::Result<
67    crate::operation::get_account_configuration::GetAccountConfigurationOutput,
68    crate::operation::get_account_configuration::GetAccountConfigurationError,
69> {
70    Ok({
71        #[allow(unused_mut)]
72        let mut output = crate::operation::get_account_configuration::builders::GetAccountConfigurationOutputBuilder::default();
73        output = crate::protocol_serde::shape_get_account_configuration::de_get_account_configuration(_response_body, output)
74            .map_err(crate::operation::get_account_configuration::GetAccountConfigurationError::unhandled)?;
75        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
76        output.build()
77    })
78}
79
80pub fn ser_get_account_configuration_input(
81    _input: &crate::operation::get_account_configuration::GetAccountConfigurationInput,
82) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
83    Ok(::aws_smithy_types::body::SdkBody::from("{}"))
84}
85
86pub(crate) fn de_get_account_configuration(
87    value: &[u8],
88    mut builder: crate::operation::get_account_configuration::builders::GetAccountConfigurationOutputBuilder,
89) -> ::std::result::Result<
90    crate::operation::get_account_configuration::builders::GetAccountConfigurationOutputBuilder,
91    ::aws_smithy_json::deserialize::error::DeserializeError,
92> {
93    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
94    let tokens = &mut tokens_owned;
95    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
96    loop {
97        match tokens.next().transpose()? {
98            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
99            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
100                "ExpiryEvents" => {
101                    builder = builder.set_expiry_events(crate::protocol_serde::shape_expiry_events_configuration::de_expiry_events_configuration(
102                        tokens,
103                    )?);
104                }
105                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
106            },
107            other => {
108                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
109                    "expected object key or end object, found: {:?}",
110                    other
111                )))
112            }
113        }
114    }
115    if tokens.next().is_some() {
116        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
117            "found more JSON tokens after completing parsing",
118        ));
119    }
120    Ok(builder)
121}