INNER CODE UNIT · JavaScript
createDashboard
ACloudGuru/serverless-plugin-aws-alerts · src/dashboards/index.js:8
const createDashboard = (service, stage, region, functions, name) => {
const dashboard = dashboards[name];
if (!dashboard) {
throw new Error(`Cannot find dashboard by name ${name}`);
}
const widgets = dashboard.widgets.map((w) => {
const widget = widgetFactory.getWidget(w.service, w.metric, w.display);
const config = {
service,
stage,
region,
coordinates: w.coordinates,
title: w.title,
functions,
};