1#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)]
4#[non_exhaustive]
5pub struct UpdateTask;
6impl UpdateTask {
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::update_task::UpdateTaskInput,
14 ) -> ::std::result::Result<
15 crate::operation::update_task::UpdateTaskOutput,
16 ::aws_smithy_runtime_api::client::result::SdkError<
17 crate::operation::update_task::UpdateTaskError,
18 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
19 >,
20 > {
21 let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<
22 ::aws_smithy_runtime_api::client::interceptors::context::Error,
23 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
24 >| {
25 err.map_service_error(|err| {
26 err.downcast::<crate::operation::update_task::UpdateTaskError>()
27 .expect("correct error type")
28 })
29 };
30 let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None)
31 .await
32 .map_err(map_err)?;
33 let output = context.finalize().map_err(map_err)?;
34 ::std::result::Result::Ok(
35 output
36 .downcast::<crate::operation::update_task::UpdateTaskOutput>()
37 .expect("correct output type"),
38 )
39 }
40
41 pub(crate) async fn orchestrate_with_stop_point(
42 runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
43 input: crate::operation::update_task::UpdateTaskInput,
44 stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint,
45 ) -> ::std::result::Result<
46 ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext,
47 ::aws_smithy_runtime_api::client::result::SdkError<
48 ::aws_smithy_runtime_api::client::interceptors::context::Error,
49 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
50 >,
51 > {
52 let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input);
53 use ::tracing::Instrument;
54 ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point("deadline", "UpdateTask", input, runtime_plugins, stop_point)
55 .instrument(::tracing::debug_span!(
58 "deadline.UpdateTask",
59 "rpc.service" = "deadline",
60 "rpc.method" = "UpdateTask",
61 "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000),
62 "rpc.system" = "aws-api",
63 ))
64 .await
65 }
66
67 pub(crate) fn operation_runtime_plugins(
68 client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins,
69 client_config: &crate::config::Config,
70 config_override: ::std::option::Option<crate::config::Builder>,
71 ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins {
72 let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new());
73 runtime_plugins = runtime_plugins.with_operation_plugin(crate::client_idempotency_token::IdempotencyTokenRuntimePlugin::new(
74 |token_provider, input| {
75 let input: &mut crate::operation::update_task::UpdateTaskInput = input.downcast_mut().expect("correct type");
76 if input.client_token.is_none() {
77 input.client_token = ::std::option::Option::Some(token_provider.make_idempotency_token());
78 }
79 },
80 ));
81 if let ::std::option::Option::Some(config_override) = config_override {
82 for plugin in config_override.runtime_plugins.iter().cloned() {
83 runtime_plugins = runtime_plugins.with_operation_plugin(plugin);
84 }
85 runtime_plugins = runtime_plugins.with_operation_plugin(crate::config::ConfigOverrideRuntimePlugin::new(
86 config_override,
87 client_config.config.clone(),
88 &client_config.runtime_components,
89 ));
90 }
91 runtime_plugins
92 }
93}
94impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for UpdateTask {
95 fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> {
96 let mut cfg = ::aws_smithy_types::config_bag::Layer::new("UpdateTask");
97
98 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(
99 UpdateTaskRequestSerializer,
100 ));
101 cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(
102 UpdateTaskResponseDeserializer,
103 ));
104
105 cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(
106 crate::config::auth::Params::builder()
107 .operation_name("UpdateTask")
108 .build()
109 .expect("required fields set"),
110 ));
111
112 cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new("UpdateTask", "deadline"));
113 let mut signing_options = ::aws_runtime::auth::SigningOptions::default();
114 signing_options.double_uri_encode = true;
115 signing_options.content_sha256_header = false;
116 signing_options.normalize_uri_path = true;
117 signing_options.payload_override = None;
118
119 cfg.store_put(::aws_runtime::auth::SigV4OperationSigningConfig {
120 signing_options,
121 ..::std::default::Default::default()
122 });
123
124 ::std::option::Option::Some(cfg.freeze())
125 }
126
127 fn runtime_components(
128 &self,
129 _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder,
130 ) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> {
131 #[allow(unused_mut)]
132 let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("UpdateTask")
133 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
134 ::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default(),
135 ))
136 .with_interceptor(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::permanent(
137 UpdateTaskEndpointParamsInterceptor,
138 ))
139 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::<
140 crate::operation::update_task::UpdateTaskError,
141 >::new())
142 .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::<
143 crate::operation::update_task::UpdateTaskError,
144 >::new())
145 .with_retry_classifier(::aws_runtime::retries::classifiers::AwsErrorCodeClassifier::<
146 crate::operation::update_task::UpdateTaskError,
147 >::new());
148
149 ::std::borrow::Cow::Owned(rcb)
150 }
151}
152
153#[derive(Debug)]
154struct UpdateTaskResponseDeserializer;
155impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for UpdateTaskResponseDeserializer {
156 fn deserialize_nonstreaming_with_config(
157 &self,
158 response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
159 _cfg: &::aws_smithy_types::config_bag::ConfigBag,
160 ) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError {
161 let (success, status) = (response.status().is_success(), response.status().as_u16());
162 let headers = response.headers();
163 let body = response.body().bytes().expect("body loaded");
164 #[allow(unused_mut)]
165 let mut force_error = false;
166 ::tracing::debug!(request_id = ?::aws_types::request_id::RequestId::request_id(response));
167 let parse_result = if !success && status != 200 || force_error {
168 crate::protocol_serde::shape_update_task::de_update_task_http_error(status, headers, body)
169 } else {
170 crate::protocol_serde::shape_update_task::de_update_task_http_response(status, headers, body)
171 };
172 crate::protocol_serde::type_erase_result(parse_result)
173 }
174}
175#[derive(Debug)]
176struct UpdateTaskRequestSerializer;
177impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for UpdateTaskRequestSerializer {
178 #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)]
179 fn serialize_input(
180 &self,
181 input: ::aws_smithy_runtime_api::client::interceptors::context::Input,
182 _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
183 ) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> {
184 let input = input.downcast::<crate::operation::update_task::UpdateTaskInput>().expect("correct type");
185 let _header_serialization_settings = _cfg
186 .load::<crate::serialization_settings::HeaderSerializationSettings>()
187 .cloned()
188 .unwrap_or_default();
189 let mut request_builder = {
190 #[allow(clippy::uninlined_format_args)]
191 fn uri_base(
192 _input: &crate::operation::update_task::UpdateTaskInput,
193 output: &mut ::std::string::String,
194 ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> {
195 use ::std::fmt::Write as _;
196 let input_1 = &_input.farm_id;
197 let input_1 = input_1
198 .as_ref()
199 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("farm_id", "cannot be empty or unset"))?;
200 let farm_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default);
201 if farm_id.is_empty() {
202 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
203 "farm_id",
204 "cannot be empty or unset",
205 ));
206 }
207 let input_2 = &_input.queue_id;
208 let input_2 = input_2
209 .as_ref()
210 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("queue_id", "cannot be empty or unset"))?;
211 let queue_id = ::aws_smithy_http::label::fmt_string(input_2, ::aws_smithy_http::label::EncodingStrategy::Default);
212 if queue_id.is_empty() {
213 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
214 "queue_id",
215 "cannot be empty or unset",
216 ));
217 }
218 let input_3 = &_input.job_id;
219 let input_3 = input_3
220 .as_ref()
221 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset"))?;
222 let job_id = ::aws_smithy_http::label::fmt_string(input_3, ::aws_smithy_http::label::EncodingStrategy::Default);
223 if job_id.is_empty() {
224 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
225 "job_id",
226 "cannot be empty or unset",
227 ));
228 }
229 let input_4 = &_input.step_id;
230 let input_4 = input_4
231 .as_ref()
232 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("step_id", "cannot be empty or unset"))?;
233 let step_id = ::aws_smithy_http::label::fmt_string(input_4, ::aws_smithy_http::label::EncodingStrategy::Default);
234 if step_id.is_empty() {
235 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
236 "step_id",
237 "cannot be empty or unset",
238 ));
239 }
240 let input_5 = &_input.task_id;
241 let input_5 = input_5
242 .as_ref()
243 .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("task_id", "cannot be empty or unset"))?;
244 let task_id = ::aws_smithy_http::label::fmt_string(input_5, ::aws_smithy_http::label::EncodingStrategy::Default);
245 if task_id.is_empty() {
246 return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field(
247 "task_id",
248 "cannot be empty or unset",
249 ));
250 }
251 ::std::write!(
252 output,
253 "/2023-10-12/farms/{farmId}/queues/{queueId}/jobs/{jobId}/steps/{stepId}/tasks/{taskId}",
254 farmId = farm_id,
255 queueId = queue_id,
256 jobId = job_id,
257 stepId = step_id,
258 taskId = task_id
259 )
260 .expect("formatting should succeed");
261 ::std::result::Result::Ok(())
262 }
263 #[allow(clippy::unnecessary_wraps)]
264 fn update_http_builder(
265 input: &crate::operation::update_task::UpdateTaskInput,
266 builder: ::http_1x::request::Builder,
267 ) -> ::std::result::Result<::http_1x::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
268 let mut uri = ::std::string::String::new();
269 uri_base(input, &mut uri)?;
270 let builder = crate::protocol_serde::shape_update_task::ser_update_task_headers(input, builder)?;
271 ::std::result::Result::Ok(builder.method("PATCH").uri(uri))
272 }
273 let mut builder = update_http_builder(&input, ::http_1x::request::Builder::new())?;
274 builder = _header_serialization_settings.set_default_header(builder, ::http_1x::header::CONTENT_TYPE, "application/json");
275 builder
276 };
277 let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_update_task::ser_update_task_input(&input)?);
278 if let Some(content_length) = body.content_length() {
279 let content_length = content_length.to_string();
280 request_builder = _header_serialization_settings.set_default_header(request_builder, ::http_1x::header::CONTENT_LENGTH, &content_length);
281 }
282 ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
283 }
284}
285#[derive(Debug)]
286struct UpdateTaskEndpointParamsInterceptor;
287
288#[::aws_smithy_runtime_api::client::interceptors::dyn_dispatch_hint]
289impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdateTaskEndpointParamsInterceptor {
290 fn name(&self) -> &'static str {
291 "UpdateTaskEndpointParamsInterceptor"
292 }
293
294 fn read_before_execution(
295 &self,
296 context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<
297 '_,
298 ::aws_smithy_runtime_api::client::interceptors::context::Input,
299 ::aws_smithy_runtime_api::client::interceptors::context::Output,
300 ::aws_smithy_runtime_api::client::interceptors::context::Error,
301 >,
302 cfg: &mut ::aws_smithy_types::config_bag::ConfigBag,
303 ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> {
304 let _input = context
305 .input()
306 .downcast_ref::<UpdateTaskInput>()
307 .ok_or("failed to downcast to UpdateTaskInput")?;
308
309 let endpoint_prefix = ::aws_smithy_runtime_api::client::endpoint::EndpointPrefix::new("management.").map_err(|err| {
310 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint prefix could not be built", err)
311 })?;
312 cfg.interceptor_state().store_put(endpoint_prefix);
313
314 let params = crate::config::endpoint::Params::builder()
315 .set_region(cfg.load::<::aws_types::region::Region>().map(|r| r.as_ref().to_owned()))
316 .set_use_dual_stack(cfg.load::<::aws_types::endpoint_config::UseDualStack>().map(|ty| ty.0))
317 .set_use_fips(cfg.load::<::aws_types::endpoint_config::UseFips>().map(|ty| ty.0))
318 .set_endpoint(cfg.load::<::aws_types::endpoint_config::EndpointUrl>().map(|ty| ty.0.clone()))
319 .build()
320 .map_err(|err| {
321 ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
322 })?;
323 cfg.interceptor_state()
324 .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
325 ::std::result::Result::Ok(())
326 }
327}
328
329#[non_exhaustive]
334#[derive(::std::fmt::Debug)]
335pub enum UpdateTaskError {
336 AccessDeniedException(crate::types::error::AccessDeniedException),
338 ConflictException(crate::types::error::ConflictException),
340 InternalServerErrorException(crate::types::error::InternalServerErrorException),
342 ResourceNotFoundException(crate::types::error::ResourceNotFoundException),
344 ThrottlingException(crate::types::error::ThrottlingException),
346 ValidationException(crate::types::error::ValidationException),
348 #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
350 variable wildcard pattern and check `.code()`:
351 \
352 `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
353 \
354 See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-UpdateTaskError) for what information is available for the error.")]
355 Unhandled(crate::error::sealed_unhandled::Unhandled),
356}
357impl UpdateTaskError {
358 pub fn unhandled(
360 err: impl ::std::convert::Into<::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>>,
361 ) -> Self {
362 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
363 source: err.into(),
364 meta: ::std::default::Default::default(),
365 })
366 }
367
368 pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self {
370 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
371 source: err.clone().into(),
372 meta: err,
373 })
374 }
375 pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
380 match self {
381 Self::AccessDeniedException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
382 Self::ConflictException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
383 Self::InternalServerErrorException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
384 Self::ResourceNotFoundException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
385 Self::ThrottlingException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
386 Self::ValidationException(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e),
387 Self::Unhandled(e) => &e.meta,
388 }
389 }
390 pub fn is_access_denied_exception(&self) -> bool {
392 matches!(self, Self::AccessDeniedException(_))
393 }
394 pub fn is_conflict_exception(&self) -> bool {
396 matches!(self, Self::ConflictException(_))
397 }
398 pub fn is_internal_server_error_exception(&self) -> bool {
400 matches!(self, Self::InternalServerErrorException(_))
401 }
402 pub fn is_resource_not_found_exception(&self) -> bool {
404 matches!(self, Self::ResourceNotFoundException(_))
405 }
406 pub fn is_throttling_exception(&self) -> bool {
408 matches!(self, Self::ThrottlingException(_))
409 }
410 pub fn is_validation_exception(&self) -> bool {
412 matches!(self, Self::ValidationException(_))
413 }
414}
415impl ::std::error::Error for UpdateTaskError {
416 fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
417 match self {
418 Self::AccessDeniedException(_inner) => ::std::option::Option::Some(_inner),
419 Self::ConflictException(_inner) => ::std::option::Option::Some(_inner),
420 Self::InternalServerErrorException(_inner) => ::std::option::Option::Some(_inner),
421 Self::ResourceNotFoundException(_inner) => ::std::option::Option::Some(_inner),
422 Self::ThrottlingException(_inner) => ::std::option::Option::Some(_inner),
423 Self::ValidationException(_inner) => ::std::option::Option::Some(_inner),
424 Self::Unhandled(_inner) => ::std::option::Option::Some(&*_inner.source),
425 }
426 }
427}
428impl ::std::fmt::Display for UpdateTaskError {
429 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
430 match self {
431 Self::AccessDeniedException(_inner) => _inner.fmt(f),
432 Self::ConflictException(_inner) => _inner.fmt(f),
433 Self::InternalServerErrorException(_inner) => _inner.fmt(f),
434 Self::ResourceNotFoundException(_inner) => _inner.fmt(f),
435 Self::ThrottlingException(_inner) => _inner.fmt(f),
436 Self::ValidationException(_inner) => _inner.fmt(f),
437 Self::Unhandled(_inner) => {
438 if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
439 write!(f, "unhandled error ({code})")
440 } else {
441 f.write_str("unhandled error")
442 }
443 }
444 }
445 }
446}
447impl ::aws_smithy_types::retry::ProvideErrorKind for UpdateTaskError {
448 fn code(&self) -> ::std::option::Option<&str> {
449 ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self)
450 }
451 fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> {
452 match self {
453 Self::InternalServerErrorException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
454 Self::ThrottlingException(inner) => ::std::option::Option::Some(inner.retryable_error_kind()),
455 _ => ::std::option::Option::None,
456 }
457 }
458}
459impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for UpdateTaskError {
460 fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata {
461 match self {
462 Self::AccessDeniedException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
463 Self::ConflictException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
464 Self::InternalServerErrorException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
465 Self::ResourceNotFoundException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
466 Self::ThrottlingException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
467 Self::ValidationException(_inner) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner),
468 Self::Unhandled(_inner) => &_inner.meta,
469 }
470 }
471}
472impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for UpdateTaskError {
473 fn create_unhandled_error(
474 source: ::std::boxed::Box<dyn ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static>,
475 meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata>,
476 ) -> Self {
477 Self::Unhandled(crate::error::sealed_unhandled::Unhandled {
478 source,
479 meta: meta.unwrap_or_default(),
480 })
481 }
482}
483impl ::aws_types::request_id::RequestId for crate::operation::update_task::UpdateTaskError {
484 fn request_id(&self) -> Option<&str> {
485 self.meta().request_id()
486 }
487}
488
489pub use crate::operation::update_task::_update_task_input::UpdateTaskInput;
490
491pub use crate::operation::update_task::_update_task_output::UpdateTaskOutput;
492
493mod _update_task_input;
494
495mod _update_task_output;
496
497pub mod builders;