Skip to main content

aws_sdk_imagebuilder/operation/
create_lifecycle_policy.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `CreateLifecyclePolicy`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateLifecyclePolicy;
6impl CreateLifecyclePolicy {
7    /// Creates a new `CreateLifecyclePolicy`
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_lifecycle_policy::CreateLifecyclePolicyInput,
14    ) -> ::std::result::Result<
15        crate::operation::create_lifecycle_policy::CreateLifecyclePolicyOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::create_lifecycle_policy::CreateLifecyclePolicyError,
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_lifecycle_policy::CreateLifecyclePolicyError>()
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_lifecycle_policy::CreateLifecyclePolicyOutput>()
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_lifecycle_policy::CreateLifecyclePolicyInput,
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            "CreateLifecyclePolicy",
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.CreateLifecyclePolicy",
65            "rpc.service" = "imagebuilder",
66            "rpc.method" = "CreateLifecyclePolicy",
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_lifecycle_policy::CreateLifecyclePolicyInput = 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 CreateLifecyclePolicy {
101    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
102        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateLifecyclePolicy");
103
104        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
105            CreateLifecyclePolicyRequestSerializer,
106        ));
107        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
108            CreateLifecyclePolicyResponseDeserializer,
109        ));
110
111        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
112            crate::config::auth::Params::builder()
113                .operation_name("CreateLifecyclePolicy")
114                .build()
115                .expect("required fields set"),
116        ));
117
118        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
119            "CreateLifecyclePolicy",
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("CreateLifecyclePolicy")
142            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
143                CreateLifecyclePolicyTelemetryInputCaptureInterceptor,
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                CreateLifecyclePolicyEndpointParamsInterceptor,
150            ))
151            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
152                crate::operation::create_lifecycle_policy::CreateLifecyclePolicyError,
153            >::new())
154            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
155                crate::operation::create_lifecycle_policy::CreateLifecyclePolicyError,
156            >::new())
157            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
158                crate::operation::create_lifecycle_policy::CreateLifecyclePolicyError,
159            >::new())
160            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
161                crate::operation::create_lifecycle_policy::CreateLifecyclePolicyError,
162            >::new());
163
164        ::std::borrow::Cow::Owned(rcb)
165    }
166}
167
168#[derive(Debug)]
169struct CreateLifecyclePolicyTelemetryInputCaptureInterceptor;
170
171#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
172impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateLifecyclePolicyTelemetryInputCaptureInterceptor {
173    fn name(&self) -> &'static str {
174        "CreateLifecyclePolicyTelemetryInputCaptureInterceptor"
175    }
176
177    fn read_before_execution(
178        &self,
179        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
180            '_,
181            ::aws_smithy_runtime_api::client::interceptors::context::Input,
182            ::aws_smithy_runtime_api::client::interceptors::context::Output,
183            ::aws_smithy_runtime_api::client::interceptors::context::Error,
184        >,
185        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
186    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
187        // Nothing to do unless the customer opted in by naming members to record.
188        let ::std::option::Option::Some(requested) = cfg
189            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
190            .filter(|r| !r.is_empty())
191        else {
192            return ::std::result::Result::Ok(());
193        };
194
195        let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateLifecyclePolicyInput>() else {
196            // A mismatched input is not this interceptor's concern; skip quietly.
197            return ::std::result::Result::Ok(());
198        };
199
200        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
201        if requested.should_capture("name") {
202            if let ::std::option::Option::Some(value) = input.name.as_deref() {
203                captured.insert("name", value);
204            }
205        }
206        if requested.should_capture("description") {
207            if let ::std::option::Option::Some(value) = input.description.as_deref() {
208                captured.insert("description", value);
209            }
210        }
211        if requested.should_capture("executionRole") {
212            if let ::std::option::Option::Some(value) = input.execution_role.as_deref() {
213                captured.insert("executionRole", value);
214            }
215        }
216        if requested.should_capture("clientToken") {
217            if let ::std::option::Option::Some(value) = input.client_token.as_deref() {
218                captured.insert("clientToken", value);
219            }
220        }
221
222        cfg.interceptor_state().store_put(captured);
223        ::std::result::Result::Ok(())
224    }
225}
226#[derive(Debug)]
227struct CreateLifecyclePolicyResponseDeserializer;
228impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateLifecyclePolicyResponseDeserializer {
229    fn deserialize_nonstreaming_with_config(
230        &self,
231        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
232        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
233    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
234        let (success, status) = (response.status().is_success(), response.status().as_u16());
235        let headers = response.headers();
236        let body = response.body().bytes().expect("body loaded");
237        #[allow(unused_mut)]
238        let mut force_error = false;
239        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
240        let parse_result = if !success && status != 200 || force_error {
241            crate::protocol_serde::shape_create_lifecycle_policy::de_create_lifecycle_policy_http_error(status, headers, body)
242        } else {
243            crate::protocol_serde::shape_create_lifecycle_policy::de_create_lifecycle_policy_http_response(status, headers, body)
244        };
245        crate::protocol_serde::type_erase_result(parse_result)
246    }
247}
248#[derive(Debug)]
249struct CreateLifecyclePolicyRequestSerializer;
250impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateLifecyclePolicyRequestSerializer {
251    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
252    fn serialize_input(
253        &self,
254        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
255        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
256    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
257        let input = input
258            .downcast::<crate::operation::create_lifecycle_policy::CreateLifecyclePolicyInput>()
259            .expect("correct type");
260        let _header_serialization_settings = _cfg
261            .load::<crate::serialization_settings::HeaderSerializationSettings>()
262            .cloned()
263            .unwrap_or_default();
264        let mut request_builder = {
265            #[allow(clippy::uninlined_format_args)]
266            fn uri_base(
267                _input: &crate::operation::create_lifecycle_policy::CreateLifecyclePolicyInput,
268                output: &mut ::std::string::String,
269            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
270                use ::std::fmt::Write as _;
271                ::std::write!(output, "/CreateLifecyclePolicy").expect("formatting should succeed");
272                ::std::result::Result::Ok(())
273            }
274            #[allow(clippy::unnecessary_wraps)]
275            fn update_http_builder(
276                input: &crate::operation::create_lifecycle_policy::CreateLifecyclePolicyInput,
277                builder: ::http_1x::request::Builder,
278            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
279                let mut uri = ::std::string::String::new();
280                uri_base(input, &mut uri)?;
281                ::std::result::Result::Ok(builder.method("PUT").uri(uri))
282            }
283            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
284            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
285            builder
286        };
287        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_lifecycle_policy::ser_create_lifecycle_policy_input(
288            &input,
289        )?);
290        if let Some(content_length) = body.content_length() {
291            let content_length = content_length.to_string();
292            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
293        }
294        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
295    }
296}
297#[derive(Debug)]
298struct CreateLifecyclePolicyEndpointParamsInterceptor;
299
300#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
301impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateLifecyclePolicyEndpointParamsInterceptor {
302    fn name(&self) -> &'static str {
303        "CreateLifecyclePolicyEndpointParamsInterceptor"
304    }
305
306    fn read_before_execution(
307        &self,
308        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
309            '_,
310            ::aws_smithy_runtime_api::client::interceptors::context::Input,
311            ::aws_smithy_runtime_api::client::interceptors::context::Output,
312            ::aws_smithy_runtime_api::client::interceptors::context::Error,
313        >,
314        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
315    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
316        let _input = context
317            .input()
318            .downcast_ref::<CreateLifecyclePolicyInput>()
319            .ok_or("failed to downcast to CreateLifecyclePolicyInput")?;
320
321        let params = crate::config::endpoint::Params::builder()
322            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
323            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
324            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
325            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
326            .build()
327            .map_err(|err| {
328                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
329            })?;
330        cfg.interceptor_state()
331            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
332        ::std::result::Result::Ok(())
333    }
334}
335
336// The get_* functions below are generated from JMESPath expressions in the
337// operationContextParams trait. They target the operation's input shape.
338
339/// Error type for the `CreateLifecyclePolicyError` operation.
340#[non_exhaustive]
341#[derive(::std::fmt::Debug)]
342pub enum CreateLifecyclePolicyError {
343    /// <p>You have exceeded the permitted request rate for the specific operation.</p>
344    CallRateLimitExceededException(crate::types::error::CallRateLimitExceededException),
345    /// <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>
346    ClientException(crate::types::error::ClientException),
347    /// <p>The dry run operation of the resource was successful, and no resources or mutations were actually performed due to the dry run flag in the request.</p>
348    DryRunOperationException(crate::types::error::DryRunOperationException),
349    /// <p>You are not authorized to perform the requested operation.</p>
350    ForbiddenException(crate::types::error::ForbiddenException),
351    /// <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>
352    IdempotentParameterMismatchException(crate::types::error::IdempotentParameterMismatchException),
353    /// <p>You have requested an action that that the service doesn't support.</p>
354    InvalidRequestException(crate::types::error::InvalidRequestException),
355    /// <p>The resource that you are trying to create already exists.</p>
356    ResourceAlreadyExistsException(crate::types::error::ResourceAlreadyExistsException),
357    /// <p>The resource that you are trying to operate on is currently in use. Review the message details and retry later.</p>
358    ResourceInUseException(crate::types::error::ResourceInUseException),
359    /// <p>This exception is thrown when the service encounters an unrecoverable exception.</p>
360    ServiceException(crate::types::error::ServiceException),
361    /// <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>
362    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
363    /// <p>The service is unable to process your request at this time.</p>
364    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
365    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
366    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
367    variable wildcard pattern and check `.code()`:
368     \
369    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
370     \
371    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateLifecyclePolicyError) for what information is available for the error.")]
372    Unhandled(crate::error::sealed_unhandled::Unhandled),
373}
374impl CreateLifecyclePolicyError {
375    /// Creates the `CreateLifecyclePolicyError::Unhandled` variant from any error type.
376    pub fn unhandled(
377        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
378    ) -> Self {
379        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
380            source: err.into(),
381            meta: ::std::default::Default::default(),
382        })
383    }
384
385    /// Creates the `CreateLifecyclePolicyError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
386    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
387        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
388            source: err.clone().into(),
389            meta: err,
390        })
391    }
392    ///
393    /// Returns error metadata, which includes the error code, message,
394    /// request ID, and potentially additional information.
395    ///
396    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
397        match self {
398            Self::CallRateLimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
399            Self::ClientException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
400            Self::DryRunOperationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
401            Self::ForbiddenException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
402            Self::IdempotentParameterMismatchException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
403            Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
404            Self::ResourceAlreadyExistsException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
405            Self::ResourceInUseException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
406            Self::ServiceException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
407            Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
408            Self::ServiceUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
409            Self::Unhandled(e) => &e.meta,
410        }
411    }
412    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::CallRateLimitExceededException`.
413    pub fn is_call_rate_limit_exceeded_exception(&self) -> bool {
414        matches!(self, Self::CallRateLimitExceededException(_))
415    }
416    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::ClientException`.
417    pub fn is_client_exception(&self) -> bool {
418        matches!(self, Self::ClientException(_))
419    }
420    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::DryRunOperationException`.
421    pub fn is_dry_run_operation_exception(&self) -> bool {
422        matches!(self, Self::DryRunOperationException(_))
423    }
424    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::ForbiddenException`.
425    pub fn is_forbidden_exception(&self) -> bool {
426        matches!(self, Self::ForbiddenException(_))
427    }
428    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::IdempotentParameterMismatchException`.
429    pub fn is_idempotent_parameter_mismatch_exception(&self) -> bool {
430        matches!(self, Self::IdempotentParameterMismatchException(_))
431    }
432    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::InvalidRequestException`.
433    pub fn is_invalid_request_exception(&self) -> bool {
434        matches!(self, Self::InvalidRequestException(_))
435    }
436    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::ResourceAlreadyExistsException`.
437    pub fn is_resource_already_exists_exception(&self) -> bool {
438        matches!(self, Self::ResourceAlreadyExistsException(_))
439    }
440    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::ResourceInUseException`.
441    pub fn is_resource_in_use_exception(&self) -> bool {
442        matches!(self, Self::ResourceInUseException(_))
443    }
444    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::ServiceException`.
445    pub fn is_service_exception(&self) -> bool {
446        matches!(self, Self::ServiceException(_))
447    }
448    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::ServiceQuotaExceededException`.
449    pub fn is_service_quota_exceeded_exception(&self) -> bool {
450        matches!(self, Self::ServiceQuotaExceededException(_))
451    }
452    /// Returns `true` if the error kind is `CreateLifecyclePolicyError::ServiceUnavailableException`.
453    pub fn is_service_unavailable_exception(&self) -> bool {
454        matches!(self, Self::ServiceUnavailableException(_))
455    }
456}
457impl ::std::error::Error for CreateLifecyclePolicyError {
458    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
459        match self {
460            Self::CallRateLimitExceededException(_inner) => ::std::option::Option::Some(_inner),
461            Self::ClientException(_inner) => ::std::option::Option::Some(_inner),
462            Self::DryRunOperationException(_inner) => ::std::option::Option::Some(_inner),
463            Self::ForbiddenException(_inner) => ::std::option::Option::Some(_inner),
464            Self::IdempotentParameterMismatchException(_inner) => ::std::option::Option::Some(_inner),
465            Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
466            Self::ResourceAlreadyExistsException(_inner) => ::std::option::Option::Some(_inner),
467            Self::ResourceInUseException(_inner) => ::std::option::Option::Some(_inner),
468            Self::ServiceException(_inner) => ::std::option::Option::Some(_inner),
469            Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
470            Self::ServiceUnavailableException(_inner) => ::std::option::Option::Some(_inner),
471            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
472        }
473    }
474}
475impl ::std::fmt::Display for CreateLifecyclePolicyError {
476    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
477        match self {
478            Self::CallRateLimitExceededException(_inner) => _inner.fmt(f),
479            Self::ClientException(_inner) => _inner.fmt(f),
480            Self::DryRunOperationException(_inner) => _inner.fmt(f),
481            Self::ForbiddenException(_inner) => _inner.fmt(f),
482            Self::IdempotentParameterMismatchException(_inner) => _inner.fmt(f),
483            Self::InvalidRequestException(_inner) => _inner.fmt(f),
484            Self::ResourceAlreadyExistsException(_inner) => _inner.fmt(f),
485            Self::ResourceInUseException(_inner) => _inner.fmt(f),
486            Self::ServiceException(_inner) => _inner.fmt(f),
487            Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
488            Self::ServiceUnavailableException(_inner) => _inner.fmt(f),
489            Self::Unhandled(_inner) => {
490                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
491                    write!(f, "unhandled error ({code})")
492                } else {
493                    f.write_str("unhandled error")
494                }
495            }
496        }
497    }
498}
499impl ::aws_smithy_types::retry::ProvideErrorKind for CreateLifecyclePolicyError {
500    fn code(&self) -> ::std::option::Option<&str> {
501        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
502    }
503    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
504        ::std::option::Option::None
505    }
506}
507impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateLifecyclePolicyError {
508    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
509        match self {
510            Self::CallRateLimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
511            Self::ClientException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
512            Self::DryRunOperationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
513            Self::ForbiddenException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
514            Self::IdempotentParameterMismatchException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
515            Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
516            Self::ResourceAlreadyExistsException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
517            Self::ResourceInUseException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
518            Self::ServiceException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
519            Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
520            Self::ServiceUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
521            Self::Unhandled(_inner) => &_inner.meta,
522        }
523    }
524}
525impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateLifecyclePolicyError {
526    fn create_unhandled_error(
527        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
528        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
529    ) -> Self {
530        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
531            source,
532            meta: meta.unwrap_or_default(),
533        })
534    }
535}
536impl ::aws_types::request_id::RequestId for crate::operation::create_lifecycle_policy::CreateLifecyclePolicyError {
537    fn request_id(&self) -> Option<&str> {
538        self.meta().request_id()
539    }
540}
541
542pub use crate::operation::create_lifecycle_policy::_create_lifecycle_policy_input::CreateLifecyclePolicyInput;
543
544pub use crate::operation::create_lifecycle_policy::_create_lifecycle_policy_output::CreateLifecyclePolicyOutput;
545
546mod _create_lifecycle_policy_input;
547
548mod _create_lifecycle_policy_output;
549
550/// Builders
551pub mod builders;