public async Task <StepFunctionLaunchResponse> StepFunctionLauncherHandler(StepFunctionLaunchRequest request, ILambdaContext context) { var serviceProvider = new Startup().Initialise(); var app = serviceProvider.GetService <IStepFunctionLauncher>(); var response = await app.Execute(request); return(response); }
/// Execute the Step Function with the Event Params. public async Task <StepFunctionLaunchResponse> Execute(StepFunctionLaunchRequest request) { // Request Details this.logger.LogInformation("Request.target: " + request.target); var startExecutionRequest = new Amazon.StepFunctions.Model.StartExecutionRequest { StateMachineArn = request.target, Name = Guid.NewGuid().ToString(), Input = "{}", }; var taskStartExecutionResponse = await this.stepFunctionClient.StartExecutionAsync(startExecutionRequest); this.logger.LogInformation("taskStartExecutionResponse: " + taskStartExecutionResponse); // Assert.Equal(HttpStatusCode.OK, taskStartExecutionResponse.HttpStatusCode); // Return the selected AMI Image return(new StepFunctionLaunchResponse { success = (HttpStatusCode.OK == taskStartExecutionResponse.HttpStatusCode) }); }