@gradientedge/cdk-utils 8.159.0 → 8.160.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 (34) hide show
  1. package/app/api-destined-function/package.json +1 -1
  2. package/dist/src/lib/aws/construct/index.d.ts +0 -2
  3. package/dist/src/lib/aws/construct/index.js +0 -2
  4. package/dist/src/lib/aws/construct/rest-api-lambda/main.d.ts +0 -4
  5. package/dist/src/lib/aws/construct/rest-api-lambda/main.js +0 -7
  6. package/dist/src/lib/aws/services/elastic-container-service/main.js +0 -3
  7. package/dist/src/lib/aws/services/elastic-container-service/types.d.ts +9 -2
  8. package/dist/src/lib/aws/services/lambda/main.d.ts +1 -2
  9. package/dist/src/lib/aws/services/lambda/main.js +14 -7
  10. package/eslint.config.mjs +5 -0
  11. package/package.json +29 -29
  12. package/src/lib/aws/construct/index.ts +0 -2
  13. package/src/lib/aws/construct/rest-api-lambda/main.ts +0 -8
  14. package/src/lib/aws/services/elastic-container-service/main.ts +0 -3
  15. package/src/lib/aws/services/elastic-container-service/types.ts +16 -2
  16. package/src/lib/aws/services/lambda/main.ts +16 -8
  17. package/dist/src/lib/aws/construct/graphql-api-lambda/index.d.ts +0 -2
  18. package/dist/src/lib/aws/construct/graphql-api-lambda/index.js +0 -18
  19. package/dist/src/lib/aws/construct/graphql-api-lambda/main.d.ts +0 -96
  20. package/dist/src/lib/aws/construct/graphql-api-lambda/main.js +0 -177
  21. package/dist/src/lib/aws/construct/graphql-api-lambda/types.d.ts +0 -26
  22. package/dist/src/lib/aws/construct/graphql-api-lambda/types.js +0 -2
  23. package/dist/src/lib/aws/construct/graphql-api-lambda-with-cache/index.d.ts +0 -2
  24. package/dist/src/lib/aws/construct/graphql-api-lambda-with-cache/index.js +0 -18
  25. package/dist/src/lib/aws/construct/graphql-api-lambda-with-cache/main.d.ts +0 -57
  26. package/dist/src/lib/aws/construct/graphql-api-lambda-with-cache/main.js +0 -137
  27. package/dist/src/lib/aws/construct/graphql-api-lambda-with-cache/types.d.ts +0 -12
  28. package/dist/src/lib/aws/construct/graphql-api-lambda-with-cache/types.js +0 -2
  29. package/src/lib/aws/construct/graphql-api-lambda/index.ts +0 -2
  30. package/src/lib/aws/construct/graphql-api-lambda/main.ts +0 -244
  31. package/src/lib/aws/construct/graphql-api-lambda/types.ts +0 -27
  32. package/src/lib/aws/construct/graphql-api-lambda-with-cache/index.ts +0 -2
  33. package/src/lib/aws/construct/graphql-api-lambda-with-cache/main.ts +0 -147
  34. package/src/lib/aws/construct/graphql-api-lambda-with-cache/types.ts +0 -13
@@ -16,7 +16,7 @@
16
16
  "test": "npx jest --ci --runInBand --passWithNoTests"
17
17
  },
18
18
  "dependencies": {
19
- "@types/uuid": "^9.0.7",
19
+ "@types/uuid": "^9.0.8",
20
20
  "uuid": "^9.0.1"
21
21
  },
