<springmvc>true</springmvc>
<locations>
<location>org.onap.ccsdk.cds.blueprintsprocessor.designer.api.BlueprintModelController</location>
- <!-- These locations are not implemented yet
<location>org.onap.ccsdk.cds.blueprintsprocessor.resource.api</location>
<location>org.onap.ccsdk.cds.blueprintsprocessor.configs.api</location>
+ <!-- This location is not implemented yet
<location>org.onap.ccsdk.cds.blueprintsprocessor.healthapi</location>
-->
</locations>
@Column(name = "resource_type", nullable = false)
var resourceType: String? = null
- @get:ApiModelProperty(value = "ID associated with the resource type in the inventory system.", required = true)
+ @get:ApiModelProperty(value = "ID associated with the resource type in the inventory system.", required = true, example = "\"1\"")
@Column(name = "resource_id", nullable = false)
var resourceId: String? = null
@Column(name = "status", nullable = false)
var status: Status? = null
- @get:ApiModelProperty(value = "Snapshot of the resource as retrieved from resource.", required = true)
+ @get:ApiModelProperty(value = "Snapshot of the resource as retrieved from resource.", required = true, example = "\"config_snapshot\"")
@Lob
@Column(name = "config_snapshot", nullable = false)
var config_snapshot: String? = null
import com.fasterxml.jackson.annotation.JsonFormat
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.JsonNode
+import io.swagger.annotations.ApiModel
+import io.swagger.annotations.ApiModelProperty
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.PropertyDefinition
import java.io.Serializable
import java.util.Date
+@ApiModel
open class ResourceDefinition {
@JsonProperty(value = "name", required = true)
+ @ApiModelProperty(value = "Name", required = true, example = "\"default-source\"")
lateinit var name: String
@JsonProperty(value = "property", required = true)
+ @ApiModelProperty(value = "Property", required = true)
lateinit var property: PropertyDefinition
var tags: String? = null
/** The default group for Resource Definition is "default" */
@JsonProperty(value = "group", required = true)
+ @ApiModelProperty(value = "Group", required = true, example = "\"default\"")
var group: String = "default"
@JsonProperty(value = "updated-by")
+ @ApiModelProperty(value = "Updated by", required = true, example = "\"example@onap.com\"")
lateinit var updatedBy: String
@JsonProperty(value = "sources", required = true)
+ @ApiModelProperty(value = "Sources", required = true, example = "\"sources\"")
lateinit var sources: MutableMap<String, NodeTemplate>
}
@RestController
@RequestMapping("/api/v1/configs")
@Api(
- value = "/api/v1/configs",
+ value = "Resource configuration",
description = "Interaction with stored configurations."
)
open class ResourceConfigSnapshotController(private val resourceConfigSnapshotService: ResourceConfigSnapshotService) {
}
@RequestMapping(
- path = [""],
method = [RequestMethod.GET],
produces = [MediaType.TEXT_PLAIN_VALUE, MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE]
)
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun get(
- @ApiParam(value = "Resource Type associated of the resource configuration snapshot.", required = false)
+ @ApiParam(value = "Resource Type associated of the resource configuration snapshot.", required = false, example = "\"PNF\"")
@RequestParam(value = "resourceType", required = true) resourceType: String,
- @ApiParam(value = "Resource Id associated of the resource configuration snapshot.", required = false)
+ @ApiParam(value = "Resource Id associated of the resource configuration snapshot.", required = false, example = "\"1\"")
@RequestParam(value = "resourceId", required = true) resourceId: String,
@ApiParam(value = "Status of the snapshot being retrieved.", defaultValue = "RUNNING", required = false)
value = "Store a resource configuration snapshot identified by resourceId, resourceType, status.",
notes = "Store a resource configuration snapshot, identified by its resourceId and resourceType, " +
"and optionally its status, either RUNNING or CANDIDATE.",
- response = ResourceConfigSnapshot::class, produces = MediaType.APPLICATION_JSON_VALUE
+ response = ResourceConfigSnapshot::class
)
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun postWithResourceIdAndResourceType(
- @ApiParam(value = "Resource Type associated with the resolution.", required = false)
+ @ApiParam(value = "Resource Type associated with the resolution.", required = false, example = "\"PNF\"")
@PathVariable(value = "resourceType", required = true) resourceType: String,
- @ApiParam(value = "Resource Id associated with the resolution.", required = false)
+ @ApiParam(value = "Resource Id associated with the resolution.", required = false, example = "\"1\"")
@PathVariable(value = "resourceId", required = true) resourceId: String,
@ApiParam(value = "Status of the snapshot being retrieved.", defaultValue = "RUNNING", required = true)
@PathVariable(value = "status", required = true) status: String,
- @ApiParam(value = "Config snapshot to store.", required = true)
+ @ApiParam(value = "Config snapshot to store.", required = true, example = "\"config_snapshot\"")
@RequestBody snapshot: String
): ResponseEntity<ResourceConfigSnapshot> = runBlocking {
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun getAllByID(
- @ApiParam(value = "Resource Id associated of the resource configuration snapshots.", required = false)
+ @ApiParam(value = "Resource Id associated of the resource configuration snapshots.", required = false, example = "\"1\"")
@RequestParam(value = "resourceId", required = true) resourceId: String,
@ApiParam(value = "Status of the snapshot being retrieved.", defaultValue = "ANY", required = false)
@RequestParam(value = "status", required = false, defaultValue = "ANY") status: String
@ResponseBody
@PreAuthorize("hasRole('USER')")
fun getAllByType(
- @ApiParam(value = "Resource Type associated of the resource configuration snapshot.", required = false)
+ @ApiParam(value = "Resource Type associated of the resource configuration snapshot.", required = false, example = "\"PNF\"")
@RequestParam(value = "resourceType", required = true) resourceType: String,
@ApiParam(value = "Status of the snapshot being retrieved.", defaultValue = "ANY", required = false)
@RequestParam(value = "status", required = false, defaultValue = "ANY") status: String
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
@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)
}
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)
}
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()
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
* @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'")
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 {
@RestController
@RequestMapping("/api/v1/resources")
@Api(
- value = "/api/v1/resources",
+ value = "Resources",
description = "Interaction with resolved resources."
)
open class ResourceController(private var resourceResolutionDBService: ResourceResolutionDBService) {
)
@ApiOperation(
value = "Delete resources using resolution key",
- notes = "Delete all the resources associated to a resolution-key using blueprint metadata, artifact name and the resolution-key.",
- produces = MediaType.APPLICATION_JSON_VALUE
+ notes = "Delete all the resources associated to a resolution-key using blueprint metadata, artifact name and the resolution-key."
)
@PreAuthorize("hasRole('USER')")
fun deleteByBlueprintNameAndBlueprintVersionAndArtifactNameAndResolutionKey(
)
@ApiOperation(
value = "Fetch a resource value using resolution key.",
- notes = "Retrieve a stored resource value using the blueprint metadata, artifact name, resolution-key along with the name of the resource value to retrieve.",
- produces = MediaType.APPLICATION_JSON_VALUE
+ notes = "Retrieve a stored resource value using the blueprint metadata, artifact name, resolution-key along with the name of the resource value to retrieve."
)
@ResponseBody
@PreAuthorize("hasRole('USER')")
@RestController
@RequestMapping("/api/v1/template")
@Api(
- value = "/api/v1/template",
+ value = "Resource template",
description = "Interaction with resolved template."
)
open class TemplateController(private val templateResolutionService: TemplateResolutionService) {
value = "Store a resolved template w/ resolution-key",
notes = "Store a template for a given CBA's action, identified by its blueprint name, blueprint version, " +
"artifact name and resolution key.",
- response = TemplateResolution::class,
- produces = MediaType.APPLICATION_JSON_VALUE
+ response = TemplateResolution::class
)
@ResponseBody
@PreAuthorize("hasRole('USER')")
value = "Store a resolved template w/ resourceId and resourceType",
notes = "Store a template for a given CBA's action, identified by its blueprint name, blueprint version, " +
"artifact name, resourceId and resourceType.",
- response = TemplateResolution::class,
- produces = MediaType.APPLICATION_JSON_VALUE
+ response = TemplateResolution::class
)
@ResponseBody
@PreAuthorize("hasRole('USER')")