Skip to main content

aws_sdk_sagemakerruntime/operation/
invoke_endpoint_with_response_stream.rs

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