1 | ;
|
2 | var _a;
|
3 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | exports.Dashboard = exports.PeriodOverride = void 0;
|
5 | const jsiiDeprecationWarnings = require("../.warnings.jsii.js");
|
6 | const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
7 | const core_1 = require("@aws-cdk/core");
|
8 | const cloudwatch_generated_1 = require("./cloudwatch.generated");
|
9 | const layout_1 = require("./layout");
|
10 | /**
|
11 | * Specify the period for graphs when the CloudWatch dashboard loads
|
12 | */
|
13 | var PeriodOverride;
|
14 | (function (PeriodOverride) {
|
15 | /**
|
16 | * Period of all graphs on the dashboard automatically adapt to the time range of the dashboard.
|
17 | */
|
18 | PeriodOverride["AUTO"] = "auto";
|
19 | /**
|
20 | * Period set for each graph will be used
|
21 | */
|
22 | PeriodOverride["INHERIT"] = "inherit";
|
23 | })(PeriodOverride = exports.PeriodOverride || (exports.PeriodOverride = {}));
|
24 | /**
|
25 | * A CloudWatch dashboard
|
26 | */
|
27 | class Dashboard extends core_1.Resource {
|
28 | constructor(scope, id, props = {}) {
|
29 | super(scope, id, {
|
30 | physicalName: props.dashboardName,
|
31 | });
|
32 | this.rows = [];
|
33 | try {
|
34 | jsiiDeprecationWarnings._aws_cdk_aws_cloudwatch_DashboardProps(props);
|
35 | }
|
36 | catch (error) {
|
37 | if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
38 | Error.captureStackTrace(error, Dashboard);
|
39 | }
|
40 | throw error;
|
41 | }
|
42 | {
|
43 | const { dashboardName } = props;
|
44 | if (dashboardName && !core_1.Token.isUnresolved(dashboardName) && !dashboardName.match(/^[\w-]+$/)) {
|
45 | throw new Error([
|
46 | `The value ${dashboardName} for field dashboardName contains invalid characters.`,
|
47 | 'It can only contain alphanumerics, dash (-) and underscore (_).',
|
48 | ].join(' '));
|
49 | }
|
50 | }
|
51 | const dashboard = new cloudwatch_generated_1.CfnDashboard(this, 'Resource', {
|
52 | dashboardName: this.physicalName,
|
53 | dashboardBody: core_1.Lazy.string({
|
54 | produce: () => {
|
55 | const column = new layout_1.Column(...this.rows);
|
56 | column.position(0, 0);
|
57 | return core_1.Stack.of(this).toJsonString({
|
58 | start: props.start,
|
59 | end: props.end,
|
60 | periodOverride: props.periodOverride,
|
61 | widgets: column.toJson(),
|
62 | });
|
63 | },
|
64 | }),
|
65 | });
|
66 | this.dashboardName = this.getResourceNameAttribute(dashboard.ref);
|
67 | (props.widgets || []).forEach(row => {
|
68 | this.addWidgets(...row);
|
69 | });
|
70 | this.dashboardArn = core_1.Stack.of(this).formatArn({
|
71 | service: 'cloudwatch',
|
72 | resource: 'dashboard',
|
73 | resourceName: this.physicalName,
|
74 | });
|
75 | }
|
76 | /**
|
77 | * Add a widget to the dashboard.
|
78 | *
|
79 | * Widgets given in multiple calls to add() will be laid out stacked on
|
80 | * top of each other.
|
81 | *
|
82 | * Multiple widgets added in the same call to add() will be laid out next
|
83 | * to each other.
|
84 | */
|
85 | addWidgets(...widgets) {
|
86 | try {
|
87 | jsiiDeprecationWarnings._aws_cdk_aws_cloudwatch_IWidget(widgets);
|
88 | }
|
89 | catch (error) {
|
90 | if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
91 | Error.captureStackTrace(error, this.addWidgets);
|
92 | }
|
93 | throw error;
|
94 | }
|
95 | if (widgets.length === 0) {
|
96 | return;
|
97 | }
|
98 | const warnings = allWidgetsDeep(widgets).flatMap(w => w.warnings ?? []);
|
99 | for (const w of warnings) {
|
100 | core_1.Annotations.of(this).addWarning(w);
|
101 | }
|
102 | const w = widgets.length > 1 ? new layout_1.Row(...widgets) : widgets[0];
|
103 | this.rows.push(w);
|
104 | }
|
105 | }
|
106 | exports.Dashboard = Dashboard;
|
107 | _a = JSII_RTTI_SYMBOL_1;
|
108 | Dashboard[_a] = { fqn: "@aws-cdk/aws-cloudwatch.Dashboard", version: "1.198.0" };
|
109 | function allWidgetsDeep(ws) {
|
110 | const ret = new Array();
|
111 | ws.forEach(recurse);
|
112 | return ret;
|
113 | function recurse(w) {
|
114 | ret.push(w);
|
115 | if (hasSubWidgets(w)) {
|
116 | w.widgets.forEach(recurse);
|
117 | }
|
118 | }
|
119 | }
|
120 | function hasSubWidgets(w) {
|
121 | return 'widgets' in w;
|
122 | }
|
123 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGFzaGJvYXJkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiZGFzaGJvYXJkLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBLHdDQUEwRTtBQUUxRSxpRUFBc0Q7QUFDdEQscUNBQXVDO0FBR3ZDOztHQUVHO0FBQ0gsSUFBWSxjQVNYO0FBVEQsV0FBWSxjQUFjO0lBQ3hCOztPQUVHO0lBQ0gsK0JBQWEsQ0FBQTtJQUNiOztPQUVHO0lBQ0gscUNBQW1CLENBQUE7QUFDckIsQ0FBQyxFQVRXLGNBQWMsR0FBZCxzQkFBYyxLQUFkLHNCQUFjLFFBU3pCO0FBdUREOztHQUVHO0FBQ0gsTUFBYSxTQUFVLFNBQVEsZUFBUTtJQWtCckMsWUFBWSxLQUFnQixFQUFFLEVBQVUsRUFBRSxRQUF3QixFQUFFO1FBQ2xFLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFO1lBQ2YsWUFBWSxFQUFFLEtBQUssQ0FBQyxhQUFhO1NBQ2xDLENBQUMsQ0FBQztRQUxZLFNBQUksR0FBYyxFQUFFLENBQUM7Ozs7OzsrQ0FoQjNCLFNBQVM7Ozs7UUF1QmxCO1lBQ0UsTUFBTSxFQUFFLGFBQWEsRUFBRSxHQUFHLEtBQUssQ0FBQztZQUNoQyxJQUFJLGFBQWEsSUFBSSxDQUFDLFlBQUssQ0FBQyxZQUFZLENBQUMsYUFBYSxDQUFDLElBQUksQ0FBQyxhQUFhLENBQUMsS0FBSyxDQUFDLFVBQVUsQ0FBQyxF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