138 142 | crate::operation::put_index_policy::PutIndexPolicyError,
|
139 143 | >::new());
|
140 144 |
|
141 145 | ::std::borrow::Cow::Owned(rcb)
|
142 146 | }
|
143 147 | }
|
144 148 |
|
145 149 | #[derive(Debug)]
|
146 150 | struct PutIndexPolicyResponseDeserializer;
|
147 151 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PutIndexPolicyResponseDeserializer {
|
148 - | fn deserialize_nonstreaming(
|
152 + | fn deserialize_nonstreaming_with_config(
|
149 153 | &self,
|
150 154 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
155 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
151 156 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
152 157 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
153 - | let headers = response.headers();
|
154 - | let body = response.body().bytes().expect("body loaded");
|
155 158 | #[allow(unused_mut)]
|
156 159 | let mut force_error = false;
|
157 160 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
158 - | let parse_result = if !success && status != 200 || force_error {
|
159 - | crate::protocol_serde::shape_put_index_policy::de_put_index_policy_http_error(status, headers, body)
|
160 - | } else {
|
161 - | crate::protocol_serde::shape_put_index_policy::de_put_index_policy_http_response(status, headers, body)
|
161 + | if !success && status != 200 || force_error {
|
162 + | let headers = response.headers();
|
163 + | let body = response.body().bytes().expect("body loaded");
|
164 + | #[allow(unused_mut)]
|
165 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
166 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
167 + | })?;
|
168 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
169 + | let generic = generic_builder.build();
|
170 + | let error_code = match generic.code() {
|
171 + | ::std::option::Option::Some(code) => code,
|
172 + | ::std::option::Option::None => {
|
173 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
174 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::put_index_policy::PutIndexPolicyError::unhandled(
|
175 + | generic,
|
176 + | )),
|
177 + | ))
|
178 + | }
|
179 + | };
|
180 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
181 + | let protocol = _cfg
|
182 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
183 + | .expect("a SharedClientProtocol is required");
|
184 + | let err = match error_code {
|
185 + | "InvalidParameterException" => crate::operation::put_index_policy::PutIndexPolicyError::InvalidParameterException({
|
186 + | let mut tmp = match protocol
|
187 + | .deserialize_response(response, crate::types::error::InvalidParameterException::SCHEMA, _cfg)
|
188 + | .and_then(|mut deser| {
|
189 + | crate::types::error::InvalidParameterException::deserialize_with_response(
|
190 + | &mut *deser,
|
191 + | response.headers(),
|
192 + | response.status().into(),
|
193 + | body,
|
194 + | )
|
195 + | }) {
|
196 + | ::std::result::Result::Ok(val) => val,
|
197 + | ::std::result::Result::Err(e) => {
|
198 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
199 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
200 + | ))
|
201 + | }
|
162 202 | };
|
163 - | crate::protocol_serde::type_erase_result(parse_result)
|
203 + | tmp.meta = generic;
|
204 + | if tmp.message.is_none() {
|
205 + | tmp.message = _error_message;
|
206 + | }
|
207 + | tmp
|
208 + | }),
|
209 + | "LimitExceededException" => crate::operation::put_index_policy::PutIndexPolicyError::LimitExceededException({
|
210 + | let mut tmp = match protocol
|
211 + | .deserialize_response(response, crate::types::error::LimitExceededException::SCHEMA, _cfg)
|
212 + | .and_then(|mut deser| {
|
213 + | crate::types::error::LimitExceededException::deserialize_with_response(
|
214 + | &mut *deser,
|
215 + | response.headers(),
|
216 + | response.status().into(),
|
217 + | body,
|
218 + | )
|
219 + | }) {
|
220 + | ::std::result::Result::Ok(val) => val,
|
221 + | ::std::result::Result::Err(e) => {
|
222 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
223 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
224 + | ))
|
225 + | }
|
226 + | };
|
227 + | tmp.meta = generic;
|
228 + | if tmp.message.is_none() {
|
229 + | tmp.message = _error_message;
|
230 + | }
|
231 + | tmp
|
232 + | }),
|
233 + | "OperationAbortedException" => crate::operation::put_index_policy::PutIndexPolicyError::OperationAbortedException({
|
234 + | let mut tmp = match protocol
|
235 + | .deserialize_response(response, crate::types::error::OperationAbortedException::SCHEMA, _cfg)
|
236 + | .and_then(|mut deser| {
|
237 + | crate::types::error::OperationAbortedException::deserialize_with_response(
|
238 + | &mut *deser,
|
239 + | response.headers(),
|
240 + | response.status().into(),
|
241 + | body,
|
242 + | )
|
243 + | }) {
|
244 + | ::std::result::Result::Ok(val) => val,
|
245 + | ::std::result::Result::Err(e) => {
|
246 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
247 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
248 + | ))
|
249 + | }
|
250 + | };
|
251 + | tmp.meta = generic;
|
252 + | if tmp.message.is_none() {
|
253 + | tmp.message = _error_message;
|
254 + | }
|
255 + | tmp
|
256 + | }),
|
257 + | "ResourceNotFoundException" => crate::operation::put_index_policy::PutIndexPolicyError::ResourceNotFoundException({
|
258 + | let mut tmp = match protocol
|
259 + | .deserialize_response(response, crate::types::error::ResourceNotFoundException::SCHEMA, _cfg)
|
260 + | .and_then(|mut deser| {
|
261 + | crate::types::error::ResourceNotFoundException::deserialize_with_response(
|
262 + | &mut *deser,
|
263 + | response.headers(),
|
264 + | response.status().into(),
|
265 + | body,
|
266 + | )
|
267 + | }) {
|
268 + | ::std::result::Result::Ok(val) => val,
|
269 + | ::std::result::Result::Err(e) => {
|
270 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
271 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
272 + | ))
|
273 + | }
|
274 + | };
|
275 + | tmp.meta = generic;
|
276 + | if tmp.message.is_none() {
|
277 + | tmp.message = _error_message;
|
278 + | }
|
279 + | tmp
|
280 + | }),
|
281 + | "ServiceUnavailableException" => crate::operation::put_index_policy::PutIndexPolicyError::ServiceUnavailableException({
|
282 + | let mut tmp = match protocol
|
283 + | .deserialize_response(response, crate::types::error::ServiceUnavailableException::SCHEMA, _cfg)
|
284 + | .and_then(|mut deser| {
|
285 + | crate::types::error::ServiceUnavailableException::deserialize_with_response(
|
286 + | &mut *deser,
|
287 + | response.headers(),
|
288 + | response.status().into(),
|
289 + | body,
|
290 + | )
|
291 + | }) {
|
292 + | ::std::result::Result::Ok(val) => val,
|
293 + | ::std::result::Result::Err(e) => {
|
294 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
295 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
296 + | ))
|
297 + | }
|
298 + | };
|
299 + | tmp.meta = generic;
|
300 + | if tmp.message.is_none() {
|
301 + | tmp.message = _error_message;
|
302 + | }
|
303 + | tmp
|
304 + | }),
|
305 + | _ => crate::operation::put_index_policy::PutIndexPolicyError::generic(generic),
|
306 + | };
|
307 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
308 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
309 + | ))
|
310 + | } else {
|
311 + | let protocol = _cfg
|
312 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
313 + | .expect("a SharedClientProtocol is required");
|
314 + | let mut deser = protocol
|
315 + | .deserialize_response(response, PutIndexPolicy::OUTPUT_SCHEMA, _cfg)
|
316 + | .map_err(|e| {
|
317 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
318 + | })?;
|
319 + | let body = response.body().bytes().expect("body loaded");
|
320 + | let output = crate::operation::put_index_policy::PutIndexPolicyOutput::deserialize_with_response(
|
321 + | &mut *deser,
|
322 + | response.headers(),
|
323 + | response.status().into(),
|
324 + | body,
|
325 + | )
|
326 + | .map_err(|e| {
|
327 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
328 + | })?;
|
329 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
330 + | }
|
164 331 | }
|
165 332 | }
|
166 333 | #[derive(Debug)]
|
167 334 | struct PutIndexPolicyRequestSerializer;
|
168 335 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PutIndexPolicyRequestSerializer {
|
169 336 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
170 337 | fn serialize_input(
|
171 338 | &self,
|
172 339 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
173 340 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
174 341 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
175 342 | let input = input
|
176 343 | .downcast::<crate::operation::put_index_policy::PutIndexPolicyInput>()
|
177 344 | .expect("correct type");
|
178 - | let _header_serialization_settings = _cfg
|
179 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
180 - | .cloned()
|
181 - | .unwrap_or_default();
|
182 - | let mut request_builder = {
|
183 - | #[allow(clippy::uninlined_format_args)]
|
184 - | fn uri_base(
|
185 - | _input: &crate::operation::put_index_policy::PutIndexPolicyInput,
|
186 - | output: &mut ::std::string::String,
|
187 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
188 - | use ::std::fmt::Write as _;
|
189 - | ::std::write!(output, "/").expect("formatting should succeed");
|
190 - | ::std::result::Result::Ok(())
|
191 - | }
|
192 - | #[allow(clippy::unnecessary_wraps)]
|
193 - | fn update_http_builder(
|
194 - | input: &crate::operation::put_index_policy::PutIndexPolicyInput,
|
195 - | builder: ::http_1x::request::Builder,
|
196 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
197 - | let mut uri = ::std::string::String::new();
|
198 - | uri_base(input, &mut uri)?;
|
199 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
200 - | }
|
201 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
202 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
|
203 - | builder = _header_serialization_settings.set_default_header(
|
204 - | builder,
|
205 - | ::http_1x::header::HeaderName::from_static("x-amz-target"),
|
206 - | "Logs_20140328.PutIndexPolicy",
|
207 - | );
|
208 - | builder
|
209 - | };
|
210 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_put_index_policy::ser_put_index_policy_input(&input)?);
|
211 - | if let Some(content_length) = body.content_length() {
|
212 - | let content_length = content_length.to_string();
|
213 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
214 - | }
|
215 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
345 + | let protocol = _cfg
|
346 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
347 + | .expect("a SharedClientProtocol is required");
|
348 + | let mut request = protocol
|
349 + | .serialize_request(&input, PutIndexPolicy::INPUT_SCHEMA, "", _cfg)
|
350 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
351 + |
|
352 + | return ::std::result::Result::Ok(request);
|
216 353 | }
|
217 354 | }
|
218 355 | #[derive(Debug)]
|
219 356 | struct PutIndexPolicyEndpointParamsInterceptor;
|
220 357 |
|
221 358 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PutIndexPolicyEndpointParamsInterceptor {
|
222 359 | fn name(&self) -> &'static str {
|
223 360 | "PutIndexPolicyEndpointParamsInterceptor"
|
224 361 | }
|
225 362 |
|