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(event-source): add function to get multi-value query string params by name #3846

Merged

Conversation

TonySherman
Copy link
Contributor

Issue number: #3845

Summary

Changes

This adds a helper function to retrieve a list of multi-value query string params similar to the get_query_string_value function.

User experience

Rather than getting the entire dictionary of multi-value parameters (multi_value_query_string_parameters), users
can get a single list of parameters by the name of the parameter.

event.get_multi_value_query_string_values(name='param', default_values=['value_1']

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@TonySherman TonySherman requested a review from a team as a code owner February 24, 2024 02:24
@boring-cyborg boring-cyborg bot added the tests label Feb 24, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 24, 2024
@heitorlessa
Copy link
Contributor

Thanks a lot @TonySherman for following through our Discord chat -- reviewing and merging this today

@heitorlessa heitorlessa changed the title feat: add function to get multi-value query string params by name feat(event-source): add function to get multi-value query string params by name Feb 26, 2024
@github-actions github-actions bot added the feature New feature or functionality label Feb 26, 2024
Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

tiny changes to return a default instead of None.

  • Empty dict if you try to get all multi-value query strings params when there are none
  • Empty list if you try to get a specific multi-value query string param that does not exist

The adjacent code has a tech debt we plan to pay in v3, where all Optional will have empty defaults.. dict, lists, etc. So we can fix this one now as it's an addition

aws_lambda_powertools/utilities/data_classes/common.py Outdated Show resolved Hide resolved
tests/unit/test_data_classes.py Outdated Show resolved Hide resolved
aws_lambda_powertools/utilities/data_classes/common.py Outdated Show resolved Hide resolved
@heitorlessa
Copy link
Contributor

I'm gonna accept the changes as we need to make a patch release shortly before you're awake ;)

Signed-off-by: Heitor Lessa <lessa@amazon.nl>
Signed-off-by: Heitor Lessa <lessa@amazon.nl>
heitorlessa
heitorlessa previously approved these changes Feb 26, 2024
@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.42%. Comparing base (e14e768) to head (cf183c4).
Report is 93 commits behind head on develop.

❗ Current head cf183c4 differs from pull request most recent head ab5f09e. Consider uploading reports for the commit ab5f09e to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3846      +/-   ##
===========================================
+ Coverage    96.38%   96.42%   +0.04%     
===========================================
  Files          214      214              
  Lines        10030    10101      +71     
  Branches      1846     1866      +20     
===========================================
+ Hits          9667     9740      +73     
+ Misses         259      258       -1     
+ Partials       104      103       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Copy link

sonarcloud bot commented Feb 26, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
4.6% Duplication on New Code

See analysis details on SonarCloud

@heitorlessa heitorlessa merged commit 9cd21aa into aws-powertools:develop Feb 26, 2024
14 checks passed
@TonySherman TonySherman deleted the feat/multivalue-querystrings branch February 26, 2024 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants