Commit ddfef06
authored
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- packages
- @aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/http
- integ.invoke-json-path.js.snapshot
- asset.c071afed018660f87ece6db422ff34407d45f6940181746b4c7f99af8f032a98
- asset.c11608a15785084ea1afe65826e575ee316add10c8b1bb373e93297e26aec564.bundle
- integ.invoke.js.snapshot
- asset.bfcf4228d6660f50e81f19efdb64c6388dda6796296eb239decdff1dbc2f4981.bundle
- aws-cdk-lib
- aws-stepfunctions-tasks
- lib/http
- test/http
- cx-api
- lib
- test
20 files changed
+63447
-25
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments