Skip to content

Commit ddfef06

Browse files
fix(stepfunctions-tasks): allow passing apiEndpoint as intrinsic function (under feature flag) (aws#32139)
### Issue aws#29925 Closes aws#29925, aws#30749. ### Reason for this change The `apiEndpoint` prop currently only works when it's a string (ie. `TaskInput.fromText('some/text')`), with the task failing when passed as a reference (ie. `TaskInput.fromText(JsonPath.format('some/text/{}', '123')`). This is needed to allow for dynamic parts in the path. ### Description of changes - Change the `ApiEndpoint` task parameter to use the `JsonPath.format` intrinsic function to combine the `apiRoot` and `apiEndpoint` props, instead of basic string concatenation. - Update README entry with more complex example. ### Description of how you validated changes - A unit test was added to cover passing formatted input. - An integration test was added using `fromJsonPathAt` for the endpoint. - A test stack was deployed with an API Gateway endpoint with basic auth Connection and was successfully invoked with dynamic payload: ``` const httpInvokeTask = new HttpInvoke(this, 'HttpInvoke', { apiRoot: api.url, apiEndpoint: TaskInput.fromJsonPathAt('$.endpointName'), method: TaskInput.fromText('GET'), connection, outputPath: '$.ResponseBody', }) ``` ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent bccafc0 commit ddfef06

File tree

20 files changed

+63447
-25
lines changed

20 files changed

+63447
-25
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/http/integ.invoke-json-path.js.snapshot/HttpInvokeTestDefaultTestDeployAssertBA1B4726.assets.json

Lines changed: 33 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/http/integ.invoke-json-path.js.snapshot/HttpInvokeTestDefaultTestDeployAssertBA1B4726.template.json

Lines changed: 188 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/http/integ.invoke-json-path.js.snapshot/asset.c071afed018660f87ece6db422ff34407d45f6940181746b4c7f99af8f032a98/index.js

Lines changed: 54 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)