1 - | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 - | #[allow(clippy::unnecessary_wraps)]
|
3 - | pub fn de_execute_command_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::execute_command::ExecuteCommandOutput, crate::operation::execute_command::ExecuteCommandError> {
|
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::execute_command::ExecuteCommandError::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::execute_command::ExecuteCommandError::unhandled(generic)),
|
16 - | };
|
17 - |
|
18 - | let _error_message = generic.message().map(|msg| msg.to_owned());
|
19 - | Err(match error_code {
|
20 - | "AccessDeniedException" => crate::operation::execute_command::ExecuteCommandError::AccessDeniedException({
|
21 - | #[allow(unused_mut)]
|
22 - | let mut tmp = {
|
23 - | #[allow(unused_mut)]
|
24 - | let mut output = crate::types::error::builders::AccessDeniedExceptionBuilder::default();
|
25 - | output = crate::protocol_serde::shape_access_denied_exception::de_access_denied_exception_json_err(_response_body, output)
|
26 - | .map_err(crate::operation::execute_command::ExecuteCommandError::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 - | "ClientException" => crate::operation::execute_command::ExecuteCommandError::ClientException({
|
36 - | #[allow(unused_mut)]
|
37 - | let mut tmp = {
|
38 - | #[allow(unused_mut)]
|
39 - | let mut output = crate::types::error::builders::ClientExceptionBuilder::default();
|
40 - | output = crate::protocol_serde::shape_client_exception::de_client_exception_json_err(_response_body, output)
|
41 - | .map_err(crate::operation::execute_command::ExecuteCommandError::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 - | "ClusterNotFoundException" => crate::operation::execute_command::ExecuteCommandError::ClusterNotFoundException({
|
51 - | #[allow(unused_mut)]
|
52 - | let mut tmp = {
|
53 - | #[allow(unused_mut)]
|
54 - | let mut output = crate::types::error::builders::ClusterNotFoundExceptionBuilder::default();
|
55 - | output = crate::protocol_serde::shape_cluster_not_found_exception::de_cluster_not_found_exception_json_err(_response_body, output)
|
56 - | .map_err(crate::operation::execute_command::ExecuteCommandError::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 - | "InvalidParameterException" => crate::operation::execute_command::ExecuteCommandError::InvalidParameterException({
|
66 - | #[allow(unused_mut)]
|
67 - | let mut tmp = {
|
68 - | #[allow(unused_mut)]
|
69 - | let mut output = crate::types::error::builders::InvalidParameterExceptionBuilder::default();
|
70 - | output = crate::protocol_serde::shape_invalid_parameter_exception::de_invalid_parameter_exception_json_err(_response_body, output)
|
71 - | .map_err(crate::operation::execute_command::ExecuteCommandError::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 - | "ServerException" => crate::operation::execute_command::ExecuteCommandError::ServerException({
|
81 - | #[allow(unused_mut)]
|
82 - | let mut tmp = {
|
83 - | #[allow(unused_mut)]
|
84 - | let mut output = crate::types::error::builders::ServerExceptionBuilder::default();
|
85 - | output = crate::protocol_serde::shape_server_exception::de_server_exception_json_err(_response_body, output)
|
86 - | .map_err(crate::operation::execute_command::ExecuteCommandError::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 - | "TargetNotConnectedException" => crate::operation::execute_command::ExecuteCommandError::TargetNotConnectedException({
|
96 - | #[allow(unused_mut)]
|
97 - | let mut tmp = {
|
98 - | #[allow(unused_mut)]
|
99 - | let mut output = crate::types::error::builders::TargetNotConnectedExceptionBuilder::default();
|
100 - | output =
|
101 - | crate::protocol_serde::shape_target_not_connected_exception::de_target_not_connected_exception_json_err(_response_body, output)
|
102 - | .map_err(crate::operation::execute_command::ExecuteCommandError::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 - | _ => crate::operation::execute_command::ExecuteCommandError::generic(generic),
|
112 - | })
|
113 - | }
|
114 - |
|
115 - | #[allow(clippy::unnecessary_wraps)]
|
116 - | pub fn de_execute_command_http_response(
|
117 - | _response_status: u16,
|
118 - | _response_headers: &::aws_smithy_runtime_api::http::Headers,
|
119 - | _response_body: &[u8],
|
120 - | ) -> std::result::Result<crate::operation::execute_command::ExecuteCommandOutput, crate::operation::execute_command::ExecuteCommandError> {
|
121 - | Ok({
|
122 - | #[allow(unused_mut)]
|
123 - | let mut output = crate::operation::execute_command::builders::ExecuteCommandOutputBuilder::default();
|
124 - | output = crate::protocol_serde::shape_execute_command::de_execute_command(_response_body, output)
|
125 - | .map_err(crate::operation::execute_command::ExecuteCommandError::unhandled)?;
|
126 - | output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
|
127 - | output.build()
|
128 - | })
|
129 - | }
|
130 - |
|
131 - | pub fn ser_execute_command_input(
|
132 - | input: &crate::operation::execute_command::ExecuteCommandInput,
|
133 - | ) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
|
134 - | let mut out = String::new();
|
135 - | let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
|
136 - | crate::protocol_serde::shape_execute_command_input::ser_execute_command_input_input(&mut object, input)?;
|
137 - | object.finish();
|
138 - | Ok(::aws_smithy_types::body::SdkBody::from(out))
|
139 - | }
|
140 - |
|
141 - | pub(crate) fn de_execute_command(
|
142 - | _value: &[u8],
|
143 - | mut builder: crate::operation::execute_command::builders::ExecuteCommandOutputBuilder,
|
144 - | ) -> ::std::result::Result<
|
145 - | crate::operation::execute_command::builders::ExecuteCommandOutputBuilder,
|
146 - | ::aws_smithy_json::deserialize::error::DeserializeError,
|
147 - | > {
|
148 - | let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(_value)).peekable();
|
149 - | let tokens = &mut tokens_owned;
|
150 - | ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
|
151 - | loop {
|
152 - | match tokens.next().transpose()? {
|
153 - | Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
|
154 - | Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => match key.to_unescaped()?.as_ref() {
|
155 - | "clusterArn" => {
|
156 - | builder = builder.set_cluster_arn(
|
157 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
158 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
159 - | .transpose()?,
|
160 - | );
|
161 - | }
|
162 - | "containerArn" => {
|
163 - | builder = builder.set_container_arn(
|
164 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
165 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
166 - | .transpose()?,
|
167 - | );
|
168 - | }
|
169 - | "containerName" => {
|
170 - | builder = builder.set_container_name(
|
171 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
172 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
173 - | .transpose()?,
|
174 - | );
|
175 - | }
|
176 - | "interactive" => {
|
177 - | builder = builder.set_interactive(::aws_smithy_json::deserialize::token::expect_bool_or_null(tokens.next())?);
|
178 - | }
|
179 - | "session" => {
|
180 - | builder = builder.set_session(crate::protocol_serde::shape_session::de_session(tokens, _value)?);
|
181 - | }
|
182 - | "taskArn" => {
|
183 - | builder = builder.set_task_arn(
|
184 - | ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?
|
185 - | .map(|s| s.to_unescaped().map(|u| u.into_owned()))
|
186 - | .transpose()?,
|
187 - | );
|
188 - | }
|
189 - | _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
|
190 - | },
|
191 - | other => {
|
192 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
|
193 - | "expected object key or end object, found: {other:?}"
|
194 - | )))
|
195 - | }
|
196 - | }
|
197 - | }
|
198 - | if tokens.next().is_some() {
|
199 - | return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(
|
200 - | "found more JSON tokens after completing parsing",
|
201 - | ));
|
202 - | }
|
203 - | Ok(builder)
|
204 - | }
|