org.graylog2.restclient.lib.ApiRequestBuilder Maven / Gradle / Ivy
The newest version!
/**
* This file is part of Graylog.
*
* Graylog is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Graylog is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Graylog. If not, see .
*/
package org.graylog2.restclient.lib;
import com.google.common.net.MediaType;
import org.graylog2.restclient.models.ClusterEntity;
import org.graylog2.restclient.models.Node;
import org.graylog2.restclient.models.Radio;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.TimeUnit;
public interface ApiRequestBuilder {
ApiRequestBuilder path(String pathTemplate);
// convenience
ApiRequestBuilder path(String pathTemplate, Object... params);
ApiRequestBuilder pathParams(Object... params);
ApiRequestBuilder pathParam(Object param);
ApiRequestBuilder node(Node node);
ApiRequestBuilder radio(Radio radio);
ApiRequestBuilder clusterEntity(ClusterEntity entity);
ApiRequestBuilder nodes(Node... nodes);
ApiRequestBuilder nodes(Collection nodes);
ApiRequestBuilder fromAllNodes();
ApiRequestBuilder onlyMasterNode();
ApiRequestBuilder queryParam(String name, String value);
ApiRequestBuilder queryParam(String name, int value);
ApiRequestBuilder queryParams(Map params);
ApiRequestBuilder session(String sessionId);
ApiRequestBuilder extendSession(boolean extend);
ApiRequestBuilder unauthenticated();
ApiRequestBuilder body(Object body);
ApiRequestBuilder expect(int... httpStatusCodes);
ApiRequestBuilder timeout(long value);
ApiRequestBuilder timeout(long value, TimeUnit unit);
ApiRequestBuilder accept(MediaType mediaType);
T execute() throws APIException, IOException;
Map executeOnAll() throws APIException;
// solely for test purposes
URL prepareUrl(ClusterEntity node);
InputStream executeStreaming() throws APIException, IOException;
}