Skip to main content

aws_sdk_lexruntime/operation/
post_content.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `PostContent`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct PostContent;
6impl PostContent {
7    /// Creates a new `PostContent`
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::post_content::PostContentInput,
14    ) -> ::std::result::Result<
15        crate::operation::post_content::PostContentOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::post_content::PostContentError,
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::post_content::PostContentError>()
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::post_content::PostContentOutput>()
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::post_content::PostContentInput,
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("Lex Runtime Service", "PostContent", input, runtime_plugins, stop_point)
55            // Create a parent span for the entire operation. Includes a random, internal-only,
56            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
57            .instrument(::tracing::debug_span!(
58                "Lex Runtime Service.PostContent",
59                "rpc.service" = "Lex Runtime Service",
60                "rpc.method" = "PostContent",
61                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62                "rpc.system" = "aws-api",
63            ))
64            .await
65    }
66
67    pub(crate) fn operation_runtime_plugins(
68        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69        client_config: &crate::config::Config,
70        config_override: ::std::option::Option<crate::config::Builder>,
71    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73
74        if let ::std::option::Option::Some(config_override) = config_override {
75            for plugin in config_override.runtime_plugins.iter().cloned() {
76                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
77            }
78            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
79                config_override,
80                client_config.config.clone(),
81                &client_config.runtime_components,
82            ));
83        }
84        runtime_plugins
85    }
86}
87impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for PostContent {
88    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
89        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("PostContent");
90
91        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
92            PostContentRequestSerializer,
93        ));
94        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
95            PostContentResponseDeserializer,
96        ));
97
98        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
99            crate::config::auth::Params::builder()
100                .operation_name("PostContent")
101                .build()
102                .expect("required fields set"),
103        ));
104
105        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
106        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
107            "PostContent",
108            "Lex Runtime Service",
109        ));
110        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
111        signing_options.double_uri_encode = true;
112        signing_options.content_sha256_header = true;
113        signing_options.normalize_uri_path = true;
114        signing_options.payload_override = Some(::aws_sigv4::http_request::SignableBody::UnsignedPayload);
115
116        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
117            signing_options,
118            ..::std::default::Default::default()
119        });
120
121        ::std::option::Option::Some(cfg.freeze())
122    }
123
124    fn runtime_components(
125        &self,
126        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
127    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
128        #[allow(unused_mut)]
129        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("PostContent")
130            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
131                PostContentTelemetryInputCaptureInterceptor,
132            ))
133            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
134                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
135            ))
136            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
137                PostContentEndpointParamsInterceptor,
138            ))
139            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
140                crate::operation::post_content::PostContentError,
141            >::new())
142            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
143                crate::operation::post_content::PostContentError,
144            >::new())
145            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
146                crate::operation::post_content::PostContentError,
147            >::new())
148            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
149                crate::operation::post_content::PostContentError,
150            >::new());
151
152        ::std::borrow::Cow::Owned(rcb)
153    }
154}
155
156#[derive(Debug)]
157struct PostContentTelemetryInputCaptureInterceptor;
158
159#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
160impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PostContentTelemetryInputCaptureInterceptor {
161    fn name(&self) -> &'static str {
162        "PostContentTelemetryInputCaptureInterceptor"
163    }
164
165    fn read_before_execution(
166        &self,
167        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
168            '_,
169            ::aws_smithy_runtime_api::client::interceptors::context::Input,
170            ::aws_smithy_runtime_api::client::interceptors::context::Output,
171            ::aws_smithy_runtime_api::client::interceptors::context::Error,
172        >,
173        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
174    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
175        // Nothing to do unless the customer opted in by naming members to record.
176        let ::std::option::Option::Some(requested) = cfg
177            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
178            .filter(|r| !r.is_empty())
179        else {
180            return ::std::result::Result::Ok(());
181        };
182
183        let ::std::option::Option::Some(input) = context.input().downcast_ref::<PostContentInput>() else {
184            // A mismatched input is not this interceptor's concern; skip quietly.
185            return ::std::result::Result::Ok(());
186        };
187
188        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
189        if requested.should_capture("botName") {
190            if let ::std::option::Option::Some(value) = input.bot_name.as_deref() {
191                captured.insert("botName", value);
192            }
193        }
194        if requested.should_capture("botAlias") {
195            if let ::std::option::Option::Some(value) = input.bot_alias.as_deref() {
196                captured.insert("botAlias", value);
197            }
198        }
199        if requested.should_capture("userId") {
200            if let ::std::option::Option::Some(value) = input.user_id.as_deref() {
201                captured.insert("userId", value);
202            }
203        }
204        if requested.should_capture("contentType") {
205            if let ::std::option::Option::Some(value) = input.content_type.as_deref() {
206                captured.insert("contentType", value);
207            }
208        }
209        if requested.should_capture("accept") {
210            if let ::std::option::Option::Some(value) = input.accept.as_deref() {
211                captured.insert("accept", value);
212            }
213        }
214
215        cfg.interceptor_state().store_put(captured);
216        ::std::result::Result::Ok(())
217    }
218}
219#[derive(Debug)]
220struct PostContentResponseDeserializer;
221impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for PostContentResponseDeserializer {
222    fn deserialize_streaming(
223        &self,
224        response: &mut ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
225    ) -> ::std::option::Option<::aws_smithy_runtime_api::client::interceptors::context::OutputOrError> {
226        #[allow(unused_mut)]
227        let mut force_error = false;
228        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
229
230        // If this is an error, defer to the non-streaming parser
231        if (!response.status().is_success() && response.status().as_u16() != 200) || force_error {
232            return ::std::option::Option::None;
233        }
234        ::std::option::Option::Some(crate::protocol_serde::type_erase_result(
235            crate::protocol_serde::shape_post_content::de_post_content_http_response(response),
236        ))
237    }
238
239    fn deserialize_nonstreaming_with_config(
240        &self,
241        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
242        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
243    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
244        // For streaming operations, we only hit this case if its an error
245        let body = response.body().bytes().expect("body loaded");
246        crate::protocol_serde::type_erase_result(crate::protocol_serde::shape_post_content::de_post_content_http_error(
247            response.status().as_u16(),
248            response.headers(),
249            body,
250        ))
251    }
252}
253#[derive(Debug)]
254struct PostContentRequestSerializer;
255impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for PostContentRequestSerializer {
256    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
257    fn serialize_input(
258        &self,
259        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
260        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
261    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
262        let input = input
263            .downcast::<crate::operation::post_content::PostContentInput>()
264            .expect("correct type");
265        let _header_serialization_settings = _cfg
266            .load::<crate::serialization_settings::HeaderSerializationSettings>()
267            .cloned()
268            .unwrap_or_default();
269        let mut request_builder = {
270            #[allow(clippy::uninlined_format_args)]
271            fn uri_base(
272                _input: &crate::operation::post_content::PostContentInput,
273                output: &mut ::std::string::String,
274            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
275                use ::std::fmt::Write as _;
276                let input_1 = &_input.bot_name;
277                let input_1 = input_1
278                    .as_ref()
279                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bot_name", "cannot be empty or unset"))?;
280                let bot_name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
281                if bot_name.is_empty() {
282                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
283                        "bot_name",
284                        "cannot be empty or unset",
285                    ));
286                }
287                let input_2 = &_input.bot_alias;
288                let input_2 = input_2
289                    .as_ref()
290                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bot_alias", "cannot be empty or unset"))?;
291                let bot_alias = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
292                if bot_alias.is_empty() {
293                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
294                        "bot_alias",
295                        "cannot be empty or unset",
296                    ));
297                }
298                let input_3 = &_input.user_id;
299                let input_3 = input_3
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_3, ::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!(
310                    output,
311                    "/bot/{botName}/alias/{botAlias}/user/{userId}/content",
312                    botName = bot_name,
313                    botAlias = bot_alias,
314                    userId = user_id
315                )
316                .expect("formatting should succeed");
317                ::std::result::Result::Ok(())
318            }
319            #[allow(clippy::unnecessary_wraps)]
320            fn update_http_builder(
321                input: &crate::operation::post_content::PostContentInput,
322                builder: ::http_1x::request::Builder,
323            ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
324                let mut uri = ::std::string::String::new();
325                uri_base(input, &mut uri)?;
326                let builder = crate::protocol_serde::shape_post_content::ser_post_content_headers(input, builder)?;
327                ::std::result::Result::Ok(builder.method("POST").uri(uri))
328            }
329            let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
330            builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/octet-stream");
331            builder
332        };
333        let body = crate::protocol_serde::shape_post_content_input::ser_input_stream_http_payload(input.input_stream)?.into_inner();
334        if let Some(content_length) = body.content_length() {
335            let content_length = content_length.to_string();
336            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
337        }
338        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
339    }
340}
341#[derive(Debug)]
342struct PostContentEndpointParamsInterceptor;
343
344#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
345impl ::aws_smithy_runtime_api::client::interceptors::Intercept for PostContentEndpointParamsInterceptor {
346    fn name(&self) -> &'static str {
347        "PostContentEndpointParamsInterceptor"
348    }
349
350    fn read_before_execution(
351        &self,
352        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
353            '_,
354            ::aws_smithy_runtime_api::client::interceptors::context::Input,
355            ::aws_smithy_runtime_api::client::interceptors::context::Output,
356            ::aws_smithy_runtime_api::client::interceptors::context::Error,
357        >,
358        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
359    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
360        let _input = context
361            .input()
362            .downcast_ref::<PostContentInput>()
363            .ok_or("failed to downcast to PostContentInput")?;
364
365        let params = crate::config::endpoint::Params::builder()
366            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
367            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
368            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
369            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
370            .build()
371            .map_err(|err| {
372                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
373            })?;
374        cfg.interceptor_state()
375            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
376        ::std::result::Result::Ok(())
377    }
378}
379
380// The get_* functions below are generated from JMESPath expressions in the
381// operationContextParams trait. They target the operation's input shape.
382
383/// Error type for the `PostContentError` operation.
384#[non_exhaustive]
385#[derive(::std::fmt::Debug)]
386pub enum PostContentError {
387    /// <p>Either the Amazon Lex bot is still building, or one of the dependent services (Amazon Polly, AWS Lambda) failed with an internal service error.</p>
388    BadGatewayException(crate::types::error::BadGatewayException),
389    /// <p>Request validation failed, there is no usable message in the context, or the bot build failed, is still in progress, or contains unbuilt changes.</p>
390    BadRequestException(crate::types::error::BadRequestException),
391    /// <p>Two clients are using the same AWS account, Amazon Lex bot, and user ID.</p>
392    ConflictException(crate::types::error::ConflictException),
393    /// <p>One of the dependencies, such as AWS Lambda or Amazon Polly, threw an exception. For example,</p>
394    /// <ul>
395    /// <li>
396    /// <p>If Amazon Lex does not have sufficient permissions to call a Lambda function.</p></li>
397    /// <li>
398    /// <p>If a Lambda function takes longer than 30 seconds to execute.</p></li>
399    /// <li>
400    /// <p>If a fulfillment Lambda function returns a <code>Delegate</code> dialog action without removing any slot values.</p></li>
401    /// </ul>
402    DependencyFailedException(crate::types::error::DependencyFailedException),
403    /// <p>Internal service error. Retry the call.</p>
404    InternalFailureException(crate::types::error::InternalFailureException),
405    /// <p>Exceeded a limit.</p>
406    LimitExceededException(crate::types::error::LimitExceededException),
407    /// <p>This exception is not used.</p>
408    LoopDetectedException(crate::types::error::LoopDetectedException),
409    /// <p>The accept header in the request does not have a valid value.</p>
410    NotAcceptableException(crate::types::error::NotAcceptableException),
411    /// <p>The resource (such as the Amazon Lex bot or an alias) that is referred to is not found.</p>
412    NotFoundException(crate::types::error::NotFoundException),
413    /// <p>The input speech is too long.</p>
414    RequestTimeoutException(crate::types::error::RequestTimeoutException),
415    /// <p>The Content-Type header (<code>PostContent</code> API) has an invalid value.</p>
416    UnsupportedMediaTypeException(crate::types::error::UnsupportedMediaTypeException),
417    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
418    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
419    variable wildcard pattern and check `.code()`:
420     \
421    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
422     \
423    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-PostContentError) for what information is available for the error.")]
424    Unhandled(crate::error::sealed_unhandled::Unhandled),
425}
426impl PostContentError {
427    /// Creates the `PostContentError::Unhandled` variant from any error type.
428    pub fn unhandled(
429        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
430    ) -> Self {
431        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
432            source: err.into(),
433            meta: ::std::default::Default::default(),
434        })
435    }
436
437    /// Creates the `PostContentError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
438    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
439        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
440            source: err.clone().into(),
441            meta: err,
442        })
443    }
444    ///
445    /// Returns error metadata, which includes the error code, message,
446    /// request ID, and potentially additional information.
447    ///
448    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
449        match self {
450            Self::BadGatewayException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
451            Self::BadRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
452            Self::ConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
453            Self::DependencyFailedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
454            Self::InternalFailureException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
455            Self::LimitExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
456            Self::LoopDetectedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
457            Self::NotAcceptableException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
458            Self::NotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
459            Self::RequestTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
460            Self::UnsupportedMediaTypeException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
461            Self::Unhandled(e) => &e.meta,
462        }
463    }
464    /// Returns `true` if the error kind is `PostContentError::BadGatewayException`.
465    pub fn is_bad_gateway_exception(&self) -> bool {
466        matches!(self, Self::BadGatewayException(_))
467    }
468    /// Returns `true` if the error kind is `PostContentError::BadRequestException`.
469    pub fn is_bad_request_exception(&self) -> bool {
470        matches!(self, Self::BadRequestException(_))
471    }
472    /// Returns `true` if the error kind is `PostContentError::ConflictException`.
473    pub fn is_conflict_exception(&self) -> bool {
474        matches!(self, Self::ConflictException(_))
475    }
476    /// Returns `true` if the error kind is `PostContentError::DependencyFailedException`.
477    pub fn is_dependency_failed_exception(&self) -> bool {
478        matches!(self, Self::DependencyFailedException(_))
479    }
480    /// Returns `true` if the error kind is `PostContentError::InternalFailureException`.
481    pub fn is_internal_failure_exception(&self) -> bool {
482        matches!(self, Self::InternalFailureException(_))
483    }
484    /// Returns `true` if the error kind is `PostContentError::LimitExceededException`.
485    pub fn is_limit_exceeded_exception(&self) -> bool {
486        matches!(self, Self::LimitExceededException(_))
487    }
488    /// Returns `true` if the error kind is `PostContentError::LoopDetectedException`.
489    pub fn is_loop_detected_exception(&self) -> bool {
490        matches!(self, Self::LoopDetectedException(_))
491    }
492    /// Returns `true` if the error kind is `PostContentError::NotAcceptableException`.
493    pub fn is_not_acceptable_exception(&self) -> bool {
494        matches!(self, Self::NotAcceptableException(_))
495    }
496    /// Returns `true` if the error kind is `PostContentError::NotFoundException`.
497    pub fn is_not_found_exception(&self) -> bool {
498        matches!(self, Self::NotFoundException(_))
499    }
500    /// Returns `true` if the error kind is `PostContentError::RequestTimeoutException`.
501    pub fn is_request_timeout_exception(&self) -> bool {
502        matches!(self, Self::RequestTimeoutException(_))
503    }
504    /// Returns `true` if the error kind is `PostContentError::UnsupportedMediaTypeException`.
505    pub fn is_unsupported_media_type_exception(&self) -> bool {
506        matches!(self, Self::UnsupportedMediaTypeException(_))
507    }
508}
509impl ::std::error::Error for PostContentError {
510    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
511        match self {
512            Self::BadGatewayException(_inner) => ::std::option::Option::Some(_inner),
513            Self::BadRequestException(_inner) => ::std::option::Option::Some(_inner),
514            Self::ConflictException(_inner) => ::std::option::Option::Some(_inner),
515            Self::DependencyFailedException(_inner) => ::std::option::Option::Some(_inner),
516            Self::InternalFailureException(_inner) => ::std::option::Option::Some(_inner),
517            Self::LimitExceededException(_inner) => ::std::option::Option::Some(_inner),
518            Self::LoopDetectedException(_inner) => ::std::option::Option::Some(_inner),
519            Self::NotAcceptableException(_inner) => ::std::option::Option::Some(_inner),
520            Self::NotFoundException(_inner) => ::std::option::Option::Some(_inner),
521            Self::RequestTimeoutException(_inner) => ::std::option::Option::Some(_inner),
522            Self::UnsupportedMediaTypeException(_inner) => ::std::option::Option::Some(_inner),
523            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
524        }
525    }
526}
527impl ::std::fmt::Display for PostContentError {
528    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
529        match self {
530            Self::BadGatewayException(_inner) => _inner.fmt(f),
531            Self::BadRequestException(_inner) => _inner.fmt(f),
532            Self::ConflictException(_inner) => _inner.fmt(f),
533            Self::DependencyFailedException(_inner) => _inner.fmt(f),
534            Self::InternalFailureException(_inner) => _inner.fmt(f),
535            Self::LimitExceededException(_inner) => _inner.fmt(f),
536            Self::LoopDetectedException(_inner) => _inner.fmt(f),
537            Self::NotAcceptableException(_inner) => _inner.fmt(f),
538            Self::NotFoundException(_inner) => _inner.fmt(f),
539            Self::RequestTimeoutException(_inner) => _inner.fmt(f),
540            Self::UnsupportedMediaTypeException(_inner) => _inner.fmt(f),
541            Self::Unhandled(_inner) => {
542                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
543                    write!(f, "unhandled error ({code})")
544                } else {
545                    f.write_str("unhandled error")
546                }
547            }
548        }
549    }
550}
551impl ::aws_smithy_types::retry::ProvideErrorKind for PostContentError {
552    fn code(&self) -> ::std::option::Option<&str> {
553        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
554    }
555    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
556        ::std::option::Option::None
557    }
558}
559impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for PostContentError {
560    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
561        match self {
562            Self::BadGatewayException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
563            Self::BadRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
564            Self::ConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
565            Self::DependencyFailedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
566            Self::InternalFailureException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
567            Self::LimitExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
568            Self::LoopDetectedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
569            Self::NotAcceptableException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
570            Self::NotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
571            Self::RequestTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
572            Self::UnsupportedMediaTypeException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
573            Self::Unhandled(_inner) => &_inner.meta,
574        }
575    }
576}
577impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for PostContentError {
578    fn create_unhandled_error(
579        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
580        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
581    ) -> Self {
582        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
583            source,
584            meta: meta.unwrap_or_default(),
585        })
586    }
587}
588impl ::aws_types::request_id::RequestId for crate::operation::post_content::PostContentError {
589    fn request_id(&self) -> Option<&str> {
590        self.meta().request_id()
591    }
592}
593
594pub use crate::operation::post_content::_post_content_input::PostContentInput;
595
596pub use crate::operation::post_content::_post_content_output::PostContentOutput;
597
598mod _post_content_input;
599
600mod _post_content_output;
601
602/// Builders
603pub mod builders;