@gradientedge/cdk-utils 8.122.0 → 8.124.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.
Files changed (61) hide show
  1. package/app/api-destined-function/node_modules/.bin/uuid +2 -2
  2. package/app/api-destined-function/package.json +1 -1
  3. package/dist/src/lib/aws/common/stack.js +5 -7
  4. package/dist/src/lib/aws/construct/api-to-any-target/main.js +24 -26
  5. package/dist/src/lib/aws/construct/api-to-eventbridge-target/main.js +85 -103
  6. package/dist/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.js +94 -120
  7. package/dist/src/lib/aws/construct/api-to-lambda-target/main.js +8 -10
  8. package/dist/src/lib/aws/construct/graphql-api-lambda/main.js +7 -3
  9. package/dist/src/lib/aws/construct/graphql-api-lambda-with-cache/main.js +5 -1
  10. package/dist/src/lib/aws/construct/lambda-with-iam-access/main.js +5 -1
  11. package/dist/src/lib/aws/construct/rest-api-lambda/main.js +7 -3
  12. package/dist/src/lib/aws/construct/rest-api-lambda-with-cache/main.js +5 -1
  13. package/dist/src/lib/aws/construct/site-with-ecs-backend/main.js +8 -6
  14. package/dist/src/lib/aws/construct/static-asset-deployment/main.js +5 -1
  15. package/dist/src/lib/aws/services/api-gateway/main.js +18 -10
  16. package/dist/src/lib/aws/services/cloudfront/main.js +11 -7
  17. package/dist/src/lib/aws/services/cloudwatch/logs.js +8 -4
  18. package/dist/src/lib/aws/services/cloudwatch/main.js +36 -78
  19. package/dist/src/lib/aws/services/dynamodb/main.js +6 -2
  20. package/dist/src/lib/aws/services/elastic-container-service/main.js +8 -4
  21. package/dist/src/lib/aws/services/elastic-file-system/main.js +5 -1
  22. package/dist/src/lib/aws/services/elasticache/main.js +6 -2
  23. package/dist/src/lib/aws/services/eventbridge/main.js +8 -4
  24. package/dist/src/lib/aws/services/lambda/main.js +7 -3
  25. package/dist/src/lib/aws/services/simple-notification-service/main.js +6 -2
  26. package/dist/src/lib/aws/services/simple-queue-service/main.js +6 -2
  27. package/dist/src/lib/aws/services/simple-storage-service/main.js +8 -4
  28. package/dist/src/lib/aws/services/step-function/main.js +52 -32
  29. package/dist/src/lib/aws/services/virtual-private-cloud/main.js +8 -4
  30. package/dist/src/lib/azure/common/stack.js +5 -7
  31. package/dist/src/lib/common/index.js +7 -3
  32. package/package.json +16 -16
  33. package/src/lib/aws/common/stack.ts +5 -7
  34. package/src/lib/aws/construct/api-to-any-target/main.ts +25 -27
  35. package/src/lib/aws/construct/api-to-eventbridge-target/main.ts +85 -103
  36. package/src/lib/aws/construct/api-to-eventbridge-target-with-sns/main.ts +94 -120
  37. package/src/lib/aws/construct/api-to-lambda-target/main.ts +8 -10
  38. package/src/lib/aws/construct/graphql-api-lambda/main.ts +4 -3
  39. package/src/lib/aws/construct/graphql-api-lambda-with-cache/main.ts +2 -1
  40. package/src/lib/aws/construct/lambda-with-iam-access/main.ts +2 -1
  41. package/src/lib/aws/construct/rest-api-lambda/main.ts +4 -3
  42. package/src/lib/aws/construct/rest-api-lambda-with-cache/main.ts +2 -1
  43. package/src/lib/aws/construct/site-with-ecs-backend/main.ts +8 -9
  44. package/src/lib/aws/construct/static-asset-deployment/main.ts +2 -1
  45. package/src/lib/aws/services/api-gateway/main.ts +9 -6
  46. package/src/lib/aws/services/cloudfront/main.ts +8 -7
  47. package/src/lib/aws/services/cloudwatch/logs.ts +6 -5
  48. package/src/lib/aws/services/cloudwatch/main.ts +35 -81
  49. package/src/lib/aws/services/dynamodb/main.ts +3 -2
  50. package/src/lib/aws/services/elastic-container-service/main.ts +5 -4
  51. package/src/lib/aws/services/elastic-file-system/main.ts +2 -1
  52. package/src/lib/aws/services/elasticache/main.ts +3 -2
  53. package/src/lib/aws/services/eventbridge/main.ts +5 -4
  54. package/src/lib/aws/services/lambda/main.ts +4 -3
  55. package/src/lib/aws/services/simple-notification-service/main.ts +3 -2
  56. package/src/lib/aws/services/simple-queue-service/main.ts +3 -2
  57. package/src/lib/aws/services/simple-storage-service/main.ts +5 -4
  58. package/src/lib/aws/services/step-function/main.ts +17 -16
  59. package/src/lib/aws/services/virtual-private-cloud/main.ts +5 -4
  60. package/src/lib/azure/common/stack.ts +7 -9
  61. package/src/lib/common/index.ts +5 -3
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.SfnManager = void 0;
4
7
  const aws_cdk_lib_1 = require("aws-cdk-lib");
