@gradientedge/cdk-utils 8.112.0 → 8.113.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.
@@ -4,6 +4,7 @@ import { LambdaWithIamAccessEnvironment, LambdaWithIamAccessProps } from './type
4
4
  import * as iam from 'aws-cdk-lib/aws-iam';
5
5
  import * as lambda from 'aws-cdk-lib/aws-lambda';
6
6
  import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager';
7
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
7
8
  /**
8
9
  * @classdesc Provides a construct to create a lambda function with IAM access
9
10
  * @example
@@ -30,6 +31,8 @@ export declare class LambdaWithIamAccess extends CommonConstruct {
30
31
  lambdaIamUser: iam.User;
31
32
  lambdaUserAccessKey: iam.CfnAccessKey;
32
33
  lambdaUserAccessSecret: secretsManager.Secret;
34
+ lambdaVpc: ec2.IVpc;
35
+ lambdaSecurityGroup: ec2.ISecurityGroup;
33
36
  constructor(parent: Construct, id: string, props: LambdaWithIamAccessProps);
34
37
  /**
35
38
  * @summary Initialise and provision resources
@@ -55,6 +55,8 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
55
55
  lambdaIamUser;
56
56
  lambdaUserAccessKey;
57
57
  lambdaUserAccessSecret;
58
+ lambdaVpc;
59
+ lambdaSecurityGroup;
58
60
  constructor(parent, id, props) {
59
61
  super(parent, id, props);
60
62
  this.props = props;
@@ -112,7 +114,7 @@ class LambdaWithIamAccess extends common_1.CommonConstruct {
112
114
  * @summary Method to create lambda function
113
115
  */
114
116
  createLambdaFunction() {
115
- 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);
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);
116
118
  }
117
119
  /**
118
120
  * @summary Method to create iam user for the lambda function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.112.0",
3
+ "version": "8.113.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -4,6 +4,7 @@ import { LambdaWithIamAccessEnvironment, LambdaWithIamAccessProps } from './type
4
4
  import * as iam from 'aws-cdk-lib/aws-iam'
5
5
  import * as lambda from 'aws-cdk-lib/aws-lambda'
6
6
  import * as secretsManager from 'aws-cdk-lib/aws-secretsmanager'
7
+ import * as ec2 from 'aws-cdk-lib/aws-ec2'
7
8
 
8
9
  /**
9
10
  * @classdesc Provides a construct to create a lambda function with IAM access
@@ -34,6 +35,8 @@ export class LambdaWithIamAccess extends CommonConstruct {
34
35
  lambdaIamUser: iam.User
35
36
  lambdaUserAccessKey: iam.CfnAccessKey
36
37
  lambdaUserAccessSecret: secretsManager.Secret
38
+ lambdaVpc: ec2.IVpc
39
+ lambdaSecurityGroup: ec2.ISecurityGroup
37
40
 
38
41
  constructor(parent: Construct, id: string, props: LambdaWithIamAccessProps) {
39
42
  super(parent, id, props)
@@ -109,7 +112,12 @@ export class LambdaWithIamAccess extends CommonConstruct {
109
112
  this.lambdaLayers,
110
113
  this.props.lambdaSource,
111
114
  this.props.lambdaHandler || 'index.handler',
112
- this.lambdaEnvironment
115
+ this.lambdaEnvironment,
116
+ this.lambdaVpc,
117
+ [this.lambdaSecurityGroup],
118
+ undefined,
119
+ undefined,
120
+ this.lambdaVpc
113
121
  )
114
122
  }
115
123