in aws-lambda-server/src/main/java/jetbrains/buildServer/runner/lambda/web/InvokeLambdaFunctionController.kt [40:63]
override fun handle(project: SProject, request: HttpServletRequest, properties: Map<String, String>): Boolean {
val serializedDetails = request.getParameter(LambdaConstants.RUN_DETAILS) ?: throw JsonControllerException("Parameter missing: ${LambdaConstants.RUN_DETAILS}", HttpStatus.BAD_REQUEST)
val builId = request.getParameter(LambdaConstants.BUILD_ID)?.toLong()
?: throw JsonControllerException("Parameter missing: ${LambdaConstants.BUILD_ID}", HttpStatus.BAD_REQUEST)
val build = runningBuildsManager.findRunningBuildById(builId) ?: throw JsonControllerException("No build found found: $builId", HttpStatus.BAD_REQUEST)
return try {
val runDetails = objectMapper.readValue<List<RunDetails>>(serializedDetails)
val lambdaFunctionInvoker = lambdaFunctionInvokerFactory
.getLambdaFunctionInvoker(properties, project)
storeNumInvocations(build, runDetails.size)
lambdaFunctionInvoker.invokeLambdaFunction(runDetails)
} catch (e: JsonProcessingException) {
stopBuild(build, e)
throw JsonControllerException("Error processing ${LambdaConstants.RUN_DETAILS} parameter: ${e.localizedMessage}", HttpStatus.BAD_REQUEST)
} catch (e: JsonMappingException) {
stopBuild(build, e)
throw JsonControllerException("Error mapping ${LambdaConstants.RUN_DETAILS} parameter: ${e.localizedMessage}", HttpStatus.BAD_REQUEST)
} catch (e: Exception) {
stopBuild(build, e)
throw JsonControllerException("Unexpecte error found: ${e.localizedMessage}", HttpStatus.INTERNAL_SERVER_ERROR)
}
}