summaryrefslogtreecommitdiffstats
path: root/cps-rest
diff options
context:
space:
mode:
Diffstat (limited to 'cps-rest')
-rwxr-xr-xcps-rest/docs/api/swagger/openapi.yml7
-rwxr-xr-xcps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java5
-rw-r--r--cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java3
3 files changed, 12 insertions, 3 deletions
diff --git a/cps-rest/docs/api/swagger/openapi.yml b/cps-rest/docs/api/swagger/openapi.yml
index 56a012ffe0..441d5e52cd 100755
--- a/cps-rest/docs/api/swagger/openapi.yml
+++ b/cps-rest/docs/api/swagger/openapi.yml
@@ -61,12 +61,17 @@ paths:
401:
description: Unauthorized
content: {}
+ 400:
+ description: Bad Request
+ content: {}
403:
description: Forbidden
- content: {}
404:
description: Not Found
content: {}
+ 204:
+ description: No Content
+ content: {}
post:
tags:
- cps-rest
diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java
index 30d3e24bb9..32ea35c5e0 100755
--- a/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java
+++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/CpsRestController.java
@@ -26,6 +26,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.Collection;
import javax.validation.Valid;
import org.modelmapper.ModelMapper;
import org.onap.cps.api.CpService;
@@ -107,8 +108,10 @@ public class CpsRestController implements CpsRestApi {
}
@Override
+
public ResponseEntity<Object> getAnchors(final String dataspaceName) {
- return null;
+ final Collection<Anchor> anchorDetails = cpsAdminService.getAnchors(dataspaceName);
+ return new ResponseEntity<>(anchorDetails, HttpStatus.OK);
}
@Override
diff --git a/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java b/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java
index fc0164f5e0..00e72a189e 100644
--- a/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java
+++ b/cps-rest/src/main/java/org/onap/cps/rest/exceptions/CpsRestExceptionHandler.java
@@ -23,6 +23,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
import org.onap.cps.rest.controller.CpsRestController;
import org.onap.cps.rest.model.ErrorMessage;
import org.onap.cps.spi.exceptions.AnchorAlreadyDefinedException;
+import org.onap.cps.spi.exceptions.CpsAdminException;
import org.onap.cps.spi.exceptions.CpsException;
import org.onap.cps.spi.exceptions.DataValidationException;
import org.onap.cps.spi.exceptions.ModelValidationException;
@@ -48,7 +49,7 @@ public class CpsRestExceptionHandler {
}
@ExceptionHandler({ModelValidationException.class, DataValidationException.class,
- SchemaSetAlreadyDefinedException.class, AnchorAlreadyDefinedException.class})
+ SchemaSetAlreadyDefinedException.class, AnchorAlreadyDefinedException.class, CpsAdminException.class})
public static ResponseEntity<Object> handleBadRequestExceptions(final CpsException exception) {
return buildErrorResponse(HttpStatus.BAD_REQUEST, exception.getMessage(), extractDetails(exception));
}