1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_tag_resource_http_error(
|
4 - | _response_status: u16,
|
5 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
6 - | _response_body: &[u8],
|
7 - | ) -> std::result::Result<crate::operation::tag_resource::TagResourceOutput, crate::operation::tag_resource::TagResourceError> {
|
8 - | #[allow(unused_mut)]
|
9 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
10 - | .map_err(crate::operation::tag_resource::TagResourceError::unhandled)?;
|
11 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
12 - | let generic = generic_builder.build();
|
13 - | let error_code = match generic.code() {
|
14 - | Some(code) => code,
|
15 - | None => return Err(crate::operation::tag_resource::TagResourceError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "InvalidParameterValueException" => crate::operation::tag_resource::TagResourceError::InvalidParameterValueException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::InvalidParameterValueExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_invalid_parameter_value_exception::de_invalid_parameter_value_exception_json_err(
|
26 - | _response_body,
|
27 - | output,
|
28 - | )
|
29 - | .map_err(crate::operation::tag_resource::TagResourceError::unhandled)?;
|
30 - | let output = output.meta(generic);
|
31 - | output.build()
|
32 - | };
|
33 - | if tmp.message.is_none() {
|
34 - | tmp.message = _error_message;
|
35 - | }
|
36 - | tmp
|
37 - | }),
|
38 - | "ResourceConflictException" => crate::operation::tag_resource::TagResourceError::ResourceConflictException({
|
39 - | #[allow(unused_mut)]
|
40 - | let mut tmp = {
|
41 - | #[allow(unused_mut)]
|
42 - | let mut output = crate::types::error::builders::ResourceConflictExceptionBuilder::default();
|
43 - | output = crate::protocol_serde::shape_resource_conflict_exception::de_resource_conflict_exception_json_err(_response_body, output)
|
44 - | .map_err(crate::operation::tag_resource::TagResourceError::unhandled)?;
|
45 - | let output = output.meta(generic);
|
46 - | output.build()
|
47 - | };
|
48 - | if tmp.message.is_none() {
|
49 - | tmp.message = _error_message;
|
50 - | }
|
51 - | tmp
|
52 - | }),
|
53 - | "ResourceNotFoundException" => crate::operation::tag_resource::TagResourceError::ResourceNotFoundException({
|
54 - | #[allow(unused_mut)]
|
55 - | let mut tmp = {
|
56 - | #[allow(unused_mut)]
|
57 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
58 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
59 - | .map_err(crate::operation::tag_resource::TagResourceError::unhandled)?;
|
60 - | let output = output.meta(generic);
|
61 - | output.build()
|
62 - | };
|
63 - | if tmp.message.is_none() {
|
64 - | tmp.message = _error_message;
|
65 - | }
|
66 - | tmp
|
67 - | }),
|
68 - | "ServiceException" => crate::operation::tag_resource::TagResourceError::ServiceException({
|
69 - | #[allow(unused_mut)]
|
70 - | let mut tmp = {
|
71 - | #[allow(unused_mut)]
|
72 - | let mut output = crate::types::error::builders::ServiceExceptionBuilder::default();
|
73 - | output = crate::protocol_serde::shape_service_exception::de_service_exception_json_err(_response_body, output)
|
74 - | .map_err(crate::operation::tag_resource::TagResourceError::unhandled)?;
|
75 - | let output = output.meta(generic);
|
76 - | output.build()
|
77 - | };
|
78 - | if tmp.message.is_none() {
|
79 - | tmp.message = _error_message;
|
80 - | }
|
81 - | tmp
|
82 - | }),
|
83 - | "TooManyRequestsException" => crate::operation::tag_resource::TagResourceError::TooManyRequestsException({
|
84 - | #[allow(unused_mut)]
|
85 - | let mut tmp = {
|
86 - | #[allow(unused_mut)]
|
87 - | let mut output = crate::types::error::builders::TooManyRequestsExceptionBuilder::default();
|
88 - | output = crate::protocol_serde::shape_too_many_requests_exception::de_too_many_requests_exception_json_err(_response_body, output)
|
89 - | .map_err(crate::operation::tag_resource::TagResourceError::unhandled)?;
|
90 - | output = output.set_retry_after_seconds(
|
91 - | crate::protocol_serde::shape_too_many_requests_exception::de_retry_after_seconds_header(_response_headers).map_err(|_| {
|
92 - | crate::operation::tag_resource::TagResourceError::unhandled("Failed to parse retryAfterSeconds from header `Retry-After")
|
93 - | })?,
|
94 - | );
|
95 - | let output = output.meta(generic);
|
96 - | output.build()
|
97 - | };
|
98 - | if tmp.message.is_none() {
|
99 - | tmp.message = _error_message;
|
100 - | }
|
101 - | tmp
|
102 - | }),
|
103 - | _ => crate::operation::tag_resource::TagResourceError::generic(generic),
|
104 - | })
|
105 - | }
|
106 - |
|
107 - | #[allow(clippy::unnecessary_wraps)]
|
108 - | pub fn de_tag_resource_http_response(
|
109 - | _response_status: u16,
|
110 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
111 - | _response_body: &[u8],
|
112 - | ) -> std::result::Result<crate::operation::tag_resource::TagResourceOutput, crate::operation::tag_resource::TagResourceError> {
|
113 - | Ok({
|
114 - | #[allow(unused_mut)]
|
115 - | let mut output = crate::operation::tag_resource::builders::TagResourceOutputBuilder::default();
|
116 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
117 - | output.build()
|
118 - | })
|
119 - | }
|
120 - |
|
121 - | pub fn ser_tag_resource_input(
|
122 - | input: &crate::operation::tag_resource::TagResourceInput,
|
123 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
124 - | let mut out = String::new();
|
125 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
126 - | crate::protocol_serde::shape_tag_resource_input::ser_tag_resource_input_input(&mut object, input)?;
|
127 - | object.finish();
|
128 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
129 - | }
|