@gradientedge/cdk-utils 8.115.0 → 8.117.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.
@@ -1,10 +1,11 @@
1
- import { CommonConstruct } from '../../common';
2
- import { Construct } from 'constructs';
3
- import { LambdaWithIamAccessEnvironment, LambdaWithIamAccessProps } from './types';
1
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
2
+ import * as efs from 'aws-cdk-lib/aws-efs';
4
3
  import * as iam from 'aws-cdk-lib/aws-iam';
5
4
  import * as lambda from 'aws-cdk-lib/aws-lambda';
6
5
  import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager';
7
- import * as ec2 from 'aws-cdk-lib/aws-ec2';
6
+ import { Construct } from 'constructs';
7
+ import { CommonConstruct } from '../../common';
8
+ import { LambdaWithIamAccessEnvironment, LambdaWithIamAccessProps } from './types';
8
9
  /**
9
10
  * @classdesc Provides a construct to create a lambda function with IAM access
10
11
  * @example
@@ -32,12 +33,20 @@ export declare class LambdaWithIamAccess extends CommonConstruct {
32
33
  lambdaUserAccessKey: iam.CfnAccessKey;
33
34
  lambdaUserAccessSecret: secretsManager.Secret;
34
35
  lambdaVpc: ec2.IVpc;
35
- lambdaSecurityGroup: ec2.ISecurityGroup;
36
+ lambdaSecurityGroups: ec2.ISecurityGroup[];
37
+ lambdaAccessPoint: efs.IAccessPoint;
38
+ lambdaMountPath: string;
39
+ lambdaVpcSubnets: ec2.SubnetSelection;
36
40
  constructor(parent: Construct, id: string, props: LambdaWithIamAccessProps);
37
41
  /**
38
42
  * @summary Initialise and provision resources
39
43
  */
40
44
  initResources(): void;
45
+ protected resolveVpc(): void;
46
+ protected resolveSecurityGroups(): void;
47
+ protected resolveAccessPoint(): void;
48
+ protected resolveMountPath(): void;
49
+ protected resolveVpcSubnets(): void;
41
50
  /**
42
51
  * @summary Method to create iam policy for Lambda function
43
52
  */
@@ -24,9 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.LambdaWithIamAccess = void 0;
27
- const common_1 = require("../../common");
28
27
  const iam = __importStar(require("aws-cdk-lib/aws-iam"));
29
28
  const secretsManager = __importStar(require("aws-cdk-lib/aws-secretsmanager"));
29
+ const common_1 = require("../../common");
30
30
  /**
31
31
  * @classdesc Provides a construct to create a lambda function with IAM access
32
32
  * @example
@@ -56,7 +56,10 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
56
56
  lambdaUserAccessKey;
57
57
  lambdaUserAccessSecret;
58
58
  lambdaVpc;
59
- lambdaSecurityGroup;
59
+ lambdaSecurityGroups;
60
+ lambdaAccessPoint;
61
+ lambdaMountPath;
62
+ lambdaVpcSubnets;
60
63
  constructor(parent, id, props) {
61
64
  super(parent, id, props);
62
65
  this.props = props;
@@ -66,6 +69,11 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
66
69
  * @summary Initialise and provision resources
67
70
  */
68
71
  initResources() {
72
+ this.resolveVpc();
73
+ this.resolveSecurityGroups();
74
+ this.resolveAccessPoint();
75
+ this.resolveMountPath();
76
+ this.resolveVpcSubnets();
69
77
  this.createLambdaPolicy();
70
78
  this.createLambdaRole();
71
79
  this.createLambdaEnvironment();
@@ -74,6 +82,11 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
74
82
  this.createIamUserForLambdaFunction();
75
83
  this.createIamSecretForLambdaFunction();
76
84
  }
85
+ resolveVpc() { }
86
+ resolveSecurityGroups() { }
87
+ resolveAccessPoint() { }
88
+ resolveMountPath() { }
89
+ resolveVpcSubnets() { }
77
90
  /**
78
91
  * @summary Method to create iam policy for Lambda function
79
92
  */
@@ -114,7 +127,7 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
114
127
  * @summary Method to create lambda function
115
128
  */
116
129
  createLambdaFunction() {
117
- this.lambdaFunction = this.lambdaManager.createLambdaFunction(`${this.id}-lambda`, this, this.props.lambda, this.lambdaRole, this.lambdaLayers, this.props.lambdaSource, this.props.lambdaHandler || 'index.handler', this.lambdaEnvironment, this.lambdaVpc, [this.lambdaSecurityGroup], undefined, undefined, this.lambdaVpc);
130
+ this.lambdaFunction = this.lambdaManager.createLambdaFunction(`${this.id}-lambda`, this, this.props.lambda, this.lambdaRole, this.lambdaLayers, this.props.lambdaSource, this.props.lambdaHandler || 'index.handler', this.lambdaEnvironment, this.lambdaVpc, this.lambdaSecurityGroups, this.lambdaAccessPoint, this.lambdaMountPath, this.lambdaVpcSubnets);
118
131
  }
