@gradientedge/cdk-utils 8.0.0 → 8.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.
- package/dist/src/lib/manager/aws/lambda-manager.d.ts +8 -0
- package/dist/src/lib/manager/aws/lambda-manager.js +28 -0
- package/dist/src/lib/manager/aws/sfn-manager.js +48 -6
- package/dist/src/lib/types/aws/index.d.ts +19 -0
- package/package.json +1 -1
- package/src/lib/manager/aws/lambda-manager.ts +36 -0
- package/src/lib/manager/aws/sfn-manager.ts +72 -6
- package/src/lib/types/aws/index.ts +20 -0
|
@@ -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;
|
|
@@ -106,12 +106,19 @@ class SfnManager {
|
|
|
106
106
|
createParallelStep(id, scope, props) {
|
|
107
107
|
if (!props)
|
|
108
108
|
throw `Step props undefined for ${id}`;
|
|
109
|
-
|
|
109
|
+
const step = new sfn.Parallel(scope, `${props.name}`, {
|
|
110
110
|
...props,
|
|
111
111
|
...{
|
|
112
112
|
comment: `Parallel step for ${props.name} - ${scope.props.stage} stage`,
|
|
113
113
|
},
|
|
114
114
|
});
|
|
115
|
+
if (props.retries && props.retries.length > 0) {
|
|
116
|
+
props.retries.forEach(retry => step.addRetry({
|
|
117
|
+
...retry,
|
|
118
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
return step;
|
|
115
122
|
}
|
|
116
123
|
/**
|
|
117
124
|
* @summary Method to create a choice step
|
|
@@ -155,7 +162,7 @@ class SfnManager {
|
|
|
155
162
|
createDynamoDbGetItemStep(id, scope, props, table, tableKey) {
|
|
156
163
|
if (!props)
|
|
157
164
|
throw `Step props undefined for ${id}`;
|
|
158
|
-
|
|
165
|
+
const step = new tasks.DynamoGetItem(scope, `${props.name}`, {
|
|
159
166
|
...props,
|
|
160
167
|
...{
|
|
161
168
|
table: table,
|
|
@@ -174,6 +181,13 @@ class SfnManager {
|
|
|
174
181
|
comment: `DynamoDB GetItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
175
182
|
},
|
|
176
183
|
});
|
|
184
|
+
if (props.retries && props.retries.length > 0) {
|
|
185
|
+
props.retries.forEach(retry => step.addRetry({
|
|
186
|
+
...retry,
|
|
187
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
return step;
|
|
177
191
|
}
|
|
178
192
|
/**
|
|
179
193
|
* @summary Method to create a DynamoDB put item step
|
|
@@ -186,7 +200,7 @@ class SfnManager {
|
|
|
186
200
|
createDynamoDbPutItemStep(id, scope, props, table, tableItem) {
|
|
187
201
|
if (!props)
|
|
188
202
|
throw `Step props undefined for ${id}`;
|
|
189
|
-
|
|
203
|
+
const step = new tasks.DynamoPutItem(scope, `${props.name}`, {
|
|
190
204
|
...props,
|
|
191
205
|
...{
|
|
192
206
|
table: table,
|
|
@@ -207,6 +221,13 @@ class SfnManager {
|
|
|
207
221
|
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
208
222
|
},
|
|
209
223
|
});
|
|
224
|
+
if (props.retries && props.retries.length > 0) {
|
|
225
|
+
props.retries.forEach(retry => step.addRetry({
|
|
226
|
+
...retry,
|
|
227
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
return step;
|
|
210
231
|
}
|
|
211
232
|
/**
|
|
212
233
|
* @summary Method to send a message to SQS step
|
|
@@ -220,7 +241,7 @@ class SfnManager {
|
|
|
220
241
|
throw `Step props undefined for ${id}`;
|
|
221
242
|
if (!props.messageBody)
|
|
222
243
|
throw 'Message body undefined';
|
|
223
|
-
|
|
244
|
+
const step = new tasks.SqsSendMessage(scope, `${props.name}`, {
|
|
224
245
|
...props,
|
|
225
246
|
...{
|
|
226
247
|
queue: queue,
|
|
@@ -238,6 +259,13 @@ class SfnManager {
|
|
|
238
259
|
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
239
260
|
},
|
|
240
261
|
});
|
|
262
|
+
if (props.retries && props.retries.length > 0) {
|
|
263
|
+
props.retries.forEach(retry => step.addRetry({
|
|
264
|
+
...retry,
|
|
265
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
return step;
|
|
241
269
|
}
|
|
242
270
|
/**
|
|
243
271
|
* @summary Method to create a lambda invoke step
|
|
@@ -249,13 +277,20 @@ class SfnManager {
|
|
|
249
277
|
createLambdaStep(id, scope, props, lambdaFunction) {
|
|
250
278
|
if (!props)
|
|
251
279
|
throw `Step props undefined for ${id}`;
|
|
252
|
-
|
|
280
|
+
const step = new tasks.LambdaInvoke(scope, `${props.name}`, {
|
|
253
281
|
...props,
|
|
254
282
|
...{
|
|
255
283
|
lambdaFunction,
|
|
256
284
|
comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
|
|
257
285
|
},
|
|
258
286
|
});
|
|
287
|
+
if (props.retries && props.retries.length > 0) {
|
|
288
|
+
props.retries.forEach(retry => step.addRetry({
|
|
289
|
+
...retry,
|
|
290
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
return step;
|
|
259
294
|
}
|
|
260
295
|
/**
|
|
261
296
|
* @summary Method to create a API Gateway invoke step
|
|
@@ -267,7 +302,7 @@ class SfnManager {
|
|
|
267
302
|
createApiStep(id, scope, props, api) {
|
|
268
303
|
if (!props)
|
|
269
304
|
throw `Step props undefined for ${id}`;
|
|
270
|
-
|
|
305
|
+
const step = new tasks.CallApiGatewayRestApiEndpoint(scope, `${props.name}`, {
|
|
271
306
|
...props,
|
|
272
307
|
...{
|
|
273
308
|
api,
|
|
@@ -275,6 +310,13 @@ class SfnManager {
|
|
|
275
310
|
comment: `API step for ${props.name} - ${scope.props.stage} stage`,
|
|
276
311
|
},
|
|
277
312
|
});
|
|
313
|
+
if (props.retries && props.retries.length > 0) {
|
|
314
|
+
props.retries.forEach(retry => step.addRetry({
|
|
315
|
+
...retry,
|
|
316
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
317
|
+
}));
|
|
318
|
+
}
|
|
319
|
+
return step;
|
|
278
320
|
}
|
|
279
321
|
/**
|
|
280
322
|
* @summary Method to create a state machine
|
|
@@ -121,6 +121,13 @@ export interface KmsKeyProps extends kms.KeyProps {
|
|
|
121
121
|
export interface SfnSucceedProps extends sfn.SucceedProps {
|
|
122
122
|
name: string;
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* @category cdk-utils.step-functions-manager
|
|
126
|
+
* @subcategory Properties
|
|
127
|
+
*/
|
|
128
|
+
export interface SfnRetryProps extends sfn.RetryProps {
|
|
129
|
+
intervalInSecs: number;
|
|
130
|
+
}
|
|
124
131
|
/**
|
|
125
132
|
* @category cdk-utils.step-functions-manager
|
|
126
133
|
* @subcategory Properties
|
|
@@ -141,6 +148,7 @@ export interface SfnPassProps extends sfn.PassProps {
|
|
|
141
148
|
*/
|
|
142
149
|
export interface SfnDynamoGetItemProps extends tasks.DynamoGetItemProps {
|
|
143
150
|
name: string;
|
|
151
|
+
retries?: SfnRetryProps[];
|
|
144
152
|
}
|
|
145
153
|
/**
|
|
146
154
|
* @category cdk-utils.step-functions-manager
|
|
@@ -148,6 +156,7 @@ export interface SfnDynamoGetItemProps extends tasks.DynamoGetItemProps {
|
|
|
148
156
|
*/
|
|
149
157
|
export interface SfnDynamoPutItemProps extends tasks.DynamoPutItemProps {
|
|
150
158
|
name: string;
|
|
159
|
+
retries?: SfnRetryProps[];
|
|
151
160
|
}
|
|
152
161
|
/**
|
|
153
162
|
* @category cdk-utils.step-functions-manager
|
|
@@ -155,6 +164,7 @@ export interface SfnDynamoPutItemProps extends tasks.DynamoPutItemProps {
|
|
|
155
164
|
*/
|
|
156
165
|
export interface SfnSqsSendMessageProps extends tasks.SqsSendMessageProps {
|
|
157
166
|
name: string;
|
|
167
|
+
retries?: SfnRetryProps[];
|
|
158
168
|
}
|
|
159
169
|
/**
|
|
160
170
|
* @category cdk-utils.step-functions-manager
|
|
@@ -162,6 +172,7 @@ export interface SfnSqsSendMessageProps extends tasks.SqsSendMessageProps {
|
|
|
162
172
|
*/
|
|
163
173
|
export interface SfnParallelProps extends sfn.ParallelProps {
|
|
164
174
|
name: string;
|
|
175
|
+
retries?: SfnRetryProps[];
|
|
165
176
|
}
|
|
166
177
|
/**
|
|
167
178
|
* @category cdk-utils.step-functions-manager
|
|
@@ -184,6 +195,7 @@ export interface SfnWaitProps extends sfn.WaitProps {
|
|
|
184
195
|
*/
|
|
185
196
|
export interface SfnLambdaInvokeProps extends tasks.LambdaInvokeProps {
|
|
186
197
|
name: string;
|
|
198
|
+
retries?: SfnRetryProps[];
|
|
187
199
|
}
|
|
188
200
|
/**
|
|
189
201
|
* @category cdk-utils.step-functions-manager
|
|
@@ -191,6 +203,7 @@ export interface SfnLambdaInvokeProps extends tasks.LambdaInvokeProps {
|
|
|
191
203
|
*/
|
|
192
204
|
export interface SfnCallApiGatewayRestApiEndpointProps extends tasks.CallApiGatewayRestApiEndpointProps {
|
|
193
205
|
name: string;
|
|
206
|
+
retries?: SfnRetryProps[];
|
|
194
207
|
}
|
|
195
208
|
/**
|
|
196
209
|
* @category cdk-utils.step-functions-manager
|
|
@@ -620,6 +633,12 @@ export interface LambdaProps extends lambda.FunctionProps {
|
|
|
620
633
|
timeoutInSecs?: number;
|
|
621
634
|
excludeLastModifiedTimestamp?: boolean;
|
|
622
635
|
}
|
|
636
|
+
/**
|
|
637
|
+
* @category cdk-utils.lambda-manager
|
|
638
|
+
* @subcategory Properties
|
|
639
|
+
*/
|
|
640
|
+
export interface LambdaAliasProps extends lambda.AliasProps {
|
|
641
|
+
}
|
|
623
642
|
/**
|
|
624
643
|
* @category cdk-utils.lambda-manager
|
|
625
644
|
* @subcategory Properties
|
package/package.json
CHANGED
|
@@ -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
|
}
|
|
@@ -88,12 +88,23 @@ export class SfnManager {
|
|
|
88
88
|
*/
|
|
89
89
|
public createParallelStep(id: string, scope: common.CommonConstruct, props: types.SfnParallelProps) {
|
|
90
90
|
if (!props) throw `Step props undefined for ${id}`
|
|
91
|
-
|
|
91
|
+
const step = new sfn.Parallel(scope, `${props.name}`, {
|
|
92
92
|
...props,
|
|
93
93
|
...{
|
|
94
94
|
comment: `Parallel step for ${props.name} - ${scope.props.stage} stage`,
|
|
95
95
|
},
|
|
96
96
|
})
|
|
97
|
+
|
|
98
|
+
if (props.retries && props.retries.length > 0) {
|
|
99
|
+
props.retries.forEach(retry =>
|
|
100
|
+
step.addRetry({
|
|
101
|
+
...retry,
|
|
102
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
103
|
+
})
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return step
|
|
97
108
|
}
|
|
98
109
|
|
|
99
110
|
/**
|
|
@@ -144,7 +155,7 @@ export class SfnManager {
|
|
|
144
155
|
tableKey: { [key: string]: tasks.DynamoAttributeValue }
|
|
145
156
|
) {
|
|
146
157
|
if (!props) throw `Step props undefined for ${id}`
|
|
147
|
-
|
|
158
|
+
const step = new tasks.DynamoGetItem(scope, `${props.name}`, {
|
|
148
159
|
...props,
|
|
149
160
|
...{
|
|
150
161
|
table: table,
|
|
@@ -163,6 +174,17 @@ export class SfnManager {
|
|
|
163
174
|
comment: `DynamoDB GetItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
164
175
|
},
|
|
165
176
|
})
|
|
177
|
+
|
|
178
|
+
if (props.retries && props.retries.length > 0) {
|
|
179
|
+
props.retries.forEach(retry =>
|
|
180
|
+
step.addRetry({
|
|
181
|
+
...retry,
|
|
182
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
183
|
+
})
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return step
|
|
166
188
|
}
|
|
167
189
|
|
|
168
190
|
/**
|
|
@@ -181,7 +203,7 @@ export class SfnManager {
|
|
|
181
203
|
tableItem: { [key: string]: tasks.DynamoAttributeValue }
|
|
182
204
|
) {
|
|
183
205
|
if (!props) throw `Step props undefined for ${id}`
|
|
184
|
-
|
|
206
|
+
const step = new tasks.DynamoPutItem(scope, `${props.name}`, {
|
|
185
207
|
...props,
|
|
186
208
|
...{
|
|
187
209
|
table: table,
|
|
@@ -202,6 +224,17 @@ export class SfnManager {
|
|
|
202
224
|
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
203
225
|
},
|
|
204
226
|
})
|
|
227
|
+
|
|
228
|
+
if (props.retries && props.retries.length > 0) {
|
|
229
|
+
props.retries.forEach(retry =>
|
|
230
|
+
step.addRetry({
|
|
231
|
+
...retry,
|
|
232
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
233
|
+
})
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return step
|
|
205
238
|
}
|
|
206
239
|
|
|
207
240
|
/**
|
|
@@ -219,7 +252,7 @@ export class SfnManager {
|
|
|
219
252
|
) {
|
|
220
253
|
if (!props) throw `Step props undefined for ${id}`
|
|
221
254
|
if (!props.messageBody) throw 'Message body undefined'
|
|
222
|
-
|
|
255
|
+
const step = new tasks.SqsSendMessage(scope, `${props.name}`, {
|
|
223
256
|
...props,
|
|
224
257
|
...{
|
|
225
258
|
queue: queue,
|
|
@@ -237,6 +270,17 @@ export class SfnManager {
|
|
|
237
270
|
comment: `DynamoDB PutItem step for ${props.name} - ${scope.props.stage} stage`,
|
|
238
271
|
},
|
|
239
272
|
})
|
|
273
|
+
|
|
274
|
+
if (props.retries && props.retries.length > 0) {
|
|
275
|
+
props.retries.forEach(retry =>
|
|
276
|
+
step.addRetry({
|
|
277
|
+
...retry,
|
|
278
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
279
|
+
})
|
|
280
|
+
)
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return step
|
|
240
284
|
}
|
|
241
285
|
|
|
242
286
|
/**
|
|
@@ -253,13 +297,24 @@ export class SfnManager {
|
|
|
253
297
|
lambdaFunction: lambda.IFunction
|
|
254
298
|
) {
|
|
255
299
|
if (!props) throw `Step props undefined for ${id}`
|
|
256
|
-
|
|
300
|
+
const step = new tasks.LambdaInvoke(scope, `${props.name}`, {
|
|
257
301
|
...props,
|
|
258
302
|
...{
|
|
259
303
|
lambdaFunction,
|
|
260
304
|
comment: `Lambda step for ${props.name} - ${scope.props.stage} stage`,
|
|
261
305
|
},
|
|
262
306
|
})
|
|
307
|
+
|
|
308
|
+
if (props.retries && props.retries.length > 0) {
|
|
309
|
+
props.retries.forEach(retry =>
|
|
310
|
+
step.addRetry({
|
|
311
|
+
...retry,
|
|
312
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
313
|
+
})
|
|
314
|
+
)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return step
|
|
263
318
|
}
|
|
264
319
|
|
|
265
320
|
/**
|
|
@@ -276,7 +331,7 @@ export class SfnManager {
|
|
|
276
331
|
api: apig.IRestApi
|
|
277
332
|
) {
|
|
278
333
|
if (!props) throw `Step props undefined for ${id}`
|
|
279
|
-
|
|
334
|
+
const step = new tasks.CallApiGatewayRestApiEndpoint(scope, `${props.name}`, {
|
|
280
335
|
...props,
|
|
281
336
|
...{
|
|
282
337
|
api,
|
|
@@ -284,6 +339,17 @@ export class SfnManager {
|
|
|
284
339
|
comment: `API step for ${props.name} - ${scope.props.stage} stage`,
|
|
285
340
|
},
|
|
286
341
|
})
|
|
342
|
+
|
|
343
|
+
if (props.retries && props.retries.length > 0) {
|
|
344
|
+
props.retries.forEach(retry =>
|
|
345
|
+
step.addRetry({
|
|
346
|
+
...retry,
|
|
347
|
+
...{ interval: retry.intervalInSecs ? cdk.Duration.seconds(retry.intervalInSecs) : retry.interval },
|
|
348
|
+
})
|
|
349
|
+
)
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return step
|
|
287
353
|
}
|
|
288
354
|
|
|
289
355
|
/**
|
|
@@ -128,6 +128,14 @@ export interface SfnSucceedProps extends sfn.SucceedProps {
|
|
|
128
128
|
name: string
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @category cdk-utils.step-functions-manager
|
|
133
|
+
* @subcategory Properties
|
|
134
|
+
*/
|
|
135
|
+
export interface SfnRetryProps extends sfn.RetryProps {
|
|
136
|
+
intervalInSecs: number
|
|
137
|
+
}
|
|
138
|
+
|
|
131
139
|
/**
|
|
132
140
|
* @category cdk-utils.step-functions-manager
|
|
133
141
|
* @subcategory Properties
|
|
@@ -150,6 +158,7 @@ export interface SfnPassProps extends sfn.PassProps {
|
|
|
150
158
|
*/
|
|
151
159
|
export interface SfnDynamoGetItemProps extends tasks.DynamoGetItemProps {
|
|
152
160
|
name: string
|
|
161
|
+
retries?: SfnRetryProps[]
|
|
153
162
|
}
|
|
154
163
|
|
|
155
164
|
/**
|
|
@@ -158,6 +167,7 @@ export interface SfnDynamoGetItemProps extends tasks.DynamoGetItemProps {
|
|
|
158
167
|
*/
|
|
159
168
|
export interface SfnDynamoPutItemProps extends tasks.DynamoPutItemProps {
|
|
160
169
|
name: string
|
|
170
|
+
retries?: SfnRetryProps[]
|
|
161
171
|
}
|
|
162
172
|
|
|
163
173
|
/**
|
|
@@ -166,6 +176,7 @@ export interface SfnDynamoPutItemProps extends tasks.DynamoPutItemProps {
|
|
|
166
176
|
*/
|
|
167
177
|
export interface SfnSqsSendMessageProps extends tasks.SqsSendMessageProps {
|
|
168
178
|
name: string
|
|
179
|
+
retries?: SfnRetryProps[]
|
|
169
180
|
}
|
|
170
181
|
|
|
171
182
|
/**
|
|
@@ -174,6 +185,7 @@ export interface SfnSqsSendMessageProps extends tasks.SqsSendMessageProps {
|
|
|
174
185
|
*/
|
|
175
186
|
export interface SfnParallelProps extends sfn.ParallelProps {
|
|
176
187
|
name: string
|
|
188
|
+
retries?: SfnRetryProps[]
|
|
177
189
|
}
|
|
178
190
|
|
|
179
191
|
/**
|
|
@@ -199,6 +211,7 @@ export interface SfnWaitProps extends sfn.WaitProps {
|
|
|
199
211
|
*/
|
|
200
212
|
export interface SfnLambdaInvokeProps extends tasks.LambdaInvokeProps {
|
|
201
213
|
name: string
|
|
214
|
+
retries?: SfnRetryProps[]
|
|
202
215
|
}
|
|
203
216
|
|
|
204
217
|
/**
|
|
@@ -207,6 +220,7 @@ export interface SfnLambdaInvokeProps extends tasks.LambdaInvokeProps {
|
|
|
207
220
|
*/
|
|
208
221
|
export interface SfnCallApiGatewayRestApiEndpointProps extends tasks.CallApiGatewayRestApiEndpointProps {
|
|
209
222
|
name: string
|
|
223
|
+
retries?: SfnRetryProps[]
|
|
210
224
|
}
|
|
211
225
|
|
|
212
226
|
/**
|
|
@@ -659,6 +673,12 @@ export interface LambdaProps extends lambda.FunctionProps {
|
|
|
659
673
|
excludeLastModifiedTimestamp?: boolean
|
|
660
674
|
}
|
|
661
675
|
|
|
676
|
+
/**
|
|
677
|
+
* @category cdk-utils.lambda-manager
|
|
678
|
+
* @subcategory Properties
|
|
679
|
+
*/
|
|
680
|
+
export interface LambdaAliasProps extends lambda.AliasProps {}
|
|
681
|
+
|
|
662
682
|
/**
|
|
663
683
|
* @category cdk-utils.lambda-manager
|
|
664
684
|
* @subcategory Properties
|