Search in sources :

Example 1 with PendingClusterTasksRequest

use of org.opensearch.action.admin.cluster.tasks.PendingClusterTasksRequest in project OpenSearch by opensearch-project.

the class RestPendingClusterTasksAction method doCatRequest.

@Override
public RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
    pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
    pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
    return channel -> client.admin().cluster().pendingClusterTasks(pendingClusterTasksRequest, new RestResponseListener<PendingClusterTasksResponse>(channel) {

        @Override
        public RestResponse buildResponse(PendingClusterTasksResponse pendingClusterTasks) throws Exception {
            Table tab = buildTable(request, pendingClusterTasks);
            return RestTable.buildResponse(tab, channel);
        }
    });
}
Also used : PendingClusterTasksResponse(org.opensearch.action.admin.cluster.tasks.PendingClusterTasksResponse) List(java.util.List) NodeClient(org.opensearch.client.node.NodeClient) PendingClusterTasksRequest(org.opensearch.action.admin.cluster.tasks.PendingClusterTasksRequest) GET(org.opensearch.rest.RestRequest.Method.GET) RestRequest(org.opensearch.rest.RestRequest) Table(org.opensearch.common.Table) PendingClusterTask(org.opensearch.cluster.service.PendingClusterTask) RestResponse(org.opensearch.rest.RestResponse) RestResponseListener(org.opensearch.rest.action.RestResponseListener) Collections.singletonList(java.util.Collections.singletonList) Table(org.opensearch.common.Table) PendingClusterTasksResponse(org.opensearch.action.admin.cluster.tasks.PendingClusterTasksResponse) RestResponse(org.opensearch.rest.RestResponse) PendingClusterTasksRequest(org.opensearch.action.admin.cluster.tasks.PendingClusterTasksRequest)

Example 2 with PendingClusterTasksRequest

use of org.opensearch.action.admin.cluster.tasks.PendingClusterTasksRequest in project OpenSearch by opensearch-project.

the class RestPendingClusterTasksAction method prepareRequest.

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest();
    pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout()));
    pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local()));
    return channel -> client.admin().cluster().pendingClusterTasks(pendingClusterTasksRequest, new RestToXContentListener<>(channel));
}
Also used : List(java.util.List) NodeClient(org.opensearch.client.node.NodeClient) RestToXContentListener(org.opensearch.rest.action.RestToXContentListener) PendingClusterTasksRequest(org.opensearch.action.admin.cluster.tasks.PendingClusterTasksRequest) GET(org.opensearch.rest.RestRequest.Method.GET) RestRequest(org.opensearch.rest.RestRequest) IOException(java.io.IOException) BaseRestHandler(org.opensearch.rest.BaseRestHandler) Collections.singletonList(java.util.Collections.singletonList) PendingClusterTasksRequest(org.opensearch.action.admin.cluster.tasks.PendingClusterTasksRequest)

Aggregations

Collections.singletonList (java.util.Collections.singletonList)2 List (java.util.List)2 PendingClusterTasksRequest (org.opensearch.action.admin.cluster.tasks.PendingClusterTasksRequest)2 NodeClient (org.opensearch.client.node.NodeClient)2 RestRequest (org.opensearch.rest.RestRequest)2 GET (org.opensearch.rest.RestRequest.Method.GET)2 IOException (java.io.IOException)1 PendingClusterTasksResponse (org.opensearch.action.admin.cluster.tasks.PendingClusterTasksResponse)1 PendingClusterTask (org.opensearch.cluster.service.PendingClusterTask)1 Table (org.opensearch.common.Table)1 BaseRestHandler (org.opensearch.rest.BaseRestHandler)1 RestResponse (org.opensearch.rest.RestResponse)1 RestResponseListener (org.opensearch.rest.action.RestResponseListener)1 RestToXContentListener (org.opensearch.rest.action.RestToXContentListener)1