129 133 | crate::operation::start_snapshot::StartSnapshotError,
|
130 134 | >::new());
|
131 135 |
|
132 136 | ::std::borrow::Cow::Owned(rcb)
|
133 137 | }
|
134 138 | }
|
135 139 |
|
136 140 | #[derive(Debug)]
|
137 141 | struct StartSnapshotResponseDeserializer;
|
138 142 | impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for StartSnapshotResponseDeserializer {
|
139 - | fn deserialize_nonstreaming(
|
143 + | fn deserialize_nonstreaming_with_config(
|
140 144 | &self,
|
141 145 | response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
|
146 + | _cfg: &::aws_smithy_types::config_bag::ConfigBag,
|
142 147 | ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
|
143 148 | let (success, status) = (response.status().is_success(), response.status().as_u16());
|
149 + | #[allow(unused_mut)]
|
150 + | let mut force_error = false;
|
151 + |
|
152 + | if !success && status != 201 || force_error {
|
144 153 | let headers = response.headers();
|
145 154 | let body = response.body().bytes().expect("body loaded");
|
146 155 | #[allow(unused_mut)]
|
147 - | let mut force_error = false;
|
156 + | let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(status, headers, body).map_err(|e| {
|
157 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
158 + | })?;
|
148 159 |
|
149 - | let parse_result = if !success && status != 201 || force_error {
|
150 - | crate::protocol_serde::shape_start_snapshot::de_start_snapshot_http_error(status, headers, body)
|
151 - | } else {
|
152 - | crate::protocol_serde::shape_start_snapshot::de_start_snapshot_http_response(status, headers, body)
|
160 + | let generic = generic_builder.build();
|
161 + | let error_code = match generic.code() {
|
162 + | ::std::option::Option::Some(code) => code,
|
163 + | ::std::option::Option::None => {
|
164 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
165 + | ::aws_smithy_runtime_api::box_error::BoxError::from(crate::operation::start_snapshot::StartSnapshotError::unhandled(generic)),
|
166 + | ))
|
167 + | }
|
168 + | };
|
169 + | let _error_message = generic.message().map(|msg| msg.to_owned());
|
170 + | let protocol = _cfg
|
171 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
172 + | .expect("a SharedClientProtocol is required");
|
173 + | let err = match error_code {
|
174 + | "AccessDeniedException" => crate::operation::start_snapshot::StartSnapshotError::AccessDeniedError({
|
175 + | let mut tmp = match protocol
|
176 + | .deserialize_response(response, crate::types::error::AccessDeniedError::SCHEMA, _cfg)
|
177 + | .and_then(|mut deser| {
|
178 + | crate::types::error::AccessDeniedError::deserialize_with_response(
|
179 + | &mut *deser,
|
180 + | response.headers(),
|
181 + | response.status().into(),
|
182 + | body,
|
183 + | )
|
184 + | }) {
|
185 + | ::std::result::Result::Ok(val) => val,
|
186 + | ::std::result::Result::Err(e) => {
|
187 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
188 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
189 + | ))
|
190 + | }
|
191 + | };
|
192 + | tmp.meta = generic;
|
193 + | if tmp.message.is_none() {
|
194 + | tmp.message = _error_message;
|
195 + | }
|
196 + | tmp
|
197 + | }),
|
198 + | "ConcurrentLimitExceededException" => crate::operation::start_snapshot::StartSnapshotError::ConcurrentLimitExceededError({
|
199 + | let mut tmp = match protocol
|
200 + | .deserialize_response(response, crate::types::error::ConcurrentLimitExceededError::SCHEMA, _cfg)
|
201 + | .and_then(|mut deser| {
|
202 + | crate::types::error::ConcurrentLimitExceededError::deserialize_with_response(
|
203 + | &mut *deser,
|
204 + | response.headers(),
|
205 + | response.status().into(),
|
206 + | body,
|
207 + | )
|
208 + | }) {
|
209 + | ::std::result::Result::Ok(val) => val,
|
210 + | ::std::result::Result::Err(e) => {
|
211 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
212 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
213 + | ))
|
214 + | }
|
215 + | };
|
216 + | tmp.meta = generic;
|
217 + | if tmp.message.is_none() {
|
218 + | tmp.message = _error_message;
|
219 + | }
|
220 + | tmp
|
221 + | }),
|
222 + | "ConflictException" => crate::operation::start_snapshot::StartSnapshotError::ConflictError({
|
223 + | let mut tmp = match protocol
|
224 + | .deserialize_response(response, crate::types::error::ConflictError::SCHEMA, _cfg)
|
225 + | .and_then(|mut deser| {
|
226 + | crate::types::error::ConflictError::deserialize_with_response(
|
227 + | &mut *deser,
|
228 + | response.headers(),
|
229 + | response.status().into(),
|
230 + | body,
|
231 + | )
|
232 + | }) {
|
233 + | ::std::result::Result::Ok(val) => val,
|
234 + | ::std::result::Result::Err(e) => {
|
235 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
236 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
237 + | ))
|
238 + | }
|
239 + | };
|
240 + | tmp.meta = generic;
|
241 + | if tmp.message.is_none() {
|
242 + | tmp.message = _error_message;
|
243 + | }
|
244 + | tmp
|
245 + | }),
|
246 + | "InternalServerException" => crate::operation::start_snapshot::StartSnapshotError::InternalServerError({
|
247 + | let mut tmp = match protocol
|
248 + | .deserialize_response(response, crate::types::error::InternalServerError::SCHEMA, _cfg)
|
249 + | .and_then(|mut deser| {
|
250 + | crate::types::error::InternalServerError::deserialize_with_response(
|
251 + | &mut *deser,
|
252 + | response.headers(),
|
253 + | response.status().into(),
|
254 + | body,
|
255 + | )
|
256 + | }) {
|
257 + | ::std::result::Result::Ok(val) => val,
|
258 + | ::std::result::Result::Err(e) => {
|
259 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
260 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
261 + | ))
|
262 + | }
|
263 + | };
|
264 + | tmp.meta = generic;
|
265 + | if tmp.message.is_none() {
|
266 + | tmp.message = _error_message;
|
267 + | }
|
268 + | tmp
|
269 + | }),
|
270 + | "RequestThrottledException" => crate::operation::start_snapshot::StartSnapshotError::RequestThrottledError({
|
271 + | let mut tmp = match protocol
|
272 + | .deserialize_response(response, crate::types::error::RequestThrottledError::SCHEMA, _cfg)
|
273 + | .and_then(|mut deser| {
|
274 + | crate::types::error::RequestThrottledError::deserialize_with_response(
|
275 + | &mut *deser,
|
276 + | response.headers(),
|
277 + | response.status().into(),
|
278 + | body,
|
279 + | )
|
280 + | }) {
|
281 + | ::std::result::Result::Ok(val) => val,
|
282 + | ::std::result::Result::Err(e) => {
|
283 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
284 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
285 + | ))
|
286 + | }
|
287 + | };
|
288 + | tmp.meta = generic;
|
289 + | if tmp.message.is_none() {
|
290 + | tmp.message = _error_message;
|
291 + | }
|
292 + | tmp
|
293 + | }),
|
294 + | "ResourceNotFoundException" => crate::operation::start_snapshot::StartSnapshotError::ResourceNotFoundError({
|
295 + | let mut tmp = match protocol
|
296 + | .deserialize_response(response, crate::types::error::ResourceNotFoundError::SCHEMA, _cfg)
|
297 + | .and_then(|mut deser| {
|
298 + | crate::types::error::ResourceNotFoundError::deserialize_with_response(
|
299 + | &mut *deser,
|
300 + | response.headers(),
|
301 + | response.status().into(),
|
302 + | body,
|
303 + | )
|
304 + | }) {
|
305 + | ::std::result::Result::Ok(val) => val,
|
306 + | ::std::result::Result::Err(e) => {
|
307 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
308 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
309 + | ))
|
310 + | }
|
311 + | };
|
312 + | tmp.meta = generic;
|
313 + | if tmp.message.is_none() {
|
314 + | tmp.message = _error_message;
|
315 + | }
|
316 + | tmp
|
317 + | }),
|
318 + | "ServiceQuotaExceededException" => crate::operation::start_snapshot::StartSnapshotError::ServiceQuotaExceededError({
|
319 + | let mut tmp = match protocol
|
320 + | .deserialize_response(response, crate::types::error::ServiceQuotaExceededError::SCHEMA, _cfg)
|
321 + | .and_then(|mut deser| {
|
322 + | crate::types::error::ServiceQuotaExceededError::deserialize_with_response(
|
323 + | &mut *deser,
|
324 + | response.headers(),
|
325 + | response.status().into(),
|
326 + | body,
|
327 + | )
|
328 + | }) {
|
329 + | ::std::result::Result::Ok(val) => val,
|
330 + | ::std::result::Result::Err(e) => {
|
331 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
332 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
333 + | ))
|
334 + | }
|
153 335 | };
|
154 - | crate::protocol_serde::type_erase_result(parse_result)
|
336 + | tmp.meta = generic;
|
337 + | if tmp.message.is_none() {
|
338 + | tmp.message = _error_message;
|
339 + | }
|
340 + | tmp
|
341 + | }),
|
342 + | "ValidationException" => crate::operation::start_snapshot::StartSnapshotError::ValidationError({
|
343 + | let mut tmp = match protocol
|
344 + | .deserialize_response(response, crate::types::error::ValidationError::SCHEMA, _cfg)
|
345 + | .and_then(|mut deser| {
|
346 + | crate::types::error::ValidationError::deserialize_with_response(
|
347 + | &mut *deser,
|
348 + | response.headers(),
|
349 + | response.status().into(),
|
350 + | body,
|
351 + | )
|
352 + | }) {
|
353 + | ::std::result::Result::Ok(val) => val,
|
354 + | ::std::result::Result::Err(e) => {
|
355 + | return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
|
356 + | ::aws_smithy_runtime_api::box_error::BoxError::from(e),
|
357 + | ))
|
358 + | }
|
359 + | };
|
360 + | tmp.meta = generic;
|
361 + | if tmp.message.is_none() {
|
362 + | tmp.message = _error_message;
|
363 + | }
|
364 + | tmp
|
365 + | }),
|
366 + | _ => crate::operation::start_snapshot::StartSnapshotError::generic(generic),
|
367 + | };
|
368 + | ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
|
369 + | ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
|
370 + | ))
|
371 + | } else {
|
372 + | let protocol = _cfg
|
373 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
374 + | .expect("a SharedClientProtocol is required");
|
375 + | let mut deser = protocol.deserialize_response(response, StartSnapshot::OUTPUT_SCHEMA, _cfg).map_err(|e| {
|
376 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
377 + | })?;
|
378 + | let body = response.body().bytes().expect("body loaded");
|
379 + | let output = crate::operation::start_snapshot::StartSnapshotOutput::deserialize_with_response(
|
380 + | &mut *deser,
|
381 + | response.headers(),
|
382 + | response.status().into(),
|
383 + | body,
|
384 + | )
|
385 + | .map_err(|e| {
|
386 + | ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
|
387 + | })?;
|
388 + | ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
|
389 + | }
|
155 390 | }
|
156 391 | }
|
157 392 | #[derive(Debug)]
|
158 393 | struct StartSnapshotRequestSerializer;
|
159 394 | impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for StartSnapshotRequestSerializer {
|
160 395 | #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
|
161 396 | fn serialize_input(
|
162 397 | &self,
|
163 398 | input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
|
164 399 | _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
|
165 400 | ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
|
166 401 | let input = input
|
167 402 | .downcast::<crate::operation::start_snapshot::StartSnapshotInput>()
|
168 403 | .expect("correct type");
|
169 - | let _header_serialization_settings = _cfg
|
170 - | .load::<crate::serialization_settings::HeaderSerializationSettings>()
|
171 - | .cloned()
|
172 - | .unwrap_or_default();
|
173 - | let mut request_builder = {
|
174 - | #[allow(clippy::uninlined_format_args)]
|
175 - | fn uri_base(
|
176 - | _input: &crate::operation::start_snapshot::StartSnapshotInput,
|
177 - | output: &mut ::std::string::String,
|
178 - | ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
|
179 - | use ::std::fmt::Write as _;
|
180 - | ::std::write!(output, "/snapshots").expect("formatting should succeed");
|
181 - | ::std::result::Result::Ok(())
|
182 - | }
|
183 - | #[allow(clippy::unnecessary_wraps)]
|
184 - | fn update_http_builder(
|
185 - | input: &crate::operation::start_snapshot::StartSnapshotInput,
|
186 - | builder: ::http_1x::request::Builder,
|
187 - | ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
|
188 - | let mut uri = ::std::string::String::new();
|
189 - | uri_base(input, &mut uri)?;
|
190 - | ::std::result::Result::Ok(builder.method("POST").uri(uri))
|
191 - | }
|
192 - | let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
|
193 - | builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
|
194 - | builder
|
195 - | };
|
196 - | let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_start_snapshot::ser_start_snapshot_input(&input)?);
|
197 - | if let Some(content_length) = body.content_length() {
|
198 - | let content_length = content_length.to_string();
|
199 - | request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
|
200 - | }
|
201 - | ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
|
404 + | let protocol = _cfg
|
405 + | .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
|
406 + | .expect("a SharedClientProtocol is required");
|
407 + | let mut request = protocol
|
408 + | .serialize_request(&input, StartSnapshot::INPUT_SCHEMA, "", _cfg)
|
409 + | .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
|
410 + |
|
411 + | return ::std::result::Result::Ok(request);
|
202 412 | }
|
203 413 | }
|
204 414 | #[derive(Debug)]
|
205 415 | struct StartSnapshotEndpointParamsInterceptor;
|
206 416 |
|
207 417 | impl ::aws_smithy_runtime_api::client::interceptors::Intercept for StartSnapshotEndpointParamsInterceptor {
|
208 418 | fn name(&self) -> &'static str {
|
209 419 | "StartSnapshotEndpointParamsInterceptor"
|
210 420 | }
|
211 421 |
|