139 143 | crate::operation::create_token_with_iam::CreateTokenWithIAMError,
|
140 144 | >::new());
|
141 145 |
|
142 146 | ::std::borrow::Cow::Owned(rcb)
|
143 147 | }
|
144 148 | }
|
145 149 |
|
146 150 | #[derive(Debug)]
|
147 151 | struct CreateTokenWithIAMResponseDeserializer;
|
148 152 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateTokenWithIAMResponseDeserializer {
|
149 - | fn deserialize_nonstreaming(
|
153 + | fn deserialize_nonstreaming_with_config(
|
150 154 | &self,
|
151 155 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
156 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
152 157 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
153 158 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
154 - | let headers = response.headers();
|
155 - | let body = response.body().bytes().expect("body loaded");
|
156 159 | #[allow(unused_mut)]
|
157 160 | let mut force_error = false;
|
158 161 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
159 - | let parse_result = if !success && status != 200 || force_error {
|
160 - | crate::protocol_serde::shape_create_token_with_iam::de_create_token_with_iam_http_error(status, headers, body)
|
161 - | } else {
|
162 - | crate::protocol_serde::shape_create_token_with_iam::de_create_token_with_iam_http_response(status, headers, body)
|
162 + | if !success && status != 200 || force_error {
|
163 + | let headers = response.headers();
|
164 + | let body = response.body().bytes().expect("body loaded");
|
165 + | #[allow(unused_mut)]
|
166 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
167 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
168 + | })?;
|
169 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
170 + | let generic = generic_builder.build();
|
171 + | let error_code = match generic.code() {
|
172 + | ::std::option::Option::Some(code) => code,
|
173 + | ::std::option::Option::None => {
|
174 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
175 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
176 + | crate::operation::create_token_with_iam::CreateTokenWithIAMError::unhandled(generic),
|
177 + | ),
|
178 + | ))
|
179 + | }
|
180 + | };
|
181 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
182 + | let protocol = _cfg
|
183 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
184 + | .expect("a SharedClientProtocol is required");
|
185 + | let err = match error_code {
|
186 + | "AccessDeniedException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::AccessDeniedException({
|
187 + | let mut tmp = match protocol
|
188 + | .deserialize_response(response, crate::types::error::AccessDeniedException::SCHEMA, _cfg)
|
189 + | .and_then(|mut deser| {
|
190 + | crate::types::error::AccessDeniedException::deserialize_with_response(
|
191 + | &mut *deser,
|
192 + | response.headers(),
|
193 + | response.status().into(),
|
194 + | body,
|
195 + | )
|
196 + | }) {
|
197 + | ::std::result::Result::Ok(val) => val,
|
198 + | ::std::result::Result::Err(e) => {
|
199 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
200 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
201 + | ))
|
202 + | }
|
203 + | };
|
204 + | tmp.meta = generic;
|
205 + | if tmp.message.is_none() {
|
206 + | tmp.message = _error_message;
|
207 + | }
|
208 + | tmp
|
209 + | }),
|
210 + | "AuthorizationPendingException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::AuthorizationPendingException({
|
211 + | let mut tmp = match protocol
|
212 + | .deserialize_response(response, crate::types::error::AuthorizationPendingException::SCHEMA, _cfg)
|
213 + | .and_then(|mut deser| {
|
214 + | crate::types::error::AuthorizationPendingException::deserialize_with_response(
|
215 + | &mut *deser,
|
216 + | response.headers(),
|
217 + | response.status().into(),
|
218 + | body,
|
219 + | )
|
220 + | }) {
|
221 + | ::std::result::Result::Ok(val) => val,
|
222 + | ::std::result::Result::Err(e) => {
|
223 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
224 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
225 + | ))
|
226 + | }
|
227 + | };
|
228 + | tmp.meta = generic;
|
229 + | if tmp.message.is_none() {
|
230 + | tmp.message = _error_message;
|
231 + | }
|
232 + | tmp
|
233 + | }),
|
234 + | "ExpiredTokenException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::ExpiredTokenException({
|
235 + | let mut tmp = match protocol
|
236 + | .deserialize_response(response, crate::types::error::ExpiredTokenException::SCHEMA, _cfg)
|
237 + | .and_then(|mut deser| {
|
238 + | crate::types::error::ExpiredTokenException::deserialize_with_response(
|
239 + | &mut *deser,
|
240 + | response.headers(),
|
241 + | response.status().into(),
|
242 + | body,
|
243 + | )
|
244 + | }) {
|
245 + | ::std::result::Result::Ok(val) => val,
|
246 + | ::std::result::Result::Err(e) => {
|
247 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
248 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
249 + | ))
|
250 + | }
|
251 + | };
|
252 + | tmp.meta = generic;
|
253 + | if tmp.message.is_none() {
|
254 + | tmp.message = _error_message;
|
255 + | }
|
256 + | tmp
|
257 + | }),
|
258 + | "InternalServerException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InternalServerException({
|
259 + | let mut tmp = match protocol
|
260 + | .deserialize_response(response, crate::types::error::InternalServerException::SCHEMA, _cfg)
|
261 + | .and_then(|mut deser| {
|
262 + | crate::types::error::InternalServerException::deserialize_with_response(
|
263 + | &mut *deser,
|
264 + | response.headers(),
|
265 + | response.status().into(),
|
266 + | body,
|
267 + | )
|
268 + | }) {
|
269 + | ::std::result::Result::Ok(val) => val,
|
270 + | ::std::result::Result::Err(e) => {
|
271 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
272 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
273 + | ))
|
274 + | }
|
275 + | };
|
276 + | tmp.meta = generic;
|
277 + | if tmp.message.is_none() {
|
278 + | tmp.message = _error_message;
|
279 + | }
|
280 + | tmp
|
281 + | }),
|
282 + | "InvalidClientException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidClientException({
|
283 + | let mut tmp = match protocol
|
284 + | .deserialize_response(response, crate::types::error::InvalidClientException::SCHEMA, _cfg)
|
285 + | .and_then(|mut deser| {
|
286 + | crate::types::error::InvalidClientException::deserialize_with_response(
|
287 + | &mut *deser,
|
288 + | response.headers(),
|
289 + | response.status().into(),
|
290 + | body,
|
291 + | )
|
292 + | }) {
|
293 + | ::std::result::Result::Ok(val) => val,
|
294 + | ::std::result::Result::Err(e) => {
|
295 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
296 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
297 + | ))
|
298 + | }
|
299 + | };
|
300 + | tmp.meta = generic;
|
301 + | if tmp.message.is_none() {
|
302 + | tmp.message = _error_message;
|
303 + | }
|
304 + | tmp
|
305 + | }),
|
306 + | "InvalidGrantException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidGrantException({
|
307 + | let mut tmp = match protocol
|
308 + | .deserialize_response(response, crate::types::error::InvalidGrantException::SCHEMA, _cfg)
|
309 + | .and_then(|mut deser| {
|
310 + | crate::types::error::InvalidGrantException::deserialize_with_response(
|
311 + | &mut *deser,
|
312 + | response.headers(),
|
313 + | response.status().into(),
|
314 + | body,
|
315 + | )
|
316 + | }) {
|
317 + | ::std::result::Result::Ok(val) => val,
|
318 + | ::std::result::Result::Err(e) => {
|
319 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
320 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
321 + | ))
|
322 + | }
|
323 + | };
|
324 + | tmp.meta = generic;
|
325 + | if tmp.message.is_none() {
|
326 + | tmp.message = _error_message;
|
327 + | }
|
328 + | tmp
|
329 + | }),
|
330 + | "InvalidRequestException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidRequestException({
|
331 + | let mut tmp = match protocol
|
332 + | .deserialize_response(response, crate::types::error::InvalidRequestException::SCHEMA, _cfg)
|
333 + | .and_then(|mut deser| {
|
334 + | crate::types::error::InvalidRequestException::deserialize_with_response(
|
335 + | &mut *deser,
|
336 + | response.headers(),
|
337 + | response.status().into(),
|
338 + | body,
|
339 + | )
|
340 + | }) {
|
341 + | ::std::result::Result::Ok(val) => val,
|
342 + | ::std::result::Result::Err(e) => {
|
343 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
344 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
345 + | ))
|
346 + | }
|
347 + | };
|
348 + | tmp.meta = generic;
|
349 + | if tmp.message.is_none() {
|
350 + | tmp.message = _error_message;
|
351 + | }
|
352 + | tmp
|
353 + | }),
|
354 + | "InvalidRequestRegionException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidRequestRegionException({
|
355 + | let mut tmp = match protocol
|
356 + | .deserialize_response(response, crate::types::error::InvalidRequestRegionException::SCHEMA, _cfg)
|
357 + | .and_then(|mut deser| {
|
358 + | crate::types::error::InvalidRequestRegionException::deserialize_with_response(
|
359 + | &mut *deser,
|
360 + | response.headers(),
|
361 + | response.status().into(),
|
362 + | body,
|
363 + | )
|
364 + | }) {
|
365 + | ::std::result::Result::Ok(val) => val,
|
366 + | ::std::result::Result::Err(e) => {
|
367 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
368 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
369 + | ))
|
370 + | }
|
371 + | };
|
372 + | tmp.meta = generic;
|
373 + | if tmp.message.is_none() {
|
374 + | tmp.message = _error_message;
|
375 + | }
|
376 + | tmp
|
377 + | }),
|
378 + | "InvalidScopeException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::InvalidScopeException({
|
379 + | let mut tmp = match protocol
|
380 + | .deserialize_response(response, crate::types::error::InvalidScopeException::SCHEMA, _cfg)
|
381 + | .and_then(|mut deser| {
|
382 + | crate::types::error::InvalidScopeException::deserialize_with_response(
|
383 + | &mut *deser,
|
384 + | response.headers(),
|
385 + | response.status().into(),
|
386 + | body,
|
387 + | )
|
388 + | }) {
|
389 + | ::std::result::Result::Ok(val) => val,
|
390 + | ::std::result::Result::Err(e) => {
|
391 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
392 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
393 + | ))
|
394 + | }
|
395 + | };
|
396 + | tmp.meta = generic;
|
397 + | if tmp.message.is_none() {
|
398 + | tmp.message = _error_message;
|
399 + | }
|
400 + | tmp
|
401 + | }),
|
402 + | "SlowDownException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::SlowDownException({
|
403 + | let mut tmp = match protocol
|
404 + | .deserialize_response(response, crate::types::error::SlowDownException::SCHEMA, _cfg)
|
405 + | .and_then(|mut deser| {
|
406 + | crate::types::error::SlowDownException::deserialize_with_response(
|
407 + | &mut *deser,
|
408 + | response.headers(),
|
409 + | response.status().into(),
|
410 + | body,
|
411 + | )
|
412 + | }) {
|
413 + | ::std::result::Result::Ok(val) => val,
|
414 + | ::std::result::Result::Err(e) => {
|
415 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
416 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
417 + | ))
|
418 + | }
|
419 + | };
|
420 + | tmp.meta = generic;
|
421 + | if tmp.message.is_none() {
|
422 + | tmp.message = _error_message;
|
423 + | }
|
424 + | tmp
|
425 + | }),
|
426 + | "UnauthorizedClientException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::UnauthorizedClientException({
|
427 + | let mut tmp = match protocol
|
428 + | .deserialize_response(response, crate::types::error::UnauthorizedClientException::SCHEMA, _cfg)
|
429 + | .and_then(|mut deser| {
|
430 + | crate::types::error::UnauthorizedClientException::deserialize_with_response(
|
431 + | &mut *deser,
|
432 + | response.headers(),
|
433 + | response.status().into(),
|
434 + | body,
|
435 + | )
|
436 + | }) {
|
437 + | ::std::result::Result::Ok(val) => val,
|
438 + | ::std::result::Result::Err(e) => {
|
439 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
440 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
441 + | ))
|
442 + | }
|
443 + | };
|
444 + | tmp.meta = generic;
|
445 + | if tmp.message.is_none() {
|
446 + | tmp.message = _error_message;
|
447 + | }
|
448 + | tmp
|
449 + | }),
|
450 + | "UnsupportedGrantTypeException" => crate::operation::create_token_with_iam::CreateTokenWithIAMError::UnsupportedGrantTypeException({
|
451 + | let mut tmp = match protocol
|
452 + | .deserialize_response(response, crate::types::error::UnsupportedGrantTypeException::SCHEMA, _cfg)
|
453 + | .and_then(|mut deser| {
|
454 + | crate::types::error::UnsupportedGrantTypeException::deserialize_with_response(
|
455 + | &mut *deser,
|
456 + | response.headers(),
|
457 + | response.status().into(),
|
458 + | body,
|
459 + | )
|
460 + | }) {
|
461 + | ::std::result::Result::Ok(val) => val,
|
462 + | ::std::result::Result::Err(e) => {
|
463 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
464 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
465 + | ))
|
466 + | }
|
467 + | };
|
468 + | tmp.meta = generic;
|
469 + | if tmp.message.is_none() {
|
470 + | tmp.message = _error_message;
|
471 + | }
|
472 + | tmp
|
473 + | }),
|
474 + | _ => crate::operation::create_token_with_iam::CreateTokenWithIAMError::generic(generic),
|
163 475 | };
|
164 - | crate::protocol_serde::type_erase_result(parse_result)
|
476 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
477 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
478 + | ))
|
479 + | } else {
|
480 + | let protocol = _cfg
|
481 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
482 + | .expect("a SharedClientProtocol is required");
|
483 + | let mut deser = protocol
|
484 + | .deserialize_response(response, CreateTokenWithIAM::OUTPUT_SCHEMA, _cfg)
|
485 + | .map_err(|e| {
|
486 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
487 + | })?;
|
488 + | let body = response.body().bytes().expect("body loaded");
|
489 + | let output = crate::operation::create_token_with_iam::CreateTokenWithIamOutput::deserialize_with_response(
|
490 + | &mut *deser,
|
491 + | response.headers(),
|
492 + | response.status().into(),
|
493 + | body,
|
494 + | )
|
495 + | .map_err(|e| {
|
496 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
497 + | })?;
|
498 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
499 + | }
|
165 500 | }
|
166 501 | }
|
167 502 | #[derive(Debug)]
|
168 503 | struct CreateTokenWithIAMRequestSerializer;
|
169 504 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateTokenWithIAMRequestSerializer {
|
170 505 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
171 506 | fn serialize_input(
|
172 507 | &self,
|
173 508 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
174 509 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
175 510 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
176 511 | let input = input
|
177 512 | .downcast::<crate::operation::create_token_with_iam::CreateTokenWithIamInput>()
|
178 513 | .expect("correct type");
|
179 - | let _header_serialization_settings = _cfg
|
180 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
181 - | .cloned()
|
182 - | .unwrap_or_default();
|
183 - | let mut request_builder = {
|
184 - | #[allow(clippy::uninlined_format_args)]
|
185 - | fn uri_base(
|
186 - | _input: &crate::operation::create_token_with_iam::CreateTokenWithIamInput,
|
187 - | output: &mut ::std::string::String,
|
188 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
189 - | use ::std::fmt::Write as _;
|
190 - | ::std::write!(output, "/token").expect("formatting should succeed");
|
191 - | ::std::result::Result::Ok(())
|
192 - | }
|
193 - | fn uri_query(
|
194 - | _input: &crate::operation::create_token_with_iam::CreateTokenWithIamInput,
|
195 - | mut output: &mut ::std::string::String,
|
196 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
197 - | let mut query = ::aws_smithy_http::query::Writer::new(output);
|
198 - | query.push_kv("aws_iam", "t");
|
199 - | ::std::result::Result::Ok(())
|
200 - | }
|
201 - | #[allow(clippy::unnecessary_wraps)]
|
202 - | fn update_http_builder(
|
203 - | input: &crate::operation::create_token_with_iam::CreateTokenWithIamInput,
|
204 - | builder: ::http_1x::request::Builder,
|
205 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
206 - | let mut uri = ::std::string::String::new();
|
207 - | uri_base(input, &mut uri)?;
|
208 - | uri_query(input, &mut uri)?;
|
209 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
210 - | }
|
211 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
212 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
213 - | builder
|
214 - | };
|
215 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_token_with_iam::ser_create_token_with_iam_input(
|
216 - | &input,
|
217 - | )?);
|
218 - | if let Some(content_length) = body.content_length() {
|
219 - | let content_length = content_length.to_string();
|
220 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
221 - | }
|
222 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
514 + | let protocol = _cfg
|
515 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
516 + | .expect("a SharedClientProtocol is required");
|
517 + | let mut request = protocol
|
518 + | .serialize_request(&input, CreateTokenWithIAM::INPUT_SCHEMA, "", _cfg)
|
519 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
520 + |
|
521 + | return ::std::result::Result::Ok(request);
|
223 522 | }
|
224 523 | }
|
225 524 | #[derive(Debug)]
|
226 525 | struct CreateTokenWithIAMEndpointParamsInterceptor;
|
227 526 |
|
228 527 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateTokenWithIAMEndpointParamsInterceptor {
|
229 528 | fn name(&self) -> &'static str {
|
230 529 | "CreateTokenWithIAMEndpointParamsInterceptor"
|
231 530 | }
|
232 531 |
|