aws_sdk_deadline/operation/
get_step.rs

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