5
8
  const aws_stepfunctions_1 = require("aws-cdk-lib/aws-stepfunctions");
6
9
  const aws_stepfunctions_tasks_1 = require("aws-cdk-lib/aws-stepfunctions-tasks");
10
+ const lodash_1 = __importDefault(require("lodash"));
7
11
  const uuid_1 = require("uuid");
8
12
  const utils_1 = require("../../utils");
9
13
  const DEFAULT_RETRY_CONFIG = [
@@ -160,10 +164,12 @@ class SfnManager {
160
164
  if (!retries || retries.length === 0) {
161
165
  retries = DEFAULT_RETRY_CONFIG;
162
166
  }
163
- retries.forEach(retry => step.addRetry({
164
- ...retry,
165
- ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
166
- }));
167
+ lodash_1.default.forEach(retries, retry => {
168
+ step.addRetry({
169
+ ...retry,
170
+ ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
171
+ });
172
+ });
167
173
  return step;
168
174
  }
169
175
  /**
@@ -202,10 +208,12 @@ class SfnManager {
202
208
  if (!retries || retries.length === 0) {
203
209
  retries = DEFAULT_RETRY_CONFIG;
204
210
  }
205
- retries.forEach(retry => step.addRetry({
206
- ...retry,
207
- ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
208
- }));
211
+ lodash_1.default.forEach(retries, retry => {
212
+ step.addRetry({
213
+ ...retry,
214
+ ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
215
+ });
216
+ });
209
217
  return step;
210
218
  }
211
219
  /**
@@ -244,10 +252,12 @@ class SfnManager {
244
252
  if (!retries || retries.length === 0) {
245
253
  retries = DEFAULT_RETRY_CONFIG;
246
254
  }
247
- retries.forEach(retry => step.addRetry({
248
- ...retry,
249
- ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
250
- }));
255
+ lodash_1.default.forEach(retries, retry => {
256
+ step.addRetry({
257
+ ...retry,
258
+ ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
259
+ });
260
+ });
251
261
  return step;
252
262
  }
253
263
  /**
@@ -284,10 +294,12 @@ class SfnManager {
284
294
  if (!retries || retries.length === 0) {
285
295
  retries = DEFAULT_RETRY_CONFIG;
286
296
  }
287
- retries.forEach(retry => step.addRetry({
288
- ...retry,
289
- ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
290
- }));
297
+ lodash_1.default.forEach(retries, retry => {
298
+ step.addRetry({
299
+ ...retry,
300
+ ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
301
+ });
302
+ });
291
303
  return step;
292
304
  }
293
305
  /**
@@ -311,10 +323,12 @@ class SfnManager {
311
323
  if (!retries || retries.length === 0) {
312
324
  retries = DEFAULT_RETRY_CONFIG;
313
325
  }
314
- retries.forEach(retry => step.addRetry({
315
- ...retry,
316
- ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
317
- }));
326
+ lodash_1.default.forEach(retries, retry => {
327
+ step.addRetry({
328
+ ...retry,
329
+ ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
330
+ });
331
+ });
318
332
  return step;
319
333
  }
320
334
  /**
@@ -341,10 +355,12 @@ class SfnManager {
341
355
  if (!retries || retries.length === 0) {
342
356
  retries = DEFAULT_RETRY_CONFIG;
343
357
  }
344
- retries.forEach(retry => step.addRetry({
345
- ...retry,
346
- ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
347
- }));
358
+ lodash_1.default.forEach(retries, retry => {
359
+ step.addRetry({
360
+ ...retry,
361
+ ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
362
+ });
363
+ });
348
364
  return step;
349
365
  }
350
366
  /**
@@ -369,10 +385,12 @@ class SfnManager {
369
385
  if (!retries || retries.length === 0) {
370
386
  retries = DEFAULT_RETRY_CONFIG;
371
387
  }
372
- retries.forEach(retry => step.addRetry({
373
- ...retry,
374
- ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
375
- }));
388
+ lodash_1.default.forEach(retries, retry => {
389
+ step.addRetry({
390
+ ...retry,
391
+ ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
392
+ });
393
+ });
376
394
  return step;
377
395
  }
378
396
  /**
@@ -394,10 +412,12 @@ class SfnManager {
394
412
  if (!retries || retries.length === 0) {
395
413
  retries = DEFAULT_RETRY_CONFIG;
396
414
  }
397
- retries.forEach(retry => step.addRetry({
398
- ...retry,
399
- ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
400
- }));
415
+ lodash_1.default.forEach(retries, retry => {
416
+ step.addRetry({
417
+ ...retry,
418
+ ...{ interval: retry.intervalInSecs ? aws_cdk_lib_1.Duration.seconds(retry.intervalInSecs) : retry.interval },
419
+ });
420
+ });
401
421
  return step;
402
422
  }
403
423
  /**
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.VpcManager = void 0;
4
7
  const aws_cdk_lib_1 = require("aws-cdk-lib");
5
8
  const aws_ec2_1 = require("aws-cdk-lib/aws-ec2");
6
9
  const utils_1 = require("../../utils");
10
+ const lodash_1 = __importDefault(require("lodash"));
7
11
  /**
8
12
  */
9
13
  const CommonVpcIdentifier = 'CommonVpc';
@@ -38,10 +42,10 @@ class VpcManager {
38
42
  maxAzs: props.maxAzs,
39
43
  });
