How to use where clause in Knex
Create refunds with Stripe
Load HTML with Cheerio
How to send POST request with Axios
Find intersection of array in Lodash
Powered by Official white Bloop logo with a period

Terms / Privacy / Search / Support

  • // The code below shows an example of how to instantiate this type.
    // The values are placeholders you should change.
    import * as lambda from '@aws-cdk/aws-lambda';
    import * as stepfunctions_tasks from '@aws-cdk/aws-stepfunctions-tasks';
    
    declare const function_: lambda.Function;
    declare const payload: any;
    const invokeFunction = new stepfunctions_tasks.InvokeFunction(function_, /* all optional props */ {
      payload: {
        payloadKey: payload,
      },
    });
    
    Docs
  • // The code below shows an example of how to instantiate this type.
    // The values are placeholders you should change.
    import * as lambda from '@aws-cdk/aws-lambda';
    import * as stepfunctions from '@aws-cdk/aws-stepfunctions';
    import * as stepfunctions_tasks from '@aws-cdk/aws-stepfunctions-tasks';
    
    declare const function_: lambda.Function;
    declare const taskInput: stepfunctions.TaskInput;
    const runLambdaTask = new stepfunctions_tasks.RunLambdaTask(function_, /* all optional props */ {
      clientContext: 'clientContext',
      integrationPattern: stepfunctions.ServiceIntegrationPattern.FIRE_AND_FORGET,
      invocationType: stepfunctions_tasks.InvocationType.REQUEST_RESPONSE,
      payload: taskInput,
      qualifier: 'qualifier',
    });
    
    Docs
  • // The code below shows an example of how to instantiate this type.
    // The values are placeholders you should change.
    import * as stepfunctions from '@aws-cdk/aws-stepfunctions';
    import * as stepfunctions_tasks from '@aws-cdk/aws-stepfunctions-tasks';
    import * as cdk from '@aws-cdk/core';
    
    declare const activity: stepfunctions.Activity;
    const invokeActivity = new stepfunctions_tasks.InvokeActivity(activity, /* all optional props */ {
      heartbeat: cdk.Duration.minutes(30),
    });
    
    Docs
  • import * as lambda from '@aws-cdk/aws-lambda';
    
    declare const submitLambda: lambda.Function;
    declare const getStatusLambda: lambda.Function;
    
    const submitJob = new tasks.LambdaInvoke(this, 'Submit Job', {
      lambdaFunction: submitLambda,
      // Lambda's result is in the attribute `Payload`
      outputPath: '$.Payload',
    });
    
    const waitX = new sfn.Wait(this, 'Wait X Seconds', {
      time: sfn.WaitTime.secondsPath('$.waitSeconds'),
    });
    
    const getStatus = new tasks.LambdaInvoke(this, 'Get Job Status', {
      lambdaFunction: getStatusLambda,
      // Pass just the field named "guid" into the Lambda, put the
      // Lambda's result in a field called "status" in the response
      inputPath: '$.guid',
      outputPath: '$.Payload',
    });
    
    const jobFailed = new sfn.Fail(this, 'Job Failed', {
      cause: 'AWS Batch Job Failed',
      error: 'DescribeJob returned FAILED',
    });
    
    const finalStatus = new tasks.LambdaInvoke(this, 'Get Final Job Status', {
      lambdaFunction: getStatusLambda,
      // Use "guid" field as input
      inputPath: '$.guid',
      outputPath: '$.Payload',
    });
    
    const definition = submitJob
      .next(waitX)
      .next(getStatus)
      .next(new sfn.Choice(this, 'Job Complete?')
        // Look at the "status" field
        .when(sfn.Condition.stringEquals('$.status', 'FAILED'), jobFailed)
        .when(sfn.Condition.stringEquals('$.status', 'SUCCEEDED'), finalStatus)
        .otherwise(waitX));
    
    new sfn.StateMachine(this, 'StateMachine', {
      definition,
      timeout: Duration.minutes(5),
    });
    
    Docs
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples