Search in sources :

Example 66 with Topology

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());
}
Also used : EventSearchCriteria(com.hortonworks.streamline.streams.logsearch.EventSearchCriteria) Topology(com.hortonworks.streamline.streams.catalog.Topology) Path(javax.ws.rs.Path) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET)

Example 67 with Topology

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);
}
Also used : Topology(com.hortonworks.streamline.streams.catalog.Topology) TopologyTestRunHistory(com.hortonworks.streamline.streams.catalog.TopologyTestRunHistory) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

Topology (com.hortonworks.streamline.streams.catalog.Topology)67 Timed (com.codahale.metrics.annotation.Timed)39 Path (javax.ws.rs.Path)27 GET (javax.ws.rs.GET)17 IOException (java.io.IOException)12 TopologyActions (com.hortonworks.streamline.streams.actions.TopologyActions)9 TopologyTestRunHistory (com.hortonworks.streamline.streams.catalog.TopologyTestRunHistory)9 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)8 TopologyTestRunCase (com.hortonworks.streamline.streams.catalog.TopologyTestRunCase)8 List (java.util.List)8 Map (java.util.Map)8 POST (javax.ws.rs.POST)8 Expectations (mockit.Expectations)8 Test (org.junit.Test)7 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)6 TopologyComponent (com.hortonworks.streamline.streams.catalog.TopologyComponent)6 TopologyTestRunCaseSource (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)6 ArrayList (java.util.ArrayList)6 StreamCatalogService (com.hortonworks.streamline.streams.catalog.service.StreamCatalogService)5 Collections (java.util.Collections)5