1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CopyWorkspaceImage;
6impl CopyWorkspaceImage {
7 pub fn new() -> Self {
9 Self
10 }
11 pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::copy_workspace_image::CopyWorkspaceImageInput::SCHEMA;
13 pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> = crate::operation::copy_workspace_image::CopyWorkspaceImageOutput::SCHEMA;
15 pub(crate) async fn orchestrate(
16 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
17 input: crate::operation::copy_workspace_image::CopyWorkspaceImageInput,
18 ) -> ::std::result::Result<
19 crate::operation::copy_workspace_image::CopyWorkspaceImageOutput,
20 ::aws_smithy_runtime_api::client::result::SdkError<
21 crate::operation::copy_workspace_image::CopyWorkspaceImageError,
22 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
23 >,
24 > {
25 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
26 ::aws_smithy_runtime_api::client::interceptors::context::Error,
27 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
28 >| {
29 err.map_service_error(|err| {
30 err.downcast::<crate::operation::copy_workspace_image::CopyWorkspaceImageError>()
31 .expect("correct error type")
32 })
33 };
34 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
35 .await
36 .map_err(map_err)?;
37 let output = context.finalize().map_err(map_err)?;
38 ::std::result::Result::Ok(
39 output
40 .downcast::<crate::operation::copy_workspace_image::CopyWorkspaceImageOutput>()
41 .expect("correct output type"),
42 )
43 }
44
45 pub(crate) async fn orchestrate_with_stop_point(
46 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
47 input: crate::operation::copy_workspace_image::CopyWorkspaceImageInput,
48 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
49 ) -> ::std::result::Result<
50 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
51 ::aws_smithy_runtime_api::client::result::SdkError<
52 ::aws_smithy_runtime_api::client::interceptors::context::Error,
53 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
54 >,
55 > {
56 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
57 use ::tracing::Instrument;
58 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("WorkSpaces", "CopyWorkspaceImage", input, runtime_plugins, stop_point)
59 .instrument(::tracing::debug_span!(
62 "WorkSpaces.CopyWorkspaceImage",
63 "rpc.service" = "WorkSpaces",
64 "rpc.method" = "CopyWorkspaceImage",
65 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
66 "rpc.system" = "aws-api",
67 ))
68 .await
69 }
70
71 pub(crate) fn operation_runtime_plugins(
72 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
73 client_config: &crate::config::Config,
74 config_override: ::std::option::Option<crate::config::Builder>,
75 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
76 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
77
78 if let ::std::option::Option::Some(config_override) = config_override {
79 for plugin in config_override.runtime_plugins.iter().cloned() {
80 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
81 }
82 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
83 config_override,
84 client_config.config.clone(),
85 &client_config.runtime_components,
86 ));
87 }
88 runtime_plugins
89 }
90}
91pub(crate) mod error_registry {
100 pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
101 ::aws_smithy_schema::registry::TypeRegistry::builder()
102 .insert_error_shape(
103 crate::types::error::AccessDeniedException::SCHEMA,
104 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
105 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::AccessDeniedException::deserialize(d)?))
106 },
107 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
108 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::AccessDeniedException::deserialize(d)?))
109 },
110 )
111.insert_error_shape(
112 crate::types::error::InvalidParameterValuesException::SCHEMA,
113 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
114 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidParameterValuesException::deserialize(d)?))
115 },
116 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
117 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidParameterValuesException::deserialize(d)?))
118 },
119 )
120.insert_error_shape(
121 crate::types::error::OperationNotSupportedException::SCHEMA,
122 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
123 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::OperationNotSupportedException::deserialize(d)?))
124 },
125 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
126 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::OperationNotSupportedException::deserialize(d)?))
127 },
128 )
129.insert_error_shape(
130 crate::types::error::ResourceAlreadyExistsException::SCHEMA,
131 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
132 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceAlreadyExistsException::deserialize(d)?))
133 },
134 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
135 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceAlreadyExistsException::deserialize(d)?))
136 },
137 )
138.insert_error_shape(
139 crate::types::error::ResourceLimitExceededException::SCHEMA,
140 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
141 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceLimitExceededException::deserialize(d)?))
142 },
143 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
144 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceLimitExceededException::deserialize(d)?))
145 },
146 )
147.insert_error_shape(
148 crate::types::error::ResourceNotFoundException::SCHEMA,
149 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
150 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
151 },
152 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
153 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceNotFoundException::deserialize(d)?))
154 },
155 )
156.insert_error_shape(
157 crate::types::error::ResourceUnavailableException::SCHEMA,
158 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
159 ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::ResourceUnavailableException::deserialize(d)?))
160 },
161 |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
162 ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::ResourceUnavailableException::deserialize(d)?))
163 },
164 )
165 .build()
166 });
167}
168impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CopyWorkspaceImage {
169 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
170 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CopyWorkspaceImage");
171
172 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
173 CopyWorkspaceImageRequestSerializer,
174 ));
175 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
176 CopyWorkspaceImageResponseDeserializer,
177 ));
178
179 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
180 crate::config::auth::Params::builder()
181 .operation_name("CopyWorkspaceImage")
182 .build()
183 .expect("required fields set"),
184 ));
185
186 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
187 "CopyWorkspaceImage",
188 "WorkSpaces",
189 ));
190 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
191 signing_options.double_uri_encode = true;
192 signing_options.content_sha256_header = false;
193 signing_options.normalize_uri_path = true;
194 signing_options.payload_override = None;
195
196 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
197 signing_options,
198 ..::std::default::Default::default()
199 });
200
201 ::std::option::Option::Some(cfg.freeze())
202 }
203
204 fn runtime_components(
205 &self,
206 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
207 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
208 #[allow(unused_mut)]
209 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CopyWorkspaceImage")
210 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
211 CopyWorkspaceImageTelemetryInputCaptureInterceptor,
212 ))
213 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
214 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
215 ))
216 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
217 CopyWorkspaceImageEndpointParamsInterceptor,
218 ))
219 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
220 crate::operation::copy_workspace_image::CopyWorkspaceImageError,
221 >::new())
222 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
223 crate::operation::copy_workspace_image::CopyWorkspaceImageError,
224 >::new())
225 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
226 crate::operation::copy_workspace_image::CopyWorkspaceImageError,
227 >::new())
228 .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
229 crate::operation::copy_workspace_image::CopyWorkspaceImageError,
230 >::new());
231
232 ::std::borrow::Cow::Owned(rcb)
233 }
234}
235
236#[derive(Debug)]
237struct CopyWorkspaceImageTelemetryInputCaptureInterceptor;
238
239#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
240impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CopyWorkspaceImageTelemetryInputCaptureInterceptor {
241 fn name(&self) -> &'static str {
242 "CopyWorkspaceImageTelemetryInputCaptureInterceptor"
243 }
244
245 fn read_before_execution(
246 &self,
247 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
248 '_,
249 ::aws_smithy_runtime_api::client::interceptors::context::Input,
250 ::aws_smithy_runtime_api::client::interceptors::context::Output,
251 ::aws_smithy_runtime_api::client::interceptors::context::Error,
252 >,
253 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
254 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
255 let ::std::option::Option::Some(requested) = cfg
257 .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
258 .filter(|r| !r.is_empty())
259 else {
260 return ::std::result::Result::Ok(());
261 };
262
263 let ::std::option::Option::Some(input) = context.input().downcast_ref::<CopyWorkspaceImageInput>() else {
264 return ::std::result::Result::Ok(());
266 };
267
268 let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
269 if requested.should_capture("Name") {
270 if let ::std::option::Option::Some(value) = input.name.as_deref() {
271 captured.insert("Name", value);
272 }
273 }
274 if requested.should_capture("Description") {
275 if let ::std::option::Option::Some(value) = input.description.as_deref() {
276 captured.insert("Description", value);
277 }
278 }
279 if requested.should_capture("SourceImageId") {
280 if let ::std::option::Option::Some(value) = input.source_image_id.as_deref() {
281 captured.insert("SourceImageId", value);
282 }
283 }
284 if requested.should_capture("SourceRegion") {
285 if let ::std::option::Option::Some(value) = input.source_region.as_deref() {
286 captured.insert("SourceRegion", value);
287 }
288 }
289
290 cfg.interceptor_state().store_put(captured);
291 ::std::result::Result::Ok(())
292 }
293}
294#[derive(Debug)]
295struct CopyWorkspaceImageResponseDeserializer;
296impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CopyWorkspaceImageResponseDeserializer {
297 fn deserialize_nonstreaming_with_config(
298 &self,
299 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
300 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
301 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
302 let (success, status) = (response.status().is_success(), response.status().as_u16());
303 #[allow(unused_variables)]
308 let body = response.body().bytes().expect("body loaded");
309 let headers = response.headers();
310 #[allow(unused_mut)]
311 let mut force_error = false;
312 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
313 if !success && status != 200 || force_error {
314 let protocol = _cfg
315 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
316 .expect("a SharedClientProtocol is required");
317 #[allow(unused_mut)]
318 let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
319 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
320 })?;
321 generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
322 let generic = generic_builder.build();
323 let error_code = match generic.code() {
324 ::std::option::Option::Some(code) => code,
325 ::std::option::Option::None => {
326 return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
327 ::aws_smithy_runtime_api::box_error::BoxError::from(
328 crate::operation::copy_workspace_image::CopyWorkspaceImageError::unhandled(generic),
329 ),
330 ))
331 }
332 };
333 let _error_message = generic.message().map(|msg| msg.to_owned());
334 let err = match error_code {
335 "AccessDeniedException" => crate::operation::copy_workspace_image::CopyWorkspaceImageError::AccessDeniedException({
336 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
337 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
338 e,
339 ))
340 })?;
341 let mut tmp = <crate::types::error::builders::AccessDeniedExceptionBuilder>::default();
342 tmp.deserialize_members(&mut *deser).map_err(|e| {
343 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
344 e,
345 ))
346 })?;
347 if tmp.message.is_none() {
348 tmp.message = _error_message;
349 }
350 let tmp = tmp.meta(generic);
351 tmp.build()
352 }),
353 "InvalidParameterValuesException" => {
354 crate::operation::copy_workspace_image::CopyWorkspaceImageError::InvalidParameterValuesException({
355 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
356 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
357 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
358 )
359 })?;
360 let mut tmp = <crate::types::error::builders::InvalidParameterValuesExceptionBuilder>::default();
361 tmp.deserialize_members(&mut *deser).map_err(|e| {
362 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
363 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
364 )
365 })?;
366 if tmp.message.is_none() {
367 tmp.message = _error_message;
368 }
369 let tmp = tmp.meta(generic);
370 tmp.build()
371 })
372 }
373 "OperationNotSupportedException" => {
374 crate::operation::copy_workspace_image::CopyWorkspaceImageError::OperationNotSupportedException({
375 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
376 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
377 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
378 )
379 })?;
380 let mut tmp = <crate::types::error::builders::OperationNotSupportedExceptionBuilder>::default();
381 tmp.deserialize_members(&mut *deser).map_err(|e| {
382 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
383 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
384 )
385 })?;
386 if tmp.message.is_none() {
387 tmp.message = _error_message;
388 }
389 let tmp = tmp.meta(generic);
390 tmp.build()
391 })
392 }
393 "ResourceAlreadyExistsException" => {
394 crate::operation::copy_workspace_image::CopyWorkspaceImageError::ResourceAlreadyExistsException({
395 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
396 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
397 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
398 )
399 })?;
400 let mut tmp = <crate::types::error::builders::ResourceAlreadyExistsExceptionBuilder>::default();
401 tmp.deserialize_members(&mut *deser).map_err(|e| {
402 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
403 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
404 )
405 })?;
406 if tmp.message.is_none() {
407 tmp.message = _error_message;
408 }
409 let tmp = tmp.meta(generic);
410 tmp.build()
411 })
412 }
413 "ResourceLimitExceededException" => {
414 crate::operation::copy_workspace_image::CopyWorkspaceImageError::ResourceLimitExceededException({
415 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
416 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
417 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
418 )
419 })?;
420 let mut tmp = <crate::types::error::builders::ResourceLimitExceededExceptionBuilder>::default();
421 tmp.deserialize_members(&mut *deser).map_err(|e| {
422 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
423 ::aws_smithy_runtime_api::box_error::BoxError::from(e),
424 )
425 })?;
426 if tmp.message.is_none() {
427 tmp.message = _error_message;
428 }
429 let tmp = tmp.meta(generic);
430 tmp.build()
431 })
432 }
433 "ResourceNotFoundException" => crate::operation::copy_workspace_image::CopyWorkspaceImageError::ResourceNotFoundException({
434 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
435 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
436 e,
437 ))
438 })?;
439 let mut tmp = <crate::types::error::builders::ResourceNotFoundExceptionBuilder>::default();
440 tmp.deserialize_members(&mut *deser).map_err(|e| {
441 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
442 e,
443 ))
444 })?;
445 if tmp.message.is_none() {
446 tmp.message = _error_message;
447 }
448 let tmp = tmp.meta(generic);
449 tmp.build()
450 }),
451 "ResourceUnavailableException" => crate::operation::copy_workspace_image::CopyWorkspaceImageError::ResourceUnavailableException({
452 let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
453 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
454 e,
455 ))
456 })?;
457 let mut tmp = <crate::types::error::builders::ResourceUnavailableExceptionBuilder>::default();
458 tmp.deserialize_members(&mut *deser).map_err(|e| {
459 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
460 e,
461 ))
462 })?;
463 if tmp.message.is_none() {
464 tmp.message = _error_message;
465 }
466 let tmp = tmp.meta(generic);
467 tmp.build()
468 }),
469 _ => {
470 match protocol
478 .deserialize_error_response(response, _cfg)
479 .ok()
480 .and_then(|mut deser| {
481 ::aws_smithy_schema::registry::reify_error(
482 crate::operation::copy_workspace_image::error_registry::REGISTRY
483 .or(&crate::error_type_registry::REGISTRY),
484 error_code,
485 &mut *deser,
486 )
487 }) {
488 ::std::option::Option::Some(source) => <crate::operation::copy_workspace_image::CopyWorkspaceImageError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
489 ::std::option::Option::None => crate::operation::copy_workspace_image::CopyWorkspaceImageError::generic(generic),
490 }
491 }
492 };
493 ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
494 ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
495 ))
496 } else {
497 let protocol = _cfg
498 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
499 .expect("a SharedClientProtocol is required");
500 let mut deser = protocol
501 .deserialize_response(response, CopyWorkspaceImage::OUTPUT_SCHEMA, _cfg)
502 .map_err(|e| {
503 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
504 })?;
505 let _response_headers = headers;
509 #[allow(unused_mut)]
513 let mut output = <crate::operation::copy_workspace_image::builders::CopyWorkspaceImageOutputBuilder>::default();
514 output.deserialize_members(&mut *deser).map_err(|e| {
515 ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
516 })?;
517 output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
518 let output = output.build();
519 ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
520 }
521 }
522}
523#[derive(Debug)]
524struct CopyWorkspaceImageRequestSerializer;
525impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CopyWorkspaceImageRequestSerializer {
526 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
527 fn serialize_input(
528 &self,
529 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
530 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
531 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
532 let input = input
533 .downcast::<crate::operation::copy_workspace_image::CopyWorkspaceImageInput>()
534 .expect("correct type");
535
536 let protocol = _cfg
537 .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
538 .expect("a SharedClientProtocol is required");
539 let mut request = protocol
540 .serialize_request(&input, CopyWorkspaceImage::INPUT_SCHEMA, "/", _cfg)
541 .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
542
543 return ::std::result::Result::Ok(request);
544 }
545}
546#[derive(Debug)]
547struct CopyWorkspaceImageEndpointParamsInterceptor;
548
549#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
550impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CopyWorkspaceImageEndpointParamsInterceptor {
551 fn name(&self) -> &'static str {
552 "CopyWorkspaceImageEndpointParamsInterceptor"
553 }
554
555 fn read_before_execution(
556 &self,
557 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
558 '_,
559 ::aws_smithy_runtime_api::client::interceptors::context::Input,
560 ::aws_smithy_runtime_api::client::interceptors::context::Output,
561 ::aws_smithy_runtime_api::client::interceptors::context::Error,
562 >,
563 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
564 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
565 let _input = context
566 .input()
567 .downcast_ref::<CopyWorkspaceImageInput>()
568 .ok_or("failed to downcast to CopyWorkspaceImageInput")?;
569
570 let params = crate::config::endpoint::Params::builder()
571 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
572 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
573 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
574 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
575 .build()
576 .map_err(|err| {
577 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
578 })?;
579 cfg.interceptor_state()
580 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
581 ::std::result::Result::Ok(())
582 }
583}
584
585#[non_exhaustive]
590#[derive(::std::fmt::Debug)]
591pub enum CopyWorkspaceImageError {
592 AccessDeniedException(crate::types::error::AccessDeniedException),
594 InvalidParameterValuesException(crate::types::error::InvalidParameterValuesException),
596 OperationNotSupportedException(crate::types::error::OperationNotSupportedException),
598 ResourceAlreadyExistsException(crate::types::error::ResourceAlreadyExistsException),
600 ResourceLimitExceededException(crate::types::error::ResourceLimitExceededException),
602 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
604 ResourceUnavailableException(crate::types::error::ResourceUnavailableException),
606 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
608 variable wildcard pattern and check `.code()`:
609 \
610 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
611 \
612 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CopyWorkspaceImageError) for what information is available for the error.")]
613 Unhandled(crate::error::sealed_unhandled::Unhandled),
614}
615impl CopyWorkspaceImageError {
616 pub fn unhandled(
618 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
619 ) -> Self {
620 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
621 source: err.into(),
622 meta: ::std::default::Default::default(),
623 })
624 }
625
626 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
628 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
629 source: err.clone().into(),
630 meta: err,
631 })
632 }
633 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
638 match self {
639 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
640 Self::InvalidParameterValuesException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
641 Self::OperationNotSupportedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
642 Self::ResourceAlreadyExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
643 Self::ResourceLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
644 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
645 Self::ResourceUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
646 Self::Unhandled(e) => &e.meta,
647 }
648 }
649 pub fn is_access_denied_exception(&self) -> bool {
651 matches!(self, Self::AccessDeniedException(_))
652 }
653 pub fn is_invalid_parameter_values_exception(&self) -> bool {
655 matches!(self, Self::InvalidParameterValuesException(_))
656 }
657 pub fn is_operation_not_supported_exception(&self) -> bool {
659 matches!(self, Self::OperationNotSupportedException(_))
660 }
661 pub fn is_resource_already_exists_exception(&self) -> bool {
663 matches!(self, Self::ResourceAlreadyExistsException(_))
664 }
665 pub fn is_resource_limit_exceeded_exception(&self) -> bool {
667 matches!(self, Self::ResourceLimitExceededException(_))
668 }
669 pub fn is_resource_not_found_exception(&self) -> bool {
671 matches!(self, Self::ResourceNotFoundException(_))
672 }
673 pub fn is_resource_unavailable_exception(&self) -> bool {
675 matches!(self, Self::ResourceUnavailableException(_))
676 }
677}
678impl ::std::error::Error for CopyWorkspaceImageError {
679 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
680 match self {
681 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
682 Self::InvalidParameterValuesException(_inner) => ::std::option::Option::Some(_inner),
683 Self::OperationNotSupportedException(_inner) => ::std::option::Option::Some(_inner),
684 Self::ResourceAlreadyExistsException(_inner) => ::std::option::Option::Some(_inner),
685 Self::ResourceLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
686 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
687 Self::ResourceUnavailableException(_inner) => ::std::option::Option::Some(_inner),
688 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
689 }
690 }
691}
692impl ::std::fmt::Display for CopyWorkspaceImageError {
693 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
694 match self {
695 Self::AccessDeniedException(_inner) => _inner.fmt(f),
696 Self::InvalidParameterValuesException(_inner) => _inner.fmt(f),
697 Self::OperationNotSupportedException(_inner) => _inner.fmt(f),
698 Self::ResourceAlreadyExistsException(_inner) => _inner.fmt(f),
699 Self::ResourceLimitExceededException(_inner) => _inner.fmt(f),
700 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
701 Self::ResourceUnavailableException(_inner) => _inner.fmt(f),
702 Self::Unhandled(_inner) => {
703 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
704 write!(f, "unhandled error ({code})")
705 } else {
706 f.write_str("unhandled error")
707 }
708 }
709 }
710 }
711}
712impl ::aws_smithy_types::retry::ProvideErrorKind for CopyWorkspaceImageError {
713 fn code(&self) -> ::std::option::Option<&str> {
714 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
715 }
716 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
717 ::std::option::Option::None
718 }
719}
720impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CopyWorkspaceImageError {
721 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
722 match self {
723 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
724 Self::InvalidParameterValuesException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
725 Self::OperationNotSupportedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
726 Self::ResourceAlreadyExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
727 Self::ResourceLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
728 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
729 Self::ResourceUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
730 Self::Unhandled(_inner) => &_inner.meta,
731 }
732 }
733}
734impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CopyWorkspaceImageError {
735 fn create_unhandled_error(
736 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
737 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
738 ) -> Self {
739 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
740 source,
741 meta: meta.unwrap_or_default(),
742 })
743 }
744}
745impl ::aws_types::request_id::RequestId for crate::operation::copy_workspace_image::CopyWorkspaceImageError {
746 fn request_id(&self) -> Option<&str> {
747 self.meta().request_id()
748 }
749}
750
751pub use crate::operation::copy_workspace_image::_copy_workspace_image_input::CopyWorkspaceImageInput;
752
753pub use crate::operation::copy_workspace_image::_copy_workspace_image_output::CopyWorkspaceImageOutput;
754
755mod _copy_workspace_image_input;
756
757mod _copy_workspace_image_output;
758
759pub mod builders;