use of org.apache.nifi.web.api.entity.BulletinBoardEntity in project nifi by apache.
the class FlowResource method getBulletinBoard.
// --------------
// bulletin board
// --------------
/**
* Retrieves all the of bulletins in this NiFi.
*
* @param after Supporting querying for bulletins after a particular
* bulletin id.
* @param limit The max number of bulletins to return.
* @param sourceName Source name filter. Supports a regular expression.
* @param message Message filter. Supports a regular expression.
* @param sourceId Source id filter. Supports a regular expression.
* @param groupId Group id filter. Supports a regular expression.
* @return A bulletinBoardEntity.
* @throws InterruptedException if interrupted
*/
@GET
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.APPLICATION_JSON)
@Path("bulletin-board")
@ApiOperation(value = "Gets current bulletins", response = BulletinBoardEntity.class, authorizations = { @Authorization(value = "Read - /flow"), @Authorization(value = "Read - /{component-type}/{uuid} - For component specific bulletins") })
@ApiResponses(value = { @ApiResponse(code = 400, message = "NiFi was unable to complete the request because it was invalid. The request should not be retried without modification."), @ApiResponse(code = 401, message = "Client could not be authenticated."), @ApiResponse(code = 403, message = "Client is not authorized to make this request."), @ApiResponse(code = 409, message = "The request was valid but NiFi was not in the appropriate state to process it. Retrying the same request later may be successful.") })
public Response getBulletinBoard(@ApiParam(value = "Includes bulletins with an id after this value.", required = false) @QueryParam("after") LongParameter after, @ApiParam(value = "Includes bulletins originating from this sources whose name match this regular expression.", required = false) @QueryParam("sourceName") BulletinBoardPatternParameter sourceName, @ApiParam(value = "Includes bulletins whose message that match this regular expression.", required = false) @QueryParam("message") BulletinBoardPatternParameter message, @ApiParam(value = "Includes bulletins originating from this sources whose id match this regular expression.", required = false) @QueryParam("sourceId") BulletinBoardPatternParameter sourceId, @ApiParam(value = "Includes bulletins originating from this sources whose group id match this regular expression.", required = false) @QueryParam("groupId") BulletinBoardPatternParameter groupId, @ApiParam(value = "The number of bulletins to limit the response to.", required = false) @QueryParam("limit") IntegerParameter limit) throws InterruptedException {
authorizeFlow();
// replicate if cluster manager
if (isReplicateRequest()) {
return replicate(HttpMethod.GET);
}
// build the bulletin query
final BulletinQueryDTO query = new BulletinQueryDTO();
if (sourceId != null) {
query.setSourceId(sourceId.getRawPattern());
}
if (groupId != null) {
query.setGroupId(groupId.getRawPattern());
}
if (sourceName != null) {
query.setName(sourceName.getRawPattern());
}
if (message != null) {
query.setMessage(message.getRawPattern());
}
if (after != null) {
query.setAfter(after.getLong());
}
if (limit != null) {
query.setLimit(limit.getInteger());
}
// get the bulletin board
final BulletinBoardDTO bulletinBoard = serviceFacade.getBulletinBoard(query);
// create the response entity
BulletinBoardEntity entity = new BulletinBoardEntity();
entity.setBulletinBoard(bulletinBoard);
// generate the response
return generateOkResponse(entity).build();
}
Aggregations