aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers
diff options
context:
space:
mode:
authorHarry Huang <huangxiangyu5@huawei.com>2020-02-21 16:13:19 +0800
committerHarry Huang <huangxiangyu5@huawei.com>2020-02-21 16:13:19 +0800
commit5293c3c248caa7373d6d512d78ea04c5d4ae61e1 (patch)
treeb90d822acbba96af17c9b6a42da044d2314e783b /mso-api-handlers
parent8017827345ee6d9e3d1015879e191c5fad3a4257 (diff)
Add POST API for OrchestrationTask
Issue-ID: SO-2368 Add methods for create a OrchestrationTask Change-Id: I0d049b4e60ead8dbb4e524ae4081f17433ac78bd Signed-off-by: Harry Huang <huangxiangyu5@huawei.com>
Diffstat (limited to 'mso-api-handlers')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
index 7961cb0886..fc5769632b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationTasks.java
@@ -116,4 +116,26 @@ public class OrchestrationTasks {
}
}
+ @POST
+ @Path("/{version:[vV][4-7]}/")
+ @Operation(description = "Create an Orchestrated Task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Produces(MediaType.APPLICATION_JSON)
+ @Transactional
+ public Response CreateOrchestrationTask(String requestJson, @PathParam("version") String version) {
+ try {
+ OrchestrationTask orchestrationTask = mapper.readValue(requestJson, OrchestrationTask.class);
+ requestsDbClient.createOrchestrationTask(orchestrationTask);
+ return builder.buildResponse(HttpStatus.SC_OK, null, orchestrationTask, version);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(),
+ "Exception while communciate with Request DB - Orchestration Task Create", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, e.getMessage(), ErrorNumbers.COULD_NOT_WRITE_TO_REQUESTS_DB, null,
+ version);
+ return response;
+ }
+ }
+
}