Skip to main content

aws_sdk_appmonetization/operation/
create_subscription_checkout_session.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `CreateSubscriptionCheckoutSession`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct CreateSubscriptionCheckoutSession;
6impl CreateSubscriptionCheckoutSession {
7    /// Creates a new `CreateSubscriptionCheckoutSession`
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_subscription_checkout_session::CreateSubscriptionCheckoutSessionInput,
14    ) -> ::std::result::Result<
15        crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionError,
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_subscription_checkout_session::CreateSubscriptionCheckoutSessionError>()
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_subscription_checkout_session::CreateSubscriptionCheckoutSessionOutput>()
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_subscription_checkout_session::CreateSubscriptionCheckoutSessionInput,
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            "AppMonetization",
56            "CreateSubscriptionCheckoutSession",
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            "AppMonetization.CreateSubscriptionCheckoutSession",
65            "rpc.service" = "AppMonetization",
66            "rpc.method" = "CreateSubscriptionCheckoutSession",
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_subscription_checkout_session::CreateSubscriptionCheckoutSessionInput =
82                    input.downcast_mut().expect("correct type");
83                if input.client_token.is_none() {
84                    input.client_token = ::std::option::Option::Some(token_provider.make_idempotency_token());
85                }
86            },
87        ));
88        if let ::std::option::Option::Some(config_override) = config_override {
89            for plugin in config_override.runtime_plugins.iter().cloned() {
90                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
91            }
92            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
93                config_override,
94                client_config.config.clone(),
95                &client_config.runtime_components,
96            ));
97        }
98        runtime_plugins
99    }
100}
101impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateSubscriptionCheckoutSession {
102    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
103        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateSubscriptionCheckoutSession");
104
105        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
106            CreateSubscriptionCheckoutSessionRequestSerializer,
107        ));
108        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
109            CreateSubscriptionCheckoutSessionResponseDeserializer,
110        ));
111
112        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
113            crate::config::auth::Params::builder()
114                .operation_name("CreateSubscriptionCheckoutSession")
115                .build()
116                .expect("required fields set"),
117        ));
118
119        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
120        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
121            "CreateSubscriptionCheckoutSession",
122            "AppMonetization",
123        ));
124        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
125        signing_options.double_uri_encode = true;
126        signing_options.content_sha256_header = false;
127        signing_options.normalize_uri_path = true;
128        signing_options.payload_override = None;
129
130        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
131            signing_options,
132            ..::std::default::Default::default()
133        });
134
135        ::std::option::Option::Some(cfg.freeze())
136    }
137
138    fn runtime_components(
139        &self,
140        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
141    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
142        #[allow(unused_mut)]
143        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateSubscriptionCheckoutSession")
144            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
145                CreateSubscriptionCheckoutSessionTelemetryInputCaptureInterceptor,
146            ))
147            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
148                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
149            ))
150            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
151                CreateSubscriptionCheckoutSessionEndpointParamsInterceptor,
152            ))
153            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
154                crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionError,
155            >::new())
156            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
157                crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionError,
158            >::new())
159            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
160                crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionError,
161            >::new())
162            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
163                crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionError,
164            >::new());
165
166        ::std::borrow::Cow::Owned(rcb)
167    }
168}
169
170#[derive(Debug)]
171struct CreateSubscriptionCheckoutSessionTelemetryInputCaptureInterceptor;
172
173#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
174impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateSubscriptionCheckoutSessionTelemetryInputCaptureInterceptor {
175    fn name(&self) -> &'static str {
176        "CreateSubscriptionCheckoutSessionTelemetryInputCaptureInterceptor"
177    }
178
179    fn read_before_execution(
180        &self,
181        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
182            '_,
183            ::aws_smithy_runtime_api::client::interceptors::context::Input,
184            ::aws_smithy_runtime_api::client::interceptors::context::Output,
185            ::aws_smithy_runtime_api::client::interceptors::context::Error,
186        >,
187        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
188    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
189        // Nothing to do unless the customer opted in by naming members to record.
190        let ::std::option::Option::Some(requested) = cfg
191            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
192            .filter(|r| !r.is_empty())
193        else {
194            return ::std::result::Result::Ok(());
195        };
196
197        let ::std::option::Option::Some(input) = context.input().downcast_ref::<CreateSubscriptionCheckoutSessionInput>() else {
198            // A mismatched input is not this interceptor's concern; skip quietly.
199            return ::std::result::Result::Ok(());
200        };
201
202        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
203        if requested.should_capture("appId") {
204            if let ::std::option::Option::Some(value) = input.app_id.as_deref() {
205                captured.insert("appId", value);
206            }
207        }
208        if requested.should_capture("userId") {
209            if let ::std::option::Option::Some(value) = input.user_id.as_deref() {
210                captured.insert("userId", value);
211            }
212        }
213        if requested.should_capture("planId") {
214            if let ::std::option::Option::Some(value) = input.plan_id.as_deref() {
215                captured.insert("planId", value);
216            }
217        }
218        if requested.should_capture("returnUrl") {
219            if let ::std::option::Option::Some(value) = input.return_url.as_deref() {
220                captured.insert("returnUrl", value);
221            }
222        }
223        if requested.should_capture("refreshUrl") {
224            if let ::std::option::Option::Some(value) = input.refresh_url.as_deref() {
225                captured.insert("refreshUrl", value);
226            }
227        }
228        if requested.should_capture("clientToken") {
229            if let ::std::option::Option::Some(value) = input.client_token.as_deref() {
230                captured.insert("clientToken", value);
231            }
232        }
233
234        cfg.interceptor_state().store_put(captured);
235        ::std::result::Result::Ok(())
236    }
237}
238#[derive(Debug)]
239struct CreateSubscriptionCheckoutSessionResponseDeserializer;
240impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateSubscriptionCheckoutSessionResponseDeserializer {
241    fn deserialize_nonstreaming_with_config(
242        &self,
243        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
244        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
245    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
246        let (success, status) = (response.status().is_success(), response.status().as_u16());
247        let headers = response.headers();
248        let body = response.body().bytes().expect("body loaded");
249        #[allow(unused_mut)]
250        let mut force_error = false;
251        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
252        let parse_result = if !success && status != 201 || force_error {
253            crate::protocol_serde::shape_create_subscription_checkout_session::de_create_subscription_checkout_session_http_error(
254                status, headers, body, _cfg,
255            )
256        } else {
257            crate::protocol_serde::shape_create_subscription_checkout_session::de_create_subscription_checkout_session_http_response(
258                status, headers, body, _cfg,
259            )
260        };
261        crate::protocol_serde::type_erase_result(parse_result)
262    }
263}
264#[derive(Debug)]
265struct CreateSubscriptionCheckoutSessionRequestSerializer;
266impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateSubscriptionCheckoutSessionRequestSerializer {
267    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
268    fn serialize_input(
269        &self,
270        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
271        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
272    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
273        let input = input
274            .downcast::<crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionInput>()
275            .expect("correct type");
276        let _header_serialization_settings = _cfg
277            .load::<crate::serialization_settings::HeaderSerializationSettings>()
278            .cloned()
279            .unwrap_or_default();
280        let mut request_builder = {
281            #[allow(clippy::uninlined_format_args)]
282            fn uri_base(
283                _input: &crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionInput,
284                output: &mut ::std::string::String,
285            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
286                use ::std::fmt::Write as _;
287                let input_1 = &_input.app_id;
288                let input_1 = input_1
289                    .as_ref()
290                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("app_id", "cannot be empty or unset"))?;
291                let app_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
292                if app_id.is_empty() {
293                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
294                        "app_id",
295                        "cannot be empty or unset",
296                    ));
297                }
298                let input_2 = &_input.user_id;
299                let input_2 = input_2
300                    .as_ref()
301                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("user_id", "cannot be empty or unset"))?;
302                let user_id = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
303                if user_id.is_empty() {
304                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
305                        "user_id",
306                        "cannot be empty or unset",
307                    ));
308                }
309                ::std::write!(output, "/apps/{appId}/users/{userId}/checkout-sessions", appId = app_id, userId = user_id)
310                    .expect("formatting should succeed");
311                ::std::result::Result::Ok(())
312            }
313            fn uri_query(
314                _input: &crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionInput,
315                mut output: &mut ::std::string::String,
316            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
317                let mut query = ::aws_smithy_http::query::Writer::new(output);
318                let inner_3 = &_input.scope;
319                let inner_3 = inner_3
320                    .as_ref()
321                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("scope", "cannot be empty or unset"))?;
322                query.push_kv("scope", &::aws_smithy_http::query::fmt_string(inner_3.as_str()));
323                ::std::result::Result::Ok(())
324            }
325            #[allow(clippy::unnecessary_wraps)]
326            fn update_http_builder(
327                input: &crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionInput,
328                builder: ::http_1x::request::Builder,
329            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
330                let mut uri = ::std::string::String::new();
331                uri_base(input, &mut uri)?;
332                uri_query(input, &mut uri)?;
333                ::std::result::Result::Ok(builder.method("POST").uri(uri))
334            }
335            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
336            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
337            builder
338        };
339        let body = ::aws_smithy_types::body::SdkBody::from(
340            crate::protocol_serde::shape_create_subscription_checkout_session::ser_create_subscription_checkout_session_input(&input)?,
341        );
342        if let Some(content_length) = body.content_length() {
343            let content_length = content_length.to_string();
344            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
345        }
346        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
347    }
348}
349#[derive(Debug)]
350struct CreateSubscriptionCheckoutSessionEndpointParamsInterceptor;
351
352#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
353impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateSubscriptionCheckoutSessionEndpointParamsInterceptor {
354    fn name(&self) -> &'static str {
355        "CreateSubscriptionCheckoutSessionEndpointParamsInterceptor"
356    }
357
358    fn read_before_execution(
359        &self,
360        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
361            '_,
362            ::aws_smithy_runtime_api::client::interceptors::context::Input,
363            ::aws_smithy_runtime_api::client::interceptors::context::Output,
364            ::aws_smithy_runtime_api::client::interceptors::context::Error,
365        >,
366        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
367    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
368        let _input = context
369            .input()
370            .downcast_ref::<CreateSubscriptionCheckoutSessionInput>()
371            .ok_or("failed to downcast to CreateSubscriptionCheckoutSessionInput")?;
372
373        let params = crate::config::endpoint::Params::builder()
374            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
375            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
376            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
377            .build()
378            .map_err(|err| {
379                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
380            })?;
381        cfg.interceptor_state()
382            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
383        ::std::result::Result::Ok(())
384    }
385}
386
387// The get_* functions below are generated from JMESPath expressions in the
388// operationContextParams trait. They target the operation's input shape.
389
390/// Error type for the `CreateSubscriptionCheckoutSessionError` operation.
391#[non_exhaustive]
392#[derive(::std::fmt::Debug)]
393pub enum CreateSubscriptionCheckoutSessionError {
394    /// The caller does not have sufficient permission to perform this action.
395    AccessDeniedException(crate::types::error::AccessDeniedException),
396    /// The request conflicts with the current state of the resource, such as a duplicate identifier or a version mismatch. Retrieve the current state of the resource and retry the request.
397    ConflictException(crate::types::error::ConflictException),
398    /// An unexpected error occurred while processing the request.
399    InternalServerException(crate::types::error::InternalServerException),
400    /// The referenced resource does not exist.
401    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
402    /// The service is temporarily unavailable. Retry the request after the time in retryAfterSeconds.
403    ServiceUnavailableException(crate::types::error::ServiceUnavailableException),
404    /// The request was denied due to request throttling.
405    ThrottlingException(crate::types::error::ThrottlingException),
406    /// The request failed input validation.
407    ValidationException(crate::types::error::ValidationException),
408    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
409    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
410    variable wildcard pattern and check `.code()`:
411     \
412    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
413     \
414    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateSubscriptionCheckoutSessionError) for what information is available for the error.")]
415    Unhandled(crate::error::sealed_unhandled::Unhandled),
416}
417impl CreateSubscriptionCheckoutSessionError {
418    /// Creates the `CreateSubscriptionCheckoutSessionError::Unhandled` variant from any error type.
419    pub fn unhandled(
420        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
421    ) -> Self {
422        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
423            source: err.into(),
424            meta: ::std::default::Default::default(),
425        })
426    }
427
428    /// Creates the `CreateSubscriptionCheckoutSessionError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
429    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
430        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
431            source: err.clone().into(),
432            meta: err,
433        })
434    }
435    ///
436    /// Returns error metadata, which includes the error code, message,
437    /// request ID, and potentially additional information.
438    ///
439    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
440        match self {
441            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
442            Self::ConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
443            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
444            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
445            Self::ServiceUnavailableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
446            Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
447            Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
448            Self::Unhandled(e) => &e.meta,
449        }
450    }
451    /// Returns `true` if the error kind is `CreateSubscriptionCheckoutSessionError::AccessDeniedException`.
452    pub fn is_access_denied_exception(&self) -> bool {
453        matches!(self, Self::AccessDeniedException(_))
454    }
455    /// Returns `true` if the error kind is `CreateSubscriptionCheckoutSessionError::ConflictException`.
456    pub fn is_conflict_exception(&self) -> bool {
457        matches!(self, Self::ConflictException(_))
458    }
459    /// Returns `true` if the error kind is `CreateSubscriptionCheckoutSessionError::InternalServerException`.
460    pub fn is_internal_server_exception(&self) -> bool {
461        matches!(self, Self::InternalServerException(_))
462    }
463    /// Returns `true` if the error kind is `CreateSubscriptionCheckoutSessionError::ResourceNotFoundException`.
464    pub fn is_resource_not_found_exception(&self) -> bool {
465        matches!(self, Self::ResourceNotFoundException(_))
466    }
467    /// Returns `true` if the error kind is `CreateSubscriptionCheckoutSessionError::ServiceUnavailableException`.
468    pub fn is_service_unavailable_exception(&self) -> bool {
469        matches!(self, Self::ServiceUnavailableException(_))
470    }
471    /// Returns `true` if the error kind is `CreateSubscriptionCheckoutSessionError::ThrottlingException`.
472    pub fn is_throttling_exception(&self) -> bool {
473        matches!(self, Self::ThrottlingException(_))
474    }
475    /// Returns `true` if the error kind is `CreateSubscriptionCheckoutSessionError::ValidationException`.
476    pub fn is_validation_exception(&self) -> bool {
477        matches!(self, Self::ValidationException(_))
478    }
479}
480impl ::std::error::Error for CreateSubscriptionCheckoutSessionError {
481    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
482        match self {
483            Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
484            Self::ConflictException(_inner) => ::std::option::Option::Some(_inner),
485            Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
486            Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
487            Self::ServiceUnavailableException(_inner) => ::std::option::Option::Some(_inner),
488            Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
489            Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
490            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
491        }
492    }
493}
494impl ::std::fmt::Display for CreateSubscriptionCheckoutSessionError {
495    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
496        match self {
497            Self::AccessDeniedException(_inner) => _inner.fmt(f),
498            Self::ConflictException(_inner) => _inner.fmt(f),
499            Self::InternalServerException(_inner) => _inner.fmt(f),
500            Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
501            Self::ServiceUnavailableException(_inner) => _inner.fmt(f),
502            Self::ThrottlingException(_inner) => _inner.fmt(f),
503            Self::ValidationException(_inner) => _inner.fmt(f),
504            Self::Unhandled(_inner) => {
505                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
506                    write!(f, "unhandled error ({code})")
507                } else {
508                    f.write_str("unhandled error")
509                }
510            }
511        }
512    }
513}
514impl ::aws_smithy_types::retry::ProvideErrorKind for CreateSubscriptionCheckoutSessionError {
515    fn code(&self) -> ::std::option::Option<&str> {
516        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
517    }
518    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
519        match self {
520            Self::InternalServerException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
521            Self::ServiceUnavailableException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
522            Self::ThrottlingException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
523            _ => ::std::option::Option::None,
524        }
525    }
526}
527impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateSubscriptionCheckoutSessionError {
528    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
529        match self {
530            Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
531            Self::ConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
532            Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
533            Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
534            Self::ServiceUnavailableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
535            Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
536            Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
537            Self::Unhandled(_inner) => &_inner.meta,
538        }
539    }
540}
541impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateSubscriptionCheckoutSessionError {
542    fn create_unhandled_error(
543        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
544        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
545    ) -> Self {
546        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
547            source,
548            meta: meta.unwrap_or_default(),
549        })
550    }
551}
552impl ::aws_types::request_id::RequestId for crate::operation::create_subscription_checkout_session::CreateSubscriptionCheckoutSessionError {
553    fn request_id(&self) -> Option<&str> {
554        self.meta().request_id()
555    }
556}
557
558pub use crate::operation::create_subscription_checkout_session::_create_subscription_checkout_session_input::CreateSubscriptionCheckoutSessionInput;
559
560pub use crate::operation::create_subscription_checkout_session::_create_subscription_checkout_session_output::CreateSubscriptionCheckoutSessionOutput;
561
562mod _create_subscription_checkout_session_input;
563
564mod _create_subscription_checkout_session_output;
565
566/// Builders
567pub mod builders;