aws_sdk_sfn/operation/test_state/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::test_state::_test_state_output::TestStateOutputBuilder;
3
4pub use crate::operation::test_state::_test_state_input::TestStateInputBuilder;
5
6impl crate::operation::test_state::builders::TestStateInputBuilder {
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::test_state::TestStateOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::test_state::TestStateError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.test_state();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `TestState`.
24///
25/// <p>Accepts the definition of a single state and executes it. You can test a state without creating a state machine or updating an existing state machine. Using this API, you can test the following:</p>
26/// <ul>
27/// <li>
28/// <p>A state's <a href="https://docs.aws.amazon.com/step-functions/latest/dg/test-state-isolation.html#test-state-input-output-dataflow">input and output processing</a> data flow</p></li>
29/// <li>
30/// <p>An <a href="https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-services.html">Amazon Web Services service integration</a> request and response</p></li>
31/// <li>
32/// <p>An <a href="https://docs.aws.amazon.com/step-functions/latest/dg/call-https-apis.html">HTTP Task</a> request and response</p></li>
33/// </ul>
34/// <p>You can call this API on only one state at a time. The states that you can test include the following:</p>
35/// <ul>
36/// <li>
37/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-task-state.html#task-types">All Task types</a> except <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-activities.html">Activity</a></p></li>
38/// <li>
39/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-pass-state.html">Pass</a></p></li>
40/// <li>
41/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-wait-state.html">Wait</a></p></li>
42/// <li>
43/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html">Choice</a></p></li>
44/// <li>
45/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-succeed-state.html">Succeed</a></p></li>
46/// <li>
47/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-fail-state.html">Fail</a></p></li>
48/// </ul>
49/// <p>The <code>TestState</code> API assumes an IAM role which must contain the required IAM permissions for the resources your state is accessing. For information about the permissions a state might need, see <a href="https://docs.aws.amazon.com/step-functions/latest/dg/test-state-isolation.html#test-state-permissions">IAM permissions to test a state</a>.</p>
50/// <p>The <code>TestState</code> API can run for up to five minutes. If the execution of a state exceeds this duration, it fails with the <code>States.Timeout</code> error.</p>
51/// <p><code>TestState</code> only supports the following when a mock is specified: <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-activities.html">Activity tasks</a>, <code>.sync</code> or <code>.waitForTaskToken</code> <a href="https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html">service integration patterns</a>, <a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-parallel-state.html">Parallel</a>, or <a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-map-state.html">Map</a> states.</p>
52#[derive(::std::clone::Clone, ::std::fmt::Debug)]
53pub struct TestStateFluentBuilder {
54 handle: ::std::sync::Arc<crate::client::Handle>,
55 inner: crate::operation::test_state::builders::TestStateInputBuilder,
56 config_override: ::std::option::Option<crate::config::Builder>,
57}
58impl crate::client::customize::internal::CustomizableSend<crate::operation::test_state::TestStateOutput, crate::operation::test_state::TestStateError>
59 for TestStateFluentBuilder
60{
61 fn send(
62 self,
63 config_override: crate::config::Builder,
64 ) -> crate::client::customize::internal::BoxFuture<
65 crate::client::customize::internal::SendResult<crate::operation::test_state::TestStateOutput, crate::operation::test_state::TestStateError>,
66 > {
67 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
68 }
69}
70impl TestStateFluentBuilder {
71 /// Creates a new `TestStateFluentBuilder`.
72 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
73 Self {
74 handle,
75 inner: ::std::default::Default::default(),
76 config_override: ::std::option::Option::None,
77 }
78 }
79 /// Access the TestState as a reference.
80 pub fn as_input(&self) -> &crate::operation::test_state::builders::TestStateInputBuilder {
81 &self.inner
82 }
83 /// Sends the request and returns the response.
84 ///
85 /// If an error occurs, an `SdkError` will be returned with additional details that
86 /// can be matched against.
87 ///
88 /// By default, any retryable failures will be retried twice. Retry behavior
89 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
90 /// set when configuring the client.
91 pub async fn send(
92 self,
93 ) -> ::std::result::Result<
94 crate::operation::test_state::TestStateOutput,
95 ::aws_smithy_runtime_api::client::result::SdkError<
96 crate::operation::test_state::TestStateError,
97 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
98 >,
99 > {
100 let input = self
101 .inner
102 .build()
103 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
104 let runtime_plugins = crate::operation::test_state::TestState::operation_runtime_plugins(
105 self.handle.runtime_plugins.clone(),
106 &self.handle.conf,
107 self.config_override,
108 );
109 crate::operation::test_state::TestState::orchestrate(&runtime_plugins, input).await
110 }
111
112 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
113 pub fn customize(
114 self,
115 ) -> crate::client::customize::CustomizableOperation<
116 crate::operation::test_state::TestStateOutput,
117 crate::operation::test_state::TestStateError,
118 Self,
119 > {
120 crate::client::customize::CustomizableOperation::new(self)
121 }
122 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
123 self.set_config_override(::std::option::Option::Some(config_override.into()));
124 self
125 }
126
127 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
128 self.config_override = config_override;
129 self
130 }
131 /// <p>The <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html">Amazon States Language</a> (ASL) definition of the state or state machine.</p>
132 pub fn definition(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
133 self.inner = self.inner.definition(input.into());
134 self
135 }
136 /// <p>The <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html">Amazon States Language</a> (ASL) definition of the state or state machine.</p>
137 pub fn set_definition(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
138 self.inner = self.inner.set_definition(input);
139 self
140 }
141 /// <p>The <a href="https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html">Amazon States Language</a> (ASL) definition of the state or state machine.</p>
142 pub fn get_definition(&self) -> &::std::option::Option<::std::string::String> {
143 self.inner.get_definition()
144 }
145 /// <p>The Amazon Resource Name (ARN) of the execution role with the required IAM permissions for the state.</p>
146 pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
147 self.inner = self.inner.role_arn(input.into());
148 self
149 }
150 /// <p>The Amazon Resource Name (ARN) of the execution role with the required IAM permissions for the state.</p>
151 pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
152 self.inner = self.inner.set_role_arn(input);
153 self
154 }
155 /// <p>The Amazon Resource Name (ARN) of the execution role with the required IAM permissions for the state.</p>
156 pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
157 self.inner.get_role_arn()
158 }
159 /// <p>A string that contains the JSON input data for the state.</p>
160 pub fn input(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
161 self.inner = self.inner.input(input.into());
162 self
163 }
164 /// <p>A string that contains the JSON input data for the state.</p>
165 pub fn set_input(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
166 self.inner = self.inner.set_input(input);
167 self
168 }
169 /// <p>A string that contains the JSON input data for the state.</p>
170 pub fn get_input(&self) -> &::std::option::Option<::std::string::String> {
171 self.inner.get_input()
172 }
173 /// <p>Determines the values to return when a state is tested. You can specify one of the following types:</p>
174 /// <ul>
175 /// <li>
176 /// <p><code>INFO</code>: Shows the final state output. By default, Step Functions sets <code>inspectionLevel</code> to <code>INFO</code> if you don't specify a level.</p></li>
177 /// <li>
178 /// <p><code>DEBUG</code>: Shows the final state output along with the input and output data processing result.</p></li>
179 /// <li>
180 /// <p><code>TRACE</code>: Shows the HTTP request and response for an HTTP Task. This level also shows the final state output along with the input and output data processing result.</p></li>
181 /// </ul>
182 /// <p>Each of these levels also provide information about the status of the state execution and the next state to transition to.</p>
183 pub fn inspection_level(mut self, input: crate::types::InspectionLevel) -> Self {
184 self.inner = self.inner.inspection_level(input);
185 self
186 }
187 /// <p>Determines the values to return when a state is tested. You can specify one of the following types:</p>
188 /// <ul>
189 /// <li>
190 /// <p><code>INFO</code>: Shows the final state output. By default, Step Functions sets <code>inspectionLevel</code> to <code>INFO</code> if you don't specify a level.</p></li>
191 /// <li>
192 /// <p><code>DEBUG</code>: Shows the final state output along with the input and output data processing result.</p></li>
193 /// <li>
194 /// <p><code>TRACE</code>: Shows the HTTP request and response for an HTTP Task. This level also shows the final state output along with the input and output data processing result.</p></li>
195 /// </ul>
196 /// <p>Each of these levels also provide information about the status of the state execution and the next state to transition to.</p>
197 pub fn set_inspection_level(mut self, input: ::std::option::Option<crate::types::InspectionLevel>) -> Self {
198 self.inner = self.inner.set_inspection_level(input);
199 self
200 }
201 /// <p>Determines the values to return when a state is tested. You can specify one of the following types:</p>
202 /// <ul>
203 /// <li>
204 /// <p><code>INFO</code>: Shows the final state output. By default, Step Functions sets <code>inspectionLevel</code> to <code>INFO</code> if you don't specify a level.</p></li>
205 /// <li>
206 /// <p><code>DEBUG</code>: Shows the final state output along with the input and output data processing result.</p></li>
207 /// <li>
208 /// <p><code>TRACE</code>: Shows the HTTP request and response for an HTTP Task. This level also shows the final state output along with the input and output data processing result.</p></li>
209 /// </ul>
210 /// <p>Each of these levels also provide information about the status of the state execution and the next state to transition to.</p>
211 pub fn get_inspection_level(&self) -> &::std::option::Option<crate::types::InspectionLevel> {
212 self.inner.get_inspection_level()
213 }
214 /// <p>Specifies whether or not to include secret information in the test result. For HTTP Tasks, a secret includes the data that an EventBridge connection adds to modify the HTTP request headers, query parameters, and body. Step Functions doesn't omit any information included in the state definition or the HTTP response.</p>
215 /// <p>If you set <code>revealSecrets</code> to <code>true</code>, you must make sure that the IAM user that calls the <code>TestState</code> API has permission for the <code>states:RevealSecrets</code> action. For an example of IAM policy that sets the <code>states:RevealSecrets</code> permission, see <a href="https://docs.aws.amazon.com/step-functions/latest/dg/test-state-isolation.html#test-state-permissions">IAM permissions to test a state</a>. Without this permission, Step Functions throws an access denied error.</p>
216 /// <p>By default, <code>revealSecrets</code> is set to <code>false</code>.</p>
217 pub fn reveal_secrets(mut self, input: bool) -> Self {
218 self.inner = self.inner.reveal_secrets(input);
219 self
220 }
221 /// <p>Specifies whether or not to include secret information in the test result. For HTTP Tasks, a secret includes the data that an EventBridge connection adds to modify the HTTP request headers, query parameters, and body. Step Functions doesn't omit any information included in the state definition or the HTTP response.</p>
222 /// <p>If you set <code>revealSecrets</code> to <code>true</code>, you must make sure that the IAM user that calls the <code>TestState</code> API has permission for the <code>states:RevealSecrets</code> action. For an example of IAM policy that sets the <code>states:RevealSecrets</code> permission, see <a href="https://docs.aws.amazon.com/step-functions/latest/dg/test-state-isolation.html#test-state-permissions">IAM permissions to test a state</a>. Without this permission, Step Functions throws an access denied error.</p>
223 /// <p>By default, <code>revealSecrets</code> is set to <code>false</code>.</p>
224 pub fn set_reveal_secrets(mut self, input: ::std::option::Option<bool>) -> Self {
225 self.inner = self.inner.set_reveal_secrets(input);
226 self
227 }
228 /// <p>Specifies whether or not to include secret information in the test result. For HTTP Tasks, a secret includes the data that an EventBridge connection adds to modify the HTTP request headers, query parameters, and body. Step Functions doesn't omit any information included in the state definition or the HTTP response.</p>
229 /// <p>If you set <code>revealSecrets</code> to <code>true</code>, you must make sure that the IAM user that calls the <code>TestState</code> API has permission for the <code>states:RevealSecrets</code> action. For an example of IAM policy that sets the <code>states:RevealSecrets</code> permission, see <a href="https://docs.aws.amazon.com/step-functions/latest/dg/test-state-isolation.html#test-state-permissions">IAM permissions to test a state</a>. Without this permission, Step Functions throws an access denied error.</p>
230 /// <p>By default, <code>revealSecrets</code> is set to <code>false</code>.</p>
231 pub fn get_reveal_secrets(&self) -> &::std::option::Option<bool> {
232 self.inner.get_reveal_secrets()
233 }
234 /// <p>JSON object literal that sets variables used in the state under test. Object keys are the variable names and values are the variable values.</p>
235 pub fn variables(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
236 self.inner = self.inner.variables(input.into());
237 self
238 }
239 /// <p>JSON object literal that sets variables used in the state under test. Object keys are the variable names and values are the variable values.</p>
240 pub fn set_variables(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
241 self.inner = self.inner.set_variables(input);
242 self
243 }
244 /// <p>JSON object literal that sets variables used in the state under test. Object keys are the variable names and values are the variable values.</p>
245 pub fn get_variables(&self) -> &::std::option::Option<::std::string::String> {
246 self.inner.get_variables()
247 }
248 /// <p>Denotes the particular state within a state machine definition to be tested. If this field is specified, the <code>definition</code> must contain a fully-formed state machine definition.</p>
249 pub fn state_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
250 self.inner = self.inner.state_name(input.into());
251 self
252 }
253 /// <p>Denotes the particular state within a state machine definition to be tested. If this field is specified, the <code>definition</code> must contain a fully-formed state machine definition.</p>
254 pub fn set_state_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
255 self.inner = self.inner.set_state_name(input);
256 self
257 }
258 /// <p>Denotes the particular state within a state machine definition to be tested. If this field is specified, the <code>definition</code> must contain a fully-formed state machine definition.</p>
259 pub fn get_state_name(&self) -> &::std::option::Option<::std::string::String> {
260 self.inner.get_state_name()
261 }
262 /// <p>Defines a mocked result or error for the state under test.</p>
263 /// <p>A mock can only be specified for Task, Map, or Parallel states. If it is specified for another state type, an exception will be thrown.</p>
264 pub fn mock(mut self, input: crate::types::MockInput) -> Self {
265 self.inner = self.inner.mock(input);
266 self
267 }
268 /// <p>Defines a mocked result or error for the state under test.</p>
269 /// <p>A mock can only be specified for Task, Map, or Parallel states. If it is specified for another state type, an exception will be thrown.</p>
270 pub fn set_mock(mut self, input: ::std::option::Option<crate::types::MockInput>) -> Self {
271 self.inner = self.inner.set_mock(input);
272 self
273 }
274 /// <p>Defines a mocked result or error for the state under test.</p>
275 /// <p>A mock can only be specified for Task, Map, or Parallel states. If it is specified for another state type, an exception will be thrown.</p>
276 pub fn get_mock(&self) -> &::std::option::Option<crate::types::MockInput> {
277 self.inner.get_mock()
278 }
279 /// <p>A JSON string representing a valid Context object for the state under test. This field may only be specified if a mock is specified in the same request.</p>
280 pub fn context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
281 self.inner = self.inner.context(input.into());
282 self
283 }
284 /// <p>A JSON string representing a valid Context object for the state under test. This field may only be specified if a mock is specified in the same request.</p>
285 pub fn set_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
286 self.inner = self.inner.set_context(input);
287 self
288 }
289 /// <p>A JSON string representing a valid Context object for the state under test. This field may only be specified if a mock is specified in the same request.</p>
290 pub fn get_context(&self) -> &::std::option::Option<::std::string::String> {
291 self.inner.get_context()
292 }
293 /// <p>Contains configurations for the state under test.</p>
294 pub fn state_configuration(mut self, input: crate::types::TestStateConfiguration) -> Self {
295 self.inner = self.inner.state_configuration(input);
296 self
297 }
298 /// <p>Contains configurations for the state under test.</p>
299 pub fn set_state_configuration(mut self, input: ::std::option::Option<crate::types::TestStateConfiguration>) -> Self {
300 self.inner = self.inner.set_state_configuration(input);
301 self
302 }
303 /// <p>Contains configurations for the state under test.</p>
304 pub fn get_state_configuration(&self) -> &::std::option::Option<crate::types::TestStateConfiguration> {
305 self.inner.get_state_configuration()
306 }
307}