From 478775d9a56f09ae6d4103b09f127aa6ae150f46 Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Fri, 9 Jun 2023 13:38:46 +0100 Subject: Update openapi.yaml swagger with new status codes Changing the response code of delete operation from 200 to 202 as it requires to be delegated to the participants. Adding 500 server error code for all the REST responses. Issue-ID: POLICY-4729 Signed-off-by: zrrmmua Change-Id: I92c17b253071c3fe4014f475d681bc99df4a9402 --- .../runtime/main/rest/InstantiationController.java | 2 +- .../src/main/resources/openapi/openapi.yaml | 298 ++++++++++++++++++++- .../rest/InstantiationControllerTest.java | 2 +- 3 files changed, 298 insertions(+), 4 deletions(-) diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java index afe09314f..1a34b37e8 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java @@ -110,7 +110,7 @@ public class InstantiationController extends AbstractRestController implements A public ResponseEntity deleteCompositionInstance(UUID compositionId, UUID instanceId, UUID requestId) { - return ResponseEntity.ok().body(provider.deleteAutomationComposition(compositionId, instanceId)); + return ResponseEntity.accepted().body(provider.deleteAutomationComposition(compositionId, instanceId)); } @Override diff --git a/runtime-acm/src/main/resources/openapi/openapi.yaml b/runtime-acm/src/main/resources/openapi/openapi.yaml index c9b6e1f7c..33f8c9bf2 100644 --- a/runtime-acm/src/main/resources/openapi/openapi.yaml +++ b/runtime-acm/src/main/resources/openapi/openapi.yaml @@ -125,6 +125,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -204,6 +225,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -306,6 +348,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -413,6 +476,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -500,6 +584,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -607,6 +712,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -709,6 +835,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -830,6 +977,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -949,6 +1117,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -1060,6 +1249,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -1195,6 +1405,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -1301,6 +1532,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -1431,6 +1683,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: @@ -1441,7 +1714,7 @@ paths: tags: - Automation Composition Instance summary: Delete an automation composition instance - description: Deletes a automation composition instance, returning the UUID of the deleted automation composition instance + description: Order a deletion of an automation composition instance, returning the UUID of the automation composition instance to be deleted operationId: deleteCompositionInstance parameters: - name : compositionId @@ -1465,7 +1738,7 @@ paths: type: string format: uuid responses: - 200: + 202: description: Serialised instance of [InstantiationResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/instantiation/InstantiationResponse.java) containing the UUID of the deleted automation composition instance @@ -1557,6 +1830,27 @@ paths: application/json: schema: $ref: '#/components/schemas/SimpleResponse' + 500: + description: Internal Server Error, returns an instance of + [SimpleResponse](https://github.com/onap/policy-clamp/blob/master/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/SimpleResponse.java) + headers: + X-LatestVersion: + schema: + type: string + X-PatchVersion: + schema: + type: string + X-MinorVersion: + schema: + type: string + X-onap-RequestId: + schema: + type: string + format: uuid + content: + application/json: + schema: + $ref: '#/components/schemas/SimpleResponse' security: - basicAuth: [] x-interface info: diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java index 5380d67a6..8948f5f53 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java @@ -263,7 +263,7 @@ class InstantiationControllerTest extends CommonRestController { var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, instResponse.getInstanceId())); var resp = invocationBuilder.delete(); - assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus()); + assertEquals(Response.Status.ACCEPTED.getStatusCode(), resp.getStatus()); instResponse = resp.readEntity(InstantiationResponse.class); InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionFromRsc); -- cgit 1.2.3-korg