@gradientedge/cdk-utils 8.9.0 → 8.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -101,6 +101,14 @@ export declare class CloudWatchManager {
101
101
  * @param {string} functionName the lambda function name
102
102
  */
103
103
  createLambdaWidget(id: string, scope: common.CommonConstruct, props: any, functionName: string): cdk.aws_cloudwatch.GaugeWidget | cdk.aws_cloudwatch.GraphWidget | cdk.aws_cloudwatch.SingleValueWidget | cdk.aws_cloudwatch.LogQueryWidget | cdk.aws_cloudwatch.TextWidget | cdk.aws_cloudwatch.AlarmStatusWidget;
104
+ /**
105
+ * @summary Method to create a custom widget
106
+ * @param {string} id scoped id of the resource
107
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
108
+ * @param {types.TextWidgetProps} props
109
+ * @param {string} service the service identifier
110
+ */
111
+ createCustomWidget(id: string, scope: common.CommonConstruct, props: any, service: string): cdk.aws_cloudwatch.GaugeWidget | cdk.aws_cloudwatch.GraphWidget | cdk.aws_cloudwatch.SingleValueWidget | cdk.aws_cloudwatch.LogQueryWidget | cdk.aws_cloudwatch.TextWidget | cdk.aws_cloudwatch.AlarmStatusWidget;
104
112
  /**
105
113
  * @summary Method to create an ecs cluster widget
106
114
  * @param {string} id scoped id of the resource
@@ -273,6 +273,24 @@ class CloudWatchManager {
273
273
  },
274
274
  });
275
275
  }
276
+ /**
277
+ * @summary Method to create a custom widget
278
+ * @param {string} id scoped id of the resource
279
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
280
+ * @param {types.TextWidgetProps} props
281
+ * @param {string} service the service identifier
282
+ */
283
+ createCustomWidget(id, scope, props, service) {
284
+ if (!props)
285
+ throw `Widget props undefined for ${id}`;
286
+ const metricProps = props.metricProps;
287
+ return this.createWidget(id, scope, {
288
+ ...props,
289
+ ...{
290
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, ...{ service: service } })),
291
+ },
292
+ });
293
+ }
276
294
  /**
277
295
  * @summary Method to create an ecs cluster widget
278
296
  * @param {string} id scoped id of the resource
@@ -541,6 +559,14 @@ class CloudWatchManager {
541
559
  },
542
560
  };
543
561
  }
562
+ if (metricProp.service) {
563
+ metricDimensions = {
564
+ ...metricProp.dimensionsMap,
565
+ ...{
566
+ service: `${metricProp.service}`,
567
+ },
568
+ };
569
+ }
544
570
  if (metricProp.distributionId) {
545
571
  metricDimensions = {
546
572
  ...metricProp.dimensionsMap,
@@ -527,6 +527,7 @@ export interface MetricProps extends watch.MetricProps {
527
527
  stateMachineArn?: string;
528
528
  eventBusName?: string;
529
529
  ruleName?: string;
530
+ service?: string;
530
531
  }
531
532
  /**
532
533
  * @category cdk-utils.cloudwatch-manager
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.9.0",
3
+ "version": "8.10.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -287,6 +287,24 @@ export class CloudWatchManager {
287
287
  })
288
288
  }
289
289
 
290
+ /**
291
+ * @summary Method to create a custom widget
292
+ * @param {string} id scoped id of the resource
293
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
294
+ * @param {types.TextWidgetProps} props
295
+ * @param {string} service the service identifier
296
+ */
297
+ public createCustomWidget(id: string, scope: common.CommonConstruct, props: any, service: string) {
298
+ if (!props) throw `Widget props undefined for ${id}`
299
+ const metricProps: any[] = props.metricProps
300
+ return this.createWidget(id, scope, {
301
+ ...props,
302
+ ...{
303
+ metricProps: metricProps.map(metricProp => ({ ...metricProp, ...{ service: service } })),
304
+ },
305
+ })
306
+ }
307
+
290
308
  /**
291
309
  * @summary Method to create an ecs cluster widget
292
310
  * @param {string} id scoped id of the resource
@@ -593,6 +611,14 @@ export class CloudWatchManager {
593
611
  },
594
612
  }
595
613
  }
614
+ if (metricProp.service) {
615
+ metricDimensions = {
616
+ ...metricProp.dimensionsMap,
617
+ ...{
618
+ service: `${metricProp.service}`,
619
+ },
620
+ }
621
+ }
596
622
  if (metricProp.distributionId) {
597
623
  metricDimensions = {
598
624
  ...metricProp.dimensionsMap,
@@ -556,6 +556,7 @@ export interface MetricProps extends watch.MetricProps {
556
556
  stateMachineArn?: string
557
557
  eventBusName?: string
558
558
  ruleName?: string
559
+ service?: string
559
560
  }
560
561
 
561
562
  /**