1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_put_organization_config_rule_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::put_organization_config_rule::PutOrganizationConfigRuleOutput,
|
9 - | crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError,
|
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::put_organization_config_rule::PutOrganizationConfigRuleError::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::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled(
|
20 - | generic,
|
21 - | ))
|
22 - | }
|
23 - | };
|
24 - |
|
25 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
26 - | Err(match error_code {
|
27 - | "InsufficientPermissionsException" => {
|
28 - | crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::InsufficientPermissionsException({
|
29 - | #[allow(unused_mut)]
|
30 - | let mut tmp = {
|
31 - | #[allow(unused_mut)]
|
32 - | let mut output = crate::types::error::builders::InsufficientPermissionsExceptionBuilder::default();
|
33 - | output = crate::protocol_serde::shape_insufficient_permissions_exception::de_insufficient_permissions_exception_json_err(
|
34 - | _response_body,
|
35 - | output,
|
36 - | )
|
37 - | .map_err(crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled)?;
|
38 - | let output = output.meta(generic);
|
39 - | output.build()
|
40 - | };
|
41 - | if tmp.message.is_none() {
|
42 - | tmp.message = _error_message;
|
43 - | }
|
44 - | tmp
|
45 - | })
|
46 - | }
|
47 - | "InvalidParameterValueException" => {
|
48 - | crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::InvalidParameterValueException({
|
49 - | #[allow(unused_mut)]
|
50 - | let mut tmp = {
|
51 - | #[allow(unused_mut)]
|
52 - | let mut output = crate::types::error::builders::InvalidParameterValueExceptionBuilder::default();
|
53 - | output = crate::protocol_serde::shape_invalid_parameter_value_exception::de_invalid_parameter_value_exception_json_err(
|
54 - | _response_body,
|
55 - | output,
|
56 - | )
|
57 - | .map_err(crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled)?;
|
58 - | let output = output.meta(generic);
|
59 - | output.build()
|
60 - | };
|
61 - | if tmp.message.is_none() {
|
62 - | tmp.message = _error_message;
|
63 - | }
|
64 - | tmp
|
65 - | })
|
66 - | }
|
67 - | "MaxNumberOfOrganizationConfigRulesExceededException" => {
|
68 - | crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::MaxNumberOfOrganizationConfigRulesExceededException({
|
69 - | #[allow(unused_mut)]
|
70 - | let mut tmp = {
|
71 - | #[allow(unused_mut)]
|
72 - | let mut output = crate::types::error::builders::MaxNumberOfOrganizationConfigRulesExceededExceptionBuilder::default();
|
73 - | output = crate::protocol_serde::shape_max_number_of_organization_config_rules_exceeded_exception::de_max_number_of_organization_config_rules_exceeded_exception_json_err(_response_body, output).map_err(crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled)?;
|
74 - | let output = output.meta(generic);
|
75 - | output.build()
|
76 - | };
|
77 - | if tmp.message.is_none() {
|
78 - | tmp.message = _error_message;
|
79 - | }
|
80 - | tmp
|
81 - | })
|
82 - | }
|
83 - | "NoAvailableOrganizationException" => {
|
84 - | crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::NoAvailableOrganizationException({
|
85 - | #[allow(unused_mut)]
|
86 - | let mut tmp = {
|
87 - | #[allow(unused_mut)]
|
88 - | let mut output = crate::types::error::builders::NoAvailableOrganizationExceptionBuilder::default();
|
89 - | output = crate::protocol_serde::shape_no_available_organization_exception::de_no_available_organization_exception_json_err(
|
90 - | _response_body,
|
91 - | output,
|
92 - | )
|
93 - | .map_err(crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled)?;
|
94 - | let output = output.meta(generic);
|
95 - | output.build()
|
96 - | };
|
97 - | if tmp.message.is_none() {
|
98 - | tmp.message = _error_message;
|
99 - | }
|
100 - | tmp
|
101 - | })
|
102 - | }
|
103 - | "OrganizationAccessDeniedException" => {
|
104 - | crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::OrganizationAccessDeniedException({
|
105 - | #[allow(unused_mut)]
|
106 - | let mut tmp = {
|
107 - | #[allow(unused_mut)]
|
108 - | let mut output = crate::types::error::builders::OrganizationAccessDeniedExceptionBuilder::default();
|
109 - | output = crate::protocol_serde::shape_organization_access_denied_exception::de_organization_access_denied_exception_json_err(
|
110 - | _response_body,
|
111 - | output,
|
112 - | )
|
113 - | .map_err(crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled)?;
|
114 - | let output = output.meta(generic);
|
115 - | output.build()
|
116 - | };
|
117 - | if tmp.message.is_none() {
|
118 - | tmp.message = _error_message;
|
119 - | }
|
120 - | tmp
|
121 - | })
|
122 - | }
|
123 - | "OrganizationAllFeaturesNotEnabledException" => {
|
124 - | crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::OrganizationAllFeaturesNotEnabledException({
|
125 - | #[allow(unused_mut)]
|
126 - | let mut tmp = {
|
127 - | #[allow(unused_mut)]
|
128 - | let mut output = crate::types::error::builders::OrganizationAllFeaturesNotEnabledExceptionBuilder::default();
|
129 - | output = crate::protocol_serde::shape_organization_all_features_not_enabled_exception::de_organization_all_features_not_enabled_exception_json_err(_response_body, output).map_err(crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled)?;
|
130 - | let output = output.meta(generic);
|
131 - | output.build()
|
132 - | };
|
133 - | if tmp.message.is_none() {
|
134 - | tmp.message = _error_message;
|
135 - | }
|
136 - | tmp
|
137 - | })
|
138 - | }
|
139 - | "ResourceInUseException" => crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::ResourceInUseException({
|
140 - | #[allow(unused_mut)]
|
141 - | let mut tmp = {
|
142 - | #[allow(unused_mut)]
|
143 - | let mut output = crate::types::error::builders::ResourceInUseExceptionBuilder::default();
|
144 - | output = crate::protocol_serde::shape_resource_in_use_exception::de_resource_in_use_exception_json_err(_response_body, output)
|
145 - | .map_err(crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled)?;
|
146 - | let output = output.meta(generic);
|
147 - | output.build()
|
148 - | };
|
149 - | if tmp.message.is_none() {
|
150 - | tmp.message = _error_message;
|
151 - | }
|
152 - | tmp
|
153 - | }),
|
154 - | "ValidationException" => crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::ValidationException({
|
155 - | #[allow(unused_mut)]
|
156 - | let mut tmp = {
|
157 - | #[allow(unused_mut)]
|
158 - | let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
|
159 - | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
160 - | .map_err(crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled)?;
|
161 - | let output = output.meta(generic);
|
162 - | output.build()
|
163 - | };
|
164 - | if tmp.message.is_none() {
|
165 - | tmp.message = _error_message;
|
166 - | }
|
167 - | tmp
|
168 - | }),
|
169 - | _ => crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::generic(generic),
|
170 - | })
|
171 - | }
|
172 - |
|
173 - | #[allow(clippy::unnecessary_wraps)]
|
174 - | pub fn de_put_organization_config_rule_http_response(
|
175 - | _response_status: u16,
|
176 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
177 - | _response_body: &[u8],
|
178 - | ) -> std::result::Result<
|
179 - | crate::operation::put_organization_config_rule::PutOrganizationConfigRuleOutput,
|
180 - | crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError,
|
181 - | > {
|
182 - | Ok({
|
183 - | #[allow(unused_mut)]
|
184 - | let mut output = crate::operation::put_organization_config_rule::builders::PutOrganizationConfigRuleOutputBuilder::default();
|
185 - | output = crate::protocol_serde::shape_put_organization_config_rule::de_put_organization_config_rule(_response_body, output)
|
186 - | .map_err(crate::operation::put_organization_config_rule::PutOrganizationConfigRuleError::unhandled)?;
|
187 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
188 - | output.build()
|
189 - | })
|
190 - | }
|
191 - |
|
192 - | pub fn ser_put_organization_config_rule_input(
|
193 - | input: &crate::operation::put_organization_config_rule::PutOrganizationConfigRuleInput,
|
194 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
195 - | let mut out = String::new();
|
196 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
197 - | crate::protocol_serde::shape_put_organization_config_rule_input::ser_put_organization_config_rule_input_input(&mut object, input)?;
|
198 - | object.finish();
|
199 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
200 - | }
|
201 - |
|
202 - | pub(crate) fn de_put_organization_config_rule(
|
203 - | _value: &[u8],
|
204 - | mut builder: crate::operation::put_organization_config_rule::builders::PutOrganizationConfigRuleOutputBuilder,
|
205 - | ) -> ::std::result::Result<
|
206 - | crate::operation::put_organization_config_rule::builders::PutOrganizationConfigRuleOutputBuilder,
|
207 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
208 - | > {
|
209 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
210 - | let tokens = &mut tokens_owned;
|
211 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
212 - | loop {
|
213 - | match tokens.next().transpose()? {
|
214 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
215 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
216 - | "OrganizationConfigRuleArn" => {
|
217 - | builder = builder.set_organization_config_rule_arn(
|
218 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
219 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
220 - | .transpose()?,
|
221 - | );
|
222 - | }
|
223 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
224 - | },
|
225 - | other => {
|
226 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
227 - | "expected object key or end object, found: {other:?}"
|
228 - | )))
|
229 - | }
|
230 - | }
|
231 - | }
|
232 - | if tokens.next().is_some() {
|
233 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
234 - | "found more JSON tokens after completing parsing",
|
235 - | ));
|
236 - | }
|
237 - | Ok(builder)
|
238 - | }
|