@gradientedge/cdk-utils 8.104.0 → 8.105.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.
@@ -117,6 +117,15 @@ export declare class SfnManager {
117
117
  * @param lambdaFunction
118
118
  */
119
119
  createLambdaStep(id: string, scope: CommonConstruct, props: SfnLambdaInvokeProps, lambdaFunction: lambda.IFunction): cdk.aws_stepfunctions_tasks.LambdaInvoke;
120
+ /**
121
+ * @summary Method to create a lambda invoke step
122
+ * @param id scoped id of the resource
123
+ * @param scope scope in which this resource is defined
124
+ * @param props
125
+ * @param lambdaFunction
126
+ * @param skipExecution
127
+ */
128
+ createSkippableLambdaStep(id: string, scope: CommonConstruct, props: SfnLambdaInvokeProps, lambdaFunction: lambda.IFunction, skipExecution?: boolean): cdk.aws_stepfunctions.Pass | cdk.aws_stepfunctions_tasks.LambdaInvoke;
120
129
  /**
121
130
  * @summary Method to create a API Gateway invoke step
122
131
  * @param id scoped id of the resource
@@ -350,6 +350,36 @@ class SfnManager {
350
350
  }));
351
351
  return step;
352
352
  }
353
+ /**
354
+ * @summary Method to create a lambda invoke step
355
+ * @param id scoped id of the resource
356
+ * @param scope scope in which this resource is defined
357
+ * @param props
358
+ * @param lambdaFunction
359
+ * @param skipExecution
360
+ */
361
+ createSkippableLambdaStep(id, scope, props, lambdaFunction, skipExecution) {
362
+ if (!props)
363
+ throw `Step props undefined for ${id}`;
364
+ if (skipExecution)
365
+ return this.createPassStep(id, scope, { name: props.name, comment: props.comment });
366
+ const step = new tasks.LambdaInvoke(scope, `${props.name}`, {
367
+ ...props,
368
+ ...{
369
+ comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
370
+ lambdaFunction,
371
+ },
372
+ });
373
+ let retries = props.retries;
374
+ if (!retries || retries.length === 0) {
375
+ retries = DEFAULT_RETRY_CONFIG;
376
+ }
377
+ retries.forEach(retry => step.addRetry({
378
+ ...retry,
379
+ ...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
380
+ }));
381
+ return step;
382
+ }
353
383
  /**
354
384
  * @summary Method to create a API Gateway invoke step
355
385
  * @param id scoped id of the resource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.104.0",
3
+ "version": "8.105.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -408,6 +408,46 @@ export class SfnManager {
408
408
  return step
409
409
  }
410
410
 
411
+ /**
412
+ * @summary Method to create a lambda invoke step
413
+ * @param id scoped id of the resource
414
+ * @param scope scope in which this resource is defined
415
+ * @param props
416
+ * @param lambdaFunction
417
+ * @param skipExecution
418
+ */
419
+ public createSkippableLambdaStep(
420
+ id: string,
421
+ scope: CommonConstruct,
422
+ props: SfnLambdaInvokeProps,
423
+ lambdaFunction: lambda.IFunction,
424
+ skipExecution?: boolean
425
+ ) {
426
+ if (!props) throw `Step props undefined for ${id}`
427
+ if (skipExecution) return this.createPassStep(id, scope, { name: props.name, comment: props.comment })
428
+ const step = new tasks.LambdaInvoke(scope, `${props.name}`, {
429
+ ...props,
430
+ ...{
431
+ comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
432
+ lambdaFunction,
433
+ },
434
+ })
435
+
436
+ let retries = props.retries
437
+ if (!retries || retries.length === 0) {
438
+ retries = DEFAULT_RETRY_CONFIG
439
+ }
440
+
441
+ retries.forEach(retry =>
442
+ step.addRetry({
443
+ ...retry,
444
+ ...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
445
+ })
446
+ )
447
+
448
+ return step
449
+ }
450
+
411
451
  /**
412
452
  * @summary Method to create a API Gateway invoke step
413
453
  * @param id scoped id of the resource