22
22
  "devDependencies": {
@@ -4,8 +4,6 @@ export * from './api-to-eventbridge-target-with-sns';
4
4
  export * from './api-to-lambda-target';
5
5
  export * from './application-configuration';
6
6
  export * from './event-handler';
7
- export * from './graphql-api-lambda';
8
- export * from './graphql-api-lambda-with-cache';
9
7
  export * from './lambda-with-iam-access';
10
8
  export * from './piped-event-handler';
11
9
  export * from './rest-api-lambda';
@@ -20,8 +20,6 @@ __exportStar(require("./api-to-eventbridge-target-with-sns"), exports);
20
20
  __exportStar(require("./api-to-lambda-target"), exports);
21
21
  __exportStar(require("./application-configuration"), exports);
22
22
  __exportStar(require("./event-handler"), exports);
23
- __exportStar(require("./graphql-api-lambda"), exports);
24
- __exportStar(require("./graphql-api-lambda-with-cache"), exports);
25
23
  __exportStar(require("./lambda-with-iam-access"), exports);
26
24
  __exportStar(require("./piped-event-handler"), exports);
27
25
  __exportStar(require("./rest-api-lambda"), exports);
@@ -93,8 +93,4 @@ export declare abstract class RestApiLambda extends CommonConstruct {
93
93
  * @summary Method to create route53 records for RestApi
94
94
  */
95
95
  protected createApiRouteAssets(): void;
96
- /**
97
- * @summary Method to deploy the changes to the RestApi
98
- */
99
- protected createRestApiDeployment(): void;
100
96
  }
@@ -63,7 +63,6 @@ class RestApiLambda extends common_1.CommonConstruct {
63
63
  this.createApiDomain();
64
64
  this.createApiBasePathMapping();
65
65
  this.createApiRouteAssets();
66
- this.createRestApiDeployment();
67
66
  }
68
67
  /**
69
68
  * @summary Method to resolve secrets from SecretsManager
@@ -174,11 +173,5 @@ class RestApiLambda extends common_1.CommonConstruct {
174
173
  createApiRouteAssets() {
175
174
  this.route53Manager.createApiGatewayARecord(`${this.id}-custom-domain-a-record`, this, this.props.apiSubDomain, this.restApiDomain, this.restApiHostedZone, this.props.skipStageForARecords);
176
175
  }
177
- /**
178
- * @summary Method to deploy the changes to the RestApi
179
- */
180
- createRestApiDeployment() {
181
- this.apiManager.createApiDeployment(`${this.id}-deployment`, this, this.restApi);
182
- }
183
176
  }
184
177
  exports.RestApiLambda = RestApiLambda;
