aws_sdk_omics/operation/
get_run.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2/// Orchestration and serialization glue logic for `GetRun`.
3#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetRun;
6impl GetRun {
7    /// Creates a new `GetRun`
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::get_run::GetRunInput,
14    ) -> ::std::result::Result<
15        crate::operation::get_run::GetRunOutput,
16        ::aws_smithy_runtime_api::client::result::SdkError<
17            crate::operation::get_run::GetRunError,
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::get_run::GetRunError>().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(output.downcast::<crate::operation::get_run::GetRunOutput>().expect("correct output type"))
31    }
32
33    pub(crate) async fn orchestrate_with_stop_point(
34        runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
35        input: crate::operation::get_run::GetRunInput,
36        stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
37    ) -> ::std::result::Result<
38        ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
39        ::aws_smithy_runtime_api::client::result::SdkError<
40            ::aws_smithy_runtime_api::client::interceptors::context::Error,
41            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
42        >,
43    > {
44        let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
45        use ::tracing::Instrument;
46        ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("Omics", "GetRun", input, runtime_plugins, stop_point)
47            // Create a parent span for the entire operation. Includes a random, internal-only,
48            // seven-digit ID for the operation orchestration so that it can be correlated in the logs.
49            .instrument(::tracing::debug_span!(
50                "Omics.GetRun",
51                "rpc.service" = "Omics",
52                "rpc.method" = "GetRun",
53                "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
54                "rpc.system" = "aws-api",
55            ))
56            .await
57    }
58
59    pub(crate) fn operation_runtime_plugins(
60        client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
61        client_config: &crate::config::Config,
62        config_override: ::std::option::Option<crate::config::Builder>,
63    ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
64        let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
65
66        if let ::std::option::Option::Some(config_override) = config_override {
67            for plugin in config_override.runtime_plugins.iter().cloned() {
68                runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
69            }
70            runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
71                config_override,
72                client_config.config.clone(),
73                &client_config.runtime_components,
74            ));
75        }
76        runtime_plugins
77    }
78}
79impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetRun {
80    fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
81        let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetRun");
82
83        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
84            GetRunRequestSerializer,
85        ));
86        cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
87            GetRunResponseDeserializer,
88        ));
89
90        cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
91            crate::config::auth::Params::builder()
92                .operation_name("GetRun")
93                .build()
94                .expect("required fields set"),
95        ));
96
97        cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("GetRun", "Omics"));
98        let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
99        signing_options.double_uri_encode = true;
100        signing_options.content_sha256_header = false;
101        signing_options.normalize_uri_path = true;
102        signing_options.payload_override = None;
103
104        cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
105            signing_options,
106            ..::std::default::Default::default()
107        });
108
109        ::std::option::Option::Some(cfg.freeze())
110    }
111
112    fn runtime_components(
113        &self,
114        _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
115    ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
116        #[allow(unused_mut)]
117        let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetRun")
118            .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default())
119            .with_interceptor(GetRunEndpointParamsInterceptor)
120            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
121                crate::operation::get_run::GetRunError,
122            >::new())
123            .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
124                crate::operation::get_run::GetRunError,
125            >::new())
126            .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
127                crate::operation::get_run::GetRunError,
128            >::new());
129
130        ::std::borrow::Cow::Owned(rcb)
131    }
132}
133
134#[derive(Debug)]
135struct GetRunResponseDeserializer;
136impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetRunResponseDeserializer {
137    fn deserialize_nonstreaming(
138        &self,
139        response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
140    ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
141        let (success, status) = (response.status().is_success(), response.status().as_u16());
142        let headers = response.headers();
143        let body = response.body().bytes().expect("body loaded");
144        #[allow(unused_mut)]
145        let mut force_error = false;
146        ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
147        let parse_result = if !success && status != 200 || force_error {
148            crate::protocol_serde::shape_get_run::de_get_run_http_error(status, headers, body)
149        } else {
150            crate::protocol_serde::shape_get_run::de_get_run_http_response(status, headers, body)
151        };
152        crate::protocol_serde::type_erase_result(parse_result)
153    }
154}
155#[derive(Debug)]
156struct GetRunRequestSerializer;
157impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetRunRequestSerializer {
158    #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
159    fn serialize_input(
160        &self,
161        input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
162        _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
163    ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
164        let input = input.downcast::<crate::operation::get_run::GetRunInput>().expect("correct type");
165        let _header_serialization_settings = _cfg
166            .load::<crate::serialization_settings::HeaderSerializationSettings>()
167            .cloned()
168            .unwrap_or_default();
169        let mut request_builder = {
170            fn uri_base(
171                _input: &crate::operation::get_run::GetRunInput,
172                output: &mut ::std::string::String,
173            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
174                use ::std::fmt::Write as _;
175                let input_1 = &_input.id;
176                let input_1 = input_1
177                    .as_ref()
178                    .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("id", "cannot be empty or unset"))?;
179                let id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
180                if id.is_empty() {
181                    return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
182                        "id",
183                        "cannot be empty or unset",
184                    ));
185                }
186                ::std::write!(output, "/run/{id}", id = id).expect("formatting should succeed");
187                ::std::result::Result::Ok(())
188            }
189            fn uri_query(
190                _input: &crate::operation::get_run::GetRunInput,
191                mut output: &mut ::std::string::String,
192            ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
193                let mut query = ::aws_smithy_http::query::Writer::new(output);
194                if let ::std::option::Option::Some(inner_2) = &_input.export {
195                    {
196                        for inner_3 in inner_2 {
197                            query.push_kv("export", &::aws_smithy_http::query::fmt_string(inner_3));
198                        }
199                    }
200                }
201                ::std::result::Result::Ok(())
202            }
203            #[allow(clippy::unnecessary_wraps)]
204            fn update_http_builder(
205                input: &crate::operation::get_run::GetRunInput,
206                builder: ::http::request::Builder,
207            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
208                let mut uri = ::std::string::String::new();
209                uri_base(input, &mut uri)?;
210                uri_query(input, &mut uri)?;
211                ::std::result::Result::Ok(builder.method("GET").uri(uri))
212            }
213            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
214            builder
215        };
216        let body = ::aws_smithy_types::body::SdkBody::from("");
217
218        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
219    }
220}
221#[derive(Debug)]
222struct GetRunEndpointParamsInterceptor;
223
224impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetRunEndpointParamsInterceptor {
225    fn name(&self) -> &'static str {
226        "GetRunEndpointParamsInterceptor"
227    }
228
229    fn read_before_execution(
230        &self,
231        context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
232            '_,
233            ::aws_smithy_runtime_api::client::interceptors::context::Input,
234            ::aws_smithy_runtime_api::client::interceptors::context::Output,
235            ::aws_smithy_runtime_api::client::interceptors::context::Error,
236        >,
237        cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
238    ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
239        let _input = context.input().downcast_ref::<GetRunInput>().ok_or("failed to downcast to GetRunInput")?;
240
241        let endpoint_prefix = ::aws_smithy_runtime_api::client::endpoint::EndpointPrefix::new("workflows-").map_err(|err| {
242            ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint prefix could not be built", err)
243        })?;
244        cfg.interceptor_state().store_put(endpoint_prefix);
245
246        let params = crate::config::endpoint::Params::builder()
247            .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
248            .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
249            .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
250            .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
251            .build()
252            .map_err(|err| {
253                ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
254            })?;
255        cfg.interceptor_state()
256            .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
257        ::std::result::Result::Ok(())
258    }
259}
260
261// The get_* functions below are generated from JMESPath expressions in the
262// operationContextParams trait. They target the operation's input shape.
263
264/// Error type for the `GetRunError` operation.
265#[non_exhaustive]
266#[derive(::std::fmt::Debug)]
267pub enum GetRunError {
268    /// <p>You do not have sufficient access to perform this action.</p>
269    AccessDeniedException(crate::types::error::AccessDeniedException),
270    /// <p>The request cannot be applied to the target resource in its current state.</p>
271    ConflictException(crate::types::error::ConflictException),
272    /// <p>An unexpected error occurred. Try the request again.</p>
273    InternalServerException(crate::types::error::InternalServerException),
274    /// <p>The request timed out.</p>
275    RequestTimeoutException(crate::types::error::RequestTimeoutException),
276    /// <p>The target resource was not found in the current Region.</p>
277    ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
278    /// <p>The request exceeds a service quota.</p>
279    ServiceQuotaExceededException(crate::types::error::ServiceQuotaExceededException),
280    /// <p>The request was denied due to request throttling.</p>
281    ThrottlingException(crate::types::error::ThrottlingException),
282    /// <p>The input fails to satisfy the constraints specified by an AWS service.</p>
283    ValidationException(crate::types::error::ValidationException),
284    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
285    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
286    variable wildcard pattern and check `.code()`:
287     \
288    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
289     \
290    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetRunError) for what information is available for the error.")]
291    Unhandled(crate::error::sealed_unhandled::Unhandled),
292}
293impl GetRunError {
294    /// Creates the `GetRunError::Unhandled` variant from any error type.
295    pub fn unhandled(
296        err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
297    ) -> Self {
298        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
299            source: err.into(),
300            meta: ::std::default::Default::default(),
301        })
302    }
303
304    /// Creates the `GetRunError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata).
305    pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
306        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
307            source: err.clone().into(),
308            meta: err,
309        })
310    }
311    ///
312    /// Returns error metadata, which includes the error code, message,
313    /// request ID, and potentially additional information.
314    ///
315    pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
316        match self {
317            Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
318            Self::ConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
319            Self::InternalServerException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
320            Self::RequestTimeoutException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
321            Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
322            Self::ServiceQuotaExceededException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
323            Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
324            Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
325            Self::Unhandled(e) => &e.meta,
326        }
327    }
328    /// Returns `true` if the error kind is `GetRunError::AccessDeniedException`.
329    pub fn is_access_denied_exception(&self) -> bool {
330        matches!(self, Self::AccessDeniedException(_))
331    }
332    /// Returns `true` if the error kind is `GetRunError::ConflictException`.
333    pub fn is_conflict_exception(&self) -> bool {
334        matches!(self, Self::ConflictException(_))
335    }
336    /// Returns `true` if the error kind is `GetRunError::InternalServerException`.
337    pub fn is_internal_server_exception(&self) -> bool {
338        matches!(self, Self::InternalServerException(_))
339    }
340    /// Returns `true` if the error kind is `GetRunError::RequestTimeoutException`.
341    pub fn is_request_timeout_exception(&self) -> bool {
342        matches!(self, Self::RequestTimeoutException(_))
343    }
344    /// Returns `true` if the error kind is `GetRunError::ResourceNotFoundException`.
345    pub fn is_resource_not_found_exception(&self) -> bool {
346        matches!(self, Self::ResourceNotFoundException(_))
347    }
348    /// Returns `true` if the error kind is `GetRunError::ServiceQuotaExceededException`.
349    pub fn is_service_quota_exceeded_exception(&self) -> bool {
350        matches!(self, Self::ServiceQuotaExceededException(_))
351    }
352    /// Returns `true` if the error kind is `GetRunError::ThrottlingException`.
353    pub fn is_throttling_exception(&self) -> bool {
354        matches!(self, Self::ThrottlingException(_))
355    }
356    /// Returns `true` if the error kind is `GetRunError::ValidationException`.
357    pub fn is_validation_exception(&self) -> bool {
358        matches!(self, Self::ValidationException(_))
359    }
360}
361impl ::std::error::Error for GetRunError {
362    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
363        match self {
364            Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
365            Self::ConflictException(_inner) => ::std::option::Option::Some(_inner),
366            Self::InternalServerException(_inner) => ::std::option::Option::Some(_inner),
367            Self::RequestTimeoutException(_inner) => ::std::option::Option::Some(_inner),
368            Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
369            Self::ServiceQuotaExceededException(_inner) => ::std::option::Option::Some(_inner),
370            Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
371            Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
372            Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
373        }
374    }
375}
376impl ::std::fmt::Display for GetRunError {
377    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
378        match self {
379            Self::AccessDeniedException(_inner) => _inner.fmt(f),
380            Self::ConflictException(_inner) => _inner.fmt(f),
381            Self::InternalServerException(_inner) => _inner.fmt(f),
382            Self::RequestTimeoutException(_inner) => _inner.fmt(f),
383            Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
384            Self::ServiceQuotaExceededException(_inner) => _inner.fmt(f),
385            Self::ThrottlingException(_inner) => _inner.fmt(f),
386            Self::ValidationException(_inner) => _inner.fmt(f),
387            Self::Unhandled(_inner) => {
388                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
389                    write!(f, "unhandled error ({code})")
390                } else {
391                    f.write_str("unhandled error")
392                }
393            }
394        }
395    }
396}
397impl ::aws_smithy_types::retry::ProvideErrorKind for GetRunError {
398    fn code(&self) -> ::std::option::Option<&str> {
399        ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
400    }
401    fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
402        match self {
403            Self::InternalServerException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
404            Self::ThrottlingException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
405            _ => ::std::option::Option::None,
406        }
407    }
408}
409impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetRunError {
410    fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
411        match self {
412            Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
413            Self::ConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
414            Self::InternalServerException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
415            Self::RequestTimeoutException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
416            Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
417            Self::ServiceQuotaExceededException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
418            Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
419            Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
420            Self::Unhandled(_inner) => &_inner.meta,
421        }
422    }
423}
424impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetRunError {
425    fn create_unhandled_error(
426        source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
427        meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
428    ) -> Self {
429        Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
430            source,
431            meta: meta.unwrap_or_default(),
432        })
433    }
434}
435impl ::aws_types::request_id::RequestId for crate::operation::get_run::GetRunError {
436    fn request_id(&self) -> Option<&str> {
437        self.meta().request_id()
438    }
439}
440
441pub use crate::operation::get_run::_get_run_output::GetRunOutput;
442
443pub use crate::operation::get_run::_get_run_input::GetRunInput;
444
445mod _get_run_input;
446
447mod _get_run_output;
448
449/// Builders
450pub mod builders;