/** * Deletes the job specified by the given id. * * @param id The id of the job to delete. * @param token The optional authorization token. * * @return The response. */ @Path("{id}") @DELETE @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public JobDeleteResponse delete(@PathParam("id") @Valid final JobId id, @QueryParam("token") @DefaultValue("") final String token) { if (!id.isFullyQualified()) { throw badRequest("Invalid id"); } try { model.removeJob(id, token); return new JobDeleteResponse(JobDeleteResponse.Status.OK); } catch (JobDoesNotExistException e) { throw notFound(new JobDeleteResponse(JobDeleteResponse.Status.JOB_NOT_FOUND)); } catch (JobStillDeployedException e) { throw badRequest(new JobDeleteResponse(JobDeleteResponse.Status.STILL_IN_USE)); } catch (TokenVerificationException e) { throw forbidden(new JobDeleteResponse(JobDeleteResponse.Status.FORBIDDEN)); } }
/** * Deletes the job specified by the given id. * * @param id The id of the job to delete. * @param token The optional authorization token. * @return The response. */ @Path("{id}") @DELETE @Produces(APPLICATION_JSON) @Timed @ExceptionMetered public JobDeleteResponse delete(@PathParam("id") @Valid final JobId id, @QueryParam("token") @DefaultValue("") final String token) { if (!id.isFullyQualified()) { throw badRequest("Invalid id"); } try { model.removeJob(id, token); return new JobDeleteResponse(JobDeleteResponse.Status.OK); } catch (JobDoesNotExistException e) { throw notFound(new JobDeleteResponse(JobDeleteResponse.Status.JOB_NOT_FOUND)); } catch (JobStillDeployedException e) { throw badRequest(new JobDeleteResponse(JobDeleteResponse.Status.STILL_IN_USE)); } catch (TokenVerificationException e) { throw forbidden(new JobDeleteResponse(JobDeleteResponse.Status.FORBIDDEN)); } }