use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowResource method step.
@POST
@Path("{jobId}/{step}")
public Response step(@PathParam("jobId") String jobId, @PathParam("step") String step, @Context UriInfo uriInfo) {
final String thisStep = findStepFromPath(uriInfo);
final Job job = workflowService.findJob(UUID.fromString(jobId));
final JobRepresentation jobRepresentation = new JobRepresentation(job);
jobRepresentation.addLink(createRetryStepLink(uriInfo, job, thisStep));
// TODO : place holder for logic steps
final NextStep nextStep = workflowService.findNextStep(job.getWorkflow(), thisStep);
if (nextStep != null) {
workflowService.advanceToNextStep(job, thisStep);
jobRepresentation.addLink(createNextStepLink(uriInfo, job, nextStep.getNextStep()), findMethodFromStep(nextStep.getNextStep()));
}
return Response.ok(jobRepresentation).build();
}
use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowResource method waitForScaleIOAddComplete.
@POST
@Path("{jobId}/wait-for-scaleio-add-complete")
public void waitForScaleIOAddComplete(@Suspended final AsyncResponse asyncResponse, @PathParam("jobId") String jobId, @Context UriInfo uriInfo) {
asyncResponse.setTimeoutHandler(asyncResponse1 -> asyncResponse1.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("{\"status\":\"timeout\"}").build()));
asyncResponse.setTimeout(10, TimeUnit.SECONDS);
//
final String thisStep = findStepFromPath(uriInfo);
final Job job = workflowService.findJob(UUID.fromString(jobId));
final JobRepresentation jobRepresentation = new JobRepresentation(job);
final NextStep nextStep = workflowService.findNextStep(job.getWorkflow(), thisStep);
if (nextStep != null) {
workflowService.advanceToNextStep(job, thisStep);
jobRepresentation.addLink(createNextStepLink(uriInfo, job, nextStep.getNextStep()), findMethodFromStep(nextStep.getNextStep()));
}
LOG.info("Completing response");
asyncResponse.resume(Response.ok(jobRepresentation).build());
LOG.debug("Completed response");
}
use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowResource method configureDisksRackHD.
@POST
@Path("{jobId}/configure-disks-rackhd")
public void configureDisksRackHD(@Suspended final AsyncResponse asyncResponse, @PathParam("jobId") String jobId, @Context UriInfo uriInfo) {
asyncResponse.setTimeoutHandler(asyncResponse1 -> asyncResponse1.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("{\"status\":\"timeout\"}").build()));
asyncResponse.setTimeout(10, TimeUnit.SECONDS);
//
final String thisStep = findStepFromPath(uriInfo);
final Job job = workflowService.findJob(UUID.fromString(jobId));
final JobRepresentation jobRepresentation = new JobRepresentation(job);
final NextStep nextStep = workflowService.findNextStep(job.getWorkflow(), thisStep);
if (nextStep != null) {
workflowService.advanceToNextStep(job, thisStep);
jobRepresentation.addLink(createNextStepLink(uriInfo, job, nextStep.getNextStep()), findMethodFromStep(nextStep.getNextStep()));
}
LOG.info("Completing response");
asyncResponse.resume(Response.ok(jobRepresentation).build());
LOG.debug("Completed response");
}
use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowResource method captureRackHD.
@POST
@Consumes("application/vnd.dellemc.rackhd.endpoint+json")
@Path("{jobId}/{step}")
public Response captureRackHD(@PathParam("jobId") String jobId, @PathParam("step") String step, @Context UriInfo uriInfo, EndpointCredentials rackhdCredentials) {
final String thisStep = findStepFromPath(uriInfo);
final Job job = workflowService.findJob(UUID.fromString(jobId));
final JobRepresentation jobRepresentation = new JobRepresentation(job);
final URL url;
try {
url = new URL(rackhdCredentials.getEndpointUrl());
} catch (MalformedURLException e) {
jobRepresentation.addLink(createRetryStepLink(uriInfo, job, thisStep));
return Response.status(Response.Status.BAD_REQUEST).entity(jobRepresentation).build();
}
job.addRackhdCredentials(rackhdCredentials);
final NextStep nextStep = workflowService.findNextStep(job.getWorkflow(), thisStep);
if (nextStep != null) {
workflowService.advanceToNextStep(job, thisStep);
jobRepresentation.addLink(createNextStepLink(uriInfo, job, nextStep.getNextStep()), findMethodFromStep(nextStep.getNextStep()));
}
return Response.ok(jobRepresentation).build();
}
use of com.dell.cpsd.paqx.fru.valueobject.NextStep in project fru-paqx-parent by dellemc-symphony.
the class WorkflowResource method scaleioRemoveWorkflow.
@POST
@Path("{jobId}/start-scaleio-remove-workflow")
public void scaleioRemoveWorkflow(@Suspended final AsyncResponse asyncResponse, @PathParam("jobId") String jobId, @Context UriInfo uriInfo) {
asyncResponse.setTimeoutHandler(asyncResponse1 -> asyncResponse1.resume(Response.status(Response.Status.SERVICE_UNAVAILABLE).entity("{\"status\":\"timeout\"}").build()));
asyncResponse.setTimeout(10, TimeUnit.SECONDS);
//
final String thisStep = findStepFromPath(uriInfo);
final Job job = workflowService.findJob(UUID.fromString(jobId));
final JobRepresentation jobRepresentation = new JobRepresentation(job);
final NextStep nextStep = workflowService.findNextStep(job.getWorkflow(), thisStep);
if (nextStep != null) {
workflowService.advanceToNextStep(job, thisStep);
jobRepresentation.addLink(createNextStepLink(uriInfo, job, nextStep.getNextStep()), findMethodFromStep(nextStep.getNextStep()));
}
LOG.info("Completing response");
asyncResponse.resume(Response.ok(jobRepresentation).build());
LOG.debug("Completed response");
}
Aggregations