1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_list_tags_for_resource_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::list_tags_for_resource::ListTagsForResourceOutput,
|
9 - | crate::operation::list_tags_for_resource::ListTagsForResourceError,
|
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::list_tags_for_resource::ListTagsForResourceError::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 => return Err(crate::operation::list_tags_for_resource::ListTagsForResourceError::unhandled(generic)),
|
19 - | };
|
20 - |
|
21 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
22 - | Err(match error_code {
|
23 - | "InvalidLimitException" => crate::operation::list_tags_for_resource::ListTagsForResourceError::InvalidLimitException({
|
24 - | #[allow(unused_mut)]
|
25 - | let mut tmp = {
|
26 - | #[allow(unused_mut)]
|
27 - | let mut output = crate::types::error::builders::InvalidLimitExceptionBuilder::default();
|
28 - | output = crate::protocol_serde::shape_invalid_limit_exception::de_invalid_limit_exception_json_err(_response_body, output)
|
29 - | .map_err(crate::operation::list_tags_for_resource::ListTagsForResourceError::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 - | "InvalidNextTokenException" => crate::operation::list_tags_for_resource::ListTagsForResourceError::InvalidNextTokenException({
|
39 - | #[allow(unused_mut)]
|
40 - | let mut tmp = {
|
41 - | #[allow(unused_mut)]
|
42 - | let mut output = crate::types::error::builders::InvalidNextTokenExceptionBuilder::default();
|
43 - | output = crate::protocol_serde::shape_invalid_next_token_exception::de_invalid_next_token_exception_json_err(_response_body, output)
|
44 - | .map_err(crate::operation::list_tags_for_resource::ListTagsForResourceError::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::list_tags_for_resource::ListTagsForResourceError::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::list_tags_for_resource::ListTagsForResourceError::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 - | "ValidationException" => crate::operation::list_tags_for_resource::ListTagsForResourceError::ValidationException({
|
69 - | #[allow(unused_mut)]
|
70 - | let mut tmp = {
|
71 - | #[allow(unused_mut)]
|
72 - | let mut output = crate::types::error::builders::ValidationExceptionBuilder::default();
|
73 - | output = crate::protocol_serde::shape_validation_exception::de_validation_exception_json_err(_response_body, output)
|
74 - | .map_err(crate::operation::list_tags_for_resource::ListTagsForResourceError::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 - | _ => crate::operation::list_tags_for_resource::ListTagsForResourceError::generic(generic),
|
84 - | })
|
85 - | }
|
86 - |
|
87 - | #[allow(clippy::unnecessary_wraps)]
|
88 - | pub fn de_list_tags_for_resource_http_response(
|
89 - | _response_status: u16,
|
90 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
91 - | _response_body: &[u8],
|
92 - | ) -> std::result::Result<
|
93 - | crate::operation::list_tags_for_resource::ListTagsForResourceOutput,
|
94 - | crate::operation::list_tags_for_resource::ListTagsForResourceError,
|
95 - | > {
|
96 - | Ok({
|
97 - | #[allow(unused_mut)]
|
98 - | let mut output = crate::operation::list_tags_for_resource::builders::ListTagsForResourceOutputBuilder::default();
|
99 - | output = crate::protocol_serde::shape_list_tags_for_resource::de_list_tags_for_resource(_response_body, output)
|
100 - | .map_err(crate::operation::list_tags_for_resource::ListTagsForResourceError::unhandled)?;
|
101 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
102 - | output.build()
|
103 - | })
|
104 - | }
|
105 - |
|
106 - | pub fn ser_list_tags_for_resource_input(
|
107 - | input: &crate::operation::list_tags_for_resource::ListTagsForResourceInput,
|
108 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
109 - | let mut out = String::new();
|
110 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
111 - | crate::protocol_serde::shape_list_tags_for_resource_input::ser_list_tags_for_resource_input_input(&mut object, input)?;
|
112 - | object.finish();
|
113 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
114 - | }
|
115 - |
|
116 - | pub(crate) fn de_list_tags_for_resource(
|
117 - | _value: &[u8],
|
118 - | mut builder: crate::operation::list_tags_for_resource::builders::ListTagsForResourceOutputBuilder,
|
119 - | ) -> ::std::result::Result<
|
120 - | crate::operation::list_tags_for_resource::builders::ListTagsForResourceOutputBuilder,
|
121 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
122 - | > {
|
123 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
124 - | let tokens = &mut tokens_owned;
|
125 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
126 - | loop {
|
127 - | match tokens.next().transpose()? {
|
128 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
129 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
130 - | "Tags" => {
|
131 - | builder = builder.set_tags(crate::protocol_serde::shape_tag_list::de_tag_list(tokens, _value)?);
|
132 - | }
|
133 - | "NextToken" => {
|
134 - | builder = builder.set_next_token(
|
135 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
136 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
137 - | .transpose()?,
|
138 - | );
|
139 - | }
|
140 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
141 - | },
|
142 - | other => {
|
143 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
144 - | "expected object key or end object, found: {other:?}"
|
145 - | )))
|
146 - | }
|
147 - | }
|
148 - | }
|
149 - | if tokens.next().is_some() {
|
150 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
151 - | "found more JSON tokens after completing parsing",
|
152 - | ));
|
153 - | }
|
154 - | Ok(builder)
|
155 - | }
|