@gradientedge/cdk-utils 8.0.0 → 8.1.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.
@@ -81,4 +81,12 @@ export declare class LambdaManager {
81
81
  * @param {ec2.SubnetSelection?} vpcSubnets
82
82
  */
83
83
  createLambdaDockerFunction(id: string, scope: common.CommonConstruct, props: types.LambdaProps, role: iam.Role | iam.CfnRole, code: lambda.DockerImageCode, environment?: any, vpc?: ec2.IVpc, securityGroups?: ec2.ISecurityGroup[], accessPoint?: efs.IAccessPoint, mountPath?: string, vpcSubnets?: ec2.SubnetSelection): cdk.aws_lambda.DockerImageFunction;
84
+ /**
85
+ * @summary Method to create a lambda function Alias
86
+ * @param {string} id scoped id of the resource
87
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
88
+ * @param {types.LambdaAliasProps} props
89
+ * @param {types.LambdaAliasProps} lambdaVersion
90
+ */
91
+ createLambdaFunctionAlias(id: string, scope: common.CommonConstruct, props: types.LambdaAliasProps, lambdaVersion: lambda.IVersion): cdk.aws_lambda.Alias;
84
92
  }
@@ -199,5 +199,33 @@ class LambdaManager {
199
199
  utils.createCfnOutput(`${id}-lambdaName`, scope, lambdaFunction.functionName);
200
200
  return lambdaFunction;
201
201
  }
202
+ /**
203
+ * @summary Method to create a lambda function Alias
204
+ * @param {string} id scoped id of the resource
205
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
206
+ * @param {types.LambdaAliasProps} props
207
+ * @param {types.LambdaAliasProps} lambdaVersion
208
+ */
209
+ createLambdaFunctionAlias(id, scope, props, lambdaVersion) {
210
+ if (!props)
211
+ throw `Lambda Alias props undefined for ${id}`;
212
+ const lambdaFunctionAlias = new lambda.Alias(scope, `${id}`, {
213
+ ...props,
214
+ ...{
215
+ aliasName: `${id}-lambda-alias`,
216
+ version: lambdaVersion,
217
+ additionalVersions: props.additionalVersions,
218
+ description: props.description,
219
+ maxEventAge: props.maxEventAge,
220
+ onFailure: props.onFailure,
221
+ onSuccess: props.onSuccess,
222
+ provisionedConcurrentExecutions: props.provisionedConcurrentExecutions,
223
+ retryAttempts: props.retryAttempts,
224
+ },
225
+ });
226
+ utils.createCfnOutput(`${id}-lambdaAliasName`, scope, lambdaFunctionAlias.functionArn);
227
+ utils.createCfnOutput(`${id}-lambdaAliasArn`, scope, lambdaFunctionAlias.functionName);
228
+ return lambdaFunctionAlias;
229
+ }
202
230
  }
203
231
  exports.LambdaManager = LambdaManager;
@@ -620,6 +620,12 @@ export interface LambdaProps extends lambda.FunctionProps {
620
620
  timeoutInSecs?: number;
621
621
  excludeLastModifiedTimestamp?: boolean;
622
622
  }
623
+ /**
624
+ * @category cdk-utils.lambda-manager
625
+ * @subcategory Properties
626
+ */
627
+ export interface LambdaAliasProps extends lambda.AliasProps {
628
+ }
623
629
  /**
624
630
  * @category cdk-utils.lambda-manager
625
631
  * @subcategory Properties
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.0.0",
3
+ "version": "8.1.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -244,4 +244,40 @@ export class LambdaManager {
244
244
 
245
245
  return lambdaFunction
246
246
  }
247
+
248
+ /**
249
+ * @summary Method to create a lambda function Alias
250
+ * @param {string} id scoped id of the resource
251
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
252
+ * @param {types.LambdaAliasProps} props
253
+ * @param {types.LambdaAliasProps} lambdaVersion
254
+ */
255
+ public createLambdaFunctionAlias(
256
+ id: string,
257
+ scope: common.CommonConstruct,
258
+ props: types.LambdaAliasProps,
259
+ lambdaVersion: lambda.IVersion
260
+ ) {
261
+ if (!props) throw `Lambda Alias props undefined for ${id}`
262
+
263
+ const lambdaFunctionAlias = new lambda.Alias(scope, `${id}`, {
264
+ ...props,
265
+ ...{
266
+ aliasName: `${id}-lambda-alias`,
267
+ version: lambdaVersion,
268
+ additionalVersions: props.additionalVersions,
269
+ description: props.description,
270
+ maxEventAge: props.maxEventAge,
271
+ onFailure: props.onFailure,
272
+ onSuccess: props.onSuccess,
273
+ provisionedConcurrentExecutions: props.provisionedConcurrentExecutions,
274
+ retryAttempts: props.retryAttempts,
275
+ },
276
+ })
277
+
278
+ utils.createCfnOutput(`${id}-lambdaAliasName`, scope, lambdaFunctionAlias.functionArn)
279
+ utils.createCfnOutput(`${id}-lambdaAliasArn`, scope, lambdaFunctionAlias.functionName)
280
+
281
+ return lambdaFunctionAlias
282
+ }
247
283
  }
@@ -659,6 +659,12 @@ export interface LambdaProps extends lambda.FunctionProps {
659
659
  excludeLastModifiedTimestamp?: boolean
660
660
  }
661
661
 
662
+ /**
663
+ * @category cdk-utils.lambda-manager
664
+ * @subcategory Properties
665
+ */
666
+ export interface LambdaAliasProps extends lambda.AliasProps {}
667
+
662
668
  /**
663
669
  * @category cdk-utils.lambda-manager
664
670
  * @subcategory Properties