Closed
Description
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 aSecretString
value is retrieved and no transform is applied - this also applies when abase64
encoded value stored in aSecretString
is retrieved and abinary
transform is appliedUint8Array
applies when retrieving aSecretBinary
value is retrieved an no transform is appliedRecord<string, unknown>
applies whenever a transform: 'json' is applied - in this case Parameters parses the value and returns an objectundefined
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
- This feature request meets Lambda Powertools Tenets
- Should this be considered in other Lambda Powertools languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.