@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/tables/{tableName}/rebuildBrokerResourceFromHelixTags")
@ApiOperation(value = "Rebuild broker resource for table", notes = "when new brokers are added")
@ApiResponses(value = {@ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 400, message = "Bad request: table name has to be with table type"), @ApiResponse(code = 500, message = "Internal error rebuilding broker resource or serializing response")})
public SuccessResponse rebuildBrokerResource(
@ApiParam(value = "Table name (with type)", required = true) @PathParam("tableName") String tableNameWithType) {
try {
final PinotResourceManagerResponse pinotResourceManagerResponse =
_helixResourceManager.rebuildBrokerResourceFromHelixTags(tableNameWithType);
return new SuccessResponse(pinotResourceManagerResponse.getMessage());
} catch (InvalidConfigException e) {
throw new ControllerApplicationException(LOGGER, e.getMessage(), Response.Status.BAD_REQUEST);
} catch (Exception e) {
throw new ControllerApplicationException(LOGGER, e.getMessage(), Response.Status.INTERNAL_SERVER_ERROR);
}
}
}