Class StateMachine


  • public class StateMachine
    extends com.pulumi.resources.CustomResource
    Provides a Step Function State Machine resource ## Example Usage ### Basic (Standard Workflow) ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.sfn.StateMachine; import com.pulumi.aws.sfn.StateMachineArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder() .roleArn(aws_iam_role.iam_for_sfn().arn()) .definition(""" { "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function", "StartAt": "HelloWorld", "States": { "HelloWorld": { "Type": "Task", "Resource": "%s", "End": true } } } ", aws_lambda_function.lambda().arn())) .build()); } } ``` ### Basic (Express Workflow) ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.sfn.StateMachine; import com.pulumi.aws.sfn.StateMachineArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder() .roleArn(aws_iam_role.iam_for_sfn().arn()) .type("EXPRESS") .definition(""" { "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function", "StartAt": "HelloWorld", "States": { "HelloWorld": { "Type": "Task", "Resource": "%s", "End": true } } } ", aws_lambda_function.lambda().arn())) .build()); } } ``` ### Publish (Publish SFN version) ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.sfn.StateMachine; import com.pulumi.aws.sfn.StateMachineArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder() .roleArn(aws_iam_role.iam_for_sfn().arn()) .publish(true) .type("EXPRESS") .definition(""" { "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function", "StartAt": "HelloWorld", "States": { "HelloWorld": { "Type": "Task", "Resource": "%s", "End": true } } } ", aws_lambda_function.lambda().arn())) .build()); } } ``` ### Logging > *NOTE:* See the [AWS Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) for more information about enabling Step Function logging. ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.sfn.StateMachine; import com.pulumi.aws.sfn.StateMachineArgs; import com.pulumi.aws.sfn.inputs.StateMachineLoggingConfigurationArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var sfnStateMachine = new StateMachine("sfnStateMachine", StateMachineArgs.builder() .roleArn(aws_iam_role.iam_for_sfn().arn()) .definition(""" { "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function", "StartAt": "HelloWorld", "States": { "HelloWorld": { "Type": "Task", "Resource": "%s", "End": true } } } ", aws_lambda_function.lambda().arn())) .loggingConfiguration(StateMachineLoggingConfigurationArgs.builder() .logDestination(String.format("%s:*", aws_cloudwatch_log_group.log_group_for_sfn().arn())) .includeExecutionData(true) .level("ERROR") .build()) .build()); } } ``` ## Import Using `pulumi import`, import State Machines using the `arn`. For example: ```sh $ pulumi import aws:sfn/stateMachine:StateMachine foo arn:aws:states:eu-west-1:123456789098:stateMachine:bar ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<java.lang.String> creationDate()  
      com.pulumi.core.Output<java.lang.String> definition()  
      com.pulumi.core.Output<java.lang.String> description()  
      static StateMachine get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, StateMachineState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<StateMachineLoggingConfiguration> loggingConfiguration()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> namePrefix()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> publish()  
      com.pulumi.core.Output<java.lang.String> revisionId()  
      com.pulumi.core.Output<java.lang.String> roleArn()  
      com.pulumi.core.Output<java.lang.String> stateMachineVersionArn()  
      com.pulumi.core.Output<java.lang.String> status()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()  
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()  
      com.pulumi.core.Output<StateMachineTracingConfiguration> tracingConfiguration()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> type()  
      com.pulumi.core.Output<java.lang.String> versionDescription()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StateMachine

        public StateMachine​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • StateMachine

        public StateMachine​(java.lang.String name,
                            StateMachineArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • StateMachine

        public StateMachine​(java.lang.String name,
                            StateMachineArgs args,
                            @Nullable
                            com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        The ARN of the state machine.
      • creationDate

        public com.pulumi.core.Output<java.lang.String> creationDate()
        Returns:
        The date the state machine was created.
      • definition

        public com.pulumi.core.Output<java.lang.String> definition()
        Returns:
        The [Amazon States Language](https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html) definition of the state machine.
      • description

        public com.pulumi.core.Output<java.lang.String> description()
      • loggingConfiguration

        public com.pulumi.core.Output<StateMachineLoggingConfiguration> loggingConfiguration()
        Returns:
        Defines what execution history events are logged and where they are logged. The `logging_configuration` parameter is only valid when `type` is set to `EXPRESS`. Defaults to `OFF`. For more information see [Logging Express Workflows](https://docs.aws.amazon.com/step-functions/latest/dg/cw-logs.html) and [Log Levels](https://docs.aws.amazon.com/step-functions/latest/dg/cloudwatch-log-level.html) in the AWS Step Functions User Guide.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        The name of the state machine. The name should only contain `0`-`9`, `A`-`Z`, `a`-`z`, `-` and `_`. If omitted, the provider will assign a random, unique name.
      • namePrefix

        public com.pulumi.core.Output<java.lang.String> namePrefix()
        Returns:
        Creates a unique name beginning with the specified prefix. Conflicts with `name`.
      • publish

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> publish()
        Returns:
        Set to true to publish a version of the state machine during creation. Default: false.
      • revisionId

        public com.pulumi.core.Output<java.lang.String> revisionId()
      • roleArn

        public com.pulumi.core.Output<java.lang.String> roleArn()
        Returns:
        The Amazon Resource Name (ARN) of the IAM role to use for this state machine.
      • stateMachineVersionArn

        public com.pulumi.core.Output<java.lang.String> stateMachineVersionArn()
      • status

        public com.pulumi.core.Output<java.lang.String> status()
        Returns:
        The current status of the state machine. Either `ACTIVE` or `DELETING`.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Key-value map of resource tags. .If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
      • tracingConfiguration

        public com.pulumi.core.Output<StateMachineTracingConfiguration> tracingConfiguration()
        Returns:
        Selects whether AWS X-Ray tracing is enabled.
      • type

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> type()
        Returns:
        Determines whether a Standard or Express state machine is created. The default is `STANDARD`. You cannot update the type of a state machine once it has been created. Valid values: `STANDARD`, `EXPRESS`.
      • versionDescription

        public com.pulumi.core.Output<java.lang.String> versionDescription()
      • get

        public static StateMachine get​(java.lang.String name,
                                       com.pulumi.core.Output<java.lang.String> id,
                                       @Nullable
                                       StateMachineState state,
                                       @Nullable
                                       com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.