aws_sdk_proton/protocol_serde/
shape_get_service_sync_blocker_summary.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_get_service_sync_blocker_summary_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_service_sync_blocker_summary::GetServiceSyncBlockerSummaryOutput,
9    crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError,
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_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::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 => return Err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled(generic)),
19    };
20
21    let _error_message = generic.message().map(|msg| msg.to_owned());
22    Err(match error_code {
23        "AccessDeniedException" => crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::AccessDeniedException({
24            #[allow(unused_mut)]
25            let mut tmp = {
26                #[allow(unused_mut)]
27                let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
28                output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
29                    .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?;
30                let output = output.meta(generic);
31                crate::serde_util::access_denied_exception_correct_errors(output)
32                    .build()
33                    .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?
34            };
35            tmp
36        }),
37        "InternalServerException" => {
38            crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::InternalServerException({
39                #[allow(unused_mut)]
40                let mut tmp = {
41                    #[allow(unused_mut)]
42                    let mut output = crate::types::error::builders::InternalServerExceptionBuilder::default();
43                    output = crate::protocol_serde::shape_internal_server_exception::de_internal_server_exception_json_err(_response_body, output)
44                        .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?;
45                    let output = output.meta(generic);
46                    crate::serde_util::internal_server_exception_correct_errors(output)
47                        .build()
48                        .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?
49                };
50                tmp
51            })
52        }
53        "ResourceNotFoundException" => {
54            crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::ResourceNotFoundException({
55                #[allow(unused_mut)]
56                let mut tmp = {
57                    #[allow(unused_mut)]
58                    let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
59                    output =
60                        crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
61                            .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?;
62                    let output = output.meta(generic);
63                    crate::serde_util::resource_not_found_exception_correct_errors(output)
64                        .build()
65                        .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?
66                };
67                tmp
68            })
69        }
70        "ThrottlingException" => crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::ThrottlingException({
71            #[allow(unused_mut)]
72            let mut tmp = {
73                #[allow(unused_mut)]
74                let mut output = crate::types::error::builders::ThrottlingExceptionBuilder::default();
75                output = crate::protocol_serde::shape_throttling_exception::de_throttling_exception_json_err(_response_body, output)
76                    .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?;
77                let output = output.meta(generic);
78                crate::serde_util::throttling_exception_correct_errors(output)
79                    .build()
80                    .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?
81            };
82            tmp
83        }),
84        "ValidationException" => crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::ValidationException({
85            #[allow(unused_mut)]
86            let mut tmp = {
87                #[allow(unused_mut)]
88                let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
89                output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
90                    .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?;
91                let output = output.meta(generic);
92                crate::serde_util::validation_exception_correct_errors(output)
93                    .build()
94                    .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?
95            };
96            tmp
97        }),
98        _ => crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::generic(generic),
99    })
100}
101
102#[allow(clippy::unnecessary_wraps)]
103pub fn de_get_service_sync_blocker_summary_http_response(
104    _response_status: u16,
105    _response_headers: &::aws_smithy_runtime_api::http::Headers,
106    _response_body: &[u8],
107) -> std::result::Result<
108    crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryOutput,
109    crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError,
110> {
111    Ok({
112        #[allow(unused_mut)]
113        let mut output = crate::operation::get_service_sync_blocker_summary::builders::GetServiceSyncBlockerSummaryOutputBuilder::default();
114        output = crate::protocol_serde::shape_get_service_sync_blocker_summary::de_get_service_sync_blocker_summary(_response_body, output)
115            .map_err(crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryError::unhandled)?;
116        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
117        output.build()
118    })
119}
120
121pub fn ser_get_service_sync_blocker_summary_input(
122    input: &crate::operation::get_service_sync_blocker_summary::GetServiceSyncBlockerSummaryInput,
123) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
124    let mut out = String::new();
125    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
126    crate::protocol_serde::shape_get_service_sync_blocker_summary_input::ser_get_service_sync_blocker_summary_input_input(&mut object, input)?;
127    object.finish();
128    Ok(::aws_smithy_types::body::SdkBody::from(out))
129}
130
131pub(crate) fn de_get_service_sync_blocker_summary(
132    value: &[u8],
133    mut builder: crate::operation::get_service_sync_blocker_summary::builders::GetServiceSyncBlockerSummaryOutputBuilder,
134) -> ::std::result::Result<
135    crate::operation::get_service_sync_blocker_summary::builders::GetServiceSyncBlockerSummaryOutputBuilder,
136    ::aws_smithy_json::deserialize::error::DeserializeError,
137> {
138    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
139    let tokens = &mut tokens_owned;
140    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
141    loop {
142        match tokens.next().transpose()? {
143            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
144            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
145                "serviceSyncBlockerSummary" => {
146                    builder = builder.set_service_sync_blocker_summary(
147                        crate::protocol_serde::shape_service_sync_blocker_summary::de_service_sync_blocker_summary(tokens)?,
148                    );
149                }
150                _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
151            },
152            other => {
153                return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
154                    "expected object key or end object, found: {:?}",
155                    other
156                )))
157            }
158        }
159    }
160    if tokens.next().is_some() {
161        return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
162            "found more JSON tokens after completing parsing",
163        ));
164    }
165    Ok(builder)
166}