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

Feature request: improve return types for Secrets Manager Parameters #1409

Closed
1 of 2 tasks
dreamorosi opened this issue Apr 12, 2023 · 3 comments · Fixed by #1411
Closed
1 of 2 tasks

Feature request: improve return types for Secrets Manager Parameters #1409

dreamorosi opened this issue Apr 12, 2023 · 3 comments · Fixed by #1411
Assignees
Labels
completed This item is complete and has been merged/shipped feature-request This item refers to a feature request for an existing or new utility parameters This item relates to the Parameters Utility

Comments

@dreamorosi
Copy link
Contributor

Use case

Note
This is a follow up issue to #1386 and aims at continuing the work started in #1387

Currently when retrieving parameter values from Secrets Manager, the Parameter utility has somewhat generic return types.

For example, when calling the getSecret function the current return type is a Promise that can resolve to undefined | string | Uint8Array | Record<string, unknown>. These types were chosen because they map to the following cases:

  • string applies when a SecretString value is retrieved and no transform is applied - this also applies when a base64 encoded value stored in a SecretString is retrieved and a binary transform is applied
  • Uint8Array applies when retrieving a SecretBinary value is retrieved an no transform is applied
  • Record<string, unknown> applies whenever a transform: 'json' is applied - in this case Parameters parses the value and returns an object
  • undefined is returned whenever a parameter is not found

Given that the utility knows both the types returned by the API and the transformation to be applied, there's an opportunity to improve the return types by applying some heuristics.

Solution/User Experience

TBD

Alternative solutions

N/A

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

@dreamorosi dreamorosi added triage This item has not been triaged by a maintainer, please wait feature-request This item refers to a feature request for an existing or new utility labels Apr 12, 2023
@dreamorosi dreamorosi self-assigned this Apr 12, 2023
@dreamorosi dreamorosi moved this from Backlog to Working on it in AWS Lambda Powertools for TypeScript Apr 14, 2023
@dreamorosi
Copy link
Contributor Author

After looking into options I have found that the solution and types for this provider will be very similar to the one already introduced for the SSMProvider.

I will open a PR shortly.

@dreamorosi dreamorosi added parameters This item relates to the Parameters Utility confirmed The scope is clear, ready for implementation and removed triage This item has not been triaged by a maintainer, please wait labels Apr 14, 2023
@dreamorosi dreamorosi linked a pull request Apr 14, 2023 that will close this issue
13 tasks
@github-project-automation github-project-automation bot moved this from Working on it to Coming soon in AWS Lambda Powertools for TypeScript Apr 14, 2023
@github-actions
Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added the pending-release This item has been merged and will be released soon label Apr 14, 2023
@dreamorosi dreamorosi removed the confirmed The scope is clear, ready for implementation label Apr 14, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

This is now released under v1.9.0 version!

@dreamorosi dreamorosi added completed This item is complete and has been merged/shipped and removed pending-release This item has been merged and will be released soon labels Jun 9, 2023
@dreamorosi dreamorosi moved this from Coming soon to Shipped in AWS Lambda Powertools for TypeScript Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
completed This item is complete and has been merged/shipped feature-request This item refers to a feature request for an existing or new utility parameters This item relates to the Parameters Utility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant