dcl-ops-lib 6.11.0 → 7.0.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.
@@ -56,12 +56,14 @@ export type FargateTaskOptions = {
56
56
  runtimePlatform?: aws.types.input.ecs.TaskDefinitionRuntimePlatform;
57
57
  appAutoscaling?: {
58
58
  maxCapacity: number;
59
- metricName: string;
60
- targetValue: number;
61
- metricDimensionValue: pulumi.Output<string>;
62
- statistic?: "Average" | "Minimum" | "Maximum";
63
- scaleOutCooldown?: number;
64
- scaleInCooldown?: number;
59
+ items: {
60
+ metricName: string;
61
+ targetValue: number;
62
+ metricDimensionValue: pulumi.Output<string>;
63
+ statistic?: "Average" | "Minimum" | "Maximum";
64
+ scaleOutCooldown?: number;
65
+ scaleInCooldown?: number;
66
+ }[];
65
67
  };
66
68
  };
67
69
  /**
@@ -115,12 +117,14 @@ export type InternalServiceOptions = {
115
117
  runtimePlatform?: aws.types.input.ecs.TaskDefinitionRuntimePlatform;
116
118
  appAutoscaling?: {
117
119
  maxCapacity: number;
118
- metricName: string;
119
- targetValue: number;
120
- metricDimensionValue: pulumi.Output<string>;
121
- statistic?: "Average" | "Minimum" | "Maximum";
122
- scaleOutCooldown?: number;
123
- scaleInCooldown?: number;
120
+ items: {
121
+ metricName: string;
122
+ targetValue: number;
123
+ metricDimensionValue: pulumi.Output<string>;
124
+ statistic?: "Average" | "Minimum" | "Maximum";
125
+ scaleOutCooldown?: number;
126
+ scaleInCooldown?: number;
127
+ }[];
124
128
  };
125
129
  };
126
130
  export declare function createInternalService(config: InternalServiceOptions): Promise<import("@pulumi/aws/ecs/service").Service>;
@@ -383,40 +383,44 @@ function setAutoscaling(service, serviceName, config) {
383
383
  maxCapacity: config.maxCapacity,
384
384
  minCapacity: config.desiredCount,
385
385
  resourceId: service.id.apply((id) => {
386
- return id.split(':').pop();
386
+ return id.split(":").pop();
387
387
  }),
388
388
  scalableDimension: "ecs:service:DesiredCount",
389
389
  serviceNamespace: "ecs",
390
390
  });
391
- const CSM_ApproximateNumberOfMessagesVisible = {
392
- metricName: config.metricName,
393
- namespace: "AWS/SQS",
394
- dimensions: [
395
- {
396
- name: "QueueName",
397
- value: config.metricDimensionValue.apply((value) => {
398
- return value.split("/").pop();
399
- }),
400
- }
401
- ],
402
- statistic: config.statistic,
403
- unit: "Count",
404
- };
405
- let TTS_CustomizedMetricSpecification = undefined;
406
- if (config.metricName === "ApproximateNumberOfMessagesVisible") {
407
- TTS_CustomizedMetricSpecification = CSM_ApproximateNumberOfMessagesVisible;
408
- }
409
- return new aws.appautoscaling.Policy(`ecs-autoscaling-policy-${(0, stack_1.getStackScopedName)(serviceName)}`, {
410
- policyType: "TargetTrackingScaling",
411
- resourceId: ecsTarget.resourceId,
412
- scalableDimension: pulumi.interpolate `${ecsTarget.scalableDimension}`,
413
- serviceNamespace: "ecs",
414
- targetTrackingScalingPolicyConfiguration: {
415
- targetValue: config.targetValue,
416
- customizedMetricSpecification: TTS_CustomizedMetricSpecification,
417
- scaleOutCooldown: config.scaleOutCooldown,
418
- scaleInCooldown: config.scaleInCooldown,
419
- },
420
- }, { dependsOn: [ecsTarget] });
391
+ config.items.forEach((item, index) => {
392
+ const CSM_ApproximateNumberOfMessagesVisible = {
393
+ metricName: item.metricName,
394
+ namespace: "AWS/SQS",
395
+ dimensions: [
396
+ {
397
+ name: "QueueName",
398
+ value: item.metricDimensionValue.apply((value) => {
399
+ return value.split("/").pop();
400
+ }),
401
+ },
402
+ ],
403
+ statistic: item.statistic,
404
+ unit: "Count",
405
+ };
406
+ let TTS_CustomizedMetricSpecification = undefined;
407
+ if (item.metricName === "ApproximateNumberOfMessagesVisible") {
408
+ TTS_CustomizedMetricSpecification =
409
+ CSM_ApproximateNumberOfMessagesVisible;
410
+ }
411
+ return new aws.appautoscaling.Policy(`ecs-autoscaling-policy-${(0, stack_1.getStackScopedName)(serviceName)}-${index.toString()}`, // distinct policies by id
412
+ {
413
+ policyType: "TargetTrackingScaling",
414
+ resourceId: ecsTarget.resourceId,
415
+ scalableDimension: pulumi.interpolate `${ecsTarget.scalableDimension}`,
416
+ serviceNamespace: "ecs",
417
+ targetTrackingScalingPolicyConfiguration: {
418
+ targetValue: item.targetValue,
419
+ customizedMetricSpecification: TTS_CustomizedMetricSpecification,
420
+ scaleOutCooldown: item.scaleOutCooldown,
421
+ scaleInCooldown: item.scaleInCooldown,
422
+ },
423
+ }, { dependsOn: [ecsTarget] });
424
+ });
421
425
  }
422
426
  //# sourceMappingURL=createFargateTask.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dcl-ops-lib",
3
- "version": "6.11.0",
3
+ "version": "7.0.0",
4
4
  "scripts": {
5
5
  "build": "tsc && cp bin/* . && node test.js",
6
6
  "clean": "rm *.d.ts *.js *.js.map"