40
44
  (0, utils_1.createCfnOutput)(`${id}Id`, scope, vpc.vpcId);
41
- (0, utils_1.createCfnOutput)(`${id}PublicSubnetIds`, scope, vpc.publicSubnets.map(subnet => subnet.subnetId).toString());
42
- (0, utils_1.createCfnOutput)(`${id}PrivateSubnetIds`, scope, vpc.privateSubnets.map(subnet => subnet.subnetId).toString());
43
- (0, utils_1.createCfnOutput)(`${id}PublicSubnetRouteTableIds`, scope, vpc.publicSubnets.map(subnet => subnet.routeTable.routeTableId).toString());
44
- (0, utils_1.createCfnOutput)(`${id}PrivateSubnetRouteTableIds`, scope, vpc.privateSubnets.map(subnet => subnet.routeTable.routeTableId).toString());
45
+ (0, utils_1.createCfnOutput)(`${id}PublicSubnetIds`, scope, lodash_1.default.map(vpc.publicSubnets, subnet => subnet.subnetId).toString());
46
+ (0, utils_1.createCfnOutput)(`${id}PrivateSubnetIds`, scope, lodash_1.default.map(vpc.privateSubnets, subnet => subnet.subnetId).toString());
47
+ (0, utils_1.createCfnOutput)(`${id}PublicSubnetRouteTableIds`, scope, lodash_1.default.map(vpc.publicSubnets, subnet => subnet.routeTable.routeTableId).toString());
48
+ (0, utils_1.createCfnOutput)(`${id}PrivateSubnetRouteTableIds`, scope, lodash_1.default.map(vpc.privateSubnets, subnet => subnet.routeTable.routeTableId).toString());
45
49
  (0, utils_1.createCfnOutput)(`${id}AvailabilityZones`, scope, vpc.availabilityZones.toString());
46
50
  (0, utils_1.createCfnOutput)(`${id}DefaultSecurityGroup`, scope, vpc.vpcDefaultSecurityGroup.toString());
47
51
  return vpc;
@@ -8,6 +8,7 @@ const fs_1 = __importDefault(require("fs"));
8
8
  const construct_1 = require("./construct");
9
9
  const app_root_path_1 = __importDefault(require("app-root-path"));
