aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--so-admin-cockpit-monitoring-workflow/so-admin-cockpit-monitoring-workflow-service/src/main/java/org/onap/so/monitoring/rest/api/SoMonitoringController.java32
1 files changed, 32 insertions, 0 deletions
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<Service> services = catalogDbClient.getServices();
+ Map<String, List<Map<String, String>>> mapServices = new HashMap<String, List<Map<String, String>>>();
+ List<Map<String, String>> serviceList = new ArrayList<Map<String, String>>();
+ for (Service service : services) {
+ Map<String, String> serviceObj = new HashMap<String, String>();
+ 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();
+ }
+
}