Skip to content

Commit

Permalink
fix(stepfunctions-tasks): RUN_JOB integration pattern not supported f…
Browse files Browse the repository at this point in the history
…or CallAwsService

It is only supported for AWS Batch and Amazon ECS.

Throw when used for CallAwsService.

Closes #19174
  • Loading branch information
jogold committed Feb 28, 2022
1 parent 3f49f02 commit 0e2d97b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export class CallAwsService extends sfn.TaskStateBase {
constructor(scope: Construct, id: string, private readonly props: CallAwsServiceProps) {
super(scope, id, props);

if (this.props.integrationPattern === sfn.IntegrationPattern.RUN_JOB) {
throw new Error('The RUN_JOB integration pattern is not supported for CallAwsService');
}

this.taskPolicies = [
new iam.PolicyStatement({
resources: props.iamResources,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,16 @@ test('with unresolved tokens', () => {
Parameters: {},
});
});

test('throws with invalid integration pattern', () => {
expect(() => new tasks.CallAwsService(stack, 'GetObject', {
integrationPattern: sfn.IntegrationPattern.RUN_JOB,
service: 's3',
action: 'getObject',
parameters: {
Bucket: 'my-bucket',
Key: sfn.JsonPath.stringAt('$.key'),
},
iamResources: ['*'],
})).toThrow(/The RUN_JOB integration pattern is not supported for CallAwsService/);
});

0 comments on commit 0e2d97b

Please sign in to comment.