diff options
Diffstat (limited to 'components/datalake-handler/feeder/src')
-rw-r--r-- | components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java index 41995e04..9865e0af 100644 --- a/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java +++ b/components/datalake-handler/feeder/src/main/java/org/onap/datalake/feeder/controller/KafkaController.java @@ -121,14 +121,14 @@ public class KafkaController { Kafka oldKafka = kafkaService.getKafkaById(id); if (oldKafka == null) { - sendError(response, 400, "kafka not found "+id); + sendError(response, 400, "kafka not found, ID: "+id); } else { kafkaRepository.delete(oldKafka); response.setStatus(204); } } - @GetMapping("") + /*@GetMapping("") @ResponseBody @ApiOperation(value="List all Kafka id") public List<Integer> list() { @@ -139,12 +139,30 @@ public class KafkaController { retString.add(k.getId()); } return retString; - } + }*/ + @GetMapping("") + @ResponseBody + @ApiOperation(value="List all Kafkas") public List<KafkaConfig> queryAllKafka(){ return kafkaService.getAllKafka(); } + @GetMapping("/{id}") + @ResponseBody + @ApiOperation(value="Get detail of kafka by id") + public KafkaConfig getKafkaDetail(@PathVariable int id, HttpServletResponse response) throws IOException { + log.info("Get detail of kafka, ID: " + id); + Kafka oldKafka = kafkaService.getKafkaById(id); + if (oldKafka == null) { + sendError(response, 400, "kafka not found, ID: "+id); + return null; + } else { + log.info("ResponseBody......" + oldKafka.getKafkaConfig()); + return oldKafka.getKafkaConfig(); + } + } + private PostReturnBody<KafkaConfig> mkPostReturnBody(int statusCode, Kafka kafka) { PostReturnBody<KafkaConfig> retBody = new PostReturnBody<>(); retBody.setStatusCode(statusCode); |