aws_sdk_swf/operation/respond_activity_task_completed/
builders.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::respond_activity_task_completed::_respond_activity_task_completed_output::RespondActivityTaskCompletedOutputBuilder;
3
4pub use crate::operation::respond_activity_task_completed::_respond_activity_task_completed_input::RespondActivityTaskCompletedInputBuilder;
5
6impl crate::operation::respond_activity_task_completed::builders::RespondActivityTaskCompletedInputBuilder {
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::respond_activity_task_completed::RespondActivityTaskCompletedOutput,
13        ::aws_smithy_runtime_api::client::result::SdkError<
14            crate::operation::respond_activity_task_completed::RespondActivityTaskCompletedError,
15            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16        >,
17    > {
18        let mut fluent_builder = client.respond_activity_task_completed();
19        fluent_builder.inner = self;
20        fluent_builder.send().await
21    }
22}
23/// Fluent builder constructing a request to `RespondActivityTaskCompleted`.
24///
25/// <p>Used by workers to tell the service that the <code>ActivityTask</code> identified by the <code>taskToken</code> completed successfully with a <code>result</code> (if provided). The <code>result</code> appears in the <code>ActivityTaskCompleted</code> event in the workflow history.</p><important>
26/// <p>If the requested task doesn't complete successfully, use <code>RespondActivityTaskFailed</code> instead. If the worker finds that the task is canceled through the <code>canceled</code> flag returned by <code>RecordActivityTaskHeartbeat</code>, it should cancel the task, clean up and then call <code>RespondActivityTaskCanceled</code>.</p>
27/// </important>
28/// <p>A task is considered open from the time that it is scheduled until it is closed. Therefore a task is reported as open while a worker is processing it. A task is closed after it has been specified in a call to RespondActivityTaskCompleted, <code>RespondActivityTaskCanceled</code>, <code>RespondActivityTaskFailed</code>, or the task has <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dg-basic.html#swf-dev-timeout-types">timed out</a>.</p>
29/// <p><b>Access Control</b></p>
30/// <p>You can use IAM policies to control this action's access to Amazon SWF resources as follows:</p>
31/// <ul>
32/// <li>
33/// <p>Use a <code>Resource</code> element with the domain name to limit the action to only specified domains.</p></li>
34/// <li>
35/// <p>Use an <code>Action</code> element to allow or deny permission to call this action.</p></li>
36/// <li>
37/// <p>You cannot use an IAM policy to constrain this action's parameters.</p></li>
38/// </ul>
39/// <p>If the caller doesn't have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's <code>cause</code> parameter is set to <code>OPERATION_NOT_PERMITTED</code>. For details and example IAM policies, see <a href="https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html">Using IAM to Manage Access to Amazon SWF Workflows</a> in the <i>Amazon SWF Developer Guide</i>.</p>
40#[derive(::std::clone::Clone, ::std::fmt::Debug)]
41pub struct RespondActivityTaskCompletedFluentBuilder {
42    handle: ::std::sync::Arc<crate::client::Handle>,
43    inner: crate::operation::respond_activity_task_completed::builders::RespondActivityTaskCompletedInputBuilder,
44    config_override: ::std::option::Option<crate::config::Builder>,
45}
46impl
47    crate::client::customize::internal::CustomizableSend<
48        crate::operation::respond_activity_task_completed::RespondActivityTaskCompletedOutput,
49        crate::operation::respond_activity_task_completed::RespondActivityTaskCompletedError,
50    > for RespondActivityTaskCompletedFluentBuilder
51{
52    fn send(
53        self,
54        config_override: crate::config::Builder,
55    ) -> crate::client::customize::internal::BoxFuture<
56        crate::client::customize::internal::SendResult<
57            crate::operation::respond_activity_task_completed::RespondActivityTaskCompletedOutput,
58            crate::operation::respond_activity_task_completed::RespondActivityTaskCompletedError,
59        >,
60    > {
61        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
62    }
63}
64impl RespondActivityTaskCompletedFluentBuilder {
65    /// Creates a new `RespondActivityTaskCompletedFluentBuilder`.
66    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
67        Self {
68            handle,
69            inner: ::std::default::Default::default(),
70            config_override: ::std::option::Option::None,
71        }
72    }
73    /// Access the RespondActivityTaskCompleted as a reference.
74    pub fn as_input(&self) -> &crate::operation::respond_activity_task_completed::builders::RespondActivityTaskCompletedInputBuilder {
75        &self.inner
76    }
77    /// Sends the request and returns the response.
78    ///
79    /// If an error occurs, an `SdkError` will be returned with additional details that
80    /// can be matched against.
81    ///
82    /// By default, any retryable failures will be retried twice. Retry behavior
83    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
84    /// set when configuring the client.
85    pub async fn send(
86        self,
87    ) -> ::std::result::Result<
88        crate::operation::respond_activity_task_completed::RespondActivityTaskCompletedOutput,
89        ::aws_smithy_runtime_api::client::result::SdkError<
90            crate::operation::respond_activity_task_completed::RespondActivityTaskCompletedError,
91            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
92        >,
93    > {
94        let input = self
95            .inner
96            .build()
97            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
98        let runtime_plugins = crate::operation::respond_activity_task_completed::RespondActivityTaskCompleted::operation_runtime_plugins(
99            self.handle.runtime_plugins.clone(),
100            &self.handle.conf,
101            self.config_override,
102        );
103        crate::operation::respond_activity_task_completed::RespondActivityTaskCompleted::orchestrate(&runtime_plugins, input).await
104    }
105
106    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
107    pub fn customize(
108        self,
109    ) -> crate::client::customize::CustomizableOperation<
110        crate::operation::respond_activity_task_completed::RespondActivityTaskCompletedOutput,
111        crate::operation::respond_activity_task_completed::RespondActivityTaskCompletedError,
112        Self,
113    > {
114        crate::client::customize::CustomizableOperation::new(self)
115    }
116    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
117        self.set_config_override(::std::option::Option::Some(config_override.into()));
118        self
119    }
120
121    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
122        self.config_override = config_override;
123        self
124    }
125    /// <p>The <code>taskToken</code> of the <code>ActivityTask</code>.</p><important>
126    /// <p><code>taskToken</code> is generated by the service and should be treated as an opaque value. If the task is passed to another process, its <code>taskToken</code> must also be passed. This enables it to provide its progress and respond with results.</p>
127    /// </important>
128    pub fn task_token(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
129        self.inner = self.inner.task_token(input.into());
130        self
131    }
132    /// <p>The <code>taskToken</code> of the <code>ActivityTask</code>.</p><important>
133    /// <p><code>taskToken</code> is generated by the service and should be treated as an opaque value. If the task is passed to another process, its <code>taskToken</code> must also be passed. This enables it to provide its progress and respond with results.</p>
134    /// </important>
135    pub fn set_task_token(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
136        self.inner = self.inner.set_task_token(input);
137        self
138    }
139    /// <p>The <code>taskToken</code> of the <code>ActivityTask</code>.</p><important>
140    /// <p><code>taskToken</code> is generated by the service and should be treated as an opaque value. If the task is passed to another process, its <code>taskToken</code> must also be passed. This enables it to provide its progress and respond with results.</p>
141    /// </important>
142    pub fn get_task_token(&self) -> &::std::option::Option<::std::string::String> {
143        self.inner.get_task_token()
144    }
145    /// <p>The result of the activity task. It is a free form string that is implementation specific.</p>
146    pub fn result(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147        self.inner = self.inner.result(input.into());
148        self
149    }
150    /// <p>The result of the activity task. It is a free form string that is implementation specific.</p>
151    pub fn set_result(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152        self.inner = self.inner.set_result(input);
153        self
154    }
155    /// <p>The result of the activity task. It is a free form string that is implementation specific.</p>
156    pub fn get_result(&self) -> &::std::option::Option<::std::string::String> {
157        self.inner.get_result()
158    }
159}