aws_sdk_cloudcontrol/operation/
create_resource.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `CreateResource`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateResource;
6impl CreateResource {
7    /// Creates a new `CreateResource`
8    pub fn new() -> Self {
9        Self
10    }
11    pub(crate) async fn orchestrate(
12        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
13        input: crate::operation::create_resource::CreateResourceInput,
14    ) -> ::std::result::Result<
15        crate::operation::create_resource::CreateResourceOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::create_resource::CreateResourceError,
18            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19        >,
20    > {
21        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22            ::aws_smithy_runtime_api::client::interceptors::context::Error,
23            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24        >| {
25            err.map_service_error(|err| {
26                err.downcast::<crate::operation::create_resource::CreateResourceError>()
27                    .expect("correct error type")
28            })
29        };
30        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31            .await
32            .map_err(map_err)?;
33        let output = context.finalize().map_err(map_err)?;
34        ::std::result::Result::Ok(
35            output
36                .downcast::<crate::operation::create_resource::CreateResourceOutput>()
37                .expect("correct output type"),
38        )
39    }
40
41    pub(crate) async fn orchestrate_with_stop_point(
42        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43        input: crate::operation::create_resource::CreateResourceInput,
44        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45    ) -> ::std::result::Result<
46        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47        ::aws_smithy_runtime_api::client::result::SdkError<
48            ::aws_smithy_runtime_api::client::interceptors::context::Error,
49            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50        >,
51    > {
52        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("cloudcontrol", "CreateResource", input, runtime_plugins, stop_point).await
54    }
55
56    pub(crate) fn operation_runtime_plugins(
57        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
58        client_config: &crate::config::Config,
59        config_override: ::std::option::Option<crate::config::Builder>,
60    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
61        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
62        runtime_plugins = runtime_plugins
63            .with_operation_plugin(crate::client_idempotency_token::IdempotencyTokenRuntimePlugin::new(
64                |token_provider, input| {
65                    let input: &mut crate::operation::create_resource::CreateResourceInput = input.downcast_mut().expect("correct type");
66                    if input.client_token.is_none() {
67                        input.client_token = ::std::option::Option::Some(token_provider.make_idempotency_token());
68                    }
69                },
70            ))
71            .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![
72                ::aws_runtime::auth::sigv4::SCHEME_ID,
73            ]));
74        if let ::std::option::Option::Some(config_override) = config_override {
75            for plugin in config_override.runtime_plugins.iter().cloned() {
76                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
77            }
78            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
79                config_override,
80                client_config.config.clone(),
81                &client_config.runtime_components,
82            ));
83        }
84        runtime_plugins
85    }
86}
87impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateResource {
88    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateResource");
90
91        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92            CreateResourceRequestSerializer,
93        ));
94        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95            CreateResourceResponseDeserializer,
96        ));
97
98        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99            ::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new(),
100        ));
101
102        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
103        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
104            "CreateResource",
105            "cloudcontrol",
106        ));
107        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
108        signing_options.double_uri_encode = true;
109        signing_options.content_sha256_header = false;
110        signing_options.normalize_uri_path = true;
111        signing_options.payload_override = None;
112
113        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
114            signing_options,
115            ..::std::default::Default::default()
116        });
117
118        ::std::option::Option::Some(cfg.freeze())
119    }
120
121    fn runtime_components(
122        &self,
123        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
124    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
125        #[allow(unused_mut)]
126        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateResource")
127            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
128            .with_interceptor(CreateResourceEndpointParamsInterceptor)
129            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
130                crate::operation::create_resource::CreateResourceError,
131            >::new())
132            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
133                crate::operation::create_resource::CreateResourceError,
134            >::new())
135            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
136                crate::operation::create_resource::CreateResourceError,
137            >::new());
138
139        ::std::borrow::Cow::Owned(rcb)
140    }
141}
142
143#[derive(Debug)]
144struct CreateResourceResponseDeserializer;
145impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateResourceResponseDeserializer {
146    fn deserialize_nonstreaming(
147        &self,
148        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
149    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
150        let (success, status) = (response.status().is_success(), response.status().as_u16());
151        let headers = response.headers();
152        let body = response.body().bytes().expect("body loaded");
153        #[allow(unused_mut)]
154        let mut force_error = false;
155        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
156        let parse_result = if !success && status != 200 || force_error {
157            crate::protocol_serde::shape_create_resource::de_create_resource_http_error(status, headers, body)
158        } else {
159            crate::protocol_serde::shape_create_resource::de_create_resource_http_response(status, headers, body)
160        };
161        crate::protocol_serde::type_erase_result(parse_result)
162    }
163}
164#[derive(Debug)]
165struct CreateResourceRequestSerializer;
166impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateResourceRequestSerializer {
167    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
168    fn serialize_input(
169        &self,
170        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
171        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
172    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
173        let input = input
174            .downcast::<crate::operation::create_resource::CreateResourceInput>()
175            .expect("correct type");
176        let _header_serialization_settings = _cfg
177            .load::<crate::serialization_settings::HeaderSerializationSettings>()
178            .cloned()
179            .unwrap_or_default();
180        let mut request_builder = {
181            fn uri_base(
182                _input: &crate::operation::create_resource::CreateResourceInput,
183                output: &mut ::std::string::String,
184            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
185                use ::std::fmt::Write as _;
186                ::std::write!(output, "/").expect("formatting should succeed");
187                ::std::result::Result::Ok(())
188            }
189            #[allow(clippy::unnecessary_wraps)]
190            fn update_http_builder(
191                input: &crate::operation::create_resource::CreateResourceInput,
192                builder: ::http::request::Builder,
193            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
194                let mut uri = ::std::string::String::new();
195                uri_base(input, &mut uri)?;
196                ::std::result::Result::Ok(builder.method("POST").uri(uri))
197            }
198            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
199            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.0");
200            builder = _header_serialization_settings.set_default_header(
201                builder,
202                ::http::header::HeaderName::from_static("x-amz-target"),
203                "CloudApiService.CreateResource",
204            );
205            builder
206        };
207        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_resource::ser_create_resource_input(&input)?);
208        if let Some(content_length) = body.content_length() {
209            let content_length = content_length.to_string();
210            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
211        }
212        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
213    }
214}
215#[derive(Debug)]
216struct CreateResourceEndpointParamsInterceptor;
217
218impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateResourceEndpointParamsInterceptor {
219    fn name(&self) -> &'static str {
220        "CreateResourceEndpointParamsInterceptor"
221    }
222
223    fn read_before_execution(
224        &self,
225        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
226            '_,
227            ::aws_smithy_runtime_api::client::interceptors::context::Input,
228            ::aws_smithy_runtime_api::client::interceptors::context::Output,
229            ::aws_smithy_runtime_api::client::interceptors::context::Error,
230        >,
231        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
232    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
233        let _input = context
234            .input()
235            .downcast_ref::<CreateResourceInput>()
236            .ok_or("failed to downcast to CreateResourceInput")?;
237
238        let params = crate::config::endpoint::Params::builder()
239            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
240            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
241            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
242            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
243            .build()
244            .map_err(|err| {
245                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
246            })?;
247        cfg.interceptor_state()
248            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
249        ::std::result::Result::Ok(())
250    }
251}
252
253// The get_* functions below are generated from JMESPath expressions in the
254// operationContextParams trait. They target the operation's input shape.
255
256/// Error type for the `CreateResourceError` operation.
257#[non_exhaustive]
258#[derive(::std::fmt::Debug)]
259pub enum CreateResourceError {
260    /// <p>The resource with the name requested already exists.</p>
261    AlreadyExistsException(crate::types::error::AlreadyExistsException),
262    /// <p>The specified client token has already been used in another resource request.</p>
263    /// <p>It's best practice for client tokens to be unique for each resource operation request. However, client token expire after 36 hours.</p>
264    ClientTokenConflictException(crate::types::error::ClientTokenConflictException),
265    /// <p>Another resource operation is currently being performed on this resource.</p>
266    ConcurrentOperationException(crate::types::error::ConcurrentOperationException),
267    /// <p>The resource handler has returned that the downstream service generated an error that doesn't map to any other handler error code.</p>
268    GeneralServiceException(crate::types::error::GeneralServiceException),
269    /// <p>The resource handler has failed without a returning a more specific error code. This can include timeouts.</p>
270    HandlerFailureException(crate::types::error::HandlerFailureException),
271    /// <p>The resource handler has returned that an unexpected error occurred within the resource handler.</p>
272    HandlerInternalFailureException(crate::types::error::HandlerInternalFailureException),
273    /// <p>The resource handler has returned that the credentials provided by the user are invalid.</p>
274    InvalidCredentialsException(crate::types::error::InvalidCredentialsException),
275    /// <p>The resource handler has returned that invalid input from the user has generated a generic exception.</p>
276    InvalidRequestException(crate::types::error::InvalidRequestException),
277    /// <p>The resource handler has returned that the request couldn't be completed due to networking issues, such as a failure to receive a response from the server.</p>
278    NetworkFailureException(crate::types::error::NetworkFailureException),
279    /// <p>The resource handler has returned that the downstream resource failed to complete all of its ready-state checks.</p>
280    NotStabilizedException(crate::types::error::NotStabilizedException),
281    /// <p>One or more properties included in this resource operation are defined as create-only, and therefore can't be updated.</p>
282    NotUpdatableException(crate::types::error::NotUpdatableException),
283    /// <p>Cloud Control API hasn't received a valid response from the resource handler, due to a configuration error. This includes issues such as the resource handler returning an invalid response, or timing out.</p>
284    PrivateTypeException(crate::types::error::PrivateTypeException),
285    /// <p>The resource is temporarily unavailable to be acted upon. For example, if the resource is currently undergoing an operation and can't be acted upon until that operation is finished.</p>
286    ResourceConflictException(crate::types::error::ResourceConflictException),
287    /// <p>A resource with the specified identifier can't be found.</p>
288    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
289    /// <p>The resource handler has returned that the downstream service returned an internal error, typically with a <code>5XX HTTP</code> status code.</p>
290    ServiceInternalErrorException(crate::types::error::ServiceInternalErrorException),
291    /// <p>The resource handler has returned that a non-transient resource limit was reached on the service side.</p>
292    ServiceLimitExceededException(crate::types::error::ServiceLimitExceededException),
293    /// <p>The request was denied due to request throttling.</p>
294    ThrottlingException(crate::types::error::ThrottlingException),
295    /// <p>The specified extension doesn't exist in the CloudFormation registry.</p>
296    TypeNotFoundException(crate::types::error::TypeNotFoundException),
297    /// <p>The specified resource doesn't support this resource operation.</p>
298    UnsupportedActionException(crate::types::error::UnsupportedActionException),
299    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
300    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
301    variable wildcard pattern and check `.code()`:
302     \
303    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
304     \
305    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateResourceError) for what information is available for the error.")]
306    Unhandled(crate::error::sealed_unhandled::Unhandled),
307}
308impl CreateResourceError {
309    /// Creates the `CreateResourceError::Unhandled` variant from any error type.
310    pub fn unhandled(
311        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
312    ) -> Self {
313        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
314            source: err.into(),
315            meta: ::std::default::Default::default(),
316        })
317    }
318
319    /// Creates the `CreateResourceError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
320    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
321        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
322            source: err.clone().into(),
323            meta: err,
324        })
325    }
326    ///
327    /// Returns error metadata, which includes the error code, message,
328    /// request ID, and potentially additional information.
329    ///
330    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
331        match self {
332            Self::AlreadyExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
333            Self::ClientTokenConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
334            Self::ConcurrentOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
335            Self::GeneralServiceException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
336            Self::HandlerFailureException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
337            Self::HandlerInternalFailureException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
338            Self::InvalidCredentialsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
339            Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
340            Self::NetworkFailureException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
341            Self::NotStabilizedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
342            Self::NotUpdatableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
343            Self::PrivateTypeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
344            Self::ResourceConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
345            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
346            Self::ServiceInternalErrorException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
347            Self::ServiceLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
348            Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
349            Self::TypeNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
350            Self::UnsupportedActionException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
351            Self::Unhandled(e) => &e.meta,
352        }
353    }
354    /// Returns `true` if the error kind is `CreateResourceError::AlreadyExistsException`.
355    pub fn is_already_exists_exception(&self) -> bool {
356        matches!(self, Self::AlreadyExistsException(_))
357    }
358    /// Returns `true` if the error kind is `CreateResourceError::ClientTokenConflictException`.
359    pub fn is_client_token_conflict_exception(&self) -> bool {
360        matches!(self, Self::ClientTokenConflictException(_))
361    }
362    /// Returns `true` if the error kind is `CreateResourceError::ConcurrentOperationException`.
363    pub fn is_concurrent_operation_exception(&self) -> bool {
364        matches!(self, Self::ConcurrentOperationException(_))
365    }
366    /// Returns `true` if the error kind is `CreateResourceError::GeneralServiceException`.
367    pub fn is_general_service_exception(&self) -> bool {
368        matches!(self, Self::GeneralServiceException(_))
369    }
370    /// Returns `true` if the error kind is `CreateResourceError::HandlerFailureException`.
371    pub fn is_handler_failure_exception(&self) -> bool {
372        matches!(self, Self::HandlerFailureException(_))
373    }
374    /// Returns `true` if the error kind is `CreateResourceError::HandlerInternalFailureException`.
375    pub fn is_handler_internal_failure_exception(&self) -> bool {
376        matches!(self, Self::HandlerInternalFailureException(_))
377    }
378    /// Returns `true` if the error kind is `CreateResourceError::InvalidCredentialsException`.
379    pub fn is_invalid_credentials_exception(&self) -> bool {
380        matches!(self, Self::InvalidCredentialsException(_))
381    }
382    /// Returns `true` if the error kind is `CreateResourceError::InvalidRequestException`.
383    pub fn is_invalid_request_exception(&self) -> bool {
384        matches!(self, Self::InvalidRequestException(_))
385    }
386    /// Returns `true` if the error kind is `CreateResourceError::NetworkFailureException`.
387    pub fn is_network_failure_exception(&self) -> bool {
388        matches!(self, Self::NetworkFailureException(_))
389    }
390    /// Returns `true` if the error kind is `CreateResourceError::NotStabilizedException`.
391    pub fn is_not_stabilized_exception(&self) -> bool {
392        matches!(self, Self::NotStabilizedException(_))
393    }
394    /// Returns `true` if the error kind is `CreateResourceError::NotUpdatableException`.
395    pub fn is_not_updatable_exception(&self) -> bool {
396        matches!(self, Self::NotUpdatableException(_))
397    }
398    /// Returns `true` if the error kind is `CreateResourceError::PrivateTypeException`.
399    pub fn is_private_type_exception(&self) -> bool {
400        matches!(self, Self::PrivateTypeException(_))
401    }
402    /// Returns `true` if the error kind is `CreateResourceError::ResourceConflictException`.
403    pub fn is_resource_conflict_exception(&self) -> bool {
404        matches!(self, Self::ResourceConflictException(_))
405    }
406    /// Returns `true` if the error kind is `CreateResourceError::ResourceNotFoundException`.
407    pub fn is_resource_not_found_exception(&self) -> bool {
408        matches!(self, Self::ResourceNotFoundException(_))
409    }
410    /// Returns `true` if the error kind is `CreateResourceError::ServiceInternalErrorException`.
411    pub fn is_service_internal_error_exception(&self) -> bool {
412        matches!(self, Self::ServiceInternalErrorException(_))
413    }
414    /// Returns `true` if the error kind is `CreateResourceError::ServiceLimitExceededException`.
415    pub fn is_service_limit_exceeded_exception(&self) -> bool {
416        matches!(self, Self::ServiceLimitExceededException(_))
417    }
418    /// Returns `true` if the error kind is `CreateResourceError::ThrottlingException`.
419    pub fn is_throttling_exception(&self) -> bool {
420        matches!(self, Self::ThrottlingException(_))
421    }
422    /// Returns `true` if the error kind is `CreateResourceError::TypeNotFoundException`.
423    pub fn is_type_not_found_exception(&self) -> bool {
424        matches!(self, Self::TypeNotFoundException(_))
425    }
426    /// Returns `true` if the error kind is `CreateResourceError::UnsupportedActionException`.
427    pub fn is_unsupported_action_exception(&self) -> bool {
428        matches!(self, Self::UnsupportedActionException(_))
429    }
430}
431impl ::std::error::Error for CreateResourceError {
432    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
433        match self {
434            Self::AlreadyExistsException(_inner) => ::std::option::Option::Some(_inner),
435            Self::ClientTokenConflictException(_inner) => ::std::option::Option::Some(_inner),
436            Self::ConcurrentOperationException(_inner) => ::std::option::Option::Some(_inner),
437            Self::GeneralServiceException(_inner) => ::std::option::Option::Some(_inner),
438            Self::HandlerFailureException(_inner) => ::std::option::Option::Some(_inner),
439            Self::HandlerInternalFailureException(_inner) => ::std::option::Option::Some(_inner),
440            Self::InvalidCredentialsException(_inner) => ::std::option::Option::Some(_inner),
441            Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
442            Self::NetworkFailureException(_inner) => ::std::option::Option::Some(_inner),
443            Self::NotStabilizedException(_inner) => ::std::option::Option::Some(_inner),
444            Self::NotUpdatableException(_inner) => ::std::option::Option::Some(_inner),
445            Self::PrivateTypeException(_inner) => ::std::option::Option::Some(_inner),
446            Self::ResourceConflictException(_inner) => ::std::option::Option::Some(_inner),
447            Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
448            Self::ServiceInternalErrorException(_inner) => ::std::option::Option::Some(_inner),
449            Self::ServiceLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
450            Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
451            Self::TypeNotFoundException(_inner) => ::std::option::Option::Some(_inner),
452            Self::UnsupportedActionException(_inner) => ::std::option::Option::Some(_inner),
453            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
454        }
455    }
456}
457impl ::std::fmt::Display for CreateResourceError {
458    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
459        match self {
460            Self::AlreadyExistsException(_inner) => _inner.fmt(f),
461            Self::ClientTokenConflictException(_inner) => _inner.fmt(f),
462            Self::ConcurrentOperationException(_inner) => _inner.fmt(f),
463            Self::GeneralServiceException(_inner) => _inner.fmt(f),
464            Self::HandlerFailureException(_inner) => _inner.fmt(f),
465            Self::HandlerInternalFailureException(_inner) => _inner.fmt(f),
466            Self::InvalidCredentialsException(_inner) => _inner.fmt(f),
467            Self::InvalidRequestException(_inner) => _inner.fmt(f),
468            Self::NetworkFailureException(_inner) => _inner.fmt(f),
469            Self::NotStabilizedException(_inner) => _inner.fmt(f),
470            Self::NotUpdatableException(_inner) => _inner.fmt(f),
471            Self::PrivateTypeException(_inner) => _inner.fmt(f),
472            Self::ResourceConflictException(_inner) => _inner.fmt(f),
473            Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
474            Self::ServiceInternalErrorException(_inner) => _inner.fmt(f),
475            Self::ServiceLimitExceededException(_inner) => _inner.fmt(f),
476            Self::ThrottlingException(_inner) => _inner.fmt(f),
477            Self::TypeNotFoundException(_inner) => _inner.fmt(f),
478            Self::UnsupportedActionException(_inner) => _inner.fmt(f),
479            Self::Unhandled(_inner) => {
480                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
481                    write!(f, "unhandled error ({code})")
482                } else {
483                    f.write_str("unhandled error")
484                }
485            }
486        }
487    }
488}
489impl ::aws_smithy_types::retry::ProvideErrorKind for CreateResourceError {
490    fn code(&self) -> ::std::option::Option<&str> {
491        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
492    }
493    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
494        ::std::option::Option::None
495    }
496}
497impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateResourceError {
498    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
499        match self {
500            Self::AlreadyExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
501            Self::ClientTokenConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
502            Self::ConcurrentOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
503            Self::GeneralServiceException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
504            Self::HandlerFailureException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
505            Self::HandlerInternalFailureException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
506            Self::InvalidCredentialsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
507            Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
508            Self::NetworkFailureException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
509            Self::NotStabilizedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
510            Self::NotUpdatableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
511            Self::PrivateTypeException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
512            Self::ResourceConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
513            Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
514            Self::ServiceInternalErrorException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
515            Self::ServiceLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
516            Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
517            Self::TypeNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
518            Self::UnsupportedActionException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
519            Self::Unhandled(_inner) => &_inner.meta,
520        }
521    }
522}
523impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateResourceError {
524    fn create_unhandled_error(
525        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
526        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
527    ) -> Self {
528        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
529            source,
530            meta: meta.unwrap_or_default(),
531        })
532    }
533}
534impl ::aws_types::request_id::RequestId for crate::operation::create_resource::CreateResourceError {
535    fn request_id(&self) -> Option<&str> {
536        self.meta().request_id()
537    }
538}
539
540pub use crate::operation::create_resource::_create_resource_output::CreateResourceOutput;
541
542pub use crate::operation::create_resource::_create_resource_input::CreateResourceInput;
543
544mod _create_resource_input;
545
546mod _create_resource_output;
547
548/// Builders
549pub mod builders;