aws_sdk_swf/operation/poll_for_activity_task/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::poll_for_activity_task::_poll_for_activity_task_output::PollForActivityTaskOutputBuilder;
3
4pub use crate::operation::poll_for_activity_task::_poll_for_activity_task_input::PollForActivityTaskInputBuilder;
5
6impl crate::operation::poll_for_activity_task::builders::PollForActivityTaskInputBuilder {
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::poll_for_activity_task::PollForActivityTaskOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::poll_for_activity_task::PollForActivityTaskError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.poll_for_activity_task();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `PollForActivityTask`.
24///
25/// <p>Used by workers to get an <code>ActivityTask</code> from the specified activity <code>taskList</code>. This initiates a long poll, where the service holds the HTTP connection open and responds as soon as a task becomes available. The maximum time the service holds on to the request before responding is 60 seconds. If no task is available within 60 seconds, the poll returns an empty result. An empty result, in this context, means that an ActivityTask is returned, but that the value of taskToken is an empty string. If a task is returned, the worker should use its type to identify and process it correctly.</p><important>
26/// <p>Workers should set their client side socket timeout to at least 70 seconds (10 seconds higher than the maximum time service may hold the poll request).</p>
27/// </important>
28/// <p><b>Access Control</b></p>
29/// <p>You can use IAM policies to control this action's access to Amazon SWF resources as follows:</p>
30/// <ul>
31/// <li>
32/// <p>Use a <code>Resource</code> element with the domain name to limit the action to only specified domains.</p></li>
33/// <li>
34/// <p>Use an <code>Action</code> element to allow or deny permission to call this action.</p></li>
35/// <li>
36/// <p>Constrain the <code>taskList.name</code> parameter by using a <code>Condition</code> element with the <code>swf:taskList.name</code> key to allow the action to access only certain task lists.</p></li>
37/// </ul>
38/// <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>
39#[derive(::std::clone::Clone, ::std::fmt::Debug)]
40pub struct PollForActivityTaskFluentBuilder {
41 handle: ::std::sync::Arc<crate::client::Handle>,
42 inner: crate::operation::poll_for_activity_task::builders::PollForActivityTaskInputBuilder,
43 config_override: ::std::option::Option<crate::config::Builder>,
44}
45impl
46 crate::client::customize::internal::CustomizableSend<
47 crate::operation::poll_for_activity_task::PollForActivityTaskOutput,
48 crate::operation::poll_for_activity_task::PollForActivityTaskError,
49 > for PollForActivityTaskFluentBuilder
50{
51 fn send(
52 self,
53 config_override: crate::config::Builder,
54 ) -> crate::client::customize::internal::BoxFuture<
55 crate::client::customize::internal::SendResult<
56 crate::operation::poll_for_activity_task::PollForActivityTaskOutput,
57 crate::operation::poll_for_activity_task::PollForActivityTaskError,
58 >,
59 > {
60 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
61 }
62}
63impl PollForActivityTaskFluentBuilder {
64 /// Creates a new `PollForActivityTaskFluentBuilder`.
65 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
66 Self {
67 handle,
68 inner: ::std::default::Default::default(),
69 config_override: ::std::option::Option::None,
70 }
71 }
72 /// Access the PollForActivityTask as a reference.
73 pub fn as_input(&self) -> &crate::operation::poll_for_activity_task::builders::PollForActivityTaskInputBuilder {
74 &self.inner
75 }
76 /// Sends the request and returns the response.
77 ///
78 /// If an error occurs, an `SdkError` will be returned with additional details that
79 /// can be matched against.
80 ///
81 /// By default, any retryable failures will be retried twice. Retry behavior
82 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
83 /// set when configuring the client.
84 pub async fn send(
85 self,
86 ) -> ::std::result::Result<
87 crate::operation::poll_for_activity_task::PollForActivityTaskOutput,
88 ::aws_smithy_runtime_api::client::result::SdkError<
89 crate::operation::poll_for_activity_task::PollForActivityTaskError,
90 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
91 >,
92 > {
93 let input = self
94 .inner
95 .build()
96 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
97 let runtime_plugins = crate::operation::poll_for_activity_task::PollForActivityTask::operation_runtime_plugins(
98 self.handle.runtime_plugins.clone(),
99 &self.handle.conf,
100 self.config_override,
101 );
102 crate::operation::poll_for_activity_task::PollForActivityTask::orchestrate(&runtime_plugins, input).await
103 }
104
105 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
106 pub fn customize(
107 self,
108 ) -> crate::client::customize::CustomizableOperation<
109 crate::operation::poll_for_activity_task::PollForActivityTaskOutput,
110 crate::operation::poll_for_activity_task::PollForActivityTaskError,
111 Self,
112 > {
113 crate::client::customize::CustomizableOperation::new(self)
114 }
115 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
116 self.set_config_override(::std::option::Option::Some(config_override.into()));
117 self
118 }
119
120 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
121 self.config_override = config_override;
122 self
123 }
124 /// <p>The name of the domain that contains the task lists being polled.</p>
125 pub fn domain(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
126 self.inner = self.inner.domain(input.into());
127 self
128 }
129 /// <p>The name of the domain that contains the task lists being polled.</p>
130 pub fn set_domain(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
131 self.inner = self.inner.set_domain(input);
132 self
133 }
134 /// <p>The name of the domain that contains the task lists being polled.</p>
135 pub fn get_domain(&self) -> &::std::option::Option<::std::string::String> {
136 self.inner.get_domain()
137 }
138 /// <p>Specifies the task list to poll for activity tasks.</p>
139 /// <p>The specified string must not start or end with whitespace. It must not contain a <code>:</code> (colon), <code>/</code> (slash), <code>|</code> (vertical bar), or any control characters (<code>\u0000-\u001f</code> | <code>\u007f-\u009f</code>). Also, it must <i>not</i> be the literal string <code>arn</code>.</p>
140 pub fn task_list(mut self, input: crate::types::TaskList) -> Self {
141 self.inner = self.inner.task_list(input);
142 self
143 }
144 /// <p>Specifies the task list to poll for activity tasks.</p>
145 /// <p>The specified string must not start or end with whitespace. It must not contain a <code>:</code> (colon), <code>/</code> (slash), <code>|</code> (vertical bar), or any control characters (<code>\u0000-\u001f</code> | <code>\u007f-\u009f</code>). Also, it must <i>not</i> be the literal string <code>arn</code>.</p>
146 pub fn set_task_list(mut self, input: ::std::option::Option<crate::types::TaskList>) -> Self {
147 self.inner = self.inner.set_task_list(input);
148 self
149 }
150 /// <p>Specifies the task list to poll for activity tasks.</p>
151 /// <p>The specified string must not start or end with whitespace. It must not contain a <code>:</code> (colon), <code>/</code> (slash), <code>|</code> (vertical bar), or any control characters (<code>\u0000-\u001f</code> | <code>\u007f-\u009f</code>). Also, it must <i>not</i> be the literal string <code>arn</code>.</p>
152 pub fn get_task_list(&self) -> &::std::option::Option<crate::types::TaskList> {
153 self.inner.get_task_list()
154 }
155 /// <p>Identity of the worker making the request, recorded in the <code>ActivityTaskStarted</code> event in the workflow history. This enables diagnostic tracing when problems arise. The form of this identity is user defined.</p>
156 pub fn identity(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
157 self.inner = self.inner.identity(input.into());
158 self
159 }
160 /// <p>Identity of the worker making the request, recorded in the <code>ActivityTaskStarted</code> event in the workflow history. This enables diagnostic tracing when problems arise. The form of this identity is user defined.</p>
161 pub fn set_identity(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
162 self.inner = self.inner.set_identity(input);
163 self
164 }
165 /// <p>Identity of the worker making the request, recorded in the <code>ActivityTaskStarted</code> event in the workflow history. This enables diagnostic tracing when problems arise. The form of this identity is user defined.</p>
166 pub fn get_identity(&self) -> &::std::option::Option<::std::string::String> {
167 self.inner.get_identity()
168 }
169}