Skip to content

Commit

Permalink
Add parameters to TaskProp, PassProp [fixes aws#3453] (aws#4815)
Browse files Browse the repository at this point in the history
  • Loading branch information
alukach authored and mergify[bot] committed Nov 4, 2019
1 parent 5029f0e commit c722b31
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ export interface PassProps {
* @default No injected result
*/
readonly result?: Result;

/**
* Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input.
*
* @see
* https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters
*
* @default No parameters
*/
readonly parameters?: { [name: string]: any };
}

/**
Expand Down
10 changes: 10 additions & 0 deletions packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ export interface TaskProps {
*/
readonly resultPath?: string;

/**
* Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input.
*
* @see
* https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters
*
* @default No parameters
*/
readonly parameters?: { [name: string]: any };

/**
* Maximum run time of this state
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,43 @@ export = {
]
}));

test.done();
},

'Pass should render InputPath / Parameters / OutputPath correctly'(test: Test) {
// GIVEN
const stack = new cdk.Stack();
const task = new stepfunctions.Pass(stack, 'Pass', {
inputPath: "$",
outputPath: "$.state",
parameters: {
"input.$": "$",
"stringArgument": "inital-task",
"numberArgument": 123,
"booleanArgument": true,
"arrayArgument": ["a", "b", "c"]
}
});

// WHEN
const taskState = task.toStateJson();

// THEN
test.deepEqual(taskState, { End: true,
InputPath: '$',
OutputPath: '$.state',
Parameters:
{ 'input.$': '$',
'stringArgument': 'inital-task',
'numberArgument': 123,
'booleanArgument': true,
'arrayArgument': [ 'a', 'b', 'c' ] },
Type: 'Pass',
Comment: undefined,
Result: undefined,
ResultPath: undefined,
});

test.done();
}

Expand Down

0 comments on commit c722b31

Please sign in to comment.