@gradientedge/cdk-utils 8.2.0 → 8.4.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.
@@ -212,7 +212,7 @@ class LambdaManager {
212
212
  const lambdaFunctionAlias = new lambda.Alias(scope, `${id}`, {
213
213
  ...props,
214
214
  ...{
215
- aliasName: `${id}-lambda-alias`,
215
+ aliasName: props.aliasName,
216
216
  version: lambdaVersion,
217
217
  additionalVersions: props.additionalVersions,
218
218
  description: props.description,
@@ -94,6 +94,17 @@ export declare class SfnManager {
94
94
  createDynamoDbPutItemStep(id: string, scope: common.CommonConstruct, props: types.SfnDynamoPutItemProps, table: dynamodb.ITable, tableItem: {
95
95
  [key: string]: tasks.DynamoAttributeValue;
96
96
  }): cdk.aws_stepfunctions_tasks.DynamoPutItem;
97
+ /**
98
+ * @summary Method to create a DynamoDB delete item step
99
+ * @param {string} id scoped id of the resource
100
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
101
+ * @param {types.SfnDynamoDeleteItemProps} props
102
+ * @param {dynamodb.ITable} table The table to put the item in
103
+ * @param tableKey The table key for query/scan
104
+ */
105
+ createDynamoDbDeleteItemStep(id: string, scope: common.CommonConstruct, props: types.SfnDynamoDeleteItemProps, table: dynamodb.ITable, tableKey: {
106
+ [key: string]: tasks.DynamoAttributeValue;
107
+ }): cdk.aws_stepfunctions_tasks.DynamoDeleteItem;
97
108
  /**
98
109
  * @summary Method to send a message to SQS step
99
110
  * @param {string} id scoped id of the resource
@@ -229,6 +229,46 @@ class SfnManager {
229
229
  }
230
230
  return step;
231
231
  }
232
+ /**
233
+ * @summary Method to create a DynamoDB delete item step
234
+ * @param {string} id scoped id of the resource
235
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
236
+ * @param {types.SfnDynamoDeleteItemProps} props
237
+ * @param {dynamodb.ITable} table The table to put the item in
238
+ * @param tableKey The table key for query/scan
239
+ */
240
+ createDynamoDbDeleteItemStep(id, scope, props, table, tableKey) {
241
+ if (!props)
242
+ throw `Step props undefined for ${id}`;
243
+ const step = new tasks.DynamoDeleteItem(scope, `${props.name}`, {
244
+ ...props,
245
+ ...{
246
+ table: table,
247
+ key: tableKey,
248
+ conditionExpression: props.conditionExpression,
249
+ expressionAttributeNames: props.expressionAttributeNames,
250
+ expressionAttributeValues: props.expressionAttributeValues,
251
+ heartbeat: props.heartbeat,
252
+ inputPath: props.inputPath,
253
+ outputPath: props.outputPath,
254
+ resultPath: props.resultPath,
255
+ resultSelector: props.resultSelector,
256
+ timeout: props.timeout,
257
+ integrationPattern: props.integrationPattern,
258
+ returnConsumedCapacity: props.returnConsumedCapacity,
259
+ returnItemCollectionMetrics: props.returnItemCollectionMetrics,
260
+ returnValues: props.returnValues,
261
+ comment: `DynamoDB DeleteItem step for ${props.name} - ${scope.props.stage} stage`,
262
+ },
263
+ });
264
+ if (props.retries && props.retries.length > 0) {
265
+ props.retries.forEach(retry => step.addRetry({
266
+ ...retry,
267
+ ...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
268
+ }));
269
+ }
270
+ return step;
271
+ }
232
272
  /**
233
273
  * @summary Method to send a message to SQS step
234
274
  * @param {string} id scoped id of the resource
@@ -158,6 +158,14 @@ export interface SfnDynamoPutItemProps extends tasks.DynamoPutItemProps {
158
158
  name: string;
159
159
  retries?: SfnRetryProps[];
160
160
  }
161
+ /**
162
+ * @category cdk-utils.step-functions-manager
163
+ * @subcategory Properties
164
+ */
165
+ export interface SfnDynamoDeleteItemProps extends tasks.DynamoDeleteItemProps {
166
+ name: string;
167
+ retries?: SfnRetryProps[];
168
+ }
161
169
  /**
162
170
  * @category cdk-utils.step-functions-manager
163
171
  * @subcategory Properties
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradientedge/cdk-utils",
3
- "version": "8.2.0",
3
+ "version": "8.4.0",
4
4
  "description": "Utilities for AWS CDK provisioning",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
@@ -263,7 +263,7 @@ export class LambdaManager {
263
263
  const lambdaFunctionAlias = new lambda.Alias(scope, `${id}`, {
264
264
  ...props,
265
265
  ...{
266
- aliasName: `${id}-lambda-alias`,
266
+ aliasName: props.aliasName,
267
267
  version: lambdaVersion,
268
268
  additionalVersions: props.additionalVersions,
269
269
  description: props.description,
@@ -237,6 +237,56 @@ export class SfnManager {
237
237
  return step
238
238
  }
239
239
 
240
+ /**
241
+ * @summary Method to create a DynamoDB delete item step
242
+ * @param {string} id scoped id of the resource
243
+ * @param {common.CommonConstruct} scope scope in which this resource is defined
244
+ * @param {types.SfnDynamoDeleteItemProps} props
245
+ * @param {dynamodb.ITable} table The table to put the item in
246
+ * @param tableKey The table key for query/scan
247
+ */
248
+ public createDynamoDbDeleteItemStep(
249
+ id: string,
250
+ scope: common.CommonConstruct,
251
+ props: types.SfnDynamoDeleteItemProps,
252
+ table: dynamodb.ITable,
253
+ tableKey: { [key: string]: tasks.DynamoAttributeValue }
254
+ ) {
255
+ if (!props) throw `Step props undefined for ${id}`
256
+ const step = new tasks.DynamoDeleteItem(scope, `${props.name}`, {
257
+ ...props,
258
+ ...{
259
+ table: table,
260
+ key: tableKey,
261
+ conditionExpression: props.conditionExpression,
262
+ expressionAttributeNames: props.expressionAttributeNames,
263
+ expressionAttributeValues: props.expressionAttributeValues,
264
+ heartbeat: props.heartbeat,
265
+ inputPath: props.inputPath,
266
+ outputPath: props.outputPath,
267
+ resultPath: props.resultPath,
268
+ resultSelector: props.resultSelector,
269
+ timeout: props.timeout,
270
+ integrationPattern: props.integrationPattern,
271
+ returnConsumedCapacity: props.returnConsumedCapacity,
272
+ returnItemCollectionMetrics: props.returnItemCollectionMetrics,
273
+ returnValues: props.returnValues,
274
+ comment: `DynamoDB DeleteItem step for ${props.name} - ${scope.props.stage} stage`,
275
+ },
276
+ })
277
+
278
+ if (props.retries && props.retries.length > 0) {
279
+ props.retries.forEach(retry =>
280
+ step.addRetry({
281
+ ...retry,
282
+ ...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
283
+ })
284
+ )
285
+ }
286
+
287
+ return step
288
+ }
289
+
240
290
  /**
241
291
  * @summary Method to send a message to SQS step
242
292
  * @param {string} id scoped id of the resource
@@ -170,6 +170,15 @@ export interface SfnDynamoPutItemProps extends tasks.DynamoPutItemProps {
170
170
  retries?: SfnRetryProps[]
171
171
  }
172
172
 
173
+ /**
174
+ * @category cdk-utils.step-functions-manager
175
+ * @subcategory Properties
176
+ */
177
+ export interface SfnDynamoDeleteItemProps extends tasks.DynamoDeleteItemProps {
178
+ name: string
179
+ retries?: SfnRetryProps[]
180
+ }
181
+
173
182
  /**
174
183
  * @category cdk-utils.step-functions-manager
175
184
  * @subcategory Properties