- String policiesJson;
- try {
- policiesJson = policiesToJson(result);
- } catch (ServiceException e) {
- return new ResponseEntity<>(e.getMessage(), HttpStatus.NO_CONTENT);
- }
- return new ResponseEntity<>(policiesJson, HttpStatus.OK);
+ String filteredPolicies = policiesToJson(filter(type, ric, service));
+ return new ResponseEntity<>(filteredPolicies, HttpStatus.OK);
+ }
+
+ @GetMapping("/policy_ids")
+ @ApiOperation(value = "Query policies, only IDs returned")
+ @ApiResponses(
+ value = {@ApiResponse(code = 200, message = "Policy ids", response = String.class, responseContainer = "List"),
+ @ApiResponse(code = 404, message = "RIC or type not found", response = String.class)})
+ public ResponseEntity<String> getPolicyIds( //
+ @ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") //
+ @RequestParam(name = "type", required = false) String type, //
+ @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get policies for.") //
+ @RequestParam(name = "ric", required = false) String ric, //
+ @ApiParam(name = "service", required = false, value = "The name of the service to get policies for.") //
+ @RequestParam(name = "service", required = false) String service) //
+ {
+ if ((type != null && this.policyTypes.get(type) == null)) {
+ return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
+ }
+ if ((ric != null && this.rics.get(ric) == null)) {
+ return new ResponseEntity<>("RIC not found", HttpStatus.NOT_FOUND);