Update openapi.yaml swagger with new status codes 33/134833/1
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>
Fri, 9 Jun 2023 12:38:46 +0000 (13:38 +0100)
committerRamesh Murugan Iyer <ramesh.murugan.iyer@est.tech>
Tue, 13 Jun 2023 08:02:09 +0000 (08:02 +0000)
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 <ramesh.murugan.iyer@est.tech>
Change-Id: I92c17b253071c3fe4014f475d681bc99df4a9402
(cherry picked from commit 478775d9a56f09ae6d4103b09f127aa6ae150f46)

runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
runtime-acm/src/main/resources/openapi/openapi.yaml
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java

index afe0931..1a34b37 100644 (file)
@@ -110,7 +110,7 @@ public class InstantiationController extends AbstractRestController implements A
     public ResponseEntity<InstantiationResponse> deleteCompositionInstance(UUID compositionId, UUID instanceId,
             UUID requestId) {
 
-        return ResponseEntity.ok().body(provider.deleteAutomationComposition(compositionId, instanceId));
+        return ResponseEntity.accepted().body(provider.deleteAutomationComposition(compositionId, instanceId));
     }
 
     @Override
index c9b6e1f..33f8c9b 100644 (file)
@@ -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:
index 5380d67..8948f5f 100644 (file)
@@ -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);