aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/inbounds/designer-api/src
diff options
context:
space:
mode:
authorPiotr Stanior <piotr.stanior@t-mobile.pl>2020-12-09 09:36:03 +0100
committerKAPIL SINGAL <ks220y@att.com>2020-12-14 18:31:15 +0000
commit108011551bb81e3465d1bd6087a81110967df9e0 (patch)
tree85915c777976517a0142b8c38654571ef0a1d776 /ms/blueprintsprocessor/modules/inbounds/designer-api/src
parentb4bbb70118f3406ffc7bdd7df557a9b0d9d63f21 (diff)
CDS add Swagger annotations for Resource, Template, Dictionary and Config API
Issue-ID: CCSDK-3014 Change-Id: I380c38cde52a748a9b797c573b7651a766e8b496 Signed-off-by: Piotr Stanior <piotr.stanior@t-mobile.pl>
Diffstat (limited to 'ms/blueprintsprocessor/modules/inbounds/designer-api/src')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt81
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt17
2 files changed, 84 insertions, 14 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt
index 7f569cfba..1dcfa2ff1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/ResourceDictionaryController.kt
@@ -16,6 +16,9 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api
+import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
+import io.swagger.annotations.ApiParam
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain.ResourceDictionary
import org.onap.ccsdk.cds.blueprintsprocessor.designer.api.handler.ResourceDictionaryHandler
import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.mdcWebCoroutineScope
@@ -34,24 +37,43 @@ import org.springframework.web.bind.annotation.RestController
@RestController
@RequestMapping(value = ["/api/v1/dictionary"])
+@Api(
+ value = "Resource dictionary",
+ description = "Interaction with stored dictionaries."
+)
open class ResourceDictionaryController(private val resourceDictionaryHandler: ResourceDictionaryHandler) {
@GetMapping(path = ["/{name}"], produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ApiOperation(
+ value = "Retrieve a resource dictionary.",
+ notes = "Retrieve a resource dictionary by name provided.",
+ response = ResourceDictionary::class
+ )
@ResponseBody
@Throws(BluePrintException::class)
- suspend fun getResourceDictionaryByName(@PathVariable(value = "name") name: String): ResourceDictionary =
+ suspend fun getResourceDictionaryByName(
+ @ApiParam(value = "Name of the resource.", required = true, example = "\"hostname\"")
+ @PathVariable(value = "name") name: String
+ ): ResourceDictionary =
mdcWebCoroutineScope {
resourceDictionaryHandler.getResourceDictionaryByName(name)
}
@PostMapping(
- path = [""],
produces = [MediaType.APPLICATION_JSON_VALUE],
consumes = [MediaType.APPLICATION_JSON_VALUE]
)
+ @ApiOperation(
+ value = "Saves a resource dictionary.",
+ notes = "Saves a resource dictionary by dictionary provided.",
+ response = ResourceDictionary::class
+ )
@ResponseBody
@Throws(BluePrintException::class)
- suspend fun saveResourceDictionary(@RequestBody dataDictionary: ResourceDictionary): ResourceDictionary =
+ suspend fun saveResourceDictionary(
+ @ApiParam(value = "Resource dictionary to store.", required = true)
+ @RequestBody dataDictionary: ResourceDictionary
+ ): ResourceDictionary =
mdcWebCoroutineScope {
resourceDictionaryHandler.saveResourceDictionary(dataDictionary)
}
@@ -61,15 +83,31 @@ open class ResourceDictionaryController(private val resourceDictionaryHandler: R
produces = [MediaType.APPLICATION_JSON_VALUE],
consumes = [MediaType.APPLICATION_JSON_VALUE]
)
+ @ApiOperation(
+ value = "Saves a resource dictionary.",
+ notes = "Saves a resource dictionary by resource definition provided.",
+ nickname = "ResourceDictionaryController_saveResourceDictionary_1_POST.org.onap.ccsdk.cds.blueprintsprocessor.designer.api",
+ response = ResourceDefinition::class
+ )
@ResponseBody
@Throws(BluePrintException::class)
- suspend fun saveResourceDictionary(@RequestBody resourceDefinition: ResourceDefinition): ResourceDefinition =
+ suspend fun saveResourceDictionary(
+ @ApiParam(value = "Resource definition to generate.", required = true)
+ @RequestBody resourceDefinition: ResourceDefinition
+ ): ResourceDefinition =
mdcWebCoroutineScope {
resourceDictionaryHandler.saveResourceDefinition(resourceDefinition)
}
@DeleteMapping(path = ["/{name}"])
- suspend fun deleteResourceDictionaryByName(@PathVariable(value = "name") name: String) = mdcWebCoroutineScope {
+ @ApiOperation(
+ value = "Removes a resource dictionary.",
+ notes = "Removes a resource dictionary by name provided."
+ )
+ suspend fun deleteResourceDictionaryByName(
+ @ApiParam(value = "Name of the resource.", required = true)
+ @PathVariable(value = "name") name: String
+ ) = mdcWebCoroutineScope {
resourceDictionaryHandler.deleteResourceDictionary(name)
}
@@ -78,26 +116,55 @@ open class ResourceDictionaryController(private val resourceDictionaryHandler: R
produces = [MediaType.APPLICATION_JSON_VALUE],
consumes = [MediaType.APPLICATION_JSON_VALUE]
)
+ @ApiOperation(
+ value = "Searches for a resource dictionary.",
+ notes = "Searches for a resource dictionary by names provided.",
+ responseContainer = "List",
+ response = ResourceDictionary::class
+ )
@ResponseBody
- suspend fun searchResourceDictionaryByNames(@RequestBody names: List<String>): List<ResourceDictionary> =
+ suspend fun searchResourceDictionaryByNames(
+ @ApiParam(value = "List of names.", required = true)
+ @RequestBody names: List<String>
+ ): List<ResourceDictionary> =
mdcWebCoroutineScope {
resourceDictionaryHandler.searchResourceDictionaryByNames(names)
}
@GetMapping(path = ["/search/{tags}"], produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ApiOperation(
+ value = "Searches for a resource dictionary.",
+ notes = "Searches for a resource dictionary by tags provided.",
+ responseContainer = "List",
+ response = ResourceDictionary::class
+ )
@ResponseBody
- suspend fun searchResourceDictionaryByTags(@PathVariable(value = "tags") tags: String): List<ResourceDictionary> =
+ suspend fun searchResourceDictionaryByTags(
+ @ApiParam(value = "Tags list.", required = true, example = "\"status\"")
+ @PathVariable(value = "tags") tags: String
+ ): List<ResourceDictionary> =
mdcWebCoroutineScope {
resourceDictionaryHandler.searchResourceDictionaryByTags(tags)
}
@GetMapping(path = ["/source-mapping"], produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ApiOperation(
+ value = "Searches for a source mapping.",
+ notes = "Searches for a source mapping.",
+ response = ResourceSourceMapping::class
+ )
@ResponseBody
suspend fun getResourceSourceMapping(): ResourceSourceMapping = mdcWebCoroutineScope {
resourceDictionaryHandler.getResourceSourceMapping()
}
@GetMapping(path = ["/resource_dictionary_group"], produces = [MediaType.APPLICATION_JSON_VALUE])
+ @ApiOperation(
+ value = "Retrieve all resource dictionary groups.",
+ notes = "Retrieve all resource dictionary groups.",
+ responseContainer = "List",
+ response = String::class
+ )
@ResponseBody
suspend fun getResourceDictionaryDistinct(): List<String> = mdcWebCoroutineScope {
resourceDictionaryHandler.getResourceDictionaryDistinct()
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
index eaa63ddee..5dac6b5e5 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/domain/ResourceDictionary.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.designer.api.domain
import com.fasterxml.jackson.annotation.JsonFormat
+import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceDefinition
import org.springframework.data.annotation.LastModifiedDate
@@ -40,40 +41,42 @@ import javax.persistence.TemporalType
* @version 1.0
*/
@EntityListeners(AuditingEntityListener::class)
+@ApiModel
@Entity
@Table(name = "RESOURCE_DICTIONARY")
class ResourceDictionary : Serializable {
@Id
@Column(name = "name", nullable = false)
- @ApiModelProperty(required = true)
+ @ApiModelProperty(value = "Name", required = true, example = "\"sample-db-source\"")
lateinit var name: String
@Column(name = "data_type", nullable = false)
- @ApiModelProperty(required = true)
+ @ApiModelProperty(value = "Data type", required = true, example = "\"string\"")
lateinit var dataType: String
@Column(name = "entry_schema")
+ @ApiModelProperty(value = "Entry schema", required = true, example = "\"dt-license-key\"")
var entrySchema: String? = null
@Column(name = "resource_dictionary_group")
- @ApiModelProperty(required = true)
+ @ApiModelProperty(value = "Resource dictionary group", required = true, example = "\"default\"")
var resourceDictionaryGroup: String? = null
@Lob
@Convert(converter = JpaResourceDefinitionConverter::class)
@Column(name = "definition", nullable = false)
- @ApiModelProperty(required = true)
+ @ApiModelProperty(value = "Definition", required = true)
lateinit var definition: ResourceDefinition
@Lob
@Column(name = "description", nullable = false)
- @ApiModelProperty(required = true)
+ @ApiModelProperty(value = "Description", required = true, example = "\"demo_artifacts_version\"")
lateinit var description: String
@Lob
@Column(name = "tags", nullable = false)
- @ApiModelProperty(required = true)
+ @ApiModelProperty(value = "Tags", required = true, example = "\"hostname\"")
lateinit var tags: String
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@@ -83,7 +86,7 @@ class ResourceDictionary : Serializable {
var creationDate: Date? = null
@Column(name = "updated_by", nullable = false)
- @ApiModelProperty(required = true)
+ @ApiModelProperty(value = "Updated by", required = true, example = "\"username\"")
lateinit var updatedBy: String
override fun toString(): String {