141 146 | ::std::borrow::Cow::Owned(rcb)
|
142 147 | }
|
143 148 | }
|
144 149 |
|
145 150 | #[derive(Debug)]
|
146 151 | struct ListServicesByNamespaceResponseDeserializer;
|
147 152 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListServicesByNamespaceResponseDeserializer {
|
148 153 | fn deserialize_nonstreaming(
|
149 154 | &self,
|
150 155 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
156 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
151 157 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
152 158 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
153 - | let headers = response.headers();
|
154 - | let body = response.body().bytes().expect("body loaded");
|
155 159 | #[allow(unused_mut)]
|
156 160 | let mut force_error = false;
|
157 161 | ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
|
158 - | let parse_result = if !success && status != 200 || force_error {
|
159 - | crate::protocol_serde::shape_list_services_by_namespace::de_list_services_by_namespace_http_error(status, headers, body)
|
160 - | } else {
|
161 - | crate::protocol_serde::shape_list_services_by_namespace::de_list_services_by_namespace_http_response(status, headers, body)
|
162 + | if !success && status != 200 || force_error {
|
163 + | let headers = response.headers();
|
164 + | let body = response.body().bytes().expect("body loaded");
|
165 + | #[allow(unused_mut)]
|
166 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
167 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
168 + | })?;
|
169 + | generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
|
170 + | let generic = generic_builder.build();
|
171 + | let error_code = match generic.code() {
|
172 + | ::std::option::Option::Some(code) => code,
|
173 + | ::std::option::Option::None => {
|
174 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
175 + | ::aws_smithy_runtime_api::box_error::BoxError::from(
|
176 + | crate::operation::list_services_by_namespace::ListServicesByNamespaceError::unhandled(generic),
|
177 + | ),
|
178 + | ))
|
179 + | }
|
180 + | };
|
181 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
182 + | let protocol = _cfg
|
183 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
184 + | .expect("a SharedClientProtocol is required");
|
185 + | let err = match error_code {
|
186 + | "ClientException" => crate::operation::list_services_by_namespace::ListServicesByNamespaceError::ClientException({
|
187 + | let mut tmp = match protocol
|
188 + | .deserialize_response(response, crate::types::error::ClientException::SCHEMA, _cfg)
|
189 + | .and_then(|mut deser| {
|
190 + | crate::types::error::ClientException::deserialize_with_response(
|
191 + | &mut *deser,
|
192 + | response.headers(),
|
193 + | response.status().into(),
|
194 + | body,
|
195 + | )
|
196 + | }) {
|
197 + | ::std::result::Result::Ok(val) => val,
|
198 + | ::std::result::Result::Err(e) => {
|
199 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
200 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
201 + | ))
|
202 + | }
|
203 + | };
|
204 + | tmp.meta = generic;
|
205 + | if tmp.message.is_none() {
|
206 + | tmp.message = _error_message;
|
207 + | }
|
208 + | tmp
|
209 + | }),
|
210 + | "InvalidParameterException" => {
|
211 + | crate::operation::list_services_by_namespace::ListServicesByNamespaceError::InvalidParameterException({
|
212 + | let mut tmp = match protocol
|
213 + | .deserialize_response(response, crate::types::error::InvalidParameterException::SCHEMA, _cfg)
|
214 + | .and_then(|mut deser| {
|
215 + | crate::types::error::InvalidParameterException::deserialize_with_response(
|
216 + | &mut *deser,
|
217 + | response.headers(),
|
218 + | response.status().into(),
|
219 + | body,
|
220 + | )
|
221 + | }) {
|
222 + | ::std::result::Result::Ok(val) => val,
|
223 + | ::std::result::Result::Err(e) => {
|
224 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
225 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
226 + | ))
|
227 + | }
|
228 + | };
|
229 + | tmp.meta = generic;
|
230 + | if tmp.message.is_none() {
|
231 + | tmp.message = _error_message;
|
232 + | }
|
233 + | tmp
|
234 + | })
|
235 + | }
|
236 + | "NamespaceNotFoundException" => {
|
237 + | crate::operation::list_services_by_namespace::ListServicesByNamespaceError::NamespaceNotFoundException({
|
238 + | let mut tmp = match protocol
|
239 + | .deserialize_response(response, crate::types::error::NamespaceNotFoundException::SCHEMA, _cfg)
|
240 + | .and_then(|mut deser| {
|
241 + | crate::types::error::NamespaceNotFoundException::deserialize_with_response(
|
242 + | &mut *deser,
|
243 + | response.headers(),
|
244 + | response.status().into(),
|
245 + | body,
|
246 + | )
|
247 + | }) {
|
248 + | ::std::result::Result::Ok(val) => val,
|
249 + | ::std::result::Result::Err(e) => {
|
250 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
251 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
252 + | ))
|
253 + | }
|
254 + | };
|
255 + | tmp.meta = generic;
|
256 + | if tmp.message.is_none() {
|
257 + | tmp.message = _error_message;
|
258 + | }
|
259 + | tmp
|
260 + | })
|
261 + | }
|
262 + | "ServerException" => crate::operation::list_services_by_namespace::ListServicesByNamespaceError::ServerException({
|
263 + | let mut tmp = match protocol
|
264 + | .deserialize_response(response, crate::types::error::ServerException::SCHEMA, _cfg)
|
265 + | .and_then(|mut deser| {
|
266 + | crate::types::error::ServerException::deserialize_with_response(
|
267 + | &mut *deser,
|
268 + | response.headers(),
|
269 + | response.status().into(),
|
270 + | body,
|
271 + | )
|
272 + | }) {
|
273 + | ::std::result::Result::Ok(val) => val,
|
274 + | ::std::result::Result::Err(e) => {
|
275 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
276 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
277 + | ))
|
278 + | }
|
279 + | };
|
280 + | tmp.meta = generic;
|
281 + | if tmp.message.is_none() {
|
282 + | tmp.message = _error_message;
|
283 + | }
|
284 + | tmp
|
285 + | }),
|
286 + | _ => crate::operation::list_services_by_namespace::ListServicesByNamespaceError::generic(generic),
|
162 287 | };
|
163 - | crate::protocol_serde::type_erase_result(parse_result)
|
288 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
289 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
290 + | ))
|
291 + | } else {
|
292 + | let protocol = _cfg
|
293 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
294 + | .expect("a SharedClientProtocol is required");
|
295 + | let mut deser = protocol
|
296 + | .deserialize_response(response, ListServicesByNamespace::OUTPUT_SCHEMA, _cfg)
|
297 + | .map_err(|e| {
|
298 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
299 + | })?;
|
300 + | let body = response.body().bytes().expect("body loaded");
|
301 + | let output = crate::operation::list_services_by_namespace::ListServicesByNamespaceOutput::deserialize_with_response(
|
302 + | &mut *deser,
|
303 + | response.headers(),
|
304 + | response.status().into(),
|
305 + | body,
|
306 + | )
|
307 + | .map_err(|e| {
|
308 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
309 + | })?;
|
310 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
311 + | }
|
164 312 | }
|
165 313 | }
|
166 314 | #[derive(Debug)]
|
167 315 | struct ListServicesByNamespaceRequestSerializer;
|
168 316 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListServicesByNamespaceRequestSerializer {
|
169 317 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
170 318 | fn serialize_input(
|
171 319 | &self,
|
172 320 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
173 321 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
174 322 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
175 323 | let input = input
|
176 324 | .downcast::<crate::operation::list_services_by_namespace::ListServicesByNamespaceInput>()
|
177 325 | .expect("correct type");
|
178 - | let _header_serialization_settings = _cfg
|
179 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
180 - | .cloned()
|
181 - | .unwrap_or_default();
|
182 - | let mut request_builder = {
|
183 - | #[allow(clippy::uninlined_format_args)]
|
184 - | fn uri_base(
|
185 - | _input: &crate::operation::list_services_by_namespace::ListServicesByNamespaceInput,
|
186 - | output: &mut ::std::string::String,
|
187 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
188 - | use ::std::fmt::Write as _;
|
189 - | ::std::write!(output, "/").expect("formatting should succeed");
|
190 - | ::std::result::Result::Ok(())
|
191 - | }
|
192 - | #[allow(clippy::unnecessary_wraps)]
|
193 - | fn update_http_builder(
|
194 - | input: &crate::operation::list_services_by_namespace::ListServicesByNamespaceInput,
|
195 - | builder: ::http_1x::request::Builder,
|
196 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
197 - | let mut uri = ::std::string::String::new();
|
198 - | uri_base(input, &mut uri)?;
|
199 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
200 - | }
|
201 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
202 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/x-amz-json-1.1");
|
203 - | builder = _header_serialization_settings.set_default_header(
|
204 - | builder,
|
205 - | ::http_1x::header::HeaderName::from_static("x-amz-target"),
|
206 - | "AmazonEC2ContainerServiceV20141113.ListServicesByNamespace",
|
207 - | );
|
208 - | builder
|
209 - | };
|
210 - | let body = ::aws_smithy_types::body::SdkBody::from(
|
211 - | crate::protocol_serde::shape_list_services_by_namespace::ser_list_services_by_namespace_input(&input)?,
|
212 - | );
|
213 - | if let Some(content_length) = body.content_length() {
|
214 - | let content_length = content_length.to_string();
|
215 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
216 - | }
|
217 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
326 + | let protocol = _cfg
|
327 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
328 + | .expect("a SharedClientProtocol is required");
|
329 + | let mut request = protocol
|
330 + | .serialize_request(&input, ListServicesByNamespace::INPUT_SCHEMA, "", _cfg)
|
331 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
332 + |
|
333 + | return ::std::result::Result::Ok(request);
|
218 334 | }
|
219 335 | }
|
220 336 | #[derive(Debug)]
|
221 337 | struct ListServicesByNamespaceEndpointParamsInterceptor;
|
222 338 |
|
223 339 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListServicesByNamespaceEndpointParamsInterceptor {
|
224 340 | fn name(&self) -> &'static str {
|
225 341 | "ListServicesByNamespaceEndpointParamsInterceptor"
|
226 342 | }
|
227 343 |
|