Improve save and delete cba
[ccsdk/cds.git] / ms / blueprintsprocessor / modules / inbounds / selfservice-api / src / main / kotlin / org / onap / ccsdk / cds / blueprintsprocessor / selfservice / api / ExecutionServiceController.kt
index 41e78e5..7cbc895 100644 (file)
@@ -22,6 +22,7 @@ import kotlinx.coroutines.runBlocking
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ACTION_MODE_ASYNC
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
 import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintException
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.http.MediaType
 import org.springframework.http.codec.multipart.FilePart
@@ -49,6 +50,14 @@ open class ExecutionServiceController {
         executionServiceHandler.upload(filePart)
     }
 
+    @DeleteMapping("/name/{name}/version/{version}")
+    @Throws(BluePrintException::class)
+    @PreAuthorize("hasRole('USER')")
+    fun deleteBlueprint(@PathVariable(value = "name") name: String,
+                        @PathVariable(value = "version") version: String) = runBlocking {
+        executionServiceHandler.remove(name, version)
+    }
+
     @RequestMapping(path = ["/process"], method = [RequestMethod.POST], produces = [MediaType.APPLICATION_JSON_VALUE])
     @ApiOperation(value = "Resolve Resource Mappings",
             notes = "Takes the blueprint information and process as per the payload")