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

  • import * as dynamodb from '@aws-cdk/aws-dynamodb';
    
    // create a table
    const table = new dynamodb.Table(this, 'montable', {
      partitionKey: {
        name: 'id',
        type: dynamodb.AttributeType.STRING,
      },
    });
    
    const finalStatus = new sfn.Pass(this, 'final step');
    
    // States language JSON to put an item into DynamoDB
    // snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
    const stateJson = {
      Type: 'Task',
      Resource: 'arn:aws:states:::dynamodb:putItem',
      Parameters: {
        TableName: table.tableName,
        Item: {
          id: {
            S: 'MyEntry',
          },
        },
      },
      ResultPath: null,
    };
    
    // custom state which represents a task to insert data into DynamoDB
    const custom = new sfn.CustomState(this, 'my custom task', {
      stateJson,
    });
    
    const chain = sfn.Chain.start(custom)
      .next(finalStatus);
    
    const sm = new sfn.StateMachine(this, 'StateMachine', {
      definition: chain,
      timeout: Duration.seconds(30),
    });
    
    // don't forget permissions. You need to assign them
    table.grantWriteData(sm);
    
    Docs
    0
  • new sfn.StateMachine(this, 'MyStateMachine', {
      definition: sfn.Chain.start(new sfn.Pass(this, 'Pass')),
      tracingEnabled: true,
    });
    
    Docs
    0
  • import * as logs from '@aws-cdk/aws-logs';
    
    const logGroup = new logs.LogGroup(this, 'MyLogGroup');
    
    new sfn.StateMachine(this, 'MyStateMachine', {
      definition: sfn.Chain.start(new sfn.Pass(this, 'Pass')),
      logs: {
        destination: logGroup,
        level: sfn.LogLevel.ALL,
      },
    });
    
    Docs
    0
  • // Define a state machine with one Pass state
    const child = new sfn.StateMachine(this, 'ChildStateMachine', {
      definition: sfn.Chain.start(new sfn.Pass(this, 'PassState')),
    });
    
    // Include the state machine in a Task state with callback pattern
    const task = new tasks.StepFunctionsStartExecution(this, 'ChildTask', {
      stateMachine: child,
      integrationPattern: sfn.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
      input: sfn.TaskInput.fromObject({
        token: sfn.JsonPath.taskToken,
        foo: 'bar',
      }),
      name: 'MyExecutionName',
    });
    
    // Define a second state machine with the Task state above
    new sfn.StateMachine(this, 'ParentStateMachine', {
      definition: task,
    });
    
    Docs
    0
  • import * as dynamodb from '@aws-cdk/aws-dynamodb';
    
    // create a table
    const table = new dynamodb.Table(this, 'montable', {
      partitionKey: {
        name: 'id',
        type: dynamodb.AttributeType.STRING,
      },
    });
    
    const finalStatus = new sfn.Pass(this, 'final step');
    
    // States language JSON to put an item into DynamoDB
    // snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
    const stateJson = {
      Type: 'Task',
      Resource: 'arn:aws:states:::dynamodb:putItem',
      Parameters: {
        TableName: table.tableName,
        Item: {
          id: {
            S: 'MyEntry',
          },
        },
      },
      ResultPath: null,
    };
    
    // custom state which represents a task to insert data into DynamoDB
    const custom = new sfn.CustomState(this, 'my custom task', {
      stateJson,
    });
    
    const chain = sfn.Chain.start(custom)
      .next(finalStatus);
    
    const sm = new sfn.StateMachine(this, 'StateMachine', {
      definition: chain,
      timeout: Duration.seconds(30),
    });
    
    // don't forget permissions. You need to assign them
    table.grantWriteData(sm);
    
    Docs
    0
  • // Makes the current JSON state { ..., "subObject": { "hello": "world" } }
    const pass = new sfn.Pass(this, 'Add Hello World', {
      result: sfn.Result.fromObject({ hello: 'world' }),
      resultPath: '$.subObject',
    });
    
    // Set the next state
    const nextState = new sfn.Pass(this, 'NextState');
    pass.next(nextState);
    
    Docs
    0
  • import * as dynamodb from '@aws-cdk/aws-dynamodb';
    
    // create a table
    const table = new dynamodb.Table(this, 'montable', {
      partitionKey: {
        name: 'id',
        type: dynamodb.AttributeType.STRING,
      },
    });
    
    const finalStatus = new sfn.Pass(this, 'final step');
    
    // States language JSON to put an item into DynamoDB
    // snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
    const stateJson = {
      Type: 'Task',
      Resource: 'arn:aws:states:::dynamodb:putItem',
      Parameters: {
        TableName: table.tableName,
        Item: {
          id: {
            S: 'MyEntry',
          },
        },
      },
      ResultPath: null,
    };
    
    // custom state which represents a task to insert data into DynamoDB
    const custom = new sfn.CustomState(this, 'my custom task', {
      stateJson,
    });
    
    const chain = sfn.Chain.start(custom)
      .next(finalStatus);
    
    const sm = new sfn.StateMachine(this, 'StateMachine', {
      definition: chain,
      timeout: Duration.seconds(30),
    });
    
    // don't forget permissions. You need to assign them
    table.grantWriteData(sm);
    
    Docs
    0
  • // Makes the current JSON state { ..., "subObject": { "hello": "world" } }
    const pass = new sfn.Pass(this, 'Add Hello World', {
      result: sfn.Result.fromObject({ hello: 'world' }),
      resultPath: '$.subObject',
    });
    
    // Set the next state
    const nextState = new sfn.Pass(this, 'NextState');
    pass.next(nextState);
    
    Docs
    0
  • Powered by Official black Bloop logo with a period
    download the IDE extension

    View other examples