10
10
  const cdktf_1 = require("cdktf");
11
+ const lodash_1 = __importDefault(require("lodash"));
11
12
  const common_1 = require("../../common");
12
13
  /**
13
14
  * @classdesc Common stack to use as a base for all higher level constructs.
@@ -64,7 +65,7 @@ class CommonAzureStack extends cdktf_1.TerraformStack {
64
65
  console.debug(`No additional contexts provided. Using default context properties from cdktf.json`);
65
66
  return;
66
67
  }
67
- extraContexts.forEach((context) => {
68
+ lodash_1.default.forEach(extraContexts, (context) => {
68
69
  const extraContextPath = `${app_root_path_1.default.path}/${context}`;
69
70
  /* scenario where extra context is configured in cdk.json but absent in file system */
70
71
  if (!fs_1.default.existsSync(extraContextPath))
@@ -76,7 +77,7 @@ class CommonAzureStack extends cdktf_1.TerraformStack {
76
77
  /* parse as JSON properties */
77
78
  const extraContextProps = JSON.parse(extraContextPropsBuffer.toString('utf-8'));
78
79
  /* set each of the property into the cdk node context */
79
- Object.keys(extraContextProps).forEach((propKey) => {
80
+ lodash_1.default.keys(extraContextProps).forEach((propKey) => {
80
81
  this.node.setContext(propKey, extraContextProps[propKey]);
81
82
  });
82
83
  });
@@ -110,13 +111,10 @@ class CommonAzureStack extends cdktf_1.TerraformStack {
110
111
  /* parse as JSON properties */
111
112
  const stageContextProps = JSON.parse(stageContextPropsBuffer.toString('utf-8'));
112
113
  /* set each of the property into the cdk node context */
113
- Object.keys(stageContextProps).forEach((propKey) => {
114
+ lodash_1.default.keys(stageContextProps).forEach((propKey) => {
114
115
  /* handle object, array properties */
115
116
  if (typeof stageContextProps[propKey] === 'object' && !Array.isArray(stageContextProps[propKey])) {
116
- this.node.setContext(propKey, {
117
- ...this.node.tryGetContext(propKey),
118
- ...stageContextProps[propKey],
119
- });
117
+ this.node.setContext(propKey, lodash_1.default.merge(this.node.tryGetContext(propKey), stageContextProps[propKey]));
120
118
  }
121
119
  else {
122
120
  /* handle all other primitive properties */
@@ -13,16 +13,20 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
13
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
16
19
  Object.defineProperty(exports, "__esModule", { value: true });
17
20
  exports.applyMixins = void 0;
21
+ const lodash_1 = __importDefault(require("lodash"));
18
22
  __exportStar(require("./construct"), exports);
19
23
  __exportStar(require("./stack"), exports);
20
24
  __exportStar(require("./types"), exports);
21
25
  __exportStar(require("./utils"), exports);
22
26
  const applyMixins = (derivedCtor, constructors) => {
23
- constructors.forEach(baseCtor => {
24
- Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
25
- Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
27
+ lodash_1.default.forEach(constructors, baseConstructor => {
28
+ Object.getOwnPropertyNames(baseConstructor.prototype).forEach(name => {
29
+ Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseConstructor.prototype, name) || Object.create(null));
26
30
  });
27
31
  });
28
32
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.122.0",
3
+ "version": "8.124.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -46,15 +46,15 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "@aws-sdk/client-secrets-manager": "^3.405.0",
50
- "@aws-sdk/credential-providers": "^3.405.0",
51
- "@aws-sdk/types": "^3.398.0",
52
- "@cdktf/provider-azurerm": "^10.0.1",
53
- "@types/lodash": "^4.14.197",
54
- "@types/node": "^20.5.9",
49
+ "@aws-sdk/client-secrets-manager": "^3.410.0",
50
+ "@aws-sdk/credential-providers": "^3.410.0",
51
+ "@aws-sdk/types": "^3.410.0",
52
+ "@cdktf/provider-azurerm": "^10.0.2",
53
+ "@types/lodash": "^4.14.198",
54
+ "@types/node": "^20.6.0",
55
55
  "@types/uuid": "^9.0.3",
56
56
  "app-root-path": "^3.1.0",
57
- "aws-cdk-lib": "^2.94.0",
57
+ "aws-cdk-lib": "^2.95.1",
58
58
  "cdktf": "^0.18.0",
59
59
  "constructs": "^10.2.70",
60
60
  "lodash": "^4.17.21",
@@ -62,27 +62,27 @@
62
62
  "nconf": "^0.12.0",
63
63
  "pluralize": "^8.0.0",
64
64
  "ts-node": "^10.9.1",
65
- "uuid": "^9.0.0"
65
+ "uuid": "^9.0.1"
66
66
  },
67
67
  "devDependencies": {
68
- "@babel/core": "^7.22.15",
68
+ "@babel/core": "^7.22.17",
69
69
  "@babel/eslint-parser": "^7.22.15",
70
70
  "@babel/plugin-proposal-class-properties": "^7.18.6",
71
71
  "@types/jest": "^29.5.4",
72
- "@typescript-eslint/eslint-plugin": "^6.6.0",
73
- "@typescript-eslint/parser": "^6.6.0",
74
- "aws-cdk": "^2.94.0",
72
+ "@typescript-eslint/eslint-plugin": "^6.7.0",
73
+ "@typescript-eslint/parser": "^6.7.0",
74
+ "aws-cdk": "^2.95.1",
75
75
  "better-docs": "^2.7.2",
76
76
  "codecov": "^3.8.3",
77
77
  "commitizen": "^4.3.0",
78
78
  "docdash": "^2.0.2",
79
79
  "dotenv": "^16.3.1",
80
- "eslint": "^8.48.0",
80
+ "eslint": "^8.49.0",
81
81
  "eslint-config-prettier": "^9.0.0",
82
82
  "eslint-plugin-import": "^2.28.1",
83
- "eslint-plugin-jsdoc": "^46.5.1",
83
+ "eslint-plugin-jsdoc": "^46.6.0",
84
84
  "husky": "^8.0.3",
85
- "jest": "^29.6.4",
85
+ "jest": "^29.7.0",
86
86
  "jest-extended": "^4.0.1",
87
87
  "jest-junit": "^16.0.0",
88
88
  "jsdoc": "^4.0.2",
@@ -5,6 +5,7 @@ import { CommonConstruct } from './construct'
5
5
  import { CommonStackProps } from './types'
6
6
 
7
7
  import appRoot from 'app-root-path'
8
+ import _ from 'lodash'
8
9
  import { isDevStage } from '../../common'
9
10
 
10
11
  /**
@@ -75,7 +76,7 @@ export class CommonStack extends Stack {
75
76
  return
76
77
  }
77
78
 
78
- extraContexts.forEach((context: string) => {
79
+ _.forEach(extraContexts, (context: string) => {
79
80
  const extraContextPath = `${appRoot.path}/${context}`
80
81
 
81
82
  /* scenario where extra context is configured in cdk.json but absent in file system */
@@ -89,7 +90,7 @@ export class CommonStack extends Stack {
89
90
  const extraContextProps = JSON.parse(extraContextPropsBuffer.toString('utf-8'))
90
91
 
91
92
  /* set each of the property into the cdk node context */
92
- Object.keys(extraContextProps).forEach((propKey: any) => {
93
+ _.keys(extraContextProps).forEach((propKey: any) => {
93
94
  this.node.setContext(propKey, extraContextProps[propKey])
94
95
  })
95
96
  })
@@ -125,13 +126,10 @@ export class CommonStack extends Stack {
125
126
  const stageContextProps = JSON.parse(stageContextPropsBuffer.toString('utf-8'))
126
127
 
127
128
  /* set each of the property into the cdk node context */
128
- Object.keys(stageContextProps).forEach((propKey: any) => {
129
+ _.keys(stageContextProps).forEach((propKey: any) => {
129
130
  /* handle object, array properties */
130
131
  if (typeof stageContextProps[propKey] === 'object' && !Array.isArray(stageContextProps[propKey])) {
131
- this.node.setContext(propKey, {
132
- ...this.node.tryGetContext(propKey),
133
- ...stageContextProps[propKey],
134
- })
132
+ this.node.setContext(propKey, _.merge(this.node.tryGetContext(propKey), stageContextProps[propKey]))
135
133
  } else {
136
134
  /* handle all other primitive properties */
137
135
  this.node.setContext(propKey, stageContextProps[propKey])
@@ -12,8 +12,8 @@ import {
12
12
  import { ISecret } from 'aws-cdk-lib/aws-secretsmanager'
13
13
  import { Construct } from 'constructs'
14
14
  import { CommonConstruct } from '../../common'
15
- import { ApiToAnyTargetProps, ApiToAnyTargetRestApiResource, ApiToAnyTargetRestApiType } from './types'
16
15
  import { ApiToAnyTargetRestApi } from './target'
16
+ import { ApiToAnyTargetProps, ApiToAnyTargetRestApiResource, ApiToAnyTargetRestApiType } from './types'
17
17
 
18
18
  /**
19
19
  * @classdesc Provides a construct to create and deploy a shallow API Gateway
@@ -127,33 +127,31 @@ export class ApiToAnyTarget extends CommonConstruct {
127
127
  }
128
128
 
129
129
  this.apiToAnyTargetRestApi.api = new RestApi(this, `${this.id}-rest-api`, {
130
- ...{
131
- cloudWatchRole: this.props.api.restApi?.cloudWatchRole ?? true,
132
- defaultCorsPreflightOptions: {
133
- allowHeaders: Cors.DEFAULT_HEADERS,
134
- allowMethods: Cors.ALL_METHODS,
135
- allowOrigins: Cors.ALL_ORIGINS,
136
- },
137
- defaultIntegration: this.apiToAnyTargetRestApi.integration,
138
- defaultMethodOptions: {
139
- methodResponses: [this.apiToAnyTargetRestApi.methodResponse, this.apiToAnyTargetRestApi.methodErrorResponse],
140
- },
141
- deploy: this.props.api.restApi?.deploy ?? true,
142
- deployOptions: {
143
- accessLogDestination: new LogGroupLogDestination(this.apiToAnyTargetRestApi.accessLogGroup),
144
- accessLogFormat: AccessLogFormat.jsonWithStandardFields(),
145
- dataTraceEnabled: this.props.api.restApi?.deployOptions?.dataTraceEnabled,
146
- description: `${this.id} - ${this.props.stage} stage`,
147
- loggingLevel: MethodLoggingLevel.INFO,
148
- metricsEnabled: true,
149
- stageName: this.props.stage,
150
- tracingEnabled: this.props.api.restApi?.deployOptions?.tracingEnabled,
151
- },
152
- endpointConfiguration: {
153
- types: [this.isProductionStage() ? EndpointType.EDGE : EndpointType.REGIONAL],
154
- },
155
- restApiName: `${this.id}-rest-api-${this.props.stage}`,
130
+ cloudWatchRole: this.props.api.restApi?.cloudWatchRole ?? true,
131
+ defaultCorsPreflightOptions: {
132
+ allowHeaders: Cors.DEFAULT_HEADERS,
133
+ allowMethods: Cors.ALL_METHODS,
134
+ allowOrigins: Cors.ALL_ORIGINS,
135
+ },
136
+ defaultIntegration: this.apiToAnyTargetRestApi.integration,
137
+ defaultMethodOptions: {
138
+ methodResponses: [this.apiToAnyTargetRestApi.methodResponse, this.apiToAnyTargetRestApi.methodErrorResponse],
139
+ },
140
+ deploy: this.props.api.restApi?.deploy ?? true,
141
+ deployOptions: {
142
+ accessLogDestination: new LogGroupLogDestination(this.apiToAnyTargetRestApi.accessLogGroup),
143
+ accessLogFormat: AccessLogFormat.jsonWithStandardFields(),
144
+ dataTraceEnabled: this.props.api.restApi?.deployOptions?.dataTraceEnabled,
145
+ description: `${this.id} - ${this.props.stage} stage`,
146
+ loggingLevel: MethodLoggingLevel.INFO,
147
+ metricsEnabled: true,
148
+ stageName: this.props.stage,
149
+ tracingEnabled: this.props.api.restApi?.deployOptions?.tracingEnabled,
150
+ },
151
+ endpointConfiguration: {
152
+ types: [this.isProductionStage() ? EndpointType.EDGE : EndpointType.REGIONAL],
156
153
  },
154
+ restApiName: `${this.id}-rest-api-${this.props.stage}`,
157
155
  ...this.props.api.restApi,
158
156
  })
159
157
  this.addCfnOutput(`${this.id}-restApiId`, this.apiToAnyTargetRestApi.api.restApiId)