1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_get_task_protection_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::get_task_protection::GetTaskProtectionOutput, crate::operation::get_task_protection::GetTaskProtectionError>
|
8 - | {
|
9 - | #[allow(unused_mut)]
|
10 - | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
|
11 - | .map_err(crate::operation::get_task_protection::GetTaskProtectionError::unhandled)?;
|
12 - | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, _response_headers);
|
13 - | let generic = generic_builder.build();
|
14 - | let error_code = match generic.code() {
|
15 - | Some(code) => code,
|
16 - | None => return Err(crate::operation::get_task_protection::GetTaskProtectionError::unhandled(generic)),
|
17 - | };
|
18 - |
|
19 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
20 - | Err(match error_code {
|
21 - | "AccessDeniedException" => crate::operation::get_task_protection::GetTaskProtectionError::AccessDeniedException({
|
22 - | #[allow(unused_mut)]
|
23 - | let mut tmp = {
|
24 - | #[allow(unused_mut)]
|
25 - | let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
|
26 - | output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
|
27 - | .map_err(crate::operation::get_task_protection::GetTaskProtectionError::unhandled)?;
|
28 - | let output = output.meta(generic);
|
29 - | output.build()
|
30 - | };
|
31 - | if tmp.message.is_none() {
|
32 - | tmp.message = _error_message;
|
33 - | }
|
34 - | tmp
|
35 - | }),
|
36 - | "ClientException" => crate::operation::get_task_protection::GetTaskProtectionError::ClientException({
|
37 - | #[allow(unused_mut)]
|
38 - | let mut tmp = {
|
39 - | #[allow(unused_mut)]
|
40 - | let mut output = crate::types::error::builders::ClientExceptionBuilder::default();
|
41 - | output = crate::protocol_serde::shape_client_exception::de_client_exception_json_err(_response_body, output)
|
42 - | .map_err(crate::operation::get_task_protection::GetTaskProtectionError::unhandled)?;
|
43 - | let output = output.meta(generic);
|
44 - | output.build()
|
45 - | };
|
46 - | if tmp.message.is_none() {
|
47 - | tmp.message = _error_message;
|
48 - | }
|
49 - | tmp
|
50 - | }),
|
51 - | "ClusterNotFoundException" => crate::operation::get_task_protection::GetTaskProtectionError::ClusterNotFoundException({
|
52 - | #[allow(unused_mut)]
|
53 - | let mut tmp = {
|
54 - | #[allow(unused_mut)]
|
55 - | let mut output = crate::types::error::builders::ClusterNotFoundExceptionBuilder::default();
|
56 - | output = crate::protocol_serde::shape_cluster_not_found_exception::de_cluster_not_found_exception_json_err(_response_body, output)
|
57 - | .map_err(crate::operation::get_task_protection::GetTaskProtectionError::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 - | "InvalidParameterException" => crate::operation::get_task_protection::GetTaskProtectionError::InvalidParameterException({
|
67 - | #[allow(unused_mut)]
|
68 - | let mut tmp = {
|
69 - | #[allow(unused_mut)]
|
70 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
71 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
72 - | .map_err(crate::operation::get_task_protection::GetTaskProtectionError::unhandled)?;
|
73 - | let output = output.meta(generic);
|
74 - | output.build()
|
75 - | };
|
76 - | if tmp.message.is_none() {
|
77 - | tmp.message = _error_message;
|
78 - | }
|
79 - | tmp
|
80 - | }),
|
81 - | "ResourceNotFoundException" => crate::operation::get_task_protection::GetTaskProtectionError::ResourceNotFoundException({
|
82 - | #[allow(unused_mut)]
|
83 - | let mut tmp = {
|
84 - | #[allow(unused_mut)]
|
85 - | let mut output = crate::types::error::builders::ResourceNotFoundExceptionBuilder::default();
|
86 - | output = crate::protocol_serde::shape_resource_not_found_exception::de_resource_not_found_exception_json_err(_response_body, output)
|
87 - | .map_err(crate::operation::get_task_protection::GetTaskProtectionError::unhandled)?;
|
88 - | let output = output.meta(generic);
|
89 - | output.build()
|
90 - | };
|
91 - | if tmp.message.is_none() {
|
92 - | tmp.message = _error_message;
|
93 - | }
|
94 - | tmp
|
95 - | }),
|
96 - | "ServerException" => crate::operation::get_task_protection::GetTaskProtectionError::ServerException({
|
97 - | #[allow(unused_mut)]
|
98 - | let mut tmp = {
|
99 - | #[allow(unused_mut)]
|
100 - | let mut output = crate::types::error::builders::ServerExceptionBuilder::default();
|
101 - | output = crate::protocol_serde::shape_server_exception::de_server_exception_json_err(_response_body, output)
|
102 - | .map_err(crate::operation::get_task_protection::GetTaskProtectionError::unhandled)?;
|
103 - | let output = output.meta(generic);
|
104 - | output.build()
|
105 - | };
|
106 - | if tmp.message.is_none() {
|
107 - | tmp.message = _error_message;
|
108 - | }
|
109 - | tmp
|
110 - | }),
|
111 - | "UnsupportedFeatureException" => crate::operation::get_task_protection::GetTaskProtectionError::UnsupportedFeatureException({
|
112 - | #[allow(unused_mut)]
|
113 - | let mut tmp = {
|
114 - | #[allow(unused_mut)]
|
115 - | let mut output = crate::types::error::builders::UnsupportedFeatureExceptionBuilder::default();
|
116 - | output =
|
117 - | crate::protocol_serde::shape_unsupported_feature_exception::de_unsupported_feature_exception_json_err(_response_body, output)
|
118 - | .map_err(crate::operation::get_task_protection::GetTaskProtectionError::unhandled)?;
|
119 - | let output = output.meta(generic);
|
120 - | output.build()
|
121 - | };
|
122 - | if tmp.message.is_none() {
|
123 - | tmp.message = _error_message;
|
124 - | }
|
125 - | tmp
|
126 - | }),
|
127 - | _ => crate::operation::get_task_protection::GetTaskProtectionError::generic(generic),
|
128 - | })
|
129 - | }
|
130 - |
|
131 - | #[allow(clippy::unnecessary_wraps)]
|
132 - | pub fn de_get_task_protection_http_response(
|
133 - | _response_status: u16,
|
134 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
135 - | _response_body: &[u8],
|
136 - | ) -> std::result::Result<crate::operation::get_task_protection::GetTaskProtectionOutput, crate::operation::get_task_protection::GetTaskProtectionError>
|
137 - | {
|
138 - | Ok({
|
139 - | #[allow(unused_mut)]
|
140 - | let mut output = crate::operation::get_task_protection::builders::GetTaskProtectionOutputBuilder::default();
|
141 - | output = crate::protocol_serde::shape_get_task_protection::de_get_task_protection(_response_body, output)
|
142 - | .map_err(crate::operation::get_task_protection::GetTaskProtectionError::unhandled)?;
|
143 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
144 - | output.build()
|
145 - | })
|
146 - | }
|
147 - |
|
148 - | pub fn ser_get_task_protection_input(
|
149 - | input: &crate::operation::get_task_protection::GetTaskProtectionInput,
|
150 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
151 - | let mut out = String::new();
|
152 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
153 - | crate::protocol_serde::shape_get_task_protection_input::ser_get_task_protection_input_input(&mut object, input)?;
|
154 - | object.finish();
|
155 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
156 - | }
|
157 - |
|
158 - | pub(crate) fn de_get_task_protection(
|
159 - | _value: &[u8],
|
160 - | mut builder: crate::operation::get_task_protection::builders::GetTaskProtectionOutputBuilder,
|
161 - | ) -> ::std::result::Result<
|
162 - | crate::operation::get_task_protection::builders::GetTaskProtectionOutputBuilder,
|
163 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
164 - | > {
|
165 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
166 - | let tokens = &mut tokens_owned;
|
167 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
168 - | loop {
|
169 - | match tokens.next().transpose()? {
|
170 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
171 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
172 - | "protectedTasks" => {
|
173 - | builder = builder.set_protected_tasks(crate::protocol_serde::shape_protected_tasks::de_protected_tasks(tokens, _value)?);
|
174 - | }
|
175 - | "failures" => {
|
176 - | builder = builder.set_failures(crate::protocol_serde::shape_failures::de_failures(tokens, _value)?);
|
177 - | }
|
178 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
179 - | },
|
180 - | other => {
|
181 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
182 - | "expected object key or end object, found: {other:?}"
|
183 - | )))
|
184 - | }
|
185 - | }
|
186 - | }
|
187 - | if tokens.next().is_some() {
|
188 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
189 - | "found more JSON tokens after completing parsing",
|
190 - | ));
|
191 - | }
|
192 - | Ok(builder)
|
193 - | }
|