Class StateMachine

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.stepfunctions.StateMachine
All Implemented Interfaces:
IResource, IGrantable, IStateMachine, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-02T15:58:34.054Z") @Stability(Stable) public class StateMachine extends Resource implements IStateMachine
Define a StepFunctions State Machine.

Example:

 import software.amazon.awscdk.services.stepfunctions.*;
 Pipeline pipeline = new Pipeline(this, "MyPipeline");
 Artifact inputArtifact = new Artifact();
 Pass startState = new Pass(this, "StartState");
 StateMachine simpleStateMachine = StateMachine.Builder.create(this, "SimpleStateMachine")
         .definition(startState)
         .build();
 StepFunctionInvokeAction stepFunctionAction = StepFunctionInvokeAction.Builder.create()
         .actionName("Invoke")
         .stateMachine(simpleStateMachine)
         .stateMachineInput(StateMachineInput.filePath(inputArtifact.atPath("assets/input.json")))
         .build();
 pipeline.addStage(StageOptions.builder()
         .stageName("StepFunctions")
         .actions(List.of(stepFunctionAction))
         .build());
 
  • Constructor Details

    • StateMachine

      protected StateMachine(software.amazon.jsii.JsiiObjectRef objRef)
    • StateMachine

      protected StateMachine(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • StateMachine

      @Stability(Stable) public StateMachine(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull StateMachineProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromStateMachineArn

      @Stability(Stable) @NotNull public static IStateMachine fromStateMachineArn(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String stateMachineArn)
      Import a state machine.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      stateMachineArn - This parameter is required.
    • fromStateMachineName

      @Stability(Stable) @NotNull public static IStateMachine fromStateMachineName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String stateMachineName)
      Import a state machine via resource name.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      stateMachineName - This parameter is required.
    • addToRolePolicy

      @Stability(Stable) public void addToRolePolicy(@NotNull PolicyStatement statement)
      Add the given statement to the role's policy.

      Parameters:
      statement - This parameter is required.
    • grant

      @Stability(Stable) @NotNull public Grant grant(@NotNull IGrantable identity, @NotNull @NotNull String... actions)
      Grant the given identity custom permissions.

      Specified by:
      grant in interface IStateMachine
      Parameters:
      identity - This parameter is required.
      actions - This parameter is required.
    • grantExecution

      @Stability(Stable) @NotNull public Grant grantExecution(@NotNull IGrantable identity, @NotNull @NotNull String... actions)
      Grant the given identity permissions on all executions of the state machine.

      Specified by:
      grantExecution in interface IStateMachine
      Parameters:
      identity - This parameter is required.
      actions - This parameter is required.
    • grantRead

      @Stability(Stable) @NotNull public Grant grantRead(@NotNull IGrantable identity)
      Grant the given identity permissions to read results from state machine.

      Specified by:
      grantRead in interface IStateMachine
      Parameters:
      identity - This parameter is required.
    • grantStartExecution

      @Stability(Stable) @NotNull public Grant grantStartExecution(@NotNull IGrantable identity)
      Grant the given identity permissions to start an execution of this state machine.

      Specified by:
      grantStartExecution in interface IStateMachine
      Parameters:
      identity - This parameter is required.
    • grantStartSyncExecution

      @Stability(Stable) @NotNull public Grant grantStartSyncExecution(@NotNull IGrantable identity)
      Grant the given identity permissions to start a synchronous execution of this state machine.

      Specified by:
      grantStartSyncExecution in interface IStateMachine
      Parameters:
      identity - This parameter is required.
    • grantTaskResponse

      @Stability(Stable) @NotNull public Grant grantTaskResponse(@NotNull IGrantable identity)
      Grant the given identity task response permissions on a state machine.

      Specified by:
      grantTaskResponse in interface IStateMachine
      Parameters:
      identity - This parameter is required.
    • metric

      @Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props)
      Return the given named metric for this State Machine's executions.

      Default: - sum over 5 minutes

      Specified by:
      metric in interface IStateMachine
      Parameters:
      metricName - This parameter is required.
      props -
    • metric

      @Stability(Stable) @NotNull public Metric metric(@NotNull String metricName)
      Return the given named metric for this State Machine's executions.

      Default: - sum over 5 minutes

      Specified by:
      metric in interface IStateMachine
      Parameters:
      metricName - This parameter is required.
    • metricAborted

      @Stability(Stable) @NotNull public Metric metricAborted(@Nullable MetricOptions props)
      Metric for the number of executions that were aborted.

      Default: - sum over 5 minutes

      Specified by:
      metricAborted in interface IStateMachine
      Parameters:
      props -
    • metricAborted

      @Stability(Stable) @NotNull public Metric metricAborted()
      Metric for the number of executions that were aborted.

      Default: - sum over 5 minutes

      Specified by:
      metricAborted in interface IStateMachine
    • metricFailed

      @Stability(Stable) @NotNull public Metric metricFailed(@Nullable MetricOptions props)
      Metric for the number of executions that failed.

      Default: - sum over 5 minutes

      Specified by:
      metricFailed in interface IStateMachine
      Parameters:
      props -
    • metricFailed

      @Stability(Stable) @NotNull public Metric metricFailed()
      Metric for the number of executions that failed.

      Default: - sum over 5 minutes

      Specified by:
      metricFailed in interface IStateMachine
    • metricStarted

      @Stability(Stable) @NotNull public Metric metricStarted(@Nullable MetricOptions props)
      Metric for the number of executions that were started.

      Default: - sum over 5 minutes

      Specified by:
      metricStarted in interface IStateMachine
      Parameters:
      props -
    • metricStarted

      @Stability(Stable) @NotNull public Metric metricStarted()
      Metric for the number of executions that were started.

      Default: - sum over 5 minutes

      Specified by:
      metricStarted in interface IStateMachine
    • metricSucceeded

      @Stability(Stable) @NotNull public Metric metricSucceeded(@Nullable MetricOptions props)
      Metric for the number of executions that succeeded.

      Default: - sum over 5 minutes

      Specified by:
      metricSucceeded in interface IStateMachine
      Parameters:
      props -
    • metricSucceeded

      @Stability(Stable) @NotNull public Metric metricSucceeded()
      Metric for the number of executions that succeeded.

      Default: - sum over 5 minutes

      Specified by:
      metricSucceeded in interface IStateMachine
    • metricThrottled

      @Stability(Stable) @NotNull public Metric metricThrottled(@Nullable MetricOptions props)
      Metric for the number of executions that were throttled.

      Default: - sum over 5 minutes

      Specified by:
      metricThrottled in interface IStateMachine
      Parameters:
      props -
    • metricThrottled

      @Stability(Stable) @NotNull public Metric metricThrottled()
      Metric for the number of executions that were throttled.

      Default: - sum over 5 minutes

      Specified by:
      metricThrottled in interface IStateMachine
    • metricTime

      @Stability(Stable) @NotNull public Metric metricTime(@Nullable MetricOptions props)
      Metric for the interval, in milliseconds, between the time the execution starts and the time it closes.

      Default: - average over 5 minutes

      Specified by:
      metricTime in interface IStateMachine
      Parameters:
      props -
    • metricTime

      @Stability(Stable) @NotNull public Metric metricTime()
      Metric for the interval, in milliseconds, between the time the execution starts and the time it closes.

      Default: - average over 5 minutes

      Specified by:
      metricTime in interface IStateMachine
    • metricTimedOut

      @Stability(Stable) @NotNull public Metric metricTimedOut(@Nullable MetricOptions props)
      Metric for the number of executions that timed out.

      Default: - sum over 5 minutes

      Specified by:
      metricTimedOut in interface IStateMachine
      Parameters:
      props -
    • metricTimedOut

      @Stability(Stable) @NotNull public Metric metricTimedOut()
      Metric for the number of executions that timed out.

      Default: - sum over 5 minutes

      Specified by:
      metricTimedOut in interface IStateMachine
    • getGrantPrincipal

      @Stability(Stable) @NotNull public IPrincipal getGrantPrincipal()
      The principal this state machine is running as.
      Specified by:
      getGrantPrincipal in interface IGrantable
    • getRole

      @Stability(Stable) @NotNull public IRole getRole()
      Execution role of this state machine.
    • getStateMachineArn

      @Stability(Stable) @NotNull public String getStateMachineArn()
      The ARN of the state machine.
      Specified by:
      getStateMachineArn in interface IStateMachine
    • getStateMachineName

      @Stability(Stable) @NotNull public String getStateMachineName()
      The name of the state machine.
    • getStateMachineRevisionId

      @Stability(Stable) @NotNull public String getStateMachineRevisionId()
      Identifier for the state machine revision, which is an immutable, read-only snapshot of a state machine’s definition and configuration.
    • getStateMachineType

      @Stability(Stable) @NotNull public StateMachineType getStateMachineType()
      Type of the state machine.