UNPKG

the-ldk

Version:

Welcome to the LDK! A collection of custom AWS CDK constructs to help you build serverless applications faster.

33 lines 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExpressStepFunction = void 0; const aws_cdk_lib_1 = require("aws-cdk-lib"); const constructs_1 = require("constructs"); const aws_stepfunctions_1 = require("aws-cdk-lib/aws-stepfunctions"); const aws_logs_1 = require("aws-cdk-lib/aws-logs"); class ExpressStepFunction extends constructs_1.Construct { constructor(scope, id, props) { super(scope, id); const { serviceName, stage, definition, timeout = 5, queryLanguage = aws_stepfunctions_1.QueryLanguage.JSON_PATH, customOverrides = {}, } = props; const logGroup = new aws_logs_1.LogGroup(this, `${serviceName}-express-stepfn-logs-${stage}`, { logGroupName: `/aws/vendedlogs/states/${serviceName}-express-stepfn-${stage}`, retention: 7, removalPolicy: aws_cdk_lib_1.RemovalPolicy.DESTROY, }); this.stateMachine = new aws_stepfunctions_1.StateMachine(this, `${serviceName}-express-stepfn-${stage}`, { definitionBody: aws_stepfunctions_1.DefinitionBody.fromChainable(definition), timeout: aws_cdk_lib_1.Duration.minutes(timeout), stateMachineType: aws_stepfunctions_1.StateMachineType.EXPRESS, stateMachineName: `${serviceName}-express-stepfn-${stage}`, queryLanguage, logs: { destination: logGroup, level: aws_stepfunctions_1.LogLevel.ALL, includeExecutionData: true, }, ...customOverrides, }); } } exports.ExpressStepFunction = ExpressStepFunction; //# sourceMappingURL=ExpressStepFunction.js.map