How to use the @aws-cdk/aws-stepfunctions.StateMachine function in @aws-cdk/aws-stepfunctions

To help you get started, we’ve selected a few @aws-cdk/aws-stepfunctions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / @aws-cdk / custom-resources / lib / provider-framework / provider.ts View on Github external
}

    this.onEventHandler = props.onEventHandler;
    this.isCompleteHandler = props.isCompleteHandler;

    const onEventFunction = this.createFunction(consts.FRAMEWORK_ON_EVENT_HANDLER_NAME);

    if (this.isCompleteHandler) {
      const isCompleteFunction = this.createFunction(consts.FRAMEWORK_IS_COMPLETE_HANDLER_NAME);
      const timeoutFunction = this.createFunction(consts.FRAMEWORK_ON_TIMEOUT_HANDLER_NAME);

      const isCompleteTask = this.createTask(isCompleteFunction);
      isCompleteTask.addCatch(this.createTask(timeoutFunction));
      isCompleteTask.addRetry(calculateRetryPolicy(props));

      const waiterStateMachine = new sfn.StateMachine(this, 'waiter-state-machine', {
        definition: isCompleteTask
      });

      // the on-event entrypoint is going to start the execution of the waiter
      onEventFunction.addEnvironment(consts.WAITER_STATE_MACHINE_ARN_ENV, waiterStateMachine.stateMachineArn);
      waiterStateMachine.grantStartExecution(onEventFunction);
    }

    this.entrypoint = onEventFunction;
  }
github deepalert / deepalert / lib / deepalert-stack.ts View on Github external
lambdaFunction: reviewer,
          })
        )
    )
    .next(
      new sfn.Choice(scope, "Job Complete?")
        .when(condFailed, invokeErrorHandler)
        .when(
          sfn.Condition.stringEquals("$.status", "SUCCEEDED"),
          new tasks.LambdaInvoke(scope, "invokePublishReport", {
            lambdaFunction: publishReport,
          })
        )
    );

  return new sfn.StateMachine(scope, "InspectionMachine", {
    definition,
    role: sfnRole,
  });
}
github deepalert / deepalert / lib / deepalert-stack.ts View on Github external
const invokeErrorHandler = new tasks.LambdaInvoke(
    scope,
    "InvokeErrorHandler",
    { lambdaFunction: errorHandler }
  );

  const definition = wait
    .next(invokeDispatcher)
    .next(
      new sfn.Choice(scope, "Job Complete?").when(
        sfn.Condition.stringEquals("$.status", "FAILED"),
        invokeErrorHandler
      )
    );

  return new sfn.StateMachine(scope, "InspectionMachine", {
    definition,
    role: sfnRole,
  });
}