Package org.graylog2.restroutes

Examples of org.graylog2.restroutes.PathMethod


        return size;
    }

    public long getThroughput() throws APIException, IOException {
        final StreamThroughputResponse throughputResponse = api.path(routes.StreamResource().oneStreamThroughput(getId()), StreamThroughputResponse.class)
                .expect(200, 404)
                .execute();

        if (throughputResponse == null) {
            return 0L;
View Full Code Here


    public void resume(String streamId) throws APIException, IOException {
        api.path(resource.resume(streamId)).expect(Http.Status.OK).execute();
    }

    public TestMatchResponse testMatch(String streamId, TestMatchRequest request) throws APIException, IOException {
        TestMatchResponse testMatchResponse = null;
        testMatchResponse = api.path(resource.testMatch(streamId), TestMatchResponse.class)
                .body(request).expect(Http.Status.OK).execute();
        return testMatchResponse;
    }
View Full Code Here

    public CheckConditionResponse activeAlerts(String streamId) throws APIException, IOException {
        return api.path(routes.StreamAlertResource().checkConditions(streamId), CheckConditionResponse.class).execute();
    }

    public List<Output> getOutputs(String streamId) throws APIException, IOException {
        OutputsResponse outputsResponse = api.path(routes.StreamOutputResource().get(streamId), OutputsResponse.class).execute();
        List<Output> result = new ArrayList<>();
        for(OutputSummaryResponse response : outputsResponse.outputs)
            result.add(outputFactory.fromSummaryResponse(response));

        return result;
View Full Code Here

    }


    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authToken) throws AuthenticationException {
        final UserResponse response;

        // we don't handle any other type, see constructor
        @SuppressWarnings("CastToConcreteClass")
        SessionIdAuthenticationToken token = (SessionIdAuthenticationToken) authToken;
        try {
View Full Code Here

            this.order = order;
        }
    }

    private <T> T doSearch(Class<T> clazz, MediaType mediaType, int pageSize, Set<String> selectedFields) throws APIException, IOException {
        PathMethod pathMethod;
        switch (timeRange.getType()) {
            case ABSOLUTE:
                pathMethod = routes.AbsoluteSearchResource().searchAbsolute();
                break;
            case KEYWORD:
View Full Code Here

    public String searchAsCsv(Set<String> selectedFields) throws IOException, APIException {
        return doSearch(String.class, MediaType.CSV_UTF_8, 10_000, selectedFields)// TODO make use of streaming support in the server.
    }

    public DateHistogramResult dateHistogram(String interval) throws IOException, APIException {
        PathMethod routePath;
        switch (timeRange.getType()) {
            case ABSOLUTE:
                routePath = routes.AbsoluteSearchResource().histogramAbsolute();
                break;
            case KEYWORD:
View Full Code Here

                timeRange
        );
    }

    public FieldStatsResponse fieldStats(String field) throws IOException, APIException {
        PathMethod routePath;
        switch (timeRange.getType()) {
            case ABSOLUTE:
                routePath = routes.AbsoluteSearchResource().statsAbsolute();
                break;
            case KEYWORD:
View Full Code Here

                .timeout(apiTimeout("search_universal_stats", KEITH, TimeUnit.SECONDS))
                .execute();
    }

    public FieldTermsResponse fieldTerms(String field) throws IOException, APIException {
        PathMethod routePath;
        switch (timeRange.getType()) {
            case ABSOLUTE:
                routePath = routes.AbsoluteSearchResource().termsAbsolute();
                break;
            case KEYWORD:
View Full Code Here

                .timeout(apiTimeout("search_universal_terms", KEITH, TimeUnit.SECONDS))
                .execute();
    }

    public FieldHistogramResponse fieldHistogram(String field, String interval) throws IOException, APIException {
        PathMethod routePath;
        switch (timeRange.getType()) {
            case ABSOLUTE:
                routePath = routes.AbsoluteSearchResource().fieldHistogramAbsolute();
                break;
            case KEYWORD:
View Full Code Here

        } catch (JClassAlreadyExistsException e) {
            e.printStackTrace();
            System.exit(-1);
        }

        final ResourceRoutesParser parser = new ResourceRoutesParser("org.graylog2.rest.resources");

        final List<RouteClass> routeClassList = parser.buildClasses();

        final RouteClassGenerator generator = new RouteClassGenerator(packagePrefix, codeModel);

        final RouterGenerator routerGenerator = new RouterGenerator(router, generator);
        routerGenerator.build(routeClassList);

        // do the same for radio resources
        JDefinedClass radioRouter = null;
        try {
            radioRouter = codeModel._class(packagePrefix + ".Radio");
        } catch (JClassAlreadyExistsException e) {
            e.printStackTrace();
            System.exit(-1);
        }

        final ResourceRoutesParser radioParser = new ResourceRoutesParser("org.graylog2.radio.rest.resources");
        final List<RouteClass> radioRouteClassList = radioParser.buildClasses();
        final RouteClassGenerator radioGenerator = new RouteClassGenerator(packagePrefix + ".radio", codeModel);
        final RouterGenerator radioRouterGenerator = new RouterGenerator(radioRouter, radioGenerator, JMod.PUBLIC);
        radioRouterGenerator.build(radioRouteClassList);

        JMethod radioMethod = router.method(JMod.PUBLIC | JMod.STATIC, radioRouter, "radio");
View Full Code Here

TOP

Related Classes of org.graylog2.restroutes.PathMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.