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 (#19186)

It is only supported for AWS Batch and Amazon ECS.

Throw when used for CallAwsService.

Closes #19174


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
jogold authored Feb 28, 2022
1 parent 5c40b90 commit 4b134b7
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 4b134b7

Please sign in to comment.