summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt35
1 files changed, 34 insertions, 1 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt
index 1c550bb3e..3689f735e 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ModelTypeController.kt
@@ -17,6 +17,8 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
+import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ModelType
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ModelTypeHandler
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.mdcWebCoroutineScope
@@ -33,19 +35,40 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping(value = ["/api/v1/model-type"])
+@Api(
+ value = "Model Type Catalog",
+ description = "Manages data types in CDS"
+)
open class ModelTypeController(private val modelTypeHandler: ModelTypeHandler) {
@GetMapping(path = ["/{name}"], produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ApiOperation(
+ value = "Retrieve a model type",
+ notes = "Retrieve a model type by name provided.",
+ response = ModelType::class
+ )
suspend fun getModelTypeByName(@PathVariable(value = "name") name: String): ModelType? = mdcWebCoroutineScope {
modelTypeHandler.getModelTypeByName(name)
}
@GetMapping(path = ["/search/{tags}"], produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ApiOperation(
+ value = "Retrieve a list of model types",
+ notes = "Retrieve a list of model types by tags provided.",
+ responseContainer = "List",
+ response = ModelType::class
+ )
suspend fun searchModelTypes(@PathVariable(value = "tags") tags: String): List<ModelType> = mdcWebCoroutineScope {
modelTypeHandler.searchModelTypes(tags)
}
@GetMapping(path = ["/by-definition/{definitionType}"], produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ApiOperation(
+ value = "Retrieve a list of model types",
+ notes = "Retrieve a list of model types by definition type provided.",
+ responseContainer = "List",
+ response = ModelType::class
+ )
@ResponseBody
suspend fun getModelTypeByDefinitionType(@PathVariable(value = "definitionType") definitionType: String): List<ModelType> =
mdcWebCoroutineScope {
@@ -53,10 +76,15 @@ open class ModelTypeController(private val modelTypeHandler: ModelTypeHandler) {
}
@PostMapping(
- path = [""],
+ path = ["/"],
produces = [MediaType.APPLICATION_JSON_VALUE],
consumes = [MediaType.APPLICATION_JSON_VALUE]
)
+ @ApiOperation(
+ value = "Save a model type",
+ notes = "Save a model type by model type definition provided.",
+ response = ModelType::class
+ )
@ResponseBody
@Throws(BluePrintException::class)
suspend fun saveModelType(@RequestBody modelType: ModelType): ModelType = mdcWebCoroutineScope {
@@ -64,6 +92,11 @@ open class ModelTypeController(private val modelTypeHandler: ModelTypeHandler) {
}
@DeleteMapping(path = ["/{name}"])
+ @ApiOperation(
+ value = "Remove a model type",
+ notes = "Remove a model type by name provided.",
+ response = ModelType::class
+ )
suspend fun deleteModelTypeByName(@PathVariable(value = "name") name: String) = mdcWebCoroutineScope {
modelTypeHandler.deleteByModelName(name)
}