use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.
the class TopologyLoggingResource method searchEvents.
@GET
@Path("/topologies/{topologyId}/events")
@Timed
public Response searchEvents(@PathParam("topologyId") Long topologyId, @QueryParam("componentName") List<String> componentNames, @QueryParam("searchString") String searchString, @QueryParam("searchEventId") String searchEventId, @QueryParam("from") Long from, @QueryParam("to") Long to, @QueryParam("start") Integer start, @QueryParam("limit") Integer limit, @QueryParam("ascending") Boolean ascending, @Context SecurityContext securityContext) throws Exception {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, NAMESPACE, topologyId, READ);
Topology topology = catalogService.getTopology(topologyId);
if (topology != null) {
if (from == null) {
throw BadRequestException.missingParameter("from");
}
if (to == null) {
throw BadRequestException.missingParameter("to");
}
EventSearchCriteria criteria = new EventSearchCriteria(String.valueOf(topologyId), componentNames, searchString, searchEventId, from, to, start, limit, ascending);
return WSUtils.respondEntity(logSearchService.searchEvent(topology, criteria), OK);
}
throw EntityNotFoundException.byId(topologyId.toString());
}
use of com.hortonworks.streamline.streams.catalog.Topology in project streamline by hortonworks.
the class TopologyTestRunResource method killTestRunTopology.
@POST
@Path("/topologies/{topologyId}/actions/killtest/{historyId}")
@Timed
public Response killTestRunTopology(@Context UriInfo urlInfo, @PathParam("topologyId") Long topologyId, @PathParam("historyId") Long historyId, @Context SecurityContext securityContext) throws Exception {
SecurityUtil.checkRoleOrPermissions(authorizer, securityContext, Roles.ROLE_TOPOLOGY_USER, Topology.NAMESPACE, topologyId, EXECUTE);
Topology topology = catalogService.getTopology(topologyId);
TopologyTestRunHistory history = catalogService.getTopologyTestRunHistory(historyId);
if (topology == null) {
throw EntityNotFoundException.byName("Topology with ID " + topologyId.toString());
} else if (history == null) {
throw EntityNotFoundException.byName("TopologyTestRunHistory with ID " + historyId.toString());
}
boolean flagged = actionsService.killTestRunTopology(topology, history);
return WSUtils.respondEntity(Collections.singletonMap("flagged", flagged), OK);
}
Aggregations