From cb74139eb31d5bdaa6eb390ae7eebaf49729b7e4 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh" Date: Wed, 27 Mar 2019 20:20:34 -0400 Subject: Improve save and delete cba Change-Id: I1dbfb6d8155e5a58663d7061de468c6d70bb29df Issue-ID: CCSDK-1137 Signed-off-by: Muthuramalingam, Brinda Santh --- .../selfservice/api/ExecutionServiceController.kt | 9 +++++++++ .../selfservice/api/ExecutionServiceHandler.kt | 4 ++++ 2 files changed, 13 insertions(+) (limited to 'ms/blueprintsprocessor/modules/inbounds/selfservice-api') diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt index 41e78e518..7cbc89583 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt @@ -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") diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt index 0120a8f33..274346917 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt @@ -69,6 +69,10 @@ class ExecutionServiceHandler(private val bluePrintPathConfiguration: BluePrintP } } + suspend fun remove(name: String, version: String) { + bluePrintCatalogService.deleteFromDatabase(name, version) + } + suspend fun process(executionServiceInput: ExecutionServiceInput, responseObserver: StreamObserver) { when { -- cgit 1.2.3-korg