Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(stepfunctions-tasks): add httpinvoke step functions task #28673

Merged
merged 26 commits into from
Apr 16, 2024

Conversation

MathieuGilbert
Copy link
Contributor

@MathieuGilbert MathieuGilbert commented Jan 11, 2024

This adds an HttpInvoke Step Functions task construct, which allows calling public APIs as described here.

  • Accepts an Event Bridge API Destination IConnection, setting required permissions to use its credentials.
  • Grants permission to invoke the root path for the endpoint (apiRoot prop). This allows passing the relative endpoint path at execution time (apiEndpoint prop).
  • Defines an enum for the allowed options for the URL encoding style of arrays, used when encoding the request body.

Closes #28278


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2 labels Jan 11, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team January 11, 2024 20:15
@MathieuGilbert MathieuGilbert changed the title Add http:invoke step functions task feat(aws-stepfunctions-tasks): Add http:invoke step functions task Jan 11, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@MathieuGilbert MathieuGilbert changed the title feat(aws-stepfunctions-tasks): Add http:invoke step functions task feat(aws-stepfunctions-tasks): add http:invoke step functions task Jan 11, 2024
Add task policies: events:RetrieveConnectionCredentials, secretsmanager:GetSecretValue, secretsmanager:DescribeSecret, states:InvokeHTTPEndpoint.
@MathieuGilbert MathieuGilbert changed the title feat(aws-stepfunctions-tasks): add http:invoke step functions task feat(stepfunctions-tasks): add http:invoke step functions task Jan 12, 2024
@aws-cdk-automation
Copy link
Collaborator

This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

…t. Test creates an API Gateway endpoint with basic auth Connection, then uses the connection in its task to invoke the endpoint.
@aws-cdk-automation aws-cdk-automation dismissed their stale review February 2, 2024 23:46

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@MathieuGilbert MathieuGilbert marked this pull request as ready for review February 22, 2024 22:32
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Feb 22, 2024
Copy link
Contributor

@msambol msambol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff. Mostly nits on formatting.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Mar 22, 2024
Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! This looks great overall but I just have one suggested change (in addition to the feedback already given).

*
* @default - ArrayEncodingFormat.INDICES
*/
readonly arrayEncodingFormat?: ArrayEncodingFormat;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this field is reliant on urlEncodeBody being set, these two fields should probably be one field. Maybe the only field here should still be called urlEncodeBody but have it take an Encoding (not sure about this name) class with a static function that has an optional input of ArrayEncodingFormat. Something along the lines of

urlEncodeBody: Encoding.set(ArrayEncodingFormat.INDICES);

to include encoding format, or

urlEncodeBody: Encoding.set();

to just include encoding with the default format.

This way, if they leave off this prop altogether, it's defaulted to false.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll also add the note here that set probably isn't a great function name here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out, I agree it's a bit awkward with the 2 params. I played around a bit, and I think a single prop can work with a couple extra enum options and renaming it to urlEncodingFormat. You can not pass it or specify URLEncodingFormat.NONE to get no encoding, pass it as URLEncodingFormat.DEFAULT to get encoding with the default array encoding (the underlying service defaults to INDICES), or specify the existing values to use those.

…. Rename enum to URLEncodingFormat and add DEFAULT and NONE options. Restructure the buildTaskParameters method for clarity with the new logic, and define an interface for it. Add specific test case for NONE.
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review April 2, 2024 23:27

Pull request has been modified.

@MathieuGilbert
Copy link
Contributor Author

@msambol @TheRealAmazonKendra Thanks for reviewing, I think I've addressed all of your comments. Please let me know if there's anything else!

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all your work on this!

Copy link
Contributor

mergify bot commented Apr 16, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@TheRealAmazonKendra
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Apr 16, 2024

update

❌ Mergify doesn't have permission to update

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/request-cli-integ-test.yml without workflows permission

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: f784b79
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented Apr 16, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-stepfunctions-tasks: Support for new HTTPS Endpoint integration
4 participants