diff options
author | 2019-03-27 20:20:34 -0400 | |
---|---|---|
committer | 2019-04-01 11:15:07 -0400 | |
commit | cb74139eb31d5bdaa6eb390ae7eebaf49729b7e4 (patch) | |
tree | 0064d5de3ecca8c5c7eadf7126ce09292bd75f05 /ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin | |
parent | 40072d3dcc1d0193bba1ea9432c13ac24857be55 (diff) |
Improve save and delete cba
Change-Id: I1dbfb6d8155e5a58663d7061de468c6d70bb29df
Issue-ID: CCSDK-1137
Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin')
2 files changed, 13 insertions, 0 deletions
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<org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceOutput>) { when { |