Skip to main content

aws_sdk_lexruntime/operation/
post_text.rs

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