aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra
diff options
context:
space:
mode:
authorChuanyu Chen <chenchuanyu@huawei.com>2020-02-21 09:22:50 +0000
committerGerrit Code Review <gerrit@onap.org>2020-02-21 09:22:50 +0000
commit99f90be67332c42f384f7d666b61d4e63b022029 (patch)
treef4d5793eee6dd6584b5cba985d979f9228dbab07 /mso-api-handlers/mso-api-handler-infra
parentdca9a2db304b2ac196ec16c1bec08e9df9cd6a22 (diff)
parent5293c3c248caa7373d6d512d78ea04c5d4ae61e1 (diff)
Merge "Add POST API for OrchestrationTask"
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra')
-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;
+ }
+ }
+
}