Add description to parameters in the remaining controllers
Change-Id: I4b91464e417adbdb646f1c78355ca97952a05e91
Issue-ID: NONRTRIC-158
Signed-off-by: maximesson <maxime.bonneau@est.tech>
diff --git a/policy-agent/docs/api.yaml b/policy-agent/docs/api.yaml
index 5de8b29..ec9bbce 100644
--- a/policy-agent/docs/api.yaml
+++ b/policy-agent/docs/api.yaml
@@ -365,9 +365,10 @@
parameters:
- name: managedElementId
in: query
- description: managedElementId
+ description: The ID of the Managed Element
required: true
type: string
+ allowEmptyValue: false
responses:
'200':
description: RIC is found
@@ -393,9 +394,10 @@
parameters:
- name: policyType
in: query
- description: policyType
+ description: The name of the policy type
required: false
type: string
+ allowEmptyValue: false
responses:
'200':
description: OK
@@ -460,9 +462,10 @@
parameters:
- name: name
in: query
- description: name
+ description: The name of the service
required: false
type: string
+ allowEmptyValue: false
responses:
'200':
description: OK
@@ -489,9 +492,10 @@
parameters:
- name: name
in: query
- description: name
+ description: The name of the service
required: true
type: string
+ allowEmptyValue: false
responses:
'200':
description: OK
@@ -523,9 +527,10 @@
parameters:
- name: name
in: query
- description: name
+ description: The name of the service
required: true
type: string
+ allowEmptyValue: false
responses:
'200':
description: 'Service supervision timer refreshed, OK'
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
index 017a9fd..7cc042c 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
@@ -99,8 +99,9 @@
value = {
@ApiResponse(code = 200, message = "Policy schemas", response = Object.class, responseContainer = "List"), //
@ApiResponse(code = 404, message = "RIC is not found", response = String.class)})
- public ResponseEntity<String> getPolicySchemas(@ApiParam(name = "ric", required = false, value = "The name of " +//
- "the Near-RT RIC to get the definitions for.")@RequestParam(name = "ric", required = false) String ricName) {
+ public ResponseEntity<String> getPolicySchemas( //
+ @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get the definitions for.") //
+ @RequestParam(name = "ric", required = false) String ricName) {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
return new ResponseEntity<>(toPolicyTypeSchemasJson(types), HttpStatus.OK);
@@ -120,8 +121,9 @@
value = { //
@ApiResponse(code = 200, message = "Policy schema", response = Object.class),
@ApiResponse(code = 404, message = "RIC is not found", response = String.class)})
- public ResponseEntity<String> getPolicySchema(@ApiParam(name = "id", required = true, value = "The ID of the " +//
- "policy type to get the definition for.")@RequestParam(name = "id", required = true) String id) {
+ public ResponseEntity<String> getPolicySchema( //
+ @ApiParam(name = "id", required = true, value = "The ID of the policy type to get the definition for.") //
+ @RequestParam(name = "id", required = true) String id) {
try {
PolicyType type = policyTypes.getType(id);
return new ResponseEntity<>(type.schema(), HttpStatus.OK);
@@ -140,8 +142,9 @@
response = String.class,
responseContainer = "List"),
@ApiResponse(code = 404, message = "RIC is not found", response = String.class)})
- public ResponseEntity<String> getPolicyTypes(@ApiParam(name = "ric", required = false, value = "The name of " +//
- "the Near-RT RIC to get types for.")@RequestParam(name = "ric", required = false) String ricName) {
+ public ResponseEntity<String> getPolicyTypes( //
+ @ApiParam(name = "ric", required = false, value = "The name of the Near-RT RIC to get types for.") //
+ @RequestParam(name = "ric", required = false) String ricName) {
if (ricName == null) {
Collection<PolicyType> types = this.policyTypes.getAll();
return new ResponseEntity<>(toPolicyTypeIdsJson(types), HttpStatus.OK);
@@ -163,8 +166,8 @@
@ApiResponse(code = 404, message = "Policy is not found")} //
)
public ResponseEntity<String> getPolicy( //
- @ApiParam(name = "id", required = true, value = "The ID of the policy instance.")@RequestParam(name = "id", //
- required = true) String id) {
+ @ApiParam(name = "id", required = true, value = "The ID of the policy instance.") //
+ @RequestParam(name = "id", required = true) String id) {
try {
Policy p = policies.getPolicy(id);
return new ResponseEntity<>(p.json(), HttpStatus.OK);
@@ -181,8 +184,8 @@
@ApiResponse(code = 404, message = "Policy is not found", response = String.class),
@ApiResponse(code = 423, message = "RIC is not operational", response = String.class)})
public Mono<ResponseEntity<Object>> deletePolicy( //
- @ApiParam(name = "id", required = true, value = "The ID of the policy instance.")@RequestParam(name = "id", //
- required = true) String id) {
+ @ApiParam(name = "id", required = true, value = "The ID of the policy instance.") //
+ @RequestParam(name = "id", required = true) String id) {
try {
Policy policy = policies.getPolicy(id);
keepServiceAlive(policy.ownerServiceName());
@@ -212,17 +215,18 @@
})
public Mono<ResponseEntity<Object>> putPolicy( //
@ApiParam(name = "type", required = false, value = "The name of the policy type.") //
- @RequestParam(name = "type", required = false, defaultValue = "") String typeName, //
- @ApiParam(name = "id", required = true, value = "The ID of the policy instance.")@RequestParam(name = "id", //
- required = true) String instanceId, //
- @ApiParam(name = "ric", required = true, value = "The name of the Near-RT RIC where the policy will be " +//
- "created.")@RequestParam(name = "ric", required = true) String ricName, //
+ @RequestParam(name = "type", required = false, defaultValue = "") String typeName, //
+ @ApiParam(name = "id", required = true, value = "The ID of the policy instance.") //
+ @RequestParam(name = "id", required = true) String instanceId, //
+ @ApiParam(name = "ric", required = true, value = "The name of the Near-RT RIC where the policy will be " + //
+ "created.") //
+ @RequestParam(name = "ric", required = true) String ricName, //
@ApiParam(name = "service", required = true, value = "The name of the service creating the policy.") //
- @RequestParam(name = "service", required = true) String service, //
- @ApiParam(name = "transient", required = false, value = "If the policy is transient or not (boolean " +//
- "defaulted to false). A policy is transient if it will be forgotten when the service needs to " +//
- "reconnect to the Near-RT RIC.")@RequestParam(name = "transient", required = false, //
- defaultValue = "false") boolean isTransient, //
+ @RequestParam(name = "service", required = true) String service, //
+ @ApiParam(name = "transient", required = false, value = "If the policy is transient or not (boolean " + //
+ "defaulted to false). A policy is transient if it will be forgotten when the service needs to " + //
+ "reconnect to the Near-RT RIC.") //
+ @RequestParam(name = "transient", required = false, defaultValue = "false") boolean isTransient, //
@RequestBody Object jsonBody) {
String jsonString = gson.toJson(jsonBody);
@@ -314,11 +318,11 @@
@ApiResponse(code = 404, message = "RIC or type not found", response = String.class)})
public ResponseEntity<String> getPolicies( //
@ApiParam(name = "type", required = false, value = "The name of the policy type to get policies for.") //
- @RequestParam(name = "type", required = false) String type, //
+ @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, //
+ @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) //
+ @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);
@@ -338,11 +342,11 @@
@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, //
+ @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, //
+ @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) //
+ @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);
@@ -363,7 +367,8 @@
@ApiResponse(code = 404, message = "Policy is not found", response = String.class)} //
)
public Mono<ResponseEntity<String>> getPolicyStatus( //
- @ApiParam(name = "id", required = true, value = "The ID of the policy.")@RequestParam(name = "id", //
+ @ApiParam(name = "id", required = true, value = "The ID of the policy.") @RequestParam(
+ name = "id", //
required = true) String id) {
try {
Policy policy = policies.getPolicy(id);
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java
index 1064c6f..c3e5800 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/RicRepositoryController.java
@@ -25,6 +25,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@@ -66,9 +67,9 @@
@ApiResponse(code = 200, message = "RIC is found", response = String.class), //
@ApiResponse(code = 404, message = "RIC is not found", response = String.class) //
})
- public ResponseEntity<String> getRic(
+ public ResponseEntity<String> getRic( //
+ @ApiParam(name = "managedElementId", required = true, value = "The ID of the Managed Element") //
@RequestParam(name = "managedElementId", required = true) String managedElementId) {
-
Optional<Ric> ric = this.rics.lookupRicForManagedElement(managedElementId);
if (ric.isPresent()) {
@@ -87,9 +88,9 @@
value = { //
@ApiResponse(code = 200, message = "OK", response = RicInfo.class, responseContainer = "List"), //
@ApiResponse(code = 404, message = "Policy type is not found", response = String.class)})
- public ResponseEntity<String> getRics(
+ public ResponseEntity<String> getRics( //
+ @ApiParam(name = "policyType", required = false, value = "The name of the policy type") //
@RequestParam(name = "policyType", required = false) String supportingPolicyType) {
-
if ((supportingPolicyType != null) && (this.types.get(supportingPolicyType) == null)) {
return new ResponseEntity<>("Policy type not found", HttpStatus.NOT_FOUND);
}
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java
index 922ba3d..8481830 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/ServiceController.java
@@ -25,6 +25,7 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
@@ -72,8 +73,8 @@
@ApiResponse(code = 200, message = "OK", response = ServiceStatus.class, responseContainer = "List"), //
@ApiResponse(code = 404, message = "Service is not found", response = String.class)})
public ResponseEntity<String> getServices(//
+ @ApiParam(name = "name", required = false, value = "The name of the service") //
@RequestParam(name = "name", required = false) String name) {
-
if (name != null && this.services.get(name) == null) {
return new ResponseEntity<>("Service not found", HttpStatus.NOT_FOUND);
}
@@ -133,6 +134,7 @@
@ApiResponse(code = 404, message = "Service not found", response = String.class)})
@DeleteMapping("/services")
public ResponseEntity<String> deleteService(//
+ @ApiParam(name = "name", required = true, value = "The name of the service") //
@RequestParam(name = "name", required = true) String serviceName) {
try {
Service service = removeService(serviceName);
@@ -152,6 +154,7 @@
@ApiResponse(code = 404, message = "The service is not found, needs re-registration")})
@PutMapping("/services/keepalive")
public ResponseEntity<String> keepAliveService(//
+ @ApiParam(name = "name", required = true, value = "The name of the service") //
@RequestParam(name = "name", required = true) String serviceName) {
try {
services.getService(serviceName).keepAlive();