summaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
authorkuldipr <kuldip.rai@amdocs.com>2022-06-17 18:27:33 -0400
committerkuldipr <kuldip.rai@amdocs.com>2022-07-04 10:24:10 -0400
commit5c658a23e4f8d739ef879f7efa708d89fbdf3d29 (patch)
tree4aa7968136307b3160c7a168eccc62a85975e52c /ms
parentbe4b713c7bd80ac0ac98f3f1ea8bc8f477dcb3e2 (diff)
Fixed Template API (resourceId and resoourceType) input validation
Validation was always checking for resolutionKey even when it is not required when using resourceId and resourceType. Also artifactName which is always required could not have been sent along with resourceId and resourceType. Issue-ID: CCSDK-3713 Signed-off-by: kuldipr <kuldip.rai@amdocs.com> Change-Id: I4a2945397f10bf5c57a698894df09ee4fc5891d0
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt8
1 files changed, 4 insertions, 4 deletions
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
index 2840f8016..03ba347fd 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
@@ -84,7 +84,7 @@ open class TemplateController(private val templateResolutionService: TemplateRes
@ApiParam(value = "Artifact name for which to retrieve a resolved resource", required = true)
@RequestParam(value = "artifactName") artifactName: String,
@ApiParam(value = "Resolution Key associated with the resolution", required = false)
- @RequestParam(value = "resolutionKey") resolutionKey: String,
+ @RequestParam(value = "resolutionKey", required = false, defaultValue = "") resolutionKey: String,
@ApiParam(value = "Resource Type associated with the resolution", required = false)
@RequestParam(value = "resourceType", required = false, defaultValue = "") resourceType: String,
@ApiParam(value = "Resource Id associated with the resolution", required = false)
@@ -102,10 +102,10 @@ open class TemplateController(private val templateResolutionService: TemplateRes
var result = ""
- if ((resolutionKey.isNotEmpty() || artifactName.isNotEmpty()) && (resourceId.isNotEmpty() || resourceType.isNotEmpty())) {
+ if (resolutionKey.isNotEmpty() && (resourceId.isNotEmpty() || resourceType.isNotEmpty())) {
throw httpProcessorException(
ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
- "Either retrieve resolved template using artifact name and resolution-key OR using resource-id and resource-type."
+ "Either retrieve resolved template using resolution-key OR using resource-id and resource-type."
)
} else if (resolutionKey.isNotEmpty() && artifactName.isNotEmpty()) {
result = templateResolutionService.findByResolutionKeyAndBlueprintNameAndBlueprintVersionAndArtifactName(
@@ -115,7 +115,7 @@ open class TemplateController(private val templateResolutionService: TemplateRes
resolutionKey,
occurrence
)
- } else if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
+ } else if (resourceType.isNotEmpty() && resourceId.isNotEmpty() && artifactName.isNotEmpty()) {
result =
templateResolutionService.findByResoureIdAndResourceTypeAndBlueprintNameAndBlueprintVersionAndArtifactName(
bpName,