use of org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest in project elasticsearch by elastic.
the class RestGetRepositoriesAction method prepareRequest.
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
final String[] repositories = request.paramAsStringArray("repository", Strings.EMPTY_ARRAY);
GetRepositoriesRequest getRepositoriesRequest = getRepositoryRequest(repositories);
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));
getRepositoriesRequest.local(request.paramAsBoolean("local", getRepositoriesRequest.local()));
settingsFilter.addFilterSettingParams(request);
return channel -> client.admin().cluster().getRepositories(getRepositoriesRequest, new RestBuilderListener<GetRepositoriesResponse>(channel) {
@Override
public RestResponse buildResponse(GetRepositoriesResponse response, XContentBuilder builder) throws Exception {
builder.startObject();
for (RepositoryMetaData repositoryMetaData : response.repositories()) {
RepositoriesMetaData.toXContent(repositoryMetaData, builder, request);
}
builder.endObject();
return new BytesRestResponse(OK, builder);
}
});
}
use of org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest in project elasticsearch by elastic.
the class RestRepositoriesAction method doCatRequest.
@Override
protected RestChannelConsumer doCatRequest(RestRequest request, NodeClient client) {
GetRepositoriesRequest getRepositoriesRequest = new GetRepositoriesRequest();
getRepositoriesRequest.local(request.paramAsBoolean("local", getRepositoriesRequest.local()));
getRepositoriesRequest.masterNodeTimeout(request.paramAsTime("master_timeout", getRepositoriesRequest.masterNodeTimeout()));
return channel -> client.admin().cluster().getRepositories(getRepositoriesRequest, new RestResponseListener<GetRepositoriesResponse>(channel) {
@Override
public RestResponse buildResponse(GetRepositoriesResponse getRepositoriesResponse) throws Exception {
return RestTable.buildResponse(buildTable(request, getRepositoriesResponse), channel);
}
});
}
Aggregations