Skip to content

Commit d074107

Browse files
Brend-SmitsCopilot
authored andcommitted
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 76f59fe commit d074107

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lambdas/libs/aws-ssm-util/src/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,32 @@ export async function getParameter(parameter_name: string): Promise<string> {
1717
return result;
1818
}
1919

20+
/**
21+
* Retrieves multiple parameters from AWS Systems Manager Parameter Store.
22+
*
23+
* This function uses the AWS SSM {@link GetParametersCommand} API to fetch the values
24+
* for the provided parameter names. Requests are automatically chunked into batches
25+
* of up to 10 names per call to comply with the AWS GetParameters API limit.
26+
*
27+
* Each successfully retrieved parameter is added to the returned {@link Map}, where:
28+
* - The map key is the full parameter name as stored in Parameter Store.
29+
* - The map value is the decrypted string value of the parameter.
30+
*
31+
* Parameter names that are not found in Parameter Store (or that cannot be returned
32+
* by the API) are silently omitted from the resulting map. They will not appear as
33+
* keys in the returned {@link Map}.
34+
*
35+
* @param parameter_names - An array of parameter names to retrieve from SSM Parameter Store.
36+
* If the array is empty, an empty {@link Map} is returned without calling the AWS API.
37+
*
38+
* @returns A {@link Map} where each key is a parameter name and each value is the
39+
* corresponding decrypted string value for that parameter. Only parameters that
40+
* are successfully retrieved and have both a `Name` and a `Value` are included.
41+
*
42+
* @throws Error Propagates any error thrown by the underlying AWS SDK client,
43+
* such as network errors, AWS service errors (e.g., access denied, throttling),
44+
* or configuration issues (e.g., missing region or credentials).
45+
*/
2046
export async function getParameters(parameter_names: string[]): Promise<Map<string, string>> {
2147
if (parameter_names.length === 0) {
2248
return new Map();

0 commit comments

Comments
 (0)