@gradientedge/cdk-utils 4.15.0 → 5.2.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.
@@ -33,6 +33,7 @@ export declare class CommonConstruct extends Construct {
33
33
  eksManager: aws.EksManager;
34
34
  elasticacheManager: aws.ElastiCacheManager;
35
35
  eventManager: aws.EventManager;
36
+ eventTargetManager: aws.EventTargetManager;
36
37
  iamManager: aws.IamManager;
37
38
  kmsManager: aws.KmsManager;
38
39
  lambdaManager: aws.LambdaManager;
@@ -58,6 +58,7 @@ class CommonConstruct extends constructs_1.Construct {
58
58
  eksManager;
59
59
  elasticacheManager;
60
60
  eventManager;
61
+ eventTargetManager;
61
62
  iamManager;
62
63
  kmsManager;
63
64
  lambdaManager;
@@ -88,6 +89,7 @@ class CommonConstruct extends constructs_1.Construct {
88
89
  this.eksManager = new aws.EksManager();
89
90
  this.elasticacheManager = new aws.ElastiCacheManager();
90
91
  this.eventManager = new aws.EventManager();
92
+ this.eventTargetManager = new aws.EventTargetManager();
91
93
  this.iamManager = new aws.IamManager();
92
94
  this.kmsManager = new aws.KmsManager();
93
95
  this.lambdaManager = new aws.LambdaManager();
@@ -0,0 +1,60 @@
1
+ import * as events from 'aws-cdk-lib/aws-events';
2
+ import * as targets from 'aws-cdk-lib/aws-events-targets';
3
+ import * as logs from 'aws-cdk-lib/aws-logs';
4
+ import * as common from '../../common';
5
+ /**
6
+ * @stability stable
7
+ * @category cdk-utils.event-taeget-manager
8
+ * @subcategory Construct
9
+ * @classdesc Provides operations on AWS EventBridge Targets.
10
+ * - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
11
+ * - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
12
+ * @example
13
+ * import * as common from '@gradientedge/cdk-utils'
14
+ *
15
+ * class CustomConstruct extends common.common.CommonConstruct {
16
+ * constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
17
+ * super(parent, id, props)
18
+ * this.props = props
19
+ * this.eventTargetManager.createCloudWatchLogGroupNoPolicy('MyLogGrouptarget', this, myLogGroup)
20
+ * }
21
+ * }
22
+ *
23
+ * @see [CDK EventBridge Target Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events_targets-readme.html}
24
+ */
25
+ export declare class EventTargetManager {
26
+ /**
27
+ * @summary Method to create a cloud watch log group target without a policy.
28
+ * - This method is created as a workaround for cdk issue - https://github.com/aws/aws-cdk/issues/17002
29
+ * @param {string} id scoped id of the resource
30
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
31
+ * @param {logs.ILogGroup} logGroup the log group
32
+ * @param {LogGroupNoPolicyProps} props the log group target properties
33
+ */
34
+ createCloudWatchLogGroupNoPolicy(id: string, scope: common.CommonConstruct, logGroup: logs.ILogGroup, props?: LogGroupNoPolicyProps): CloudWatchLogGroupNoPolicy;
35
+ }
36
+ /**
37
+ * Customize the CloudWatch LogGroup Event Target
38
+ */
39
+ export interface LogGroupNoPolicyProps extends targets.TargetBaseProps {
40
+ /**
41
+ * The event to send to the CloudWatch LogGroup
42
+ *
43
+ * This will be the event logged into the CloudWatch LogGroup
44
+ *
45
+ * @default - the entire EventBridge event
46
+ */
47
+ readonly event?: events.RuleTargetInput;
48
+ }
49
+ /**
50
+ * Use an AWS CloudWatch LogGroup as an event rule target, but don't apply a policy.
51
+ */
52
+ export declare class CloudWatchLogGroupNoPolicy implements events.IRuleTarget {
53
+ private readonly logGroup;
54
+ private readonly props;
55
+ constructor(logGroup: logs.ILogGroup, props?: LogGroupNoPolicyProps);
56
+ /**
57
+ * Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
58
+ */
59
+ bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig;
60
+ }
@@ -0,0 +1,91 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.CloudWatchLogGroupNoPolicy = exports.EventTargetManager = void 0;
27
+ const cdk = __importStar(require("aws-cdk-lib"));
28
+ const targets = __importStar(require("aws-cdk-lib/aws-events-targets"));
29
+ /**
30
+ * @stability stable
31
+ * @category cdk-utils.event-taeget-manager
32
+ * @subcategory Construct
33
+ * @classdesc Provides operations on AWS EventBridge Targets.
34
+ * - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
35
+ * - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
36
+ * @example
37
+ * import * as common from '@gradientedge/cdk-utils'
38
+ *
39
+ * class CustomConstruct extends common.common.CommonConstruct {
40
+ * constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
41
+ * super(parent, id, props)
42
+ * this.props = props
43
+ * this.eventTargetManager.createCloudWatchLogGroupNoPolicy('MyLogGrouptarget', this, myLogGroup)
44
+ * }
45
+ * }
46
+ *
47
+ * @see [CDK EventBridge Target Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events_targets-readme.html}
48
+ */
49
+ class EventTargetManager {
50
+ /**
51
+ * @summary Method to create a cloud watch log group target without a policy.
52
+ * - This method is created as a workaround for cdk issue - https://github.com/aws/aws-cdk/issues/17002
53
+ * @param {string} id scoped id of the resource
54
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
55
+ * @param {logs.ILogGroup} logGroup the log group
56
+ * @param {LogGroupNoPolicyProps} props the log group target properties
57
+ */
58
+ createCloudWatchLogGroupNoPolicy(id, scope, logGroup, props) {
59
+ return new CloudWatchLogGroupNoPolicy(logGroup, props);
60
+ }
61
+ }
62
+ exports.EventTargetManager = EventTargetManager;
63
+ /**
64
+ * Use an AWS CloudWatch LogGroup as an event rule target, but don't apply a policy.
65
+ */
66
+ class CloudWatchLogGroupNoPolicy {
67
+ logGroup;
68
+ props;
69
+ constructor(logGroup, props = {}) {
70
+ this.logGroup = logGroup;
71
+ this.props = props;
72
+ }
73
+ /**
74
+ * Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
75
+ */
76
+ bind(_rule, _id) {
77
+ const logGroupStack = cdk.Stack.of(this.logGroup);
78
+ return {
79
+ ...targets.bindBaseTargetConfig(this.props),
80
+ arn: logGroupStack.formatArn({
81
+ service: 'logs',
82
+ resource: 'log-group',
83
+ arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME,
84
+ resourceName: this.logGroup.logGroupName,
85
+ }),
86
+ input: this.props.event,
87
+ targetResource: this.logGroup,
88
+ };
89
+ }
90
+ }
91
+ exports.CloudWatchLogGroupNoPolicy = CloudWatchLogGroupNoPolicy;
@@ -11,6 +11,7 @@ export * from './ecs-manager';
11
11
  export * from './eks-manager';
12
12
  export * from './elasticache-manager';
13
13
  export * from './event-manager';
14
+ export * from './event-target-manager';
14
15
  export * from './iam-manager';
15
16
  export * from './kms-manager';
16
17
  export * from './lambda-manager';
@@ -27,6 +27,7 @@ __exportStar(require("./ecs-manager"), exports);
27
27
  __exportStar(require("./eks-manager"), exports);
28
28
  __exportStar(require("./elasticache-manager"), exports);
29
29
  __exportStar(require("./event-manager"), exports);
30
+ __exportStar(require("./event-target-manager"), exports);
30
31
  __exportStar(require("./iam-manager"), exports);
31
32
  __exportStar(require("./kms-manager"), exports);
32
33
  __exportStar(require("./lambda-manager"), exports);
@@ -1,4 +1,3 @@
1
- import * as pylambda from '@aws-cdk/aws-lambda-python-alpha';
2
1
  import * as cdk from 'aws-cdk-lib';
3
2
  import * as ec2 from 'aws-cdk-lib/aws-ec2';
4
3
  import * as efs from 'aws-cdk-lib/aws-efs';
@@ -34,31 +33,6 @@ export declare class LambdaManager {
34
33
  * @param {lambda.AssetCode} code
35
34
  */
36
35
  createLambdaLayer(id: string, scope: common.CommonConstruct, code: lambda.AssetCode): cdk.aws_lambda.LayerVersion;
37
- /**
38
- * @summary Method to create a lambda layer (python)
39
- * @param {string} id scoped id of the resource
40
- * @param {common.CommonConstruct} scope scope in which this resource is defined
41
- * @param {string} entry path to layer source
42
- */
43
- createPythonLambdaLayer(id: string, scope: common.CommonConstruct, entry: string): pylambda.PythonLayerVersion;
44
- /**
45
- * @summary Method to create a lambda function (python)
46
- * @param {string} id scoped id of the resource
47
- * @param {common.CommonConstruct} scope scope in which this resource is defined
48
- * @param {types.LambdaProps} props
49
- * @param {iam.Role | iam.CfnRole} role
50
- * @param {lambda.ILayerVersion[]} layers
51
- * @param {string} entry path to lambda source
52
- * @param {string?} index
53
- * @param {string?} handler
54
- * @param {Map<string, string>?} environment
55
- * @param {ec2.IVpc?} vpc
56
- * @param {ec2.ISecurityGroup[]?} securityGroups
57
- * @param {efs.IAccessPoint?} accessPoint
58
- * @param {string?} mountPath
59
- * @param {ec2.SubnetSelection?} vpcSubnets
60
- */
61
- createPythonLambdaFunction(id: string, scope: common.CommonConstruct, props: types.LambdaProps, role: iam.Role | iam.CfnRole, layers: lambda.ILayerVersion[], entry: string, index?: string, handler?: string, environment?: any, vpc?: ec2.IVpc, securityGroups?: ec2.ISecurityGroup[], accessPoint?: efs.IAccessPoint, mountPath?: string, vpcSubnets?: ec2.SubnetSelection): pylambda.PythonFunction;
62
36
  /**
63
37
  * @summary Method to create a lambda function (nodejs)
64
38
  * @param {string} id scoped id of the resource
@@ -24,7 +24,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.LambdaManager = void 0;
27
- const pylambda = __importStar(require("@aws-cdk/aws-lambda-python-alpha"));
28
27
  const cdk = __importStar(require("aws-cdk-lib"));
29
28
  const iam = __importStar(require("aws-cdk-lib/aws-iam"));
30
29
  const lambda = __importStar(require("aws-cdk-lib/aws-lambda"));
@@ -67,72 +66,6 @@ class LambdaManager {
67
66
  utils.createCfnOutput(`${id}-lambdaLayerArn`, scope, lambdaLayer.layerVersionArn);
68
67
  return lambdaLayer;
69
68
  }
70
- /**
71
- * @summary Method to create a lambda layer (python)
72
- * @param {string} id scoped id of the resource
73
- * @param {common.CommonConstruct} scope scope in which this resource is defined
74
- * @param {string} entry path to layer source
75
- */
76
- createPythonLambdaLayer(id, scope, entry) {
77
- const lambdaLayer = new pylambda.PythonLayerVersion(scope, `${id}`, {
78
- compatibleRuntimes: [lambda.Runtime.PYTHON_3_8],
79
- description: `${id}`,
80
- entry: entry,
81
- layerVersionName: `${id}-${scope.props.stage}`,
82
- });
83
- utils.createCfnOutput(`${id}-lambdaLayerArn`, scope, lambdaLayer.layerVersionArn);
84
- return lambdaLayer;
85
- }
86
- /**
87
- * @summary Method to create a lambda function (python)
88
- * @param {string} id scoped id of the resource
89
- * @param {common.CommonConstruct} scope scope in which this resource is defined
90
- * @param {types.LambdaProps} props
91
- * @param {iam.Role | iam.CfnRole} role
92
- * @param {lambda.ILayerVersion[]} layers
93
- * @param {string} entry path to lambda source
94
- * @param {string?} index
95
- * @param {string?} handler
96
- * @param {Map<string, string>?} environment
97
- * @param {ec2.IVpc?} vpc
98
- * @param {ec2.ISecurityGroup[]?} securityGroups
99
- * @param {efs.IAccessPoint?} accessPoint
100
- * @param {string?} mountPath
101
- * @param {ec2.SubnetSelection?} vpcSubnets
102
- */
103
- createPythonLambdaFunction(id, scope, props, role, layers, entry, index, handler, environment, vpc, securityGroups, accessPoint, mountPath, vpcSubnets) {
104
- if (!props)
105
- throw `Lambda props undefined`;
106
- const functionName = `${props.functionName}-${scope.props.stage}`;
107
- const lambdaFunction = new pylambda.PythonFunction(scope, `${id}`, {
108
- ...props,
109
- ...{
110
- allowPublicSubnet: !!vpc,
111
- functionName: functionName,
112
- index: index,
113
- handler: handler,
114
- runtime: lambda.Runtime.PYTHON_3_8,
115
- entry: entry,
116
- environment: {
117
- REGION: scope.props.region,
118
- ...environment,
119
- },
120
- filesystem: accessPoint
121
- ? lambda.FileSystem.fromEfsAccessPoint(accessPoint, mountPath || '/mnt/msg')
122
- : undefined,
123
- layers: layers,
124
- reservedConcurrentExecutions: props.reservedConcurrentExecutions,
125
- role: role instanceof iam.Role ? role : undefined,
126
- securityGroups: securityGroups,
127
- timeout: props.timeoutInSecs ? cdk.Duration.seconds(props.timeoutInSecs) : cdk.Duration.minutes(1),
128
- vpc: vpc,
129
- vpcSubnets: vpcSubnets,
130
- },
131
- });
132
- utils.createCfnOutput(`${id}-lambdaArn`, scope, lambdaFunction.functionArn);
133
- utils.createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName);
134
- return lambdaFunction;
135
- }
136
69
  /**
137
70
  * @summary Method to create a lambda function (nodejs)
138
71
  * @param {string} id scoped id of the resource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "4.15.0",
3
+ "version": "5.2.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -45,54 +45,53 @@
45
45
  }
46
46
  },
47
47
  "dependencies": {
48
- "@aws-cdk/aws-lambda-python-alpha": "2.19.0-alpha.0",
49
- "@types/lodash": "^4.14.181",
50
- "@types/node": "^17.0.23",
48
+ "@types/lodash": "^4.14.182",
49
+ "@types/node": "^17.0.31",
51
50
  "app-root-path": "^3.0.0",
52
- "aws-cdk-lib": "^2.19.0",
53
- "aws-sdk": "^2.1105.0",
54
- "constructs": "^10.0.102",
51
+ "aws-cdk-lib": "^2.23.0",
52
+ "aws-sdk": "^2.1129.0",
53
+ "constructs": "^10.1.1",
55
54
  "lodash": "^4.17.21",
56
- "moment": "^2.29.1",
57
- "nconf": "^0.11.3",
55
+ "moment": "^2.29.3",
56
+ "nconf": "^0.12.0",
58
57
  "pluralize": "^8.0.0",
59
58
  "ts-node": "^10.7.0"
60
59
  },
61
60
  "devDependencies": {
62
61
  "@babel/plugin-proposal-class-properties": "^7.16.7",
63
- "@types/jest": "^27.4.1",
64
- "@typescript-eslint/eslint-plugin": "^5.17.0",
65
- "@typescript-eslint/parser": "^5.17.0",
62
+ "@types/jest": "^27.5.0",
63
+ "@typescript-eslint/eslint-plugin": "^5.22.0",
64
+ "@typescript-eslint/parser": "^5.22.0",
66
65
  "aws-cdk": "*",
67
66
  "babel-eslint": "^10.1.0",
68
67
  "better-docs": "^2.7.2",
69
68
  "codecov": "^3.8.3",
70
69
  "commitizen": "^4.2.4",
71
70
  "dotenv": "^16.0.0",
72
- "eslint": "^8.12.0",
71
+ "eslint": "^8.14.0",
73
72
  "eslint-config-prettier": "^8.5.0",
74
- "eslint-plugin-import": "^2.25.4",
73
+ "eslint-plugin-import": "^2.26.0",
75
74
  "husky": "^7.0.4",
76
- "jest": "^27.5.1",
75
+ "jest": "^28.1.0",
77
76
  "jest-extended": "^2.0.0",
78
- "jest-junit": "^13.0.0",
77
+ "jest-junit": "^13.2.0",
79
78
  "jsdoc": "^3.6.10",
80
79
  "jsdoc-babel": "^0.5.0",
81
80
  "jsdoc-mermaid": "^1.0.0",
82
81
  "lerna": "^4.0.0",
83
- "prettier": "^2.6.1",
82
+ "prettier": "^2.6.2",
84
83
  "prettier-plugin-organize-imports": "^2.3.4",
85
84
  "rimraf": "^3.0.2",
86
85
  "semantic-release": "^19.0.2",
87
- "ts-jest": "^27.1.4",
86
+ "ts-jest": "^28.0.1",
88
87
  "ts-node": "^10.7.0",
89
- "typescript": "4.6.3"
88
+ "typescript": "4.6.4"
90
89
  },
91
90
  "optionalDependencies": {
92
- "@babel/core": "^7.17.8",
91
+ "@babel/core": "^7.17.10",
93
92
  "prop-types": "^15.8.1",
94
- "react": "^18.0.0",
95
- "react-dom": "^18.0.0"
93
+ "react": "^18.1.0",
94
+ "react-dom": "^18.1.0"
96
95
  },
97
96
  "config": {
98
97
  "commitizen": {
@@ -35,6 +35,7 @@ export class CommonConstruct extends Construct {
35
35
  eksManager: aws.EksManager
36
36
  elasticacheManager: aws.ElastiCacheManager
37
37
  eventManager: aws.EventManager
38
+ eventTargetManager: aws.EventTargetManager
38
39
  iamManager: aws.IamManager
39
40
  kmsManager: aws.KmsManager
40
41
  lambdaManager: aws.LambdaManager
@@ -67,6 +68,7 @@ export class CommonConstruct extends Construct {
67
68
  this.eksManager = new aws.EksManager()
68
69
  this.elasticacheManager = new aws.ElastiCacheManager()
69
70
  this.eventManager = new aws.EventManager()
71
+ this.eventTargetManager = new aws.EventTargetManager()
70
72
  this.iamManager = new aws.IamManager()
71
73
  this.kmsManager = new aws.KmsManager()
72
74
  this.lambdaManager = new aws.LambdaManager()
@@ -0,0 +1,84 @@
1
+ import * as cdk from 'aws-cdk-lib'
2
+ import * as events from 'aws-cdk-lib/aws-events'
3
+ import * as targets from 'aws-cdk-lib/aws-events-targets'
4
+ import * as logs from 'aws-cdk-lib/aws-logs'
5
+ import * as common from '../../common'
6
+
7
+ /**
8
+ * @stability stable
9
+ * @category cdk-utils.event-taeget-manager
10
+ * @subcategory Construct
11
+ * @classdesc Provides operations on AWS EventBridge Targets.
12
+ * - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
13
+ * - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
14
+ * @example
15
+ * import * as common from '@gradientedge/cdk-utils'
16
+ *
17
+ * class CustomConstruct extends common.common.CommonConstruct {
18
+ * constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
19
+ * super(parent, id, props)
20
+ * this.props = props
21
+ * this.eventTargetManager.createCloudWatchLogGroupNoPolicy('MyLogGrouptarget', this, myLogGroup)
22
+ * }
23
+ * }
24
+ *
25
+ * @see [CDK EventBridge Target Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events_targets-readme.html}
26
+ */
27
+ export class EventTargetManager {
28
+ /**
29
+ * @summary Method to create a cloud watch log group target without a policy.
30
+ * - This method is created as a workaround for cdk issue - https://github.com/aws/aws-cdk/issues/17002
31
+ * @param {string} id scoped id of the resource
32
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
33
+ * @param {logs.ILogGroup} logGroup the log group
34
+ * @param {LogGroupNoPolicyProps} props the log group target properties
35
+ */
36
+ public createCloudWatchLogGroupNoPolicy(
37
+ id: string,
38
+ scope: common.CommonConstruct,
39
+ logGroup: logs.ILogGroup,
40
+ props?: LogGroupNoPolicyProps
41
+ ) {
42
+ return new CloudWatchLogGroupNoPolicy(logGroup, props)
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Customize the CloudWatch LogGroup Event Target
48
+ */
49
+ export interface LogGroupNoPolicyProps extends targets.TargetBaseProps {
50
+ /**
51
+ * The event to send to the CloudWatch LogGroup
52
+ *
53
+ * This will be the event logged into the CloudWatch LogGroup
54
+ *
55
+ * @default - the entire EventBridge event
56
+ */
57
+ readonly event?: events.RuleTargetInput
58
+ }
59
+
60
+ /**
61
+ * Use an AWS CloudWatch LogGroup as an event rule target, but don't apply a policy.
62
+ */
63
+ export class CloudWatchLogGroupNoPolicy implements events.IRuleTarget {
64
+ constructor(private readonly logGroup: logs.ILogGroup, private readonly props: LogGroupNoPolicyProps = {}) {}
65
+
66
+ /**
67
+ * Returns a RuleTarget that can be used to log an event into a CloudWatch LogGroup
68
+ */
69
+ public bind(_rule: events.IRule, _id?: string): events.RuleTargetConfig {
70
+ const logGroupStack = cdk.Stack.of(this.logGroup)
71
+
72
+ return {
73
+ ...targets.bindBaseTargetConfig(this.props),
74
+ arn: logGroupStack.formatArn({
75
+ service: 'logs',
76
+ resource: 'log-group',
77
+ arnFormat: cdk.ArnFormat.COLON_RESOURCE_NAME,
78
+ resourceName: this.logGroup.logGroupName,
79
+ }),
80
+ input: this.props.event,
81
+ targetResource: this.logGroup,
82
+ }
83
+ }
84
+ }
@@ -11,6 +11,7 @@ export * from './ecs-manager'
11
11
  export * from './eks-manager'
12
12
  export * from './elasticache-manager'
13
13
  export * from './event-manager'
14
+ export * from './event-target-manager'
14
15
  export * from './iam-manager'
15
16
  export * from './kms-manager'
16
17
  export * from './lambda-manager'
@@ -1,4 +1,3 @@
1
- import * as pylambda from '@aws-cdk/aws-lambda-python-alpha'
2
1
  import * as cdk from 'aws-cdk-lib'
3
2
  import * as ec2 from 'aws-cdk-lib/aws-ec2'
4
3
  import * as efs from 'aws-cdk-lib/aws-efs'
@@ -49,94 +48,6 @@ export class LambdaManager {
49
48
  return lambdaLayer
50
49
  }
51
50
 
52
- /**
53
- * @summary Method to create a lambda layer (python)
54
- * @param {string} id scoped id of the resource
55
- * @param {common.CommonConstruct} scope scope in which this resource is defined
56
- * @param {string} entry path to layer source
57
- */
58
- public createPythonLambdaLayer(id: string, scope: common.CommonConstruct, entry: string) {
59
- const lambdaLayer = new pylambda.PythonLayerVersion(scope, `${id}`, {
60
- compatibleRuntimes: [lambda.Runtime.PYTHON_3_8],
61
- description: `${id}`,
62
- entry: entry,
63
- layerVersionName: `${id}-${scope.props.stage}`,
64
- })
65
-
66
- utils.createCfnOutput(`${id}-lambdaLayerArn`, scope, lambdaLayer.layerVersionArn)
67
-
68
- return lambdaLayer
69
- }
70
-
71
- /**
72
- * @summary Method to create a lambda function (python)
73
- * @param {string} id scoped id of the resource
74
- * @param {common.CommonConstruct} scope scope in which this resource is defined
75
- * @param {types.LambdaProps} props
76
- * @param {iam.Role | iam.CfnRole} role
77
- * @param {lambda.ILayerVersion[]} layers
78
- * @param {string} entry path to lambda source
79
- * @param {string?} index
80
- * @param {string?} handler
81
- * @param {Map<string, string>?} environment
82
- * @param {ec2.IVpc?} vpc
83
- * @param {ec2.ISecurityGroup[]?} securityGroups
84
- * @param {efs.IAccessPoint?} accessPoint
85
- * @param {string?} mountPath
86
- * @param {ec2.SubnetSelection?} vpcSubnets
87
- */
88
-
89
- public createPythonLambdaFunction(
90
- id: string,
91
- scope: common.CommonConstruct,
92
- props: types.LambdaProps,
93
- role: iam.Role | iam.CfnRole,
94
- layers: lambda.ILayerVersion[],
95
- entry: string,
96
- index?: string,
97
- handler?: string,
98
- environment?: any,
99
- vpc?: ec2.IVpc,
100
- securityGroups?: ec2.ISecurityGroup[],
101
- accessPoint?: efs.IAccessPoint,
102
- mountPath?: string,
103
- vpcSubnets?: ec2.SubnetSelection
104
- ) {
105
- if (!props) throw `Lambda props undefined`
106
-
107
- const functionName = `${props.functionName}-${scope.props.stage}`
108
- const lambdaFunction = new pylambda.PythonFunction(scope, `${id}`, {
109
- ...props,
110
- ...{
111
- allowPublicSubnet: !!vpc,
112
- functionName: functionName,
113
- index: index,
114
- handler: handler,
115
- runtime: lambda.Runtime.PYTHON_3_8,
116
- entry: entry,
117
- environment: {
118
- REGION: scope.props.region,
119
- ...environment,
120
- },
121
- filesystem: accessPoint
122
- ? lambda.FileSystem.fromEfsAccessPoint(accessPoint, mountPath || '/mnt/msg')
123
- : undefined,
124
- layers: layers,
125
- reservedConcurrentExecutions: props.reservedConcurrentExecutions,
126
- role: role instanceof iam.Role ? role : undefined,
127
- securityGroups: securityGroups,
128
- timeout: props.timeoutInSecs ? cdk.Duration.seconds(props.timeoutInSecs) : cdk.Duration.minutes(1),
129
- vpc: vpc,
130
- vpcSubnets: vpcSubnets,
131
- },
132
- })
133
-
134
- utils.createCfnOutput(`${id}-lambdaArn`, scope, lambdaFunction.functionArn)
135
- utils.createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName)
136
-
137
- return lambdaFunction
138
- }
139
-
140
51
  /**
141
52
  * @summary Method to create a lambda function (nodejs)
142
53
  * @param {string} id scoped id of the resource