1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_associate_resource_types_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::associate_resource_types::AssociateResourceTypesOutput,
|
9 - | crate::operation::associate_resource_types::AssociateResourceTypesError,
|
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::associate_resource_types::AssociateResourceTypesError::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::associate_resource_types::AssociateResourceTypesError::unhandled(
|
20 - | generic,
|
21 - | ))
|
22 - | }
|
23 - | };
|
24 - |
|
25 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
26 - | Err(match error_code {
|
27 - | "ConflictException" => crate::operation::associate_resource_types::AssociateResourceTypesError::ConflictException({
|
28 - | #[allow(unused_mut)]
|
29 - | let mut tmp = {
|
30 - | #[allow(unused_mut)]
|
31 - | let mut output = crate::types::error::builders::ConflictExceptionBuilder::default();
|
32 - | output = crate::protocol_serde::shape_conflict_exception::de_conflict_exception_json_err(_response_body, output)
|
33 - | .map_err(crate::operation::associate_resource_types::AssociateResourceTypesError::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 - | "NoSuchConfigurationRecorderException" => {
|
43 - | crate::operation::associate_resource_types::AssociateResourceTypesError::NoSuchConfigurationRecorderException({
|
44 - | #[allow(unused_mut)]
|
45 - | let mut tmp = {
|
46 - | #[allow(unused_mut)]
|
47 - | let mut output = crate::types::error::builders::NoSuchConfigurationRecorderExceptionBuilder::default();
|
48 - | output =
|
49 - | crate::protocol_serde::shape_no_such_configuration_recorder_exception::de_no_such_configuration_recorder_exception_json_err(
|
50 - | _response_body,
|
51 - | output,
|
52 - | )
|
53 - | .map_err(crate::operation::associate_resource_types::AssociateResourceTypesError::unhandled)?;
|
54 - | let output = output.meta(generic);
|
55 - | output.build()
|
56 - | };
|
57 - | if tmp.message.is_none() {
|
58 - | tmp.message = _error_message;
|
59 - | }
|
60 - | tmp
|
61 - | })
|
62 - | }
|
63 - | "ValidationException" => crate::operation::associate_resource_types::AssociateResourceTypesError::ValidationException({
|
64 - | #[allow(unused_mut)]
|
65 - | let mut tmp = {
|
66 - | #[allow(unused_mut)]
|
67 - | let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
|
68 - | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
69 - | .map_err(crate::operation::associate_resource_types::AssociateResourceTypesError::unhandled)?;
|
70 - | let output = output.meta(generic);
|
71 - | output.build()
|
72 - | };
|
73 - | if tmp.message.is_none() {
|
74 - | tmp.message = _error_message;
|
75 - | }
|
76 - | tmp
|
77 - | }),
|
78 - | _ => crate::operation::associate_resource_types::AssociateResourceTypesError::generic(generic),
|
79 - | })
|
80 - | }
|
81 - |
|
82 - | #[allow(clippy::unnecessary_wraps)]
|
83 - | pub fn de_associate_resource_types_http_response(
|
84 - | _response_status: u16,
|
85 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
86 - | _response_body: &[u8],
|
87 - | ) -> std::result::Result<
|
88 - | crate::operation::associate_resource_types::AssociateResourceTypesOutput,
|
89 - | crate::operation::associate_resource_types::AssociateResourceTypesError,
|
90 - | > {
|
91 - | Ok({
|
92 - | #[allow(unused_mut)]
|
93 - | let mut output = crate::operation::associate_resource_types::builders::AssociateResourceTypesOutputBuilder::default();
|
94 - | output = crate::protocol_serde::shape_associate_resource_types::de_associate_resource_types(_response_body, output)
|
95 - | .map_err(crate::operation::associate_resource_types::AssociateResourceTypesError::unhandled)?;
|
96 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
97 - | crate::serde_util::associate_resource_types_output_output_correct_errors(output).build()
|
98 - | })
|
99 - | }
|
100 - |
|
101 - | pub fn ser_associate_resource_types_input(
|
102 - | input: &crate::operation::associate_resource_types::AssociateResourceTypesInput,
|
103 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
104 - | let mut out = String::new();
|
105 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
106 - | crate::protocol_serde::shape_associate_resource_types_input::ser_associate_resource_types_input_input(&mut object, input)?;
|
107 - | object.finish();
|
108 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
109 - | }
|
110 - |
|
111 - | pub(crate) fn de_associate_resource_types(
|
112 - | _value: &[u8],
|
113 - | mut builder: crate::operation::associate_resource_types::builders::AssociateResourceTypesOutputBuilder,
|
114 - | ) -> ::std::result::Result<
|
115 - | crate::operation::associate_resource_types::builders::AssociateResourceTypesOutputBuilder,
|
116 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
117 - | > {
|
118 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
119 - | let tokens = &mut tokens_owned;
|
120 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
121 - | loop {
|
122 - | match tokens.next().transpose()? {
|
123 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
124 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
125 - | "ConfigurationRecorder" => {
|
126 - | builder = builder.set_configuration_recorder(crate::protocol_serde::shape_configuration_recorder::de_configuration_recorder(
|
127 - | tokens, _value,
|
128 - | )?);
|
129 - | }
|
130 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
131 - | },
|
132 - | other => {
|
133 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
134 - | "expected object key or end object, found: {other:?}"
|
135 - | )))
|
136 - | }
|
137 - | }
|
138 - | }
|
139 - | if tokens.next().is_some() {
|
140 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
141 - | "found more JSON tokens after completing parsing",
|
142 - | ));
|
143 - | }
|
144 - | Ok(builder)
|
145 - | }
|