UNPKG

@khulnasoft/cdk

Version:

Define your observability as code using the AWS CDK

27 lines (23 loc) 710 B
import { CfnResource, Stack } from "aws-cdk-lib"; import { Kengine as Config } from "../config"; import { DashboardProps } from "../types/dashboard"; export { WidgetType } from "../types/dashboard"; export class Dashboard extends CfnResource { constructor(id: string, props: DashboardProps) { const parameters = { ...props.parameters, widgets: props.parameters.widgets.map(el => ({ ...el, query: el.query.ref })) } super(Config.getConstruct(), id, { type: "Custom::KengineDashboard", properties: { id, ServiceToken: Config.getServiceToken(), KengineApiKey: Config.getApiKey(), Description: props.description, Parameters: parameters, Origin: "cdk" }, }); } }