119
132
  /**
120
133
  * @summary Method to create iam user for the lambda function
@@ -355,6 +355,7 @@ class SiteWithEcsBackend extends common_1.CommonConstruct {
355
355
  minTtl: cdk.Duration.seconds(siteCachePolicy.minTtlInSeconds),
356
356
  maxTtl: cdk.Duration.seconds(siteCachePolicy.maxTtlInSeconds),
357
357
  enableAcceptEncodingGzip: siteCachePolicy.enableAcceptEncodingGzip,
358
+ enableAcceptEncodingBrotli: siteCachePolicy.enableAcceptEncodingBrotli,
358
359
  queryStringBehavior: siteCachePolicy.queryStringBehavior,
359
360
  headerBehavior: siteCachePolicy.headerBehavior,
360
361
  cookieBehavior: siteCachePolicy.cookieBehavior,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.115.0",
3
+ "version": "8.117.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -1,10 +1,11 @@
1
- import { CommonConstruct } from '../../common'
2
- import { Construct } from 'constructs'
3
- import { LambdaWithIamAccessEnvironment, LambdaWithIamAccessProps } from './types'
1
+ import * as ec2 from 'aws-cdk-lib/aws-ec2'
2
+ import * as efs from 'aws-cdk-lib/aws-efs'
4
3
  import * as iam from 'aws-cdk-lib/aws-iam'
5
4
  import * as lambda from 'aws-cdk-lib/aws-lambda'
6
5
  import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager'
7
- import * as ec2 from 'aws-cdk-lib/aws-ec2'
6
+ import { Construct } from 'constructs'
7
+ import { CommonConstruct } from '../../common'
8
+ import { LambdaWithIamAccessEnvironment, LambdaWithIamAccessProps } from './types'
8
9
 
9
10
  /**
10
11
  * @classdesc Provides a construct to create a lambda function with IAM access
@@ -36,7 +37,10 @@ export class LambdaWithIamAccess extends CommonConstruct {
36
37
  lambdaUserAccessKey: iam.CfnAccessKey
37
38
  lambdaUserAccessSecret: secretsManager.Secret
38
39
  lambdaVpc: ec2.IVpc
39
- lambdaSecurityGroup: ec2.ISecurityGroup
40
+ lambdaSecurityGroups: ec2.ISecurityGroup[]
41
+ lambdaAccessPoint: efs.IAccessPoint
42
+ lambdaMountPath: string
43
+ lambdaVpcSubnets: ec2.SubnetSelection
40
44
 
41
45
  constructor(parent: Construct, id: string, props: LambdaWithIamAccessProps) {
42
46
  super(parent, id, props)
@@ -49,6 +53,11 @@ export class LambdaWithIamAccess extends CommonConstruct {
49
53
  * @summary Initialise and provision resources
50
54
  */
51
55
  public initResources() {
56
+ this.resolveVpc()
57
+ this.resolveSecurityGroups()
58
+ this.resolveAccessPoint()
59
+ this.resolveMountPath()
60
+ this.resolveVpcSubnets()
52
61
  this.createLambdaPolicy()
53
62
  this.createLambdaRole()
54
63
  this.createLambdaEnvironment()
@@ -58,6 +67,16 @@ export class LambdaWithIamAccess extends CommonConstruct {
58
67
  this.createIamSecretForLambdaFunction()
59
68
  }
60
69
 
70
+ protected resolveVpc() {}
71
+
72
+ protected resolveSecurityGroups() {}
73
+
74
+ protected resolveAccessPoint() {}
75
+
76
+ protected resolveMountPath() {}
77
+
78
+ protected resolveVpcSubnets() {}
79
+
61
80
  /**
62
81
  * @summary Method to create iam policy for Lambda function
63
82
  */
@@ -114,10 +133,10 @@ export class LambdaWithIamAccess extends CommonConstruct {
114
133
  this.props.lambdaHandler || 'index.handler',
115
134
  this.lambdaEnvironment,
116
135
  this.lambdaVpc,
117
- [this.lambdaSecurityGroup],
118
- undefined,
119
- undefined,
120
- this.lambdaVpc
136
+ this.lambdaSecurityGroups,
137
+ this.lambdaAccessPoint,
138
+ this.lambdaMountPath,
139
+ this.lambdaVpcSubnets
121
140
  )
122
141
  }
123
142
 
@@ -418,6 +418,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
418
418
  minTtl: cdk.Duration.seconds(siteCachePolicy.minTtlInSeconds),
419
419
  maxTtl: cdk.Duration.seconds(siteCachePolicy.maxTtlInSeconds),
420
420
  enableAcceptEncodingGzip: siteCachePolicy.enableAcceptEncodingGzip,
421
+ enableAcceptEncodingBrotli: siteCachePolicy.enableAcceptEncodingBrotli,
421
422
  queryStringBehavior: siteCachePolicy.queryStringBehavior,
422
423
  headerBehavior: siteCachePolicy.headerBehavior,
423
424
  cookieBehavior: siteCachePolicy.cookieBehavior,