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