aws_sdk_config/protocol_serde/
shape_start_config_rules_evaluation.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(clippy::unnecessary_wraps)]
3pub fn de_start_config_rules_evaluation_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::start_config_rules_evaluation::StartConfigRulesEvaluationOutput,
9    crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError,
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::start_config_rules_evaluation::StartConfigRulesEvaluationError::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::start_config_rules_evaluation::StartConfigRulesEvaluationError::unhandled(generic)),
19    };
20
21    let _error_message = generic.message().map(|msg| msg.to_owned());
22    Err(match error_code {
23        "InvalidParameterValueException" => {
24            crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError::InvalidParameterValueException({
25                #[allow(unused_mut)]
26                let mut tmp = {
27                    #[allow(unused_mut)]
28                    let mut output = crate::types::error::builders::InvalidParameterValueExceptionBuilder::default();
29                    output = crate::protocol_serde::shape_invalid_parameter_value_exception::de_invalid_parameter_value_exception_json_err(
30                        _response_body,
31                        output,
32                    )
33                    .map_err(crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError::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        }
43        "LimitExceededException" => crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError::LimitExceededException({
44            #[allow(unused_mut)]
45            let mut tmp = {
46                #[allow(unused_mut)]
47                let mut output = crate::types::error::builders::LimitExceededExceptionBuilder::default();
48                output = crate::protocol_serde::shape_limit_exceeded_exception::de_limit_exceeded_exception_json_err(_response_body, output)
49                    .map_err(crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError::unhandled)?;
50                let output = output.meta(generic);
51                output.build()
52            };
53            if tmp.message.is_none() {
54                tmp.message = _error_message;
55            }
56            tmp
57        }),
58        "NoSuchConfigRuleException" => crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError::NoSuchConfigRuleException({
59            #[allow(unused_mut)]
60            let mut tmp = {
61                #[allow(unused_mut)]
62                let mut output = crate::types::error::builders::NoSuchConfigRuleExceptionBuilder::default();
63                output =
64                    crate::protocol_serde::shape_no_such_config_rule_exception::de_no_such_config_rule_exception_json_err(_response_body, output)
65                        .map_err(crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError::unhandled)?;
66                let output = output.meta(generic);
67                output.build()
68            };
69            if tmp.message.is_none() {
70                tmp.message = _error_message;
71            }
72            tmp
73        }),
74        "ResourceInUseException" => crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError::ResourceInUseException({
75            #[allow(unused_mut)]
76            let mut tmp = {
77                #[allow(unused_mut)]
78                let mut output = crate::types::error::builders::ResourceInUseExceptionBuilder::default();
79                output = crate::protocol_serde::shape_resource_in_use_exception::de_resource_in_use_exception_json_err(_response_body, output)
80                    .map_err(crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError::unhandled)?;
81                let output = output.meta(generic);
82                output.build()
83            };
84            if tmp.message.is_none() {
85                tmp.message = _error_message;
86            }
87            tmp
88        }),
89        _ => crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError::generic(generic),
90    })
91}
92
93#[allow(clippy::unnecessary_wraps)]
94pub fn de_start_config_rules_evaluation_http_response(
95    _response_status: u16,
96    _response_headers: &::aws_smithy_runtime_api::http::Headers,
97    _response_body: &[u8],
98) -> std::result::Result<
99    crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationOutput,
100    crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationError,
101> {
102    Ok({
103        #[allow(unused_mut)]
104        let mut output = crate::operation::start_config_rules_evaluation::builders::StartConfigRulesEvaluationOutputBuilder::default();
105        output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
106        output.build()
107    })
108}
109
110pub fn ser_start_config_rules_evaluation_input(
111    input: &crate::operation::start_config_rules_evaluation::StartConfigRulesEvaluationInput,
112) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
113    let mut out = String::new();
114    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
115    crate::protocol_serde::shape_start_config_rules_evaluation_input::ser_start_config_rules_evaluation_input_input(&mut object, input)?;
116    object.finish();
117    Ok(::aws_smithy_types::body::SdkBody::from(out))
118}