Skip to main content

aws_sdk_imagebuilder/operation/
create_container_recipe.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `CreateContainerRecipe`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateContainerRecipe;
6impl CreateContainerRecipe {
7    /// Creates a new `CreateContainerRecipe`
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_container_recipe::CreateContainerRecipeInput,
14    ) -> ::std::result::Result<
15        crate::operation::create_container_recipe::CreateContainerRecipeOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::create_container_recipe::CreateContainerRecipeError,
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_container_recipe::CreateContainerRecipeError>()
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_container_recipe::CreateContainerRecipeOutput>()
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_container_recipe::CreateContainerRecipeInput,
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        use ::tracing::Instrument;
54        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point(
55            "imagebuilder",
56            "CreateContainerRecipe",
57            input,
58            runtime_plugins,
59            stop_point,
60        )
61        // Create a parent span for the entire operation. Includes a random, internal-only,
62        // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
63        .instrument(::tracing::debug_span!(
64            "imagebuilder.CreateContainerRecipe",
65            "rpc.service" = "imagebuilder",
66            "rpc.method" = "CreateContainerRecipe",
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        runtime_plugins = runtime_plugins.with_operation_plugin(crate::client_idempotency_token::IdempotencyTokenRuntimePlugin::new(
80            |token_provider, input| {
81                let input: &mut crate::operation::create_container_recipe::CreateContainerRecipeInput = input.downcast_mut().expect("correct type");
82                if input.client_token.is_none() {
83                    input.client_token = ::std::option::Option::Some(token_provider.make_idempotency_token());
84                }
85            },
86        ));
87        if let ::std::option::Option::Some(config_override) = config_override {
88            for plugin in config_override.runtime_plugins.iter().cloned() {
89                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
90            }
91            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
92                config_override,
93                client_config.config.clone(),
94                &client_config.runtime_components,
95            ));
96        }
97        runtime_plugins
98    }
99}
100impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateContainerRecipe {
101    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
102        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateContainerRecipe");
103
104        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
105            CreateContainerRecipeRequestSerializer,
106        ));
107        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
108            CreateContainerRecipeResponseDeserializer,
109        ));
110
111        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
112            crate::config::auth::Params::builder()
113                .operation_name("CreateContainerRecipe")
114                .build()
115                .expect("required fields set"),
116        ));
117
118        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
119            "CreateContainerRecipe",
120            "imagebuilder",
121        ));
122        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
123        signing_options.double_uri_encode = true;
124        signing_options.content_sha256_header = false;
125        signing_options.normalize_uri_path = true;
126        signing_options.payload_override = None;
127
128        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
129            signing_options,
130            ..::std::default::Default::default()
131        });
132
133        ::std::option::Option::Some(cfg.freeze())
134    }
135
136    fn runtime_components(
137        &self,
138        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
139    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
140        #[allow(unused_mut)]
141        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateContainerRecipe")
142            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
143                CreateContainerRecipeTelemetryInputCaptureInterceptor,
144            ))
145            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
146                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
147            ))
148            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
149                CreateContainerRecipeEndpointParamsInterceptor,
150            ))
151            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
152                crate::operation::create_container_recipe::CreateContainerRecipeError,
153            >::new())
154            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
155                crate::operation::create_container_recipe::CreateContainerRecipeError,
156            >::new())
157            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
158                crate::operation::create_container_recipe::CreateContainerRecipeError,
159            >::new());
160
161        ::std::borrow::Cow::Owned(rcb)
162    }
163}
164
165#[derive(Debug)]
166struct CreateContainerRecipeTelemetryInputCaptureInterceptor;
167
168#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
169impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateContainerRecipeTelemetryInputCaptureInterceptor {
170    fn name(&self) -> &'static str {
171        "CreateContainerRecipeTelemetryInputCaptureInterceptor"
172    }
173
174    fn read_before_execution(
175        &self,
176        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
177            '_,
178            ::aws_smithy_runtime_api::client::interceptors::context::Input,
179            ::aws_smithy_runtime_api::client::interceptors::context::Output,
180            ::aws_smithy_runtime_api::client::interceptors::context::Error,
181        >,
182        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
183    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
184        // Nothing to do unless the customer opted in by naming members to record.
185        let ::std::option::Option::Some(requested) = cfg
186            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
187            .filter(|r| !r.is_empty())
188        else {
189            return ::std::result::Result::Ok(());
190        };
191
192        let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateContainerRecipeInput>() else {
193            // A mismatched input is not this interceptor's concern; skip quietly.
194            return ::std::result::Result::Ok(());
195        };
196
197        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
198        if requested.should_capture("name") {
199            if let ::std::option::Option::Some(value) = input.name.as_deref() {
200                captured.insert("name", value);
201            }
202        }
203        if requested.should_capture("description") {
204            if let ::std::option::Option::Some(value) = input.description.as_deref() {
205                captured.insert("description", value);
206            }
207        }
208        if requested.should_capture("semanticVersion") {
209            if let ::std::option::Option::Some(value) = input.semantic_version.as_deref() {
210                captured.insert("semanticVersion", value);
211            }
212        }
213        if requested.should_capture("dockerfileTemplateData") {
214            if let ::std::option::Option::Some(value) = input.dockerfile_template_data.as_deref() {
215                captured.insert("dockerfileTemplateData", value);
216            }
217        }
218        if requested.should_capture("dockerfileTemplateUri") {
219            if let ::std::option::Option::Some(value) = input.dockerfile_template_uri.as_deref() {
220                captured.insert("dockerfileTemplateUri", value);
221            }
222        }
223        if requested.should_capture("imageOsVersionOverride") {
224            if let ::std::option::Option::Some(value) = input.image_os_version_override.as_deref() {
225                captured.insert("imageOsVersionOverride", value);
226            }
227        }
228        if requested.should_capture("parentImage") {
229            if let ::std::option::Option::Some(value) = input.parent_image.as_deref() {
230                captured.insert("parentImage", value);
231            }
232        }
233        if requested.should_capture("workingDirectory") {
234            if let ::std::option::Option::Some(value) = input.working_directory.as_deref() {
235                captured.insert("workingDirectory", value);
236            }
237        }
238        if requested.should_capture("kmsKeyId") {
239            if let ::std::option::Option::Some(value) = input.kms_key_id.as_deref() {
240                captured.insert("kmsKeyId", value);
241            }
242        }
243        if requested.should_capture("clientToken") {
244            if let ::std::option::Option::Some(value) = input.client_token.as_deref() {
245                captured.insert("clientToken", value);
246            }
247        }
248
249        cfg.interceptor_state().store_put(captured);
250        ::std::result::Result::Ok(())
251    }
252}
253#[derive(Debug)]
254struct CreateContainerRecipeResponseDeserializer;
255impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateContainerRecipeResponseDeserializer {
256    fn deserialize_nonstreaming_with_config(
257        &self,
258        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
259        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
260    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
261        let (success, status) = (response.status().is_success(), response.status().as_u16());
262        let headers = response.headers();
263        let body = response.body().bytes().expect("body loaded");
264        #[allow(unused_mut)]
265        let mut force_error = false;
266        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
267        let parse_result = if !success && status != 200 || force_error {
268            crate::protocol_serde::shape_create_container_recipe::de_create_container_recipe_http_error(status, headers, body)
269        } else {
270            crate::protocol_serde::shape_create_container_recipe::de_create_container_recipe_http_response(status, headers, body)
271        };
272        crate::protocol_serde::type_erase_result(parse_result)
273    }
274}
275#[derive(Debug)]
276struct CreateContainerRecipeRequestSerializer;
277impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateContainerRecipeRequestSerializer {
278    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
279    fn serialize_input(
280        &self,
281        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
282        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
283    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
284        let input = input
285            .downcast::<crate::operation::create_container_recipe::CreateContainerRecipeInput>()
286            .expect("correct type");
287        let _header_serialization_settings = _cfg
288            .load::<crate::serialization_settings::HeaderSerializationSettings>()
289            .cloned()
290            .unwrap_or_default();
291        let mut request_builder = {
292            #[allow(clippy::uninlined_format_args)]
293            fn uri_base(
294                _input: &crate::operation::create_container_recipe::CreateContainerRecipeInput,
295                output: &mut ::std::string::String,
296            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
297                use ::std::fmt::Write as _;
298                ::std::write!(output, "/CreateContainerRecipe").expect("formatting should succeed");
299                ::std::result::Result::Ok(())
300            }
301            #[allow(clippy::unnecessary_wraps)]
302            fn update_http_builder(
303                input: &crate::operation::create_container_recipe::CreateContainerRecipeInput,
304                builder: ::http_1x::request::Builder,
305            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
306                let mut uri = ::std::string::String::new();
307                uri_base(input, &mut uri)?;
308                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
309            }
310            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
311            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
312            builder
313        };
314        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_container_recipe::ser_create_container_recipe_input(
315            &input,
316        )?);
317        if let Some(content_length) = body.content_length() {
318            let content_length = content_length.to_string();
319            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
320        }
321        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
322    }
323}
324#[derive(Debug)]
325struct CreateContainerRecipeEndpointParamsInterceptor;
326
327#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
328impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateContainerRecipeEndpointParamsInterceptor {
329    fn name(&self) -> &'static str {
330        "CreateContainerRecipeEndpointParamsInterceptor"
331    }
332
333    fn read_before_execution(
334        &self,
335        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
336            '_,
337            ::aws_smithy_runtime_api::client::interceptors::context::Input,
338            ::aws_smithy_runtime_api::client::interceptors::context::Output,
339            ::aws_smithy_runtime_api::client::interceptors::context::Error,
340        >,
341        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
342    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
343        let _input = context
344            .input()
345            .downcast_ref::<CreateContainerRecipeInput>()
346            .ok_or("failed to downcast to CreateContainerRecipeInput")?;
347
348        let params = crate::config::endpoint::Params::builder()
349            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
350            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
351            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
352            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
353            .build()
354            .map_err(|err| {
355                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
356            })?;
357        cfg.interceptor_state()
358            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
359        ::std::result::Result::Ok(())
360    }
361}
362
363// The get_* functions below are generated from JMESPath expressions in the
364// operationContextParams trait. They target the operation's input shape.
365
366/// Error type for the `CreateContainerRecipeError` operation.
367#[non_exhaustive]
368#[derive(::std::fmt::Debug)]
369pub enum CreateContainerRecipeError {
370    /// <p>You have exceeded the permitted request rate for the specific operation.</p>
371    CallRateLimitExceededException(crate::types::error::CallRateLimitExceededException),
372    /// <p>These errors are usually caused by a client action, such as using an action or resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying an invalid resource identifier.</p>
373    ClientException(crate::types::error::ClientException),
374    /// <p>You are not authorized to perform the requested operation.</p>
375    ForbiddenException(crate::types::error::ForbiddenException),
376    /// <p>You have specified a client token for an operation using parameter values that differ from a previous request that used the same client token.</p>
377    IdempotentParameterMismatchException(crate::types::error::IdempotentParameterMismatchException),
378    /// <p>You have requested an action that that the service doesn't support.</p>
379    InvalidRequestException(crate::types::error::InvalidRequestException),
380    /// <p>Your version number is out of bounds or does not follow the required syntax.</p>
381    InvalidVersionNumberException(crate::types::error::InvalidVersionNumberException),
382    /// <p>The resource that you are trying to create already exists.</p>
383    ResourceAlreadyExistsException(crate::types::error::ResourceAlreadyExistsException),
384    /// <p>The resource that you are trying to operate on is currently in use. Review the message details and retry later.</p>
385    ResourceInUseException(crate::types::error::ResourceInUseException),
386    /// <p>This exception is thrown when the service encounters an unrecoverable exception.</p>
387    ServiceException(crate::types::error::ServiceException),
388    /// <p>You have exceeded the number of permitted resources or operations for this service. For service quotas, see <a href="https://docs.aws.amazon.com/general/latest/gr/imagebuilder.html#limits_imagebuilder">EC2 Image Builder endpoints and quotas</a>.</p>
389    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
390    /// <p>The service is unable to process your request at this time.</p>
391    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
392    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
393    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
394    variable wildcard pattern and check `.code()`:
395     \
396    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
397     \
398    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateContainerRecipeError) for what information is available for the error.")]
399    Unhandled(crate::error::sealed_unhandled::Unhandled),
400}
401impl CreateContainerRecipeError {
402    /// Creates the `CreateContainerRecipeError::Unhandled` variant from any error type.
403    pub fn unhandled(
404        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
405    ) -> Self {
406        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
407            source: err.into(),
408            meta: ::std::default::Default::default(),
409        })
410    }
411
412    /// Creates the `CreateContainerRecipeError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
413    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
414        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
415            source: err.clone().into(),
416            meta: err,
417        })
418    }
419    ///
420    /// Returns error metadata, which includes the error code, message,
421    /// request ID, and potentially additional information.
422    ///
423    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
424        match self {
425            Self::CallRateLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
426            Self::ClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
427            Self::ForbiddenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
428            Self::IdempotentParameterMismatchException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
429            Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
430            Self::InvalidVersionNumberException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
431            Self::ResourceAlreadyExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
432            Self::ResourceInUseException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
433            Self::ServiceException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
434            Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
435            Self::ServiceUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
436            Self::Unhandled(e) => &e.meta,
437        }
438    }
439    /// Returns `true` if the error kind is `CreateContainerRecipeError::CallRateLimitExceededException`.
440    pub fn is_call_rate_limit_exceeded_exception(&self) -> bool {
441        matches!(self, Self::CallRateLimitExceededException(_))
442    }
443    /// Returns `true` if the error kind is `CreateContainerRecipeError::ClientException`.
444    pub fn is_client_exception(&self) -> bool {
445        matches!(self, Self::ClientException(_))
446    }
447    /// Returns `true` if the error kind is `CreateContainerRecipeError::ForbiddenException`.
448    pub fn is_forbidden_exception(&self) -> bool {
449        matches!(self, Self::ForbiddenException(_))
450    }
451    /// Returns `true` if the error kind is `CreateContainerRecipeError::IdempotentParameterMismatchException`.
452    pub fn is_idempotent_parameter_mismatch_exception(&self) -> bool {
453        matches!(self, Self::IdempotentParameterMismatchException(_))
454    }
455    /// Returns `true` if the error kind is `CreateContainerRecipeError::InvalidRequestException`.
456    pub fn is_invalid_request_exception(&self) -> bool {
457        matches!(self, Self::InvalidRequestException(_))
458    }
459    /// Returns `true` if the error kind is `CreateContainerRecipeError::InvalidVersionNumberException`.
460    pub fn is_invalid_version_number_exception(&self) -> bool {
461        matches!(self, Self::InvalidVersionNumberException(_))
462    }
463    /// Returns `true` if the error kind is `CreateContainerRecipeError::ResourceAlreadyExistsException`.
464    pub fn is_resource_already_exists_exception(&self) -> bool {
465        matches!(self, Self::ResourceAlreadyExistsException(_))
466    }
467    /// Returns `true` if the error kind is `CreateContainerRecipeError::ResourceInUseException`.
468    pub fn is_resource_in_use_exception(&self) -> bool {
469        matches!(self, Self::ResourceInUseException(_))
470    }
471    /// Returns `true` if the error kind is `CreateContainerRecipeError::ServiceException`.
472    pub fn is_service_exception(&self) -> bool {
473        matches!(self, Self::ServiceException(_))
474    }
475    /// Returns `true` if the error kind is `CreateContainerRecipeError::ServiceQuotaExceededException`.
476    pub fn is_service_quota_exceeded_exception(&self) -> bool {
477        matches!(self, Self::ServiceQuotaExceededException(_))
478    }
479    /// Returns `true` if the error kind is `CreateContainerRecipeError::ServiceUnavailableException`.
480    pub fn is_service_unavailable_exception(&self) -> bool {
481        matches!(self, Self::ServiceUnavailableException(_))
482    }
483}
484impl ::std::error::Error for CreateContainerRecipeError {
485    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
486        match self {
487            Self::CallRateLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
488            Self::ClientException(_inner) => ::std::option::Option::Some(_inner),
489            Self::ForbiddenException(_inner) => ::std::option::Option::Some(_inner),
490            Self::IdempotentParameterMismatchException(_inner) => ::std::option::Option::Some(_inner),
491            Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
492            Self::InvalidVersionNumberException(_inner) => ::std::option::Option::Some(_inner),
493            Self::ResourceAlreadyExistsException(_inner) => ::std::option::Option::Some(_inner),
494            Self::ResourceInUseException(_inner) => ::std::option::Option::Some(_inner),
495            Self::ServiceException(_inner) => ::std::option::Option::Some(_inner),
496            Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
497            Self::ServiceUnavailableException(_inner) => ::std::option::Option::Some(_inner),
498            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
499        }
500    }
501}
502impl ::std::fmt::Display for CreateContainerRecipeError {
503    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
504        match self {
505            Self::CallRateLimitExceededException(_inner) => _inner.fmt(f),
506            Self::ClientException(_inner) => _inner.fmt(f),
507            Self::ForbiddenException(_inner) => _inner.fmt(f),
508            Self::IdempotentParameterMismatchException(_inner) => _inner.fmt(f),
509            Self::InvalidRequestException(_inner) => _inner.fmt(f),
510            Self::InvalidVersionNumberException(_inner) => _inner.fmt(f),
511            Self::ResourceAlreadyExistsException(_inner) => _inner.fmt(f),
512            Self::ResourceInUseException(_inner) => _inner.fmt(f),
513            Self::ServiceException(_inner) => _inner.fmt(f),
514            Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
515            Self::ServiceUnavailableException(_inner) => _inner.fmt(f),
516            Self::Unhandled(_inner) => {
517                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
518                    write!(f, "unhandled error ({code})")
519                } else {
520                    f.write_str("unhandled error")
521                }
522            }
523        }
524    }
525}
526impl ::aws_smithy_types::retry::ProvideErrorKind for CreateContainerRecipeError {
527    fn code(&self) -> ::std::option::Option<&str> {
528        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
529    }
530    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
531        ::std::option::Option::None
532    }
533}
534impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateContainerRecipeError {
535    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
536        match self {
537            Self::CallRateLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
538            Self::ClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
539            Self::ForbiddenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
540            Self::IdempotentParameterMismatchException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
541            Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
542            Self::InvalidVersionNumberException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
543            Self::ResourceAlreadyExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
544            Self::ResourceInUseException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
545            Self::ServiceException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
546            Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
547            Self::ServiceUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
548            Self::Unhandled(_inner) => &_inner.meta,
549        }
550    }
551}
552impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateContainerRecipeError {
553    fn create_unhandled_error(
554        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
555        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
556    ) -> Self {
557        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
558            source,
559            meta: meta.unwrap_or_default(),
560        })
561    }
562}
563impl ::aws_types::request_id::RequestId for crate::operation::create_container_recipe::CreateContainerRecipeError {
564    fn request_id(&self) -> Option<&str> {
565        self.meta().request_id()
566    }
567}
568
569pub use crate::operation::create_container_recipe::_create_container_recipe_input::CreateContainerRecipeInput;
570
571pub use crate::operation::create_container_recipe::_create_container_recipe_output::CreateContainerRecipeOutput;
572
573mod _create_container_recipe_input;
574
575mod _create_container_recipe_output;
576
577/// Builders
578pub mod builders;