@certenza/aws-cdk-infrastructure-commons 2.5.7 → 2.6.1
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.
- package/dist/src/lambda.d.ts +12 -2
- package/dist/src/lambda.js +25 -1
- package/package.json +2 -2
package/dist/src/lambda.d.ts
CHANGED
|
@@ -25,12 +25,22 @@ type CreateLambdaFunctionProps = {
|
|
|
25
25
|
* @returns The lambda function
|
|
26
26
|
*/
|
|
27
27
|
declare const createLambdaFunction: (scope: Construct, functionName: string, environment: string, props?: CreateLambdaFunctionProps) => nodejs.NodejsFunction;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a provisioned lambda function with an alias
|
|
30
|
+
* @param scope - The scope of the lambda function
|
|
31
|
+
* @param functionName - The name of the lambda function (will be also used as the id)
|
|
32
|
+
* @param environment - The environment of the provisioned lambda function
|
|
33
|
+
* @param provisionedConcurrentExecutions - The provisioned concurrent executions for the provisioned lambda function (0 to disable)
|
|
34
|
+
* @param props - The properties of the provisioned lambda function
|
|
35
|
+
* @returns The provisioned lambda function if provisionedConcurrentExecutions is 0, otherwise the provisioned lambda function alias
|
|
36
|
+
*/
|
|
37
|
+
declare const createProvisionedLambdaFunction: (scope: Construct, functionName: string, environment: string, provisionedConcurrentExecutions: number, props?: CreateLambdaFunctionProps) => nodejs.NodejsFunction | lambda.Alias;
|
|
28
38
|
/**
|
|
29
39
|
* Creates a lambda integration for a REST API Gateway
|
|
30
40
|
* @param lambdaFunction - The lambda function to create an integration for
|
|
31
41
|
* @returns The lambda integration
|
|
32
42
|
*/
|
|
33
|
-
declare const createLambdaApiGatewayIntegration: (lambdaFunction: lambda.Function) => cdk.aws_apigateway.LambdaIntegration;
|
|
43
|
+
declare const createLambdaApiGatewayIntegration: (lambdaFunction: lambda.Function | lambda.Alias) => cdk.aws_apigateway.LambdaIntegration;
|
|
34
44
|
/**
|
|
35
45
|
* Creates a lambda DynamoDB stream event source
|
|
36
46
|
* @param table - The table to create the event source for
|
|
@@ -43,5 +53,5 @@ declare const createLambdaDynamoDBStreamEventSource: (table: cdk.aws_dynamodb.IT
|
|
|
43
53
|
* @returns The lambda SQS event source
|
|
44
54
|
*/
|
|
45
55
|
declare const createLambdaSQSEventSource: (queue: cdk.aws_sqs.IQueue) => cdk.aws_lambda_event_sources.SqsEventSource;
|
|
46
|
-
export { createLambdaFunction, createLambdaApiGatewayIntegration, createLambdaDynamoDBStreamEventSource, createLambdaSQSEventSource, };
|
|
56
|
+
export { createLambdaFunction, createProvisionedLambdaFunction, createLambdaApiGatewayIntegration, createLambdaDynamoDBStreamEventSource, createLambdaSQSEventSource, };
|
|
47
57
|
export type { CreateLambdaFunctionProps };
|
package/dist/src/lambda.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.createLambdaSQSEventSource = exports.createLambdaDynamoDBStreamEventSource = exports.createLambdaApiGatewayIntegration = exports.createLambdaFunction = void 0;
|
|
36
|
+
exports.createLambdaSQSEventSource = exports.createLambdaDynamoDBStreamEventSource = exports.createLambdaApiGatewayIntegration = exports.createProvisionedLambdaFunction = exports.createLambdaFunction = void 0;
|
|
37
37
|
/**
|
|
38
38
|
* Lambda functions and integrations
|
|
39
39
|
*/
|
|
@@ -107,6 +107,30 @@ const createLambdaFunction = (scope, functionName, environment, props = {}) => {
|
|
|
107
107
|
return lambdaFunction;
|
|
108
108
|
};
|
|
109
109
|
exports.createLambdaFunction = createLambdaFunction;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a provisioned lambda function with an alias
|
|
112
|
+
* @param scope - The scope of the lambda function
|
|
113
|
+
* @param functionName - The name of the lambda function (will be also used as the id)
|
|
114
|
+
* @param environment - The environment of the provisioned lambda function
|
|
115
|
+
* @param provisionedConcurrentExecutions - The provisioned concurrent executions for the provisioned lambda function (0 to disable)
|
|
116
|
+
* @param props - The properties of the provisioned lambda function
|
|
117
|
+
* @returns The provisioned lambda function if provisionedConcurrentExecutions is 0, otherwise the provisioned lambda function alias
|
|
118
|
+
*/
|
|
119
|
+
const createProvisionedLambdaFunction = (scope, functionName, environment, provisionedConcurrentExecutions, props = {}) => {
|
|
120
|
+
// Create a common lambda function
|
|
121
|
+
const lambdaFunction = createLambdaFunction(scope, functionName, environment, props);
|
|
122
|
+
// If provisionedConcurrentExecutions is 0, return the lambda function without an alias
|
|
123
|
+
if (provisionedConcurrentExecutions === 0) {
|
|
124
|
+
return lambdaFunction;
|
|
125
|
+
}
|
|
126
|
+
// Create the lambda function alias
|
|
127
|
+
const lambdaFunctionAlias = lambdaFunction.addAlias(`${functionName}-live`, {
|
|
128
|
+
provisionedConcurrentExecutions: provisionedConcurrentExecutions,
|
|
129
|
+
});
|
|
130
|
+
// Return the lambda function alias
|
|
131
|
+
return lambdaFunctionAlias;
|
|
132
|
+
};
|
|
133
|
+
exports.createProvisionedLambdaFunction = createProvisionedLambdaFunction;
|
|
110
134
|
/**
|
|
111
135
|
* Creates a lambda integration for a REST API Gateway
|
|
112
136
|
* @param lambdaFunction - The lambda function to create an integration for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certenza/aws-cdk-infrastructure-commons",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Common infrastructure reusable utilities and resources for Certenza projects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/certenza/aws-cdk-infrastructure-commons#readme",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"aws-cdk-lib": "^2.
|
|
43
|
+
"aws-cdk-lib": "^2.241.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^24.0.0",
|