use of io.hops.hopsworks.exceptions.AlertException in project hopsworks by logicalclocks.
the class AdminSilenceResource method update.
@PUT
@Path("{silenceId}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Update a silence.", response = SilenceDTO.class)
@JWTRequired(acceptedTokens = { Audience.API }, allowedUserRoles = { "HOPS_ADMIN" })
public Response update(@PathParam("silenceId") String silenceId, PostableSilenceDTO postableSilenceDTO, @Context UriInfo uriInfo, @Context SecurityContext sc) throws AlertException, ProjectException {
if (postableSilenceDTO == null) {
throw new AlertException(RESTCodes.AlertErrorCode.ILLEGAL_ARGUMENT, Level.FINE, "No payload.");
}
Users user = jWTHelper.getUserPrincipal(sc);
postableSilenceDTO.setId(silenceId);
SilenceID silenceID = postSilence(postableSilenceDTO, user);
SilenceDTO dto = silenceBuilder.build(uriInfo, new ResourceRequest(ResourceRequest.Name.SILENCES), silenceID.getSilenceID(), null);
return Response.ok().entity(dto).build();
}
Aggregations