@@ -142,11 +142,8 @@ class EcsManager {
142
142
  if (props.healthCheck) {
143
143
  fargateService.targetGroup.configureHealthCheck({
144
144
  ...props.healthCheck,
145
- enabled: props.healthCheck.enabled ?? true,
146
145
  interval: props.healthCheck.interval ?? aws_cdk_lib_1.Duration.seconds(props.healthCheck.intervalInSecs),
147
- path: props.healthCheck.path ?? '/',
148
146
  timeout: props.healthCheck.timeout ?? aws_cdk_lib_1.Duration.seconds(props.healthCheck.timeoutInSecs),
149
- unhealthyThresholdCount: props.healthCheck.unhealthyThresholdCount,
150
147
  });
151
148
  }
152
149
  return fargateService;
@@ -1,5 +1,5 @@
1
1
  import { ScalingSchedule } from 'aws-cdk-lib/aws-applicationautoscaling';
2
- import { AwsLogDriverProps, ClusterProps, MountPoint, TaskDefinitionProps } from 'aws-cdk-lib/aws-ecs';
2
+ import { AwsLogDriverProps, ClusterProps, HealthCheck as FargateHealthCheck, MountPoint, TaskDefinitionProps } from 'aws-cdk-lib/aws-ecs';
3
3
  import { ApplicationLoadBalancedFargateServiceProps } from 'aws-cdk-lib/aws-ecs-patterns';
4
4
  import { HealthCheck as ElbHealthCheck } from 'aws-cdk-lib/aws-elasticloadbalancingv2';
5
5
  import { TagProps } from '../../types';
@@ -28,10 +28,17 @@ export interface HealthCheck extends ElbHealthCheck {
28
28
  intervalInSecs: number;
29
29
  timeoutInSecs: number;
30
30
  }
31
+ /**
32
+ *
33
+ */
34
+ export interface EcsApplicationLoadBalancedFargateServiceHealthCheck extends FargateHealthCheck {
35
+ intervalInSecs: number;
36
+ timeoutInSecs: number;
37
+ }
31
38
  /**
32
39
  */
33
40
  export interface EcsApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedFargateServiceProps {
34
- healthCheck?: HealthCheck;
41
+ healthCheck?: EcsApplicationLoadBalancedFargateServiceHealthCheck;
35
42
  logging?: AwsLogDriverProps;
36
43
  mountPoints?: MountPoint[];
37
44
  siteScaling?: EcsScalingProps;
@@ -75,9 +75,8 @@ export declare class LambdaManager {
75
75
  * @param accessPoint
76
76
  * @param mountPath
77
77
  * @param vpcSubnets
78
- * @param layers
79
78
  */
80
- createLambdaDockerFunction(id: string, scope: CommonConstruct, props: LambdaProps, role: Role | CfnRole, code: DockerImageCode, environment?: any, vpc?: IVpc, securityGroups?: ISecurityGroup[], accessPoint?: IAccessPoint, mountPath?: string, vpcSubnets?: SubnetSelection, layers?: ILayerVersion[]): DockerImageFunction;
79
+ createLambdaDockerFunction(id: string, scope: CommonConstruct, props: LambdaProps, role: Role | CfnRole, code: DockerImageCode, environment?: any, vpc?: IVpc, securityGroups?: ISecurityGroup[], accessPoint?: IAccessPoint, mountPath?: string, vpcSubnets?: SubnetSelection): DockerImageFunction;
81
80
  /**
82
81
  * @summary Method to create a lambda function Alias
83
82
  * @param id scoped id of the resource
@@ -8,6 +8,7 @@ const aws_cdk_lib_1 = require("aws-cdk-lib");
8
8
  const aws_iam_1 = require("aws-cdk-lib/aws-iam");
9
9
  const aws_lambda_1 = require("aws-cdk-lib/aws-lambda");
10
10
  const aws_lambda_event_sources_1 = require("aws-cdk-lib/aws-lambda-event-sources");
11
+ const aws_logs_1 = require("aws-cdk-lib/aws-logs");
11
12
  const lodash_1 = __importDefault(require("lodash"));
12
13
  const common_1 = require("../../common");
13
14
  const utils_1 = require("../../utils");
@@ -79,8 +80,9 @@ class LambdaManager {
79
80
  const redriveQueue = scope.sqsManager.createRedriveQueueForLambda(`${id}-rdq`, scope, props);
80
81
  deadLetterQueue = scope.sqsManager.createDeadLetterQueueForLambda(`${id}-dlq`, scope, props, redriveQueue);
81
82
  }
83
+ const { logRetention, ...lambdaProps } = props;
82
84
  const lambdaFunction = new aws_lambda_1.Function(scope, `${id}`, {
83
- ...props,
85
+ ...lambdaProps,
84
86
  allowPublicSubnet: !!vpc,
85
87
  architecture: props.architecture ?? aws_lambda_1.Architecture.ARM_64,
86
88
  code,
@@ -98,7 +100,10 @@ class LambdaManager {
98
100
  functionName,
99
101
  handler: handler || 'index.lambda_handler',
100
102
  layers,
101
- logRetention: scope.props.logRetention ?? props.logRetention,
103
+ logGroup: new aws_logs_1.LogGroup(scope, `${id}-log-group`, {
104
+ logGroupName: `/aws/lambda/${functionName}`,
105
+ retention: scope.props.logRetention ?? logRetention,
106
+ }),
102
107
  reservedConcurrentExecutions: props.reservedConcurrentExecutions ?? scope.props.defaultReservedLambdaConcurrentExecutions,
103
108
  role: role instanceof aws_iam_1.Role ? role : undefined,
104
109
  runtime: props.runtime ?? scope.props.nodejsRuntime ?? common_1.CommonStack.NODEJS_RUNTIME,
@@ -167,9 +172,8 @@ class LambdaManager {
167
172
  * @param accessPoint
168
173
  * @param mountPath
169
174
  * @param vpcSubnets
170
- * @param layers
171
175
  */
172
- createLambdaDockerFunction(id, scope, props, role, code, environment, vpc, securityGroups, accessPoint, mountPath, vpcSubnets, layers) {
176
+ createLambdaDockerFunction(id, scope, props, role, code, environment, vpc, securityGroups, accessPoint, mountPath, vpcSubnets) {
173
177
  if (!props)
174
178
  throw `Lambda props undefined for ${id}`;
175
179
  const functionName = `${props.functionName}-${scope.props.stage}`;
@@ -178,8 +182,9 @@ class LambdaManager {
178
182
  const redriveQueue = scope.sqsManager.createRedriveQueueForLambda(`${id}-rdq`, scope, props);
179
183
  deadLetterQueue = scope.sqsManager.createDeadLetterQueueForLambda(`${id}-dlq`, scope, props, redriveQueue);
180
184
  }
185
+ const { logRetention, ...lambdaProps } = props;
181
186
  const lambdaFunction = new aws_lambda_1.DockerImageFunction(scope, `${id}`, {
182
- ...props,
187
+ ...lambdaProps,
183
188
  allowPublicSubnet: !!vpc,
184
189
  architecture: props.architecture ?? aws_lambda_1.Architecture.ARM_64,
185
190
  code,
@@ -195,8 +200,10 @@ class LambdaManager {
195
200
  },
196
201
  filesystem: accessPoint ? aws_lambda_1.FileSystem.fromEfsAccessPoint(accessPoint, mountPath || '/mnt/msg') : undefined,
197
202
  functionName,
198
- layers,
199
- logRetention: scope.props.logRetention ?? props.logRetention,
203
+ logGroup: new aws_logs_1.LogGroup(scope, `${id}-log-group`, {
204
+ logGroupName: `/aws/lambda/${functionName}`,
205
+ retention: scope.props.logRetention ?? logRetention,
206
+ }),
200
207
  role: role instanceof aws_iam_1.Role ? role : undefined,
201
208
  securityGroups: securityGroups,
202
209
  timeout: props.timeoutInSecs ? aws_cdk_lib_1.Duration.seconds(props.timeoutInSecs) : aws_cdk_lib_1.Duration.minutes(1),
@@ -0,0 +1,5 @@
1
+ export default [
2
+ {
3
+ ignores: ["*.js", "**/cdk.out/**", "**/build/**", "**/*.d.ts", "coverage"]
4
+ }
5
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.159.0",
3
+ "version": "8.160.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -33,7 +33,7 @@
33
33
  "cz": "npx cz",
34
34
  "docs": "npx rimraf api-docs && pnpm override:plugin:docs && npx jsdoc --pedantic -c jsdoc.json .",
35
35
  "fix": "pnpm prettify && eslint --fix **/*.ts",
36
- "lint": "pnpm prettify && eslint **/*.ts --cache --max-warnings=0",
36
+ "lint": "pnpm prettify && eslint **/*.ts --cache --max-warnings=0 --no-warn-ignored",
37
37
  "override:plugin:docs": "cp theme/type-converter.js node_modules/better-docs/typescript",
38
38
  "prettier": "npx prettier --cache --check \"**/*.{ts,json,md}\"",
39
39
  "prettify": "npx prettier --cache --write \"**/*.{ts,json,md}\"",
@@ -47,19 +47,19 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
- "@aws-sdk/client-secrets-manager": "^3.496.0",
51
- "@aws-sdk/credential-providers": "^3.496.0",
52
- "@aws-sdk/types": "^3.496.0",
53
- "@cdktf/provider-aws": "^19.2.0",
54
- "@cdktf/provider-azurerm": "^12.2.0",
55
- "@cdktf/provider-cloudflare": "^11.0.0",
56
- "@types/lodash": "^4.14.202",
57
- "@types/node": "^20.11.5",
58
- "@types/uuid": "^9.0.7",
50
+ "@aws-sdk/client-secrets-manager": "^3.554.0",
51
+ "@aws-sdk/credential-providers": "^3.554.0",
52
+ "@aws-sdk/types": "^3.535.0",
53
+ "@cdktf/provider-aws": "^19.14.0",
54
+ "@cdktf/provider-azurerm": "^12.12.0",
55
+ "@cdktf/provider-cloudflare": "^11.7.0",
56
+ "@types/lodash": "^4.17.0",
57
+ "@types/node": "^20.12.7",
58
+ "@types/uuid": "^9.0.8",
59
59
  "app-root-path": "^3.1.0",
60
- "aws-cdk-lib": "^2.122.0",
61
- "cdktf": "^0.20.1",
62
- "cdktf-local-exec": "^0.5.2",
60
+ "aws-cdk-lib": "^2.137.0",
61
+ "cdktf": "^0.20.7",
62
+ "cdktf-local-exec": "^0.5.13",
63
63
  "constructs": "^10.3.0",
64
64
  "lodash": "^4.17.21",
65
65
  "moment": "^2.30.1",
@@ -69,23 +69,23 @@
69
69
  "uuid": "^9.0.1"
70
70
  },
71
71
  "devDependencies": {
72
- "@babel/core": "^7.23.7",
73
- "@babel/eslint-parser": "^7.23.3",
72
+ "@babel/core": "^7.24.4",
73
+ "@babel/eslint-parser": "^7.24.1",
74
74
  "@babel/plugin-proposal-class-properties": "^7.18.6",
75
- "@types/jest": "^29.5.11",
76
- "@typescript-eslint/eslint-plugin": "^6.19.0",
77
- "@typescript-eslint/parser": "^6.19.0",
78
- "aws-cdk": "^2.122.0",
75
+ "@types/jest": "^29.5.12",
76
+ "@typescript-eslint/eslint-plugin": "^7.7.0",
77
+ "@typescript-eslint/parser": "^7.7.0",
78
+ "aws-cdk": "^2.137.0",
79
79
  "better-docs": "^2.7.3",
80
80
  "codecov": "^3.8.3",
81
81
  "commitizen": "^4.3.0",
82
82
  "docdash": "^2.0.2",
83
- "dotenv": "^16.3.2",
84
- "eslint": "^8.56.0",
83
+ "dotenv": "^16.4.5",
84
+ "eslint": "^9.0.0",
85
85
  "eslint-config-prettier": "^9.1.0",
86
86
  "eslint-plugin-import": "^2.29.1",
87
- "eslint-plugin-jsdoc": "^48.0.2",
88
- "husky": "^8.0.3",
87
+ "eslint-plugin-jsdoc": "^48.2.3",
88
+ "husky": "^9.0.11",
89
89
  "jest": "^29.7.0",
90
90
  "jest-extended": "^4.0.2",
91
91
  "jest-junit": "^16.0.0",
@@ -93,15 +93,15 @@
93
93
  "jsdoc-babel": "^0.5.0",
94
94
  "jsdoc-mermaid": "^1.0.0",
95
95
  "jsdoc-plugin-typescript": "^2.2.1",
96
- "jsdoc-to-markdown": "^8.0.0",
97
- "prettier": "^3.2.4",
96
+ "jsdoc-to-markdown": "^8.0.1",
97
+ "prettier": "^3.2.5",
98
98
  "prettier-plugin-organize-imports": "^3.2.4",
99
99
  "rimraf": "^5.0.5",
100
- "semantic-release": "^23.0.0",
100
+ "semantic-release": "^23.0.8",
101
101
  "taffydb": "^2.7.3",
102
- "ts-jest": "^29.1.1",
102
+ "ts-jest": "^29.1.2",
103
103
  "ts-node": "^10.9.2",
104
- "typescript": "5.3.3"
104
+ "typescript": "5.4.5"
105
105
  },
106
106
  "optionalDependencies": {
107
107
  "prop-types": "^15.8.1",
@@ -4,8 +4,6 @@ export * from './api-to-eventbridge-target-with-sns'
4
4
  export * from './api-to-lambda-target'
5
5
  export * from './application-configuration'
6
6
  export * from './event-handler'
7
- export * from './graphql-api-lambda'
8
- export * from './graphql-api-lambda-with-cache'
9
7
  export * from './lambda-with-iam-access'
10
8
  export * from './piped-event-handler'
11
9
  export * from './rest-api-lambda'
@@ -68,7 +68,6 @@ export abstract class RestApiLambda extends CommonConstruct {
68
68
  this.createApiDomain()
69
69
  this.createApiBasePathMapping()
70
70
  this.createApiRouteAssets()
71
- this.createRestApiDeployment()
72
71
  }
73
72
 
74
73
  /**
@@ -244,11 +243,4 @@ export abstract class RestApiLambda extends CommonConstruct {
244
243
  this.props.skipStageForARecords
245
244
  )
246
245
  }
247
-
248
- /**
249
- * @summary Method to deploy the changes to the RestApi
250
- */
251
- protected createRestApiDeployment() {
252
- this.apiManager.createApiDeployment(`${this.id}-deployment`, this, this.restApi)
253
- }
254
246
  }
@@ -180,11 +180,8 @@ export class EcsManager {
180
180
  if (props.healthCheck) {
181
181
  fargateService.targetGroup.configureHealthCheck({
182
182
  ...props.healthCheck,
183
- enabled: props.healthCheck.enabled ?? true,
184
183
  interval: props.healthCheck.interval ?? Duration.seconds(props.healthCheck.intervalInSecs),
185
- path: props.healthCheck.path ?? '/',
186
184
  timeout: props.healthCheck.timeout ?? Duration.seconds(props.healthCheck.timeoutInSecs),
187
- unhealthyThresholdCount: props.healthCheck.unhealthyThresholdCount,
188
185
  })
189
186
  }
190
187
 
@@ -1,5 +1,11 @@
1
1
  import { ScalingSchedule } from 'aws-cdk-lib/aws-applicationautoscaling'
2
- import { AwsLogDriverProps, ClusterProps, MountPoint, TaskDefinitionProps } from 'aws-cdk-lib/aws-ecs'
2
+ import {
3
+ AwsLogDriverProps,
4
+ ClusterProps,
5
+ HealthCheck as FargateHealthCheck,
6
+ MountPoint,
7
+ TaskDefinitionProps,
8
+ } from 'aws-cdk-lib/aws-ecs'
3
9
  import { ApplicationLoadBalancedFargateServiceProps } from 'aws-cdk-lib/aws-ecs-patterns'
4
10
  import { HealthCheck as ElbHealthCheck } from 'aws-cdk-lib/aws-elasticloadbalancingv2'
5
11
  import { TagProps } from '../../types'
@@ -33,10 +39,18 @@ export interface HealthCheck extends ElbHealthCheck {
33
39
  timeoutInSecs: number
34
40
  }
35
41
 
42
+ /**
43
+ *
44
+ */
45
+ export interface EcsApplicationLoadBalancedFargateServiceHealthCheck extends FargateHealthCheck {
46
+ intervalInSecs: number
47
+ timeoutInSecs: number
48
+ }
49
+
36
50
  /**
37
51
  */
38
52
  export interface EcsApplicationLoadBalancedFargateServiceProps extends ApplicationLoadBalancedFargateServiceProps {
39
- healthCheck?: HealthCheck
53
+ healthCheck?: EcsApplicationLoadBalancedFargateServiceHealthCheck
40
54
  logging?: AwsLogDriverProps
41
55
  mountPoints?: MountPoint[]
42
56
  siteScaling?: EcsScalingProps
@@ -15,6 +15,7 @@ import {
15
15
  LayerVersion,
16
16
  } from 'aws-cdk-lib/aws-lambda'
17
17
  import { SqsEventSource } from 'aws-cdk-lib/aws-lambda-event-sources'
18
+ import { LogGroup } from 'aws-cdk-lib/aws-logs'
18
19
  import _ from 'lodash'
19
20
  import { CommonConstruct, CommonStack } from '../../common'
20
21
  import { createCfnOutput } from '../../utils'
@@ -116,8 +117,10 @@ export class LambdaManager {
116
117
  deadLetterQueue = scope.sqsManager.createDeadLetterQueueForLambda(`${id}-dlq`, scope, props, redriveQueue)
117
118
  }
118
119
 
120
+ const { logRetention, ...lambdaProps } = props
121
+
119
122
  const lambdaFunction = new Function(scope, `${id}`, {
120
- ...props,
123
+ ...lambdaProps,
121
124
  allowPublicSubnet: !!vpc,
122
125
  architecture: props.architecture ?? Architecture.ARM_64,
123
126
  code,
@@ -139,7 +142,10 @@ export class LambdaManager {
139
142
  functionName,
140
143
  handler: handler || 'index.lambda_handler',
141
144
  layers,
142
- logRetention: scope.props.logRetention ?? props.logRetention,
145
+ logGroup: new LogGroup(scope, `${id}-log-group`, {
146
+ logGroupName: `/aws/lambda/${functionName}`,
147
+ retention: scope.props.logRetention ?? logRetention,
148
+ }),
143
149
  reservedConcurrentExecutions:
144
150
  props.reservedConcurrentExecutions ?? scope.props.defaultReservedLambdaConcurrentExecutions,
145
151
  role: role instanceof Role ? role : undefined,
@@ -243,7 +249,6 @@ export class LambdaManager {
243
249
  * @param accessPoint
244
250
  * @param mountPath
245
251
  * @param vpcSubnets
246
- * @param layers
247
252
  */
248
253
  public createLambdaDockerFunction(
249
254
  id: string,
@@ -256,8 +261,7 @@ export class LambdaManager {
256
261
  securityGroups?: ISecurityGroup[],
257
262
  accessPoint?: IAccessPoint,
258
263
  mountPath?: string,
259
- vpcSubnets?: SubnetSelection,
260
- layers?: ILayerVersion[]
264
+ vpcSubnets?: SubnetSelection
261
265
  ) {
262
266
  if (!props) throw `Lambda props undefined for ${id}`
263
267
 
@@ -269,8 +273,10 @@ export class LambdaManager {
269
273
  deadLetterQueue = scope.sqsManager.createDeadLetterQueueForLambda(`${id}-dlq`, scope, props, redriveQueue)
270
274
  }
271
275
 
276
+ const { logRetention, ...lambdaProps } = props
277
+
272
278
  const lambdaFunction = new DockerImageFunction(scope, `${id}`, {
273
- ...props,
279
+ ...lambdaProps,
274
280
  allowPublicSubnet: !!vpc,
275
281
  architecture: props.architecture ?? Architecture.ARM_64,
276
282
  code,
@@ -290,8 +296,10 @@ export class LambdaManager {
290
296
  },
291
297
  filesystem: accessPoint ? FileSystem.fromEfsAccessPoint(accessPoint, mountPath || '/mnt/msg') : undefined,
292
298
  functionName,
293
- layers,
294
- logRetention: scope.props.logRetention ?? props.logRetention,
299
+ logGroup: new LogGroup(scope, `${id}-log-group`, {
300
+ logGroupName: `/aws/lambda/${functionName}`,
301
+ retention: scope.props.logRetention ?? logRetention,
302
+ }),
295
303
  role: role instanceof Role ? role : undefined,
296
304
  securityGroups: securityGroups,
297
305
  timeout: props.timeoutInSecs ? Duration.seconds(props.timeoutInSecs) : Duration.minutes(1),
@@ -1,2 +0,0 @@
1
- export * from './main';
2
- export * from './types';
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./main"), exports);
18
- __exportStar(require("./types"), exports);
@@ -1,96 +0,0 @@
1
- import { BasePathMapping, DomainName, RestApi } from 'aws-cdk-lib/aws-apigateway';
2
- import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager';
3
- import { PolicyDocument, Role } from 'aws-cdk-lib/aws-iam';
4
- import { IFunction, ILayerVersion } from 'aws-cdk-lib/aws-lambda';
5
- import { IHostedZone } from 'aws-cdk-lib/aws-route53';
6
- import { ISecret } from 'aws-cdk-lib/aws-secretsmanager';
7
- import { Construct } from 'constructs';
8
- import { CommonConstruct } from '../../common';
9
- import { GraphQlApiLambdaEnvironment, GraphQlApiLambdaProps } from './types';
10
- /**
11
- * @deprecated Use RestApiLambda instead. This will be removed in a future release.
12
- * @classdesc Provides a construct to create and deploy a Graphql API as Lambda
13
- *
14
- * <b>Architecture</b><br/> ![Architecture](./GraphQLApi.jpg)
15
- * @example
16
- * import { GraphQLApiLambda, GraphQlApiLambdaProps } '@gradientedge/cdk-utils'
17
- * import { Construct } from 'constructs'
18
- *
19
- * class CustomConstruct extends GraphQLApiLambda {
20
- * constructor(parent: Construct, id: string, props: GraphQlApiLambdaProps) {
21
- * super(parent, id, props)
22
- * this.props = props
23
- * this.id = id
24
- * this.initResources()
25
- * }
26
- * }
27
- */
28
- export declare class GraphQLApiLambda extends CommonConstruct {
29
- props: GraphQlApiLambdaProps;
30
- id: string;
31
- applicationSecrets: ISecret[];
32
- graphQLApiLambdaPolicy: PolicyDocument;
33
- graphQLApiLambdaRole: Role;
34
- graphQLApiLambdaEnvironment: GraphQlApiLambdaEnvironment;
35
- graphQLApiLambdaLayers: ILayerVersion[];
36
- graphQLApiLambdaFunction: IFunction;
37
- graphQLApi: RestApi;
38
- graphQLApiHostedZone: IHostedZone;
39
- graphQLApiCertificate: ICertificate;
40
- graphQLApiDomain: DomainName;
41
- graphQLApiBasePathMappings: BasePathMapping[];
42
- constructor(parent: Construct, id: string, props: GraphQlApiLambdaProps);
43
- /**
44
- * @summary Initialise and provision resources
45
- */
46
- protected initResources(): void;
47
- /**
48
- * @summary Method to resolve secrets from SecretsManager
49
- * - To be implemented in the overriding method in the implementation class
50
- */
51
- protected resolveSecrets(): void;
52
- /**
53
- * @summary Method to resolve a hosted zone based on domain attributes
54
- */
55
- protected resolveHostedZone(): void;
56
- /**
57
- * @summary Method to resolve a certificate based on attributes
58
- */
59
- protected resolveCertificate(): void;
60
- /**
61
- * @summary Method to create iam policy for GraphQL Lambda function
62
- */
63
- protected createLambdaPolicy(): void;
64
- /**
65
- * @summary Method to create iam role for GraphQL Lambda function
66
- */
67
- protected createLambdaRole(): void;
68
- /**
69
- * @summary Method to create environment variables for GraphQL Lambda function
70
- */
71
- protected createLambdaEnvironment(): void;
72
- /**
73
- * @summary Method to create layers for GraphQL Lambda function
74
- */
75
- protected createLambdaLayers(): void;
76
- /**
77
- * @summary Method to create lambda function for GraphQL
78
- */
79
- protected createLambdaFunction(): void;
80
- /**
81
- * @summary Method to create rest restApi for GraphQL
82
- */
83
- protected createRestApi(): void;
84
- /**
85
- * @summary Method to create custom restApi domain for GraphQL API
86
- */
87
- protected createApiDomain(): void;
88
- /**
89
- * @summary Method to create base path mappings for GraphQL API
90
- */
91
- protected createApiBasePathMapping(): void;
92
- /**
93
- * @summary Method to create route53 records for GraphQL API
94
- */
95
- protected createApiRouteAssets(): void;
96
- }