aws-sdk-sfn 1.107.0

AWS SDK for AWS Step Functions
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
pub use crate::operation::test_state::_test_state_input::TestStateInputBuilder;

pub use crate::operation::test_state::_test_state_output::TestStateOutputBuilder;

impl crate::operation::test_state::builders::TestStateInputBuilder {
    /// Sends a request with this input using the given client.
    pub async fn send_with(
        self,
        client: &crate::Client,
    ) -> ::std::result::Result<
        crate::operation::test_state::TestStateOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::test_state::TestStateError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let mut fluent_builder = client.test_state();
        fluent_builder.inner = self;
        fluent_builder.send().await
    }
}
/// Fluent builder constructing a request to `TestState`.
///
/// <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>
/// <ul>
/// <li>
/// <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>
/// <li>
/// <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>
/// <li>
/// <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>
/// </ul>
/// <p>You can call this API on only one state at a time. The states that you can test include the following:</p>
/// <ul>
/// <li>
/// <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>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-pass-state.html">Pass</a></p></li>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-wait-state.html">Wait</a></p></li>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html">Choice</a></p></li>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-succeed-state.html">Succeed</a></p></li>
/// <li>
/// <p><a href="https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-fail-state.html">Fail</a></p></li>
/// </ul>
/// <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>
/// <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>
/// <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>
#[derive(::std::clone::Clone, ::std::fmt::Debug)]
pub struct TestStateFluentBuilder {
    handle: ::std::sync::Arc<crate::client::Handle>,
    inner: crate::operation::test_state::builders::TestStateInputBuilder,
    config_override: ::std::option::Option<crate::config::Builder>,
}
impl crate::client::customize::internal::CustomizableSend<crate::operation::test_state::TestStateOutput, crate::operation::test_state::TestStateError>
    for TestStateFluentBuilder
{
    fn send(
        self,
        config_override: crate::config::Builder,
    ) -> crate::client::customize::internal::BoxFuture<
        crate::client::customize::internal::SendResult<crate::operation::test_state::TestStateOutput, crate::operation::test_state::TestStateError>,
    > {
        ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
    }
}
impl TestStateFluentBuilder {
    /// Creates a new `TestStateFluentBuilder`.
    pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
        Self {
            handle,
            inner: ::std::default::Default::default(),
            config_override: ::std::option::Option::None,
        }
    }
    /// Access the TestState as a reference.
    pub fn as_input(&self) -> &crate::operation::test_state::builders::TestStateInputBuilder {
        &self.inner
    }
    /// Sends the request and returns the response.
    ///
    /// If an error occurs, an `SdkError` will be returned with additional details that
    /// can be matched against.
    ///
    /// By default, any retryable failures will be retried twice. Retry behavior
    /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
    /// set when configuring the client.
    pub async fn send(
        self,
    ) -> ::std::result::Result<
        crate::operation::test_state::TestStateOutput,
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::test_state::TestStateError,
            ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
        >,
    > {
        let input = self
            .inner
            .build()
            .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
        let runtime_plugins = crate::operation::test_state::TestState::operation_runtime_plugins(
            self.handle.runtime_plugins.clone(),
            &self.handle.conf,
            self.config_override,
        );
        crate::operation::test_state::TestState::orchestrate(&runtime_plugins, input).await
    }

    /// Consumes this builder, creating a customizable operation that can be modified before being sent.
    pub fn customize(
        self,
    ) -> crate::client::customize::CustomizableOperation<
        crate::operation::test_state::TestStateOutput,
        crate::operation::test_state::TestStateError,
        Self,
    > {
        crate::client::customize::CustomizableOperation::new(self)
    }
    pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
        self.set_config_override(::std::option::Option::Some(config_override.into()));
        self
    }

    pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
        self.config_override = config_override;
        self
    }
    /// <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>
    pub fn definition(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.definition(input.into());
        self
    }
    /// <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>
    pub fn set_definition(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_definition(input);
        self
    }
    /// <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>
    pub fn get_definition(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_definition()
    }
    /// <p>The Amazon Resource Name (ARN) of the execution role with the required IAM permissions for the state.</p>
    pub fn role_arn(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.role_arn(input.into());
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the execution role with the required IAM permissions for the state.</p>
    pub fn set_role_arn(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_role_arn(input);
        self
    }
    /// <p>The Amazon Resource Name (ARN) of the execution role with the required IAM permissions for the state.</p>
    pub fn get_role_arn(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_role_arn()
    }
    /// <p>A string that contains the JSON input data for the state.</p>
    pub fn input(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.input(input.into());
        self
    }
    /// <p>A string that contains the JSON input data for the state.</p>
    pub fn set_input(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_input(input);
        self
    }
    /// <p>A string that contains the JSON input data for the state.</p>
    pub fn get_input(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_input()
    }
    /// <p>Determines the values to return when a state is tested. You can specify one of the following types:</p>
    /// <ul>
    /// <li>
    /// <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>
    /// <li>
    /// <p><code>DEBUG</code>: Shows the final state output along with the input and output data processing result.</p></li>
    /// <li>
    /// <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>
    /// </ul>
    /// <p>Each of these levels also provide information about the status of the state execution and the next state to transition to.</p>
    pub fn inspection_level(mut self, input: crate::types::InspectionLevel) -> Self {
        self.inner = self.inner.inspection_level(input);
        self
    }
    /// <p>Determines the values to return when a state is tested. You can specify one of the following types:</p>
    /// <ul>
    /// <li>
    /// <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>
    /// <li>
    /// <p><code>DEBUG</code>: Shows the final state output along with the input and output data processing result.</p></li>
    /// <li>
    /// <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>
    /// </ul>
    /// <p>Each of these levels also provide information about the status of the state execution and the next state to transition to.</p>
    pub fn set_inspection_level(mut self, input: ::std::option::Option<crate::types::InspectionLevel>) -> Self {
        self.inner = self.inner.set_inspection_level(input);
        self
    }
    /// <p>Determines the values to return when a state is tested. You can specify one of the following types:</p>
    /// <ul>
    /// <li>
    /// <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>
    /// <li>
    /// <p><code>DEBUG</code>: Shows the final state output along with the input and output data processing result.</p></li>
    /// <li>
    /// <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>
    /// </ul>
    /// <p>Each of these levels also provide information about the status of the state execution and the next state to transition to.</p>
    pub fn get_inspection_level(&self) -> &::std::option::Option<crate::types::InspectionLevel> {
        self.inner.get_inspection_level()
    }
    /// <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>
    /// <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>
    /// <p>By default, <code>revealSecrets</code> is set to <code>false</code>.</p>
    pub fn reveal_secrets(mut self, input: bool) -> Self {
        self.inner = self.inner.reveal_secrets(input);
        self
    }
    /// <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>
    /// <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>
    /// <p>By default, <code>revealSecrets</code> is set to <code>false</code>.</p>
    pub fn set_reveal_secrets(mut self, input: ::std::option::Option<bool>) -> Self {
        self.inner = self.inner.set_reveal_secrets(input);
        self
    }
    /// <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>
    /// <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>
    /// <p>By default, <code>revealSecrets</code> is set to <code>false</code>.</p>
    pub fn get_reveal_secrets(&self) -> &::std::option::Option<bool> {
        self.inner.get_reveal_secrets()
    }
    /// <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>
    pub fn variables(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.variables(input.into());
        self
    }
    /// <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>
    pub fn set_variables(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_variables(input);
        self
    }
    /// <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>
    pub fn get_variables(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_variables()
    }
    /// <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>
    pub fn state_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.state_name(input.into());
        self
    }
    /// <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>
    pub fn set_state_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_state_name(input);
        self
    }
    /// <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>
    pub fn get_state_name(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_state_name()
    }
    /// <p>Defines a mocked result or error for the state under test.</p>
    /// <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>
    pub fn mock(mut self, input: crate::types::MockInput) -> Self {
        self.inner = self.inner.mock(input);
        self
    }
    /// <p>Defines a mocked result or error for the state under test.</p>
    /// <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>
    pub fn set_mock(mut self, input: ::std::option::Option<crate::types::MockInput>) -> Self {
        self.inner = self.inner.set_mock(input);
        self
    }
    /// <p>Defines a mocked result or error for the state under test.</p>
    /// <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>
    pub fn get_mock(&self) -> &::std::option::Option<crate::types::MockInput> {
        self.inner.get_mock()
    }
    /// <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>
    pub fn context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.inner = self.inner.context(input.into());
        self
    }
    /// <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>
    pub fn set_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.inner = self.inner.set_context(input);
        self
    }
    /// <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>
    pub fn get_context(&self) -> &::std::option::Option<::std::string::String> {
        self.inner.get_context()
    }
    /// <p>Contains configurations for the state under test.</p>
    pub fn state_configuration(mut self, input: crate::types::TestStateConfiguration) -> Self {
        self.inner = self.inner.state_configuration(input);
        self
    }
    /// <p>Contains configurations for the state under test.</p>
    pub fn set_state_configuration(mut self, input: ::std::option::Option<crate::types::TestStateConfiguration>) -> Self {
        self.inner = self.inner.set_state_configuration(input);
        self
    }
    /// <p>Contains configurations for the state under test.</p>
    pub fn get_state_configuration(&self) -> &::std::option::Option<crate::types::TestStateConfiguration> {
        self.inner.get_state_configuration()
    }
}