@gradientedge/cdk-utils 8.8.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.
- package/dist/src/lib/manager/aws/cloudwatch-manager.d.ts +8 -0
- package/dist/src/lib/manager/aws/cloudwatch-manager.js +26 -0
- package/dist/src/lib/manager/aws/ecs-manager.d.ts +2 -1
- package/dist/src/lib/manager/aws/ecs-manager.js +3 -1
- package/dist/src/lib/types/aws/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/lib/manager/aws/cloudwatch-manager.ts +26 -0
- package/src/lib/manager/aws/ecs-manager.ts +4 -1
- package/src/lib/types/aws/index.ts +1 -0
|
@@ -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,
|
|
@@ -45,8 +45,9 @@ export declare class EcsManager {
|
|
|
45
45
|
* @param {ecs.ContainerImage} containerImage
|
|
46
46
|
* @param {Map<string, string>} environment
|
|
47
47
|
* @param {Map<string, string>} secrets
|
|
48
|
+
* @param {string[]} command
|
|
48
49
|
*/
|
|
49
|
-
createEcsFargateTask(id: string, scope: common.CommonConstruct, props: types.EcsTaskProps, cluster: ecs.ICluster, role: iam.Role, logGroup: logs.ILogGroup, containerImage: ecs.ContainerImage, environment?: any, secrets?: any): cdk.aws_ecs.TaskDefinition;
|
|
50
|
+
createEcsFargateTask(id: string, scope: common.CommonConstruct, props: types.EcsTaskProps, cluster: ecs.ICluster, role: iam.Role, logGroup: logs.ILogGroup, containerImage: ecs.ContainerImage, environment?: any, secrets?: any, command?: string[]): cdk.aws_ecs.TaskDefinition;
|
|
50
51
|
/**
|
|
51
52
|
* @summary Method to create an application loadbalanced ecs fargate task
|
|
52
53
|
* @param {string} id scoped id of the resource
|
|
@@ -83,8 +83,9 @@ class EcsManager {
|
|
|
83
83
|
* @param {ecs.ContainerImage} containerImage
|
|
84
84
|
* @param {Map<string, string>} environment
|
|
85
85
|
* @param {Map<string, string>} secrets
|
|
86
|
+
* @param {string[]} command
|
|
86
87
|
*/
|
|
87
|
-
createEcsFargateTask(id, scope, props, cluster, role, logGroup, containerImage, environment, secrets) {
|
|
88
|
+
createEcsFargateTask(id, scope, props, cluster, role, logGroup, containerImage, environment, secrets, command) {
|
|
88
89
|
if (!props)
|
|
89
90
|
throw `EcsTask props undefined for ${id}`;
|
|
90
91
|
const ecsTask = new ecs.TaskDefinition(scope, `${id}`, {
|
|
@@ -119,6 +120,7 @@ class EcsManager {
|
|
|
119
120
|
memoryLimitMiB: props.memoryMiB ? parseInt(props.memoryMiB) : undefined,
|
|
120
121
|
privileged: false,
|
|
121
122
|
secrets: secrets,
|
|
123
|
+
command: command,
|
|
122
124
|
});
|
|
123
125
|
utils.createCfnOutput(`${id}-taskArn`, scope, ecsTask.taskDefinitionArn);
|
|
124
126
|
return ecsTask;
|
package/package.json
CHANGED
|
@@ -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,
|
|
@@ -66,6 +66,7 @@ export class EcsManager {
|
|
|
66
66
|
* @param {ecs.ContainerImage} containerImage
|
|
67
67
|
* @param {Map<string, string>} environment
|
|
68
68
|
* @param {Map<string, string>} secrets
|
|
69
|
+
* @param {string[]} command
|
|
69
70
|
*/
|
|
70
71
|
public createEcsFargateTask(
|
|
71
72
|
id: string,
|
|
@@ -76,7 +77,8 @@ export class EcsManager {
|
|
|
76
77
|
logGroup: logs.ILogGroup,
|
|
77
78
|
containerImage: ecs.ContainerImage,
|
|
78
79
|
environment?: any,
|
|
79
|
-
secrets?: any
|
|
80
|
+
secrets?: any,
|
|
81
|
+
command?: string[]
|
|
80
82
|
) {
|
|
81
83
|
if (!props) throw `EcsTask props undefined for ${id}`
|
|
82
84
|
|
|
@@ -113,6 +115,7 @@ export class EcsManager {
|
|
|
113
115
|
memoryLimitMiB: props.memoryMiB ? parseInt(props.memoryMiB) : undefined,
|
|
114
116
|
privileged: false,
|
|
115
117
|
secrets: secrets,
|
|
118
|
+
command: command,
|
|
116
119
|
})
|
|
117
120
|
|
|
118
121
|
utils.createCfnOutput(`${id}-taskArn`, scope, ecsTask.taskDefinitionArn)
|