Package org.graylog2.restclient.models

Examples of org.graylog2.restclient.models.Startpage


    private NaturalDateTest(ApiClient api) {
        this.api = api;
    }

    public Map<String, String> test(String string) throws APIException, IOException {
        NaturalDateTestResponse r = api.get(NaturalDateTestResponse.class)
                .path("/tools/natural_date_tester")
                .queryParam("string", string)
                .execute();

        Map<String, String> result = Maps.newHashMap();
View Full Code Here


    private RegexTest(ApiClient api) {
        this.api = api;
    }

    public Map<String, Object> test(String regex, String string) throws IOException, APIException {
        RegexTestResponse r = api.get(RegexTestResponse.class)
                .path("/tools/regex_tester")
                .queryParam("regex", regex)
                .queryParam("string", string)
                .execute();
View Full Code Here

        final String userName = credString[0];
        final String password = credString[1];

        try {
            SessionCreateResponse session = sessionService.create(userName, password, request.remoteAddress());
            return userService.retrieveUserWithSessionId(userName, session.sessionId);
        } catch (IOException e) {
            log.error("Could not reach graylog2 server", e);
        } catch (APIException e) {
            log.error("Unauthorized to load user " + userName, e);
View Full Code Here

    private SplitAndIndexTest(ApiClient api) {
        this.api = api;
    }

    public Map<String, Object> test(String splitBy, int index, String string) throws IOException, APIException {
        SplitAndIndexTestResponse r = api.get(SplitAndIndexTestResponse.class)
                .path("/tools/split_and_index_tester")
                .queryParam("split_by", splitBy)
                .queryParam("index", index)
                .queryParam("string", string)
                .execute();
View Full Code Here

    private SubstringTest(ApiClient api) {
        this.api = api;
    }

    public Map<String, Object> test(int start, int end, String string) throws IOException, APIException {
        SubstringTestResponse r = api.get(SubstringTestResponse.class)
                .path("/tools/substring_tester")
                .queryParam("begin_index", start)
                .queryParam("end_index", end)
                .queryParam("string", string)
                .execute();
View Full Code Here

            int time = (alertCondition.getParameters().get("time") == null ? 0 : Integer.parseInt(alertCondition.getParameters().get("time").toString()));
            int grace = (alertCondition.getParameters().get("grace") == null ? 0 : Integer.parseInt(alertCondition.getParameters().get("grace").toString()));
            int since = Math.round(new DateTime().minusMinutes((time + grace == 0 ? 1 : time + grace)).getMillis()/1000);
            total += getAlertsInformation(since).alerts.size();
        }*/
        CheckConditionResponse response = streamService.activeAlerts(this.getId());
        int size = (response.results == null ? 0 : response.results.size());

        return size;
    }
View Full Code Here

        }
        assertNotNull("Should have thrown an Graylog2ServerUnavailableException", t);
        assertEquals("First node failure count should be 1", 1, firstNode.getFailureCount());

        final Node.Factory nodeFactory = injector.getInstance(Node.Factory.class);
        final NodeSummaryResponse r1 = new NodeSummaryResponse();
        r1.transportAddress = "http://localhost:65534";
        r1.id = UUID.randomUUID().toString();

        final Node newNode = nodeFactory.fromSummaryResponse(r1);
        newNode.touch();
        final NodeSummaryResponse r2 = new NodeSummaryResponse();
        r2.transportAddress = firstNode.getTransportAddress();
        r2.id = firstNode.getNodeId();
        final Node sameAsInitialNode = nodeFactory.fromSummaryResponse(r2);
        sameAsInitialNode.touch();
        serverNodes.put(ImmutableList.of(newNode, sameAsInitialNode));
View Full Code Here

    }

    public void registerNodes(ServerNodes serverNodes, Node.Factory factory, AddressNodeId[] nodeDesc) {
        final ArrayList<Node> nodes = Lists.newArrayList();
        for (AddressNodeId n : nodeDesc) {
            NodeSummaryResponse r = new NodeSummaryResponse();
            r.transportAddress = n.address;
            r.id = n.nodeId;
            final Node node = factory.fromSummaryResponse(r);
            node.touch();
            nodes.add(node);
View Full Code Here

        return list;
    }

    public SavedSearch get(String searchId) throws APIException, IOException {
        SavedSearchSummaryResponse response = api.path(routes.SavedSearchesResource().get(searchId), SavedSearchSummaryResponse.class)
                .execute();

        return savedSearchFactory.fromSummaryResponse(response);
    }
View Full Code Here

    }

    public List<SavedSearch> all() throws APIException, IOException {
        List<SavedSearch> list = Lists.newArrayList();

        SavedSearchesResponse response = api.path(routes.SavedSearchesResource().list(), SavedSearchesResponse.class).execute();

        for (SavedSearchSummaryResponse search : response.searches) {
            list.add(savedSearchFactory.fromSummaryResponse(search));
        }
View Full Code Here

TOP

Related Classes of org.graylog2.restclient.models.Startpage

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.