-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Expand file tree
/
Copy pathhello.js
More file actions
29 lines (22 loc) · 851 Bytes
/
hello.js
File metadata and controls
29 lines (22 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import { fileURLToPath } from "node:url";
// snippet-start:[javascript.v3.lambda.hello]
import { LambdaClient, paginateListFunctions } from "@aws-sdk/client-lambda";
const client = new LambdaClient({});
export const helloLambda = async () => {
const paginator = paginateListFunctions({ client }, {});
const functions = [];
for await (const page of paginator) {
const funcNames = page.Functions.map((f) => f.FunctionName);
functions.push(...funcNames);
}
console.log("Functions:");
console.log(functions.join("\n"));
return functions;
};
// snippet-end:[javascript.v3.lambda.hello]
// Invoke main function if this file was run directly.
if (process.argv[1] === fileURLToPath(import.meta.url)) {
helloLambda();
}