org.elasticsearch.xpack.core.async.GetAsyncStatusRequest Maven / Gradle / Ivy
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.core.async;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import java.io.IOException;
import java.util.Objects;
/**
* A request class to get a status update of the async search request
*/
public class GetAsyncStatusRequest extends ActionRequest {
private final String id;
/**
* Creates a new request
* @param id The id of the search progress request.
*/
public GetAsyncStatusRequest(String id) {
this.id = id;
}
public GetAsyncStatusRequest(StreamInput in) throws IOException {
super(in);
this.id = in.readString();
}
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeString(id);
}
@Override
public ActionRequestValidationException validate() {
return null;
}
/**
* Returns the id of the async search.
*/
public String getId() {
return id;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GetAsyncStatusRequest request = (GetAsyncStatusRequest) o;
return Objects.equals(id, request.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}