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