1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_list_tasks_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::list_tasks::ListTasksOutput, crate::operation::list_tasks::ListTasksError> {
|
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::list_tasks::ListTasksError::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::list_tasks::ListTasksError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "ClientException" => crate::operation::list_tasks::ListTasksError::ClientException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::ClientExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_client_exception::de_client_exception_json_err(_response_body, output)
|
26 - | .map_err(crate::operation::list_tasks::ListTasksError::unhandled)?;
|
27 - | let output = output.meta(generic);
|
28 - | output.build()
|
29 - | };
|
30 - | if tmp.message.is_none() {
|
31 - | tmp.message = _error_message;
|
32 - | }
|
33 - | tmp
|
34 - | }),
|
35 - | "ClusterNotFoundException" => crate::operation::list_tasks::ListTasksError::ClusterNotFoundException({
|
36 - | #[allow(unused_mut)]
|
37 - | let mut tmp = {
|
38 - | #[allow(unused_mut)]
|
39 - | let mut output = crate::types::error::builders::ClusterNotFoundExceptionBuilder::default();
|
40 - | output = crate::protocol_serde::shape_cluster_not_found_exception::de_cluster_not_found_exception_json_err(_response_body, output)
|
41 - | .map_err(crate::operation::list_tasks::ListTasksError::unhandled)?;
|
42 - | let output = output.meta(generic);
|
43 - | output.build()
|
44 - | };
|
45 - | if tmp.message.is_none() {
|
46 - | tmp.message = _error_message;
|
47 - | }
|
48 - | tmp
|
49 - | }),
|
50 - | "InvalidParameterException" => crate::operation::list_tasks::ListTasksError::InvalidParameterException({
|
51 - | #[allow(unused_mut)]
|
52 - | let mut tmp = {
|
53 - | #[allow(unused_mut)]
|
54 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
55 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
56 - | .map_err(crate::operation::list_tasks::ListTasksError::unhandled)?;
|
57 - | let output = output.meta(generic);
|
58 - | output.build()
|
59 - | };
|
60 - | if tmp.message.is_none() {
|
61 - | tmp.message = _error_message;
|
62 - | }
|
63 - | tmp
|
64 - | }),
|
65 - | "ServerException" => crate::operation::list_tasks::ListTasksError::ServerException({
|
66 - | #[allow(unused_mut)]
|
67 - | let mut tmp = {
|
68 - | #[allow(unused_mut)]
|
69 - | let mut output = crate::types::error::builders::ServerExceptionBuilder::default();
|
70 - | output = crate::protocol_serde::shape_server_exception::de_server_exception_json_err(_response_body, output)
|
71 - | .map_err(crate::operation::list_tasks::ListTasksError::unhandled)?;
|
72 - | let output = output.meta(generic);
|
73 - | output.build()
|
74 - | };
|
75 - | if tmp.message.is_none() {
|
76 - | tmp.message = _error_message;
|
77 - | }
|
78 - | tmp
|
79 - | }),
|
80 - | "ServiceNotFoundException" => crate::operation::list_tasks::ListTasksError::ServiceNotFoundException({
|
81 - | #[allow(unused_mut)]
|
82 - | let mut tmp = {
|
83 - | #[allow(unused_mut)]
|
84 - | let mut output = crate::types::error::builders::ServiceNotFoundExceptionBuilder::default();
|
85 - | output = crate::protocol_serde::shape_service_not_found_exception::de_service_not_found_exception_json_err(_response_body, output)
|
86 - | .map_err(crate::operation::list_tasks::ListTasksError::unhandled)?;
|
87 - | let output = output.meta(generic);
|
88 - | output.build()
|
89 - | };
|
90 - | if tmp.message.is_none() {
|
91 - | tmp.message = _error_message;
|
92 - | }
|
93 - | tmp
|
94 - | }),
|
95 - | _ => crate::operation::list_tasks::ListTasksError::generic(generic),
|
96 - | })
|
97 - | }
|
98 - |
|
99 - | #[allow(clippy::unnecessary_wraps)]
|
100 - | pub fn de_list_tasks_http_response(
|
101 - | _response_status: u16,
|
102 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
103 - | _response_body: &[u8],
|
104 - | ) -> std::result::Result<crate::operation::list_tasks::ListTasksOutput, crate::operation::list_tasks::ListTasksError> {
|
105 - | Ok({
|
106 - | #[allow(unused_mut)]
|
107 - | let mut output = crate::operation::list_tasks::builders::ListTasksOutputBuilder::default();
|
108 - | output = crate::protocol_serde::shape_list_tasks::de_list_tasks(_response_body, output)
|
109 - | .map_err(crate::operation::list_tasks::ListTasksError::unhandled)?;
|
110 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
111 - | output.build()
|
112 - | })
|
113 - | }
|
114 - |
|
115 - | pub fn ser_list_tasks_input(
|
116 - | input: &crate::operation::list_tasks::ListTasksInput,
|
117 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
118 - | let mut out = String::new();
|
119 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
120 - | crate::protocol_serde::shape_list_tasks_input::ser_list_tasks_input_input(&mut object, input)?;
|
121 - | object.finish();
|
122 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
123 - | }
|
124 - |
|
125 - | pub(crate) fn de_list_tasks(
|
126 - | _value: &[u8],
|
127 - | mut builder: crate::operation::list_tasks::builders::ListTasksOutputBuilder,
|
128 - | ) -> ::std::result::Result<crate::operation::list_tasks::builders::ListTasksOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
|
129 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
130 - | let tokens = &mut tokens_owned;
|
131 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
132 - | loop {
|
133 - | match tokens.next().transpose()? {
|
134 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
135 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
136 - | "taskArns" => {
|
137 - | builder = builder.set_task_arns(crate::protocol_serde::shape_string_list::de_string_list(tokens, _value)?);
|
138 - | }
|
139 - | "nextToken" => {
|
140 - | builder = builder.set_next_token(
|
141 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
142 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
143 - | .transpose()?,
|
144 - | );
|
145 - | }
|
146 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
147 - | },
|
148 - | other => {
|
149 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
150 - | "expected object key or end object, found: {other:?}"
|
151 - | )))
|
152 - | }
|
153 - | }
|
154 - | }
|
155 - | if tokens.next().is_some() {
|
156 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
157 - | "found more JSON tokens after completing parsing",
|
158 - | ));
|
159 - | }
|
160 - | Ok(builder)
|
161 - | }
|