From 7cbb2d84bdfb1b467c5799ea267b9300fee609f6 Mon Sep 17 00:00:00 2001 From: Mukesh Paliwal Date: Wed, 20 Oct 2021 09:42:28 +0530 Subject: Adding Custom workflow changes Issue-ID: SO-3765 Signed-off-by: Mukesh Paliwal Change-Id: I7e315e16c71c0be2648550c3b6ed9ac7ba26cb6b --- .../rest/api/SoMonitoringController.java | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java index 1069dd3..0cca471 100644 --- a/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java +++ b/so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java @@ -32,6 +32,7 @@ import java.util.ArrayList; import java.util.HashMap; import javax.ws.rs.Consumes; import javax.ws.rs.GET; +import javax.ws.rs.DELETE; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -655,4 +656,35 @@ public class SoMonitoringController { } } + @DELETE + @Path("/serviceRecipes/{id}") + @Produces({MediaType.APPLICATION_JSON}) + public Response delServiceRecipe(final @PathParam("id") String id) { + try { + catalogDbClient.deleteServiceRecipe(id); + } catch (Exception e) { + LOGGER.info("SoMonitoringController delServiceRecipe error: {}", e.getMessage()); + return Response.status(Status.INTERNAL_SERVER_ERROR).entity("{\"errMsg\":\"Unable to delete service recipe.\"}").build(); + } + return Response.status(Status.OK).build(); + } + + @GET + @Path("/serviceTemplates") + @Produces({MediaType.APPLICATION_JSON}) + public Response getServices() { + List services = catalogDbClient.getServices(); + Map>> mapServices = new HashMap>>(); + List> serviceList = new ArrayList>(); + for (Service service : services) { + Map serviceObj = new HashMap(); + serviceObj.put("modelInvariantId", service.getModelInvariantId()); + serviceObj.put("modelVersionId", service.getModelVersionId()); + serviceObj.put("modelName", service.getModelName()); + serviceList.add(serviceObj); + } + mapServices.put("services", serviceList); + return Response.status(Status.OK).entity(mapServices).build(); + } + } -- cgit 1.2.3-korg