aws_sdk_batch/operation/cancel_job/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::cancel_job::_cancel_job_output::CancelJobOutputBuilder;
3
4pub use crate::operation::cancel_job::_cancel_job_input::CancelJobInputBuilder;
5
6impl crate::operation::cancel_job::builders::CancelJobInputBuilder {
7    /// Sends a request with this input using the given client.
8    pub async fn send_with(
9        self,
10        client: &crate::Client,
11    ) -> ::std::result::Result<
12        crate::operation::cancel_job::CancelJobOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::cancel_job::CancelJobError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.cancel_job();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `CancelJob`.
24///
25/// <p>Cancels a job in an Batch job queue. Jobs that are in a <code>SUBMITTED</code>, <code>PENDING</code>, or <code>RUNNABLE</code> state are cancelled and the job status is updated to <code>FAILED</code>.</p><note>
26/// <p>A <code>PENDING</code> job is canceled after all dependency jobs are completed. Therefore, it may take longer than expected to cancel a job in <code>PENDING</code> status.</p>
27/// <p>When you try to cancel an array parent job in <code>PENDING</code>, Batch attempts to cancel all child jobs. The array parent job is canceled when all child jobs are completed.</p>
28/// </note>
29/// <p>Jobs that progressed to the <code>STARTING</code> or <code>RUNNING</code> state aren't canceled. However, the API operation still succeeds, even if no job is canceled. These jobs must be terminated with the <code>TerminateJob</code> operation.</p>
30#[derive(::std::clone::Clone, ::std::fmt::Debug)]
31pub struct CancelJobFluentBuilder {
32    handle: ::std::sync::Arc<crate::client::Handle>,
33    inner: crate::operation::cancel_job::builders::CancelJobInputBuilder,
34    config_override: ::std::option::Option<crate::config::Builder>,
35}
36impl crate::client::customize::internal::CustomizableSend<crate::operation::cancel_job::CancelJobOutput, crate::operation::cancel_job::CancelJobError>
37    for CancelJobFluentBuilder
38{
39    fn send(
40        self,
41        config_override: crate::config::Builder,
42    ) -> crate::client::customize::internal::BoxFuture<
43        crate::client::customize::internal::SendResult<crate::operation::cancel_job::CancelJobOutput, crate::operation::cancel_job::CancelJobError>,
44    > {
45        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
46    }
47}
48impl CancelJobFluentBuilder {
49    /// Creates a new `CancelJobFluentBuilder`.
50    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
51        Self {
52            handle,
53            inner: ::std::default::Default::default(),
54            config_override: ::std::option::Option::None,
55        }
56    }
57    /// Access the CancelJob as a reference.
58    pub fn as_input(&self) -> &crate::operation::cancel_job::builders::CancelJobInputBuilder {
59        &self.inner
60    }
61    /// Sends the request and returns the response.
62    ///
63    /// If an error occurs, an `SdkError` will be returned with additional details that
64    /// can be matched against.
65    ///
66    /// By default, any retryable failures will be retried twice. Retry behavior
67    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
68    /// set when configuring the client.
69    pub async fn send(
70        self,
71    ) -> ::std::result::Result<
72        crate::operation::cancel_job::CancelJobOutput,
73        ::aws_smithy_runtime_api::client::result::SdkError<
74            crate::operation::cancel_job::CancelJobError,
75            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
76        >,
77    > {
78        let input = self
79            .inner
80            .build()
81            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
82        let runtime_plugins = crate::operation::cancel_job::CancelJob::operation_runtime_plugins(
83            self.handle.runtime_plugins.clone(),
84            &self.handle.conf,
85            self.config_override,
86        );
87        crate::operation::cancel_job::CancelJob::orchestrate(&runtime_plugins, input).await
88    }
89
90    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
91    pub fn customize(
92        self,
93    ) -> crate::client::customize::CustomizableOperation<
94        crate::operation::cancel_job::CancelJobOutput,
95        crate::operation::cancel_job::CancelJobError,
96        Self,
97    > {
98        crate::client::customize::CustomizableOperation::new(self)
99    }
100    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
101        self.set_config_override(::std::option::Option::Some(config_override.into()));
102        self
103    }
104
105    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
106        self.config_override = config_override;
107        self
108    }
109    /// <p>The Batch job ID of the job to cancel.</p>
110    pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
111        self.inner = self.inner.job_id(input.into());
112        self
113    }
114    /// <p>The Batch job ID of the job to cancel.</p>
115    pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
116        self.inner = self.inner.set_job_id(input);
117        self
118    }
119    /// <p>The Batch job ID of the job to cancel.</p>
120    pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> {
121        self.inner.get_job_id()
122    }
123    /// <p>A message to attach to the job that explains the reason for canceling it. This message is returned by future <code>DescribeJobs</code> operations on the job. It is also recorded in the Batch activity logs.</p>
124    /// <p>This parameter has as limit of 1024 characters.</p>
125    pub fn reason(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126        self.inner = self.inner.reason(input.into());
127        self
128    }
129    /// <p>A message to attach to the job that explains the reason for canceling it. This message is returned by future <code>DescribeJobs</code> operations on the job. It is also recorded in the Batch activity logs.</p>
130    /// <p>This parameter has as limit of 1024 characters.</p>
131    pub fn set_reason(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
132        self.inner = self.inner.set_reason(input);
133        self
134    }
135    /// <p>A message to attach to the job that explains the reason for canceling it. This message is returned by future <code>DescribeJobs</code> operations on the job. It is also recorded in the Batch activity logs.</p>
136    /// <p>This parameter has as limit of 1024 characters.</p>
137    pub fn get_reason(&self) -> &::std::option::Option<::std::string::String> {
138        self.inner.get_reason()
139    }
140}