-
-
Notifications
You must be signed in to change notification settings - Fork 367
/
Copy pathlayers.js
29 lines (24 loc) · 959 Bytes
/
layers.js
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
const fs = require('fs');
const path = require('path');
/**
* @param {import('./serverless').Serverless} serverless
* @param {import('./serverless').Logger} log
*/
function listLayers(serverless, log) {
const region = serverless.getProvider("aws").getRegion();
const json = fs.readFileSync(path.join(__dirname, '../layers.json'));
const layers = JSON.parse(json.toString());
log(`Layers for the ${region} region:`);
log();
log('Layer Version ARN');
log('----------------------------------------------------------------------------------');
for (const [layer, versions] of Object.entries(layers)) {
const version = versions[region];
const arn = `arn:aws:lambda:${region}:534081306603:layer:${layer}:${version}`;
log(`${padString(layer, 12)} ${padString(version, 9)} ${arn}`);
}
}
function padString(str, length) {
return str.padEnd(length, ' ');
}
module.exports = {listLayers};