Skip to main content

aws_sdk_datasync/operation/
describe_location_fsx_ontap.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `DescribeLocationFsxOntap`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct DescribeLocationFsxOntap;
6impl DescribeLocationFsxOntap {
7    /// Creates a new `DescribeLocationFsxOntap`
8    pub fn new() -> Self {
9        Self
10    }
11    /// The schema for this operation's input shape.
12    pub const INPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
13        crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapInput::SCHEMA;
14    /// The schema for this operation's output shape.
15    pub const OUTPUT_SCHEMA: &'static ::aws_smithy_schema::Schema<'static> =
16        crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapOutput::SCHEMA;
17    pub(crate) async fn orchestrate(
18        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
19        input: crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapInput,
20    ) -> ::std::result::Result<
21        crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapOutput,
22        ::aws_smithy_runtime_api::client::result::SdkError<
23            crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError,
24            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
25        >,
26    > {
27        let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
28            ::aws_smithy_runtime_api::client::interceptors::context::Error,
29            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
30        >| {
31            err.map_service_error(|err| {
32                err.downcast::<crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError>()
33                    .expect("correct error type")
34            })
35        };
36        let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
37            .await
38            .map_err(map_err)?;
39        let output = context.finalize().map_err(map_err)?;
40        ::std::result::Result::Ok(
41            output
42                .downcast::<crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapOutput>()
43                .expect("correct output type"),
44        )
45    }
46
47    pub(crate) async fn orchestrate_with_stop_point(
48        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
49        input: crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapInput,
50        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
51    ) -> ::std::result::Result<
52        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
53        ::aws_smithy_runtime_api::client::result::SdkError<
54            ::aws_smithy_runtime_api::client::interceptors::context::Error,
55            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
56        >,
57    > {
58        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
59        use ::tracing::Instrument;
60        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("DataSync", "DescribeLocationFsxOntap", input, runtime_plugins, stop_point)
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                "DataSync.DescribeLocationFsxOntap",
65                "rpc.service" = "DataSync",
66                "rpc.method" = "DescribeLocationFsxOntap",
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}
93/// Per-operation error registry. Contains an entry for every modeled
94/// error this operation can throw.
95///
96/// Used by the schema-serde error path as the operation-scoped lookup
97/// for registry-backed error reification: an error code that does not
98/// match one of the operation's modeled errors directly is resolved
99/// against this registry first, then widened to the service-wide error
100/// registry.
101pub(crate) mod error_registry {
102    pub(crate) static REGISTRY: ::std::sync::LazyLock<::aws_smithy_schema::registry::TypeRegistry> = ::std::sync::LazyLock::new(|| {
103        ::aws_smithy_schema::registry::TypeRegistry::builder()
104                            .insert_error_shape(
105                        crate::types::error::InternalException::SCHEMA,
106                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
107                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InternalException::deserialize(d)?))
108                        },
109                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
110                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InternalException::deserialize(d)?))
111                        },
112                    )
113.insert_error_shape(
114                        crate::types::error::InvalidRequestException::SCHEMA,
115                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::aws_smithy_types::type_erasure::TypeErasedBox, ::aws_smithy_schema::serde::SerdeError> {
116                            ::std::result::Result::Ok(::aws_smithy_types::type_erasure::TypeErasedBox::new(crate::types::error::InvalidRequestException::deserialize(d)?))
117                        },
118                        |d: &mut dyn ::aws_smithy_schema::serde::ShapeDeserializer| -> ::std::result::Result<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync>, ::aws_smithy_schema::serde::SerdeError> {
119                            ::std::result::Result::Ok(::std::boxed::Box::new(crate::types::error::InvalidRequestException::deserialize(d)?))
120                        },
121                    )
122                            .build()
123    });
124}
125impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for DescribeLocationFsxOntap {
126    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
127        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("DescribeLocationFsxOntap");
128
129        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
130            DescribeLocationFsxOntapRequestSerializer,
131        ));
132        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
133            DescribeLocationFsxOntapResponseDeserializer,
134        ));
135
136        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
137            crate::config::auth::Params::builder()
138                .operation_name("DescribeLocationFsxOntap")
139                .build()
140                .expect("required fields set"),
141        ));
142
143        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::SensitiveOutput);
144        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new(
145            "DescribeLocationFsxOntap",
146            "DataSync",
147        ));
148        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
149        signing_options.double_uri_encode = true;
150        signing_options.content_sha256_header = false;
151        signing_options.normalize_uri_path = true;
152        signing_options.payload_override = None;
153
154        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
155            signing_options,
156            ..::std::default::Default::default()
157        });
158
159        ::std::option::Option::Some(cfg.freeze())
160    }
161
162    fn runtime_components(
163        &self,
164        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
165    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
166        #[allow(unused_mut)]
167        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("DescribeLocationFsxOntap")
168            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
169                DescribeLocationFsxOntapTelemetryInputCaptureInterceptor,
170            ))
171            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
172                ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
173            ))
174            .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
175                DescribeLocationFsxOntapEndpointParamsInterceptor,
176            ))
177            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
178                crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError,
179            >::new())
180            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
181                crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError,
182            >::new())
183            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
184                crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError,
185            >::new())
186            .with_retry_classifier(::aws_runtime::service_clock_skew::ServiceClockSkewClassifier::<
187                crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError,
188            >::new());
189
190        ::std::borrow::Cow::Owned(rcb)
191    }
192}
193
194#[derive(Debug)]
195struct DescribeLocationFsxOntapTelemetryInputCaptureInterceptor;
196
197#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
198impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DescribeLocationFsxOntapTelemetryInputCaptureInterceptor {
199    fn name(&self) -> &'static str {
200        "DescribeLocationFsxOntapTelemetryInputCaptureInterceptor"
201    }
202
203    fn read_before_execution(
204        &self,
205        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
206            '_,
207            ::aws_smithy_runtime_api::client::interceptors::context::Input,
208            ::aws_smithy_runtime_api::client::interceptors::context::Output,
209            ::aws_smithy_runtime_api::client::interceptors::context::Error,
210        >,
211        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
212    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
213        // Nothing to do unless the customer opted in by naming members to record.
214        let ::std::option::Option::Some(requested) = cfg
215            .load::<::aws_smithy_types::telemetry::RequestedTelemetryAttributes>()
216            .filter(|r| !r.is_empty())
217        else {
218            return ::std::result::Result::Ok(());
219        };
220
221        let ::std::option::Option::Some(input) = context.input().downcast_ref::<DescribeLocationFsxOntapInput>() else {
222            // A mismatched input is not this interceptor's concern; skip quietly.
223            return ::std::result::Result::Ok(());
224        };
225
226        let mut captured = ::aws_smithy_types::telemetry::CapturedTelemetryAttributes::default();
227        if requested.should_capture("LocationArn") {
228            if let ::std::option::Option::Some(value) = input.location_arn.as_deref() {
229                captured.insert("LocationArn", value);
230            }
231        }
232
233        cfg.interceptor_state().store_put(captured);
234        ::std::result::Result::Ok(())
235    }
236}
237#[derive(Debug)]
238struct DescribeLocationFsxOntapResponseDeserializer;
239impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DescribeLocationFsxOntapResponseDeserializer {
240    fn deserialize_nonstreaming_with_config(
241        &self,
242        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
243        _cfg: &::aws_smithy_types::config_bag::ConfigBag,
244    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
245        let (success, status) = (response.status().is_success(), response.status().as_u16());
246        // Load body and headers BEFORE BeforeParseResponse so customizations
247        // (e.g., S3's `body_is_error` check that detects errors returned with
248        // HTTP 200) can inspect them. The legacy non-streaming path also
249        // loads `body` before firing this hook.
250        #[allow(unused_variables)]
251        let body = response.body().bytes().expect("body loaded");
252        let headers = response.headers();
253        #[allow(unused_mut)]
254        let mut force_error = false;
255        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
256        if !success && status != 200 || force_error {
257            let protocol = _cfg
258                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
259                .expect("a SharedClientProtocol is required");
260            #[allow(unused_mut)]
261            let mut generic_builder = protocol.parse_error_metadata(response, _cfg).map_err(|e| {
262                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
263            })?;
264            generic_builder = ::aws_types::request_id::apply_request_id(generic_builder, headers);
265            let generic = generic_builder.build();
266            let error_code = match generic.code() {
267                ::std::option::Option::Some(code) => code,
268                ::std::option::Option::None => {
269                    return ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(
270                        ::aws_smithy_runtime_api::box_error::BoxError::from(
271                            crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError::unhandled(generic),
272                        ),
273                    ))
274                }
275            };
276            let _error_message = generic.message().map(|msg| msg.to_owned());
277            let err = match error_code {
278                "InternalException" => crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError::InternalException({
279                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
280                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
281                            e,
282                        ))
283                    })?;
284                    let mut tmp = <crate::types::error::builders::InternalExceptionBuilder>::default();
285                    tmp.deserialize_members(&mut *deser).map_err(|e| {
286                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
287                            e,
288                        ))
289                    })?;
290                    if tmp.message.is_none() {
291                        tmp.message = _error_message;
292                    }
293                    let tmp = tmp.meta(generic);
294                    tmp.build()
295                }),
296                "InvalidRequestException" => crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError::InvalidRequestException({
297                    let mut deser = protocol.deserialize_error_response(response, _cfg).map_err(|e| {
298                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
299                            e,
300                        ))
301                    })?;
302                    let mut tmp = <crate::types::error::builders::InvalidRequestExceptionBuilder>::default();
303                    tmp.deserialize_members(&mut *deser).map_err(|e| {
304                        ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(
305                            e,
306                        ))
307                    })?;
308                    if tmp.message.is_none() {
309                        tmp.message = _error_message;
310                    }
311                    let tmp = tmp.meta(generic);
312                    tmp.build()
313                }),
314                _ => {
315                    // Registry-backed, operation-scoped reification of an error whose
316                    // code this operation does not model directly: the operation's own
317                    // error registry is consulted first, then the lookup widens to the
318                    // service-wide error registry. On a hit, the reified error is attached
319                    // as the source of the returned unhandled error while its metadata
320                    // (code, message, request id) is preserved; on a miss the generic
321                    // error is returned unchanged.
322                    match protocol
323                        .deserialize_error_response(response, _cfg)
324                        .ok()
325                        .and_then(|mut deser| {
326                            ::aws_smithy_schema::registry::reify_error(
327                                crate::operation::describe_location_fsx_ontap::error_registry::REGISTRY
328                                    .or(&crate::error_type_registry::REGISTRY),
329                                error_code,
330                                &mut *deser,
331                            )
332                        }) {
333                        ::std::option::Option::Some(source) => <crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError as ::aws_smithy_runtime_api::client::result::CreateUnhandledError>::create_unhandled_error(source, ::std::option::Option::Some(generic)),
334                        ::std::option::Option::None => crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError::generic(generic),
335                    }
336                }
337            };
338            ::std::result::Result::Err(::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::operation(
339                ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(err),
340            ))
341        } else {
342            let protocol = _cfg
343                .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
344                .expect("a SharedClientProtocol is required");
345            let mut deser = protocol
346                .deserialize_response(response, DescribeLocationFsxOntap::OUTPUT_SCHEMA, _cfg)
347                .map_err(|e| {
348                    ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
349                })?;
350            // `headers` is already in scope from the top of the function; alias it as
351            // `_response_headers` so MutateOutput customizations have a stable name to
352            // read from.
353            let _response_headers = headers;
354            // `mut` is required because `deserialize_members` and the `MutateOutput`
355            // builder setters take `&mut self`. Marked `allow(unused_mut)` because an
356            // empty output has no members and no customizations to run.
357            #[allow(unused_mut)]
358            let mut output = <crate::operation::describe_location_fsx_ontap::builders::DescribeLocationFsxOntapOutputBuilder>::default();
359            output.deserialize_members(&mut *deser).map_err(|e| {
360                ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError::other(::aws_smithy_runtime_api::box_error::BoxError::from(e))
361            })?;
362            output._set_request_id(::aws_types::request_id::RequestId::request_id(_response_headers).map(str::to_string));
363            let output = output.build();
364            ::std::result::Result::Ok(::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output))
365        }
366    }
367}
368#[derive(Debug)]
369struct DescribeLocationFsxOntapRequestSerializer;
370impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DescribeLocationFsxOntapRequestSerializer {
371    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
372    fn serialize_input(
373        &self,
374        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
375        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
376    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
377        let input = input
378            .downcast::<crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapInput>()
379            .expect("correct type");
380
381        let protocol = _cfg
382            .load::<::aws_smithy_schema::protocol::SharedClientProtocol>()
383            .expect("a SharedClientProtocol is required");
384        let mut request = protocol
385            .serialize_request(&input, DescribeLocationFsxOntap::INPUT_SCHEMA, "/", _cfg)
386            .map_err(::aws_smithy_runtime_api::box_error::BoxError::from)?;
387
388        return ::std::result::Result::Ok(request);
389    }
390}
391#[derive(Debug)]
392struct DescribeLocationFsxOntapEndpointParamsInterceptor;
393
394#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
395impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DescribeLocationFsxOntapEndpointParamsInterceptor {
396    fn name(&self) -> &'static str {
397        "DescribeLocationFsxOntapEndpointParamsInterceptor"
398    }
399
400    fn read_before_execution(
401        &self,
402        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
403            '_,
404            ::aws_smithy_runtime_api::client::interceptors::context::Input,
405            ::aws_smithy_runtime_api::client::interceptors::context::Output,
406            ::aws_smithy_runtime_api::client::interceptors::context::Error,
407        >,
408        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
409    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
410        let _input = context
411            .input()
412            .downcast_ref::<DescribeLocationFsxOntapInput>()
413            .ok_or("failed to downcast to DescribeLocationFsxOntapInput")?;
414
415        let params = crate::config::endpoint::Params::builder()
416            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
417            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
418            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
419            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
420            .build()
421            .map_err(|err| {
422                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
423            })?;
424        cfg.interceptor_state()
425            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
426        ::std::result::Result::Ok(())
427    }
428}
429
430// The get_* functions below are generated from JMESPath expressions in the
431// operationContextParams trait. They target the operation's input shape.
432
433/// Error type for the `DescribeLocationFsxOntapError` operation.
434#[non_exhaustive]
435#[derive(::std::fmt::Debug)]
436pub enum DescribeLocationFsxOntapError {
437    /// <p>This exception is thrown when an error occurs in the DataSync service.</p>
438    InternalException(crate::types::error::InternalException),
439    /// <p>This exception is thrown when the client submits a malformed request.</p>
440    InvalidRequestException(crate::types::error::InvalidRequestException),
441    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
442    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
443    variable wildcard pattern and check `.code()`:
444     \
445    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
446     \
447    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DescribeLocationFsxOntapError) for what information is available for the error.")]
448    Unhandled(crate::error::sealed_unhandled::Unhandled),
449}
450impl DescribeLocationFsxOntapError {
451    /// Creates the `DescribeLocationFsxOntapError::Unhandled` variant from any error type.
452    pub fn unhandled(
453        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
454    ) -> Self {
455        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
456            source: err.into(),
457            meta: ::std::default::Default::default(),
458        })
459    }
460
461    /// Creates the `DescribeLocationFsxOntapError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
462    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
463        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
464            source: err.clone().into(),
465            meta: err,
466        })
467    }
468    ///
469    /// Returns error metadata, which includes the error code, message,
470    /// request ID, and potentially additional information.
471    ///
472    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
473        match self {
474            Self::InternalException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
475            Self::InvalidRequestException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
476            Self::Unhandled(e) => &e.meta,
477        }
478    }
479    /// Returns `true` if the error kind is `DescribeLocationFsxOntapError::InternalException`.
480    pub fn is_internal_exception(&self) -> bool {
481        matches!(self, Self::InternalException(_))
482    }
483    /// Returns `true` if the error kind is `DescribeLocationFsxOntapError::InvalidRequestException`.
484    pub fn is_invalid_request_exception(&self) -> bool {
485        matches!(self, Self::InvalidRequestException(_))
486    }
487}
488impl ::std::error::Error for DescribeLocationFsxOntapError {
489    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
490        match self {
491            Self::InternalException(_inner) => ::std::option::Option::Some(_inner),
492            Self::InvalidRequestException(_inner) => ::std::option::Option::Some(_inner),
493            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
494        }
495    }
496}
497impl ::std::fmt::Display for DescribeLocationFsxOntapError {
498    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
499        match self {
500            Self::InternalException(_inner) => _inner.fmt(f),
501            Self::InvalidRequestException(_inner) => _inner.fmt(f),
502            Self::Unhandled(_inner) => {
503                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
504                    write!(f, "unhandled error ({code})")
505                } else {
506                    f.write_str("unhandled error")
507                }
508            }
509        }
510    }
511}
512impl ::aws_smithy_types::retry::ProvideErrorKind for DescribeLocationFsxOntapError {
513    fn code(&self) -> ::std::option::Option<&str> {
514        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
515    }
516    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
517        ::std::option::Option::None
518    }
519}
520impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DescribeLocationFsxOntapError {
521    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
522        match self {
523            Self::InternalException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
524            Self::InvalidRequestException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
525            Self::Unhandled(_inner) => &_inner.meta,
526        }
527    }
528}
529impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DescribeLocationFsxOntapError {
530    fn create_unhandled_error(
531        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
532        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
533    ) -> Self {
534        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
535            source,
536            meta: meta.unwrap_or_default(),
537        })
538    }
539}
540impl ::aws_types::request_id::RequestId for crate::operation::describe_location_fsx_ontap::DescribeLocationFsxOntapError {
541    fn request_id(&self) -> Option<&str> {
542        self.meta().request_id()
543    }
544}
545
546pub use crate::operation::describe_location_fsx_ontap::_describe_location_fsx_ontap_input::DescribeLocationFsxOntapInput;
547
548pub use crate::operation::describe_location_fsx_ontap::_describe_location_fsx_ontap_output::DescribeLocationFsxOntapOutput;
549
550mod _describe_location_fsx_ontap_input;
551
552mod _describe_location_fsx_ontap_output;
553
554/// Builders
555pub mod builders;