in software/configvalidator/src/main/kotlin/com/app/config/ValidatorHandler.kt [22:42]
override fun handleRequest(input: Map<String, String>, context: Context?): String {
println(input)
val decodedBytes = Base64.getDecoder().decode(input["content"])
val node = mapper.readValue<JsonNode>(decodedBytes)
if(node.has("application.logging").not()) {
throw IllegalArgumentException("Missing application.logging")
}
if (node.get("application.logging").has("level").not()){
throw IllegalArgumentException("Missing level config")
}
if((node.get("application.logging").get("level").asText() in setOf("INFO", "TRACE", "DEBUG")).not()) {
throw IllegalArgumentException("Allowed values are INFO, TRACE or DEBUG")
}
return "Success"
}