import { LambdaClient, ListFunctionsCommand } from "@aws-sdk/client-lambda"
/**
* List Lambda functions
* List one page of the Lambda functions in the resource's region (at most 50 per page). Pass the returned NextMarker as marker to fetch the next page; NextMarker is absent on the last page. Needs lambda:ListFunctions.
*/
export async function main(
auth: RT.Aws,
max_items: number | undefined,
marker: string | undefined,
function_version: "ALL" | undefined
) {
const client = new LambdaClient({
region: auth.region || undefined,
credentials: {
accessKeyId: auth.awsAccessKeyId,
secretAccessKey: auth.awsSecretAccessKey,
},
})
const { $metadata, ...result } = await client.send(
new ListFunctionsCommand({
MaxItems: max_items || undefined,
Marker: marker || undefined,
FunctionVersion: function_version || undefined,
})
)
return {
Functions: result.Functions ?? [],
NextMarker: result.NextMarker ?? null,
}
}
Submitted by hugo989 2 hours ago