1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct GetTask;
6impl GetTask {
7 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_task::GetTaskInput,
14 ) -> ::std::result::Result<
15 crate::operation::get_task::GetTaskOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::get_task::GetTaskError,
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_task::GetTaskError>().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_task::GetTaskOutput>()
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_task::GetTaskInput,
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", "GetTask", input, runtime_plugins, stop_point)
51 .instrument(::tracing::debug_span!(
54 "deadline.GetTask",
55 "rpc.service" = "deadline",
56 "rpc.method" = "GetTask",
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 GetTask {
84 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
85 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetTask");
86
87 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
88 GetTaskRequestSerializer,
89 ));
90 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
91 GetTaskResponseDeserializer,
92 ));
93
94 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
95 crate::config::auth::Params::builder()
96 .operation_name("GetTask")
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("GetTask", "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("GetTask")
123 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
124 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
125 ))
126 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
127 GetTaskEndpointParamsInterceptor,
128 ))
129 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
130 crate::operation::get_task::GetTaskError,
131 >::new())
132 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
133 crate::operation::get_task::GetTaskError,
134 >::new())
135 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
136 crate::operation::get_task::GetTaskError,
137 >::new());
138
139 ::std::borrow::Cow::Owned(rcb)
140 }
141}
142
143#[derive(Debug)]
144struct GetTaskResponseDeserializer;
145impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetTaskResponseDeserializer {
146 fn deserialize_nonstreaming_with_config(
147 &self,
148 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
149 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
150 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
151 let (success, status) = (response.status().is_success(), response.status().as_u16());
152 let headers = response.headers();
153 let body = response.body().bytes().expect("body loaded");
154 #[allow(unused_mut)]
155 let mut force_error = false;
156 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
157 let parse_result = if !success && status != 200 || force_error {
158 crate::protocol_serde::shape_get_task::de_get_task_http_error(status, headers, body)
159 } else {
160 crate::protocol_serde::shape_get_task::de_get_task_http_response(status, headers, body)
161 };
162 crate::protocol_serde::type_erase_result(parse_result)
163 }
164}
165#[derive(Debug)]
166struct GetTaskRequestSerializer;
167impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetTaskRequestSerializer {
168 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
169 fn serialize_input(
170 &self,
171 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
172 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
173 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
174 let input = input.downcast::<crate::operation::get_task::GetTaskInput>().expect("correct type");
175 let _header_serialization_settings = _cfg
176 .load::<crate::serialization_settings::HeaderSerializationSettings>()
177 .cloned()
178 .unwrap_or_default();
179 let mut request_builder = {
180 #[allow(clippy::uninlined_format_args)]
181 fn uri_base(
182 _input: &crate::operation::get_task::GetTaskInput,
183 output: &mut ::std::string::String,
184 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
185 use ::std::fmt::Write as _;
186 let input_1 = &_input.farm_id;
187 let input_1 = input_1
188 .as_ref()
189 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("farm_id", "cannot be empty or unset"))?;
190 let farm_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
191 if farm_id.is_empty() {
192 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
193 "farm_id",
194 "cannot be empty or unset",
195 ));
196 }
197 let input_2 = &_input.queue_id;
198 let input_2 = input_2
199 .as_ref()
200 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("queue_id", "cannot be empty or unset"))?;
201 let queue_id = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
202 if queue_id.is_empty() {
203 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
204 "queue_id",
205 "cannot be empty or unset",
206 ));
207 }
208 let input_3 = &_input.job_id;
209 let input_3 = input_3
210 .as_ref()
211 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset"))?;
212 let job_id = ::aws_smithy_http::label::fmt_string(input_3, ::aws_smithy_http::label::EncodingStrategy::Default);
213 if job_id.is_empty() {
214 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
215 "job_id",
216 "cannot be empty or unset",
217 ));
218 }
219 let input_4 = &_input.step_id;
220 let input_4 = input_4
221 .as_ref()
222 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("step_id", "cannot be empty or unset"))?;
223 let step_id = ::aws_smithy_http::label::fmt_string(input_4, ::aws_smithy_http::label::EncodingStrategy::Default);
224 if step_id.is_empty() {
225 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
226 "step_id",
227 "cannot be empty or unset",
228 ));
229 }
230 let input_5 = &_input.task_id;
231 let input_5 = input_5
232 .as_ref()
233 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("task_id", "cannot be empty or unset"))?;
234 let task_id = ::aws_smithy_http::label::fmt_string(input_5, ::aws_smithy_http::label::EncodingStrategy::Default);
235 if task_id.is_empty() {
236 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
237 "task_id",
238 "cannot be empty or unset",
239 ));
240 }
241 ::std::write!(
242 output,
243 "/2023-10-12/farms/{farmId}/queues/{queueId}/jobs/{jobId}/steps/{stepId}/tasks/{taskId}",
244 farmId = farm_id,
245 queueId = queue_id,
246 jobId = job_id,
247 stepId = step_id,
248 taskId = task_id
249 )
250 .expect("formatting should succeed");
251 ::std::result::Result::Ok(())
252 }
253 #[allow(clippy::unnecessary_wraps)]
254 fn update_http_builder(
255 input: &crate::operation::get_task::GetTaskInput,
256 builder: ::http_1x::request::Builder,
257 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
258 let mut uri = ::std::string::String::new();
259 uri_base(input, &mut uri)?;
260 ::std::result::Result::Ok(builder.method("GET").uri(uri))
261 }
262 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
263 builder
264 };
265 let body = ::aws_smithy_types::body::SdkBody::from("");
266
267 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
268 }
269}
270#[derive(Debug)]
271struct GetTaskEndpointParamsInterceptor;
272
273#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
274impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetTaskEndpointParamsInterceptor {
275 fn name(&self) -> &'static str {
276 "GetTaskEndpointParamsInterceptor"
277 }
278
279 fn read_before_execution(
280 &self,
281 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
282 '_,
283 ::aws_smithy_runtime_api::client::interceptors::context::Input,
284 ::aws_smithy_runtime_api::client::interceptors::context::Output,
285 ::aws_smithy_runtime_api::client::interceptors::context::Error,
286 >,
287 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
288 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
289 let _input = context
290 .input()
291 .downcast_ref::<GetTaskInput>()
292 .ok_or("failed to downcast to GetTaskInput")?;
293
294 let endpoint_prefix = ::aws_smithy_runtime_api::client::endpoint::EndpointPrefix::new("management.").map_err(|err| {
295 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint prefix could not be built", err)
296 })?;
297 cfg.interceptor_state().store_put(endpoint_prefix);
298
299 let params = crate::config::endpoint::Params::builder()
300 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
301 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
302 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
303 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
304 .build()
305 .map_err(|err| {
306 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
307 })?;
308 cfg.interceptor_state()
309 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
310 ::std::result::Result::Ok(())
311 }
312}
313
314#[non_exhaustive]
319#[derive(::std::fmt::Debug)]
320pub enum GetTaskError {
321 AccessDeniedException(crate::types::error::AccessDeniedException),
323 InternalServerErrorException(crate::types::error::InternalServerErrorException),
325 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
327 ThrottlingException(crate::types::error::ThrottlingException),
329 ValidationException(crate::types::error::ValidationException),
331 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
333 variable wildcard pattern and check `.code()`:
334 \
335 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
336 \
337 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetTaskError) for what information is available for the error.")]
338 Unhandled(crate::error::sealed_unhandled::Unhandled),
339}
340impl GetTaskError {
341 pub fn unhandled(
343 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
344 ) -> Self {
345 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
346 source: err.into(),
347 meta: ::std::default::Default::default(),
348 })
349 }
350
351 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
353 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
354 source: err.clone().into(),
355 meta: err,
356 })
357 }
358 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
363 match self {
364 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
365 Self::InternalServerErrorException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
366 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
367 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
368 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
369 Self::Unhandled(e) => &e.meta,
370 }
371 }
372 pub fn is_access_denied_exception(&self) -> bool {
374 matches!(self, Self::AccessDeniedException(_))
375 }
376 pub fn is_internal_server_error_exception(&self) -> bool {
378 matches!(self, Self::InternalServerErrorException(_))
379 }
380 pub fn is_resource_not_found_exception(&self) -> bool {
382 matches!(self, Self::ResourceNotFoundException(_))
383 }
384 pub fn is_throttling_exception(&self) -> bool {
386 matches!(self, Self::ThrottlingException(_))
387 }
388 pub fn is_validation_exception(&self) -> bool {
390 matches!(self, Self::ValidationException(_))
391 }
392}
393impl ::std::error::Error for GetTaskError {
394 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
395 match self {
396 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
397 Self::InternalServerErrorException(_inner) => ::std::option::Option::Some(_inner),
398 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
399 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
400 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
401 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
402 }
403 }
404}
405impl ::std::fmt::Display for GetTaskError {
406 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
407 match self {
408 Self::AccessDeniedException(_inner) => _inner.fmt(f),
409 Self::InternalServerErrorException(_inner) => _inner.fmt(f),
410 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
411 Self::ThrottlingException(_inner) => _inner.fmt(f),
412 Self::ValidationException(_inner) => _inner.fmt(f),
413 Self::Unhandled(_inner) => {
414 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
415 write!(f, "unhandled error ({code})")
416 } else {
417 f.write_str("unhandled error")
418 }
419 }
420 }
421 }
422}
423impl ::aws_smithy_types::retry::ProvideErrorKind for GetTaskError {
424 fn code(&self) -> ::std::option::Option<&str> {
425 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
426 }
427 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
428 match self {
429 Self::InternalServerErrorException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
430 Self::ThrottlingException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
431 _ => ::std::option::Option::None,
432 }
433 }
434}
435impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetTaskError {
436 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
437 match self {
438 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
439 Self::InternalServerErrorException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
440 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
441 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
442 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
443 Self::Unhandled(_inner) => &_inner.meta,
444 }
445 }
446}
447impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetTaskError {
448 fn create_unhandled_error(
449 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
450 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
451 ) -> Self {
452 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
453 source,
454 meta: meta.unwrap_or_default(),
455 })
456 }
457}
458impl ::aws_types::request_id::RequestId for crate::operation::get_task::GetTaskError {
459 fn request_id(&self) -> Option<&str> {
460 self.meta().request_id()
461 }
462}
463
464pub use crate::operation::get_task::_get_task_input::GetTaskInput;
465
466pub use crate::operation::get_task::_get_task_output::GetTaskOutput;
467
468mod _get_task_input;
469
470mod _get_task_output;
471
472pub mod builders;