Search in sources :

Example 1 with SnapshotsStatusRequest

use of org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest in project elasticsearch by elastic.

the class RestSnapshotsStatusAction method prepareRequest.

@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    String repository = request.param("repository", "_all");
    String[] snapshots = request.paramAsStringArray("snapshot", Strings.EMPTY_ARRAY);
    if (snapshots.length == 1 && "_all".equalsIgnoreCase(snapshots[0])) {
        snapshots = Strings.EMPTY_ARRAY;
    }
    SnapshotsStatusRequest snapshotsStatusRequest = snapshotsStatusRequest(repository).snapshots(snapshots);
    snapshotsStatusRequest.ignoreUnavailable(request.paramAsBoolean("ignore_unavailable", snapshotsStatusRequest.ignoreUnavailable()));
    snapshotsStatusRequest.masterNodeTimeout(request.paramAsTime("master_timeout", snapshotsStatusRequest.masterNodeTimeout()));
    return channel -> client.admin().cluster().snapshotsStatus(snapshotsStatusRequest, new RestToXContentListener<>(channel));
}
Also used : BaseRestHandler(org.elasticsearch.rest.BaseRestHandler) Settings(org.elasticsearch.common.settings.Settings) GET(org.elasticsearch.rest.RestRequest.Method.GET) SnapshotsStatusRequest(org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest) RestToXContentListener(org.elasticsearch.rest.action.RestToXContentListener) RestRequest(org.elasticsearch.rest.RestRequest) Requests.snapshotsStatusRequest(org.elasticsearch.client.Requests.snapshotsStatusRequest) NodeClient(org.elasticsearch.client.node.NodeClient) IOException(java.io.IOException) RestController(org.elasticsearch.rest.RestController) Strings(org.elasticsearch.common.Strings) SnapshotsStatusRequest(org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest)

Aggregations

IOException (java.io.IOException)1 SnapshotsStatusRequest (org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest)1 Requests.snapshotsStatusRequest (org.elasticsearch.client.Requests.snapshotsStatusRequest)1 NodeClient (org.elasticsearch.client.node.NodeClient)1 Strings (org.elasticsearch.common.Strings)1 Settings (org.elasticsearch.common.settings.Settings)1 BaseRestHandler (org.elasticsearch.rest.BaseRestHandler)1 RestController (org.elasticsearch.rest.RestController)1 RestRequest (org.elasticsearch.rest.RestRequest)1 GET (org.elasticsearch.rest.RestRequest.Method.GET)1 RestToXContentListener (org.elasticsearch.rest.action.RestToXContentListener)1