inherit from BroadcastOperationRequest
This commit is contained in:
parent
771763ae58
commit
9ca17f834b
|
@ -19,24 +19,14 @@
|
||||||
|
|
||||||
package org.elasticsearch.action.admin.indices.seal;
|
package org.elasticsearch.action.admin.indices.seal;
|
||||||
|
|
||||||
import org.elasticsearch.action.ActionRequest;
|
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequest;
|
||||||
import org.elasticsearch.action.ActionRequestValidationException;
|
|
||||||
import org.elasticsearch.action.IndicesRequest;
|
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A request to seal one or more indices.
|
* A request to seal one or more indices.
|
||||||
*/
|
*/
|
||||||
public class SealIndicesRequest extends ActionRequest implements IndicesRequest.Replaceable {
|
public class SealIndicesRequest extends BroadcastOperationRequest {
|
||||||
|
|
||||||
private String[] indices;
|
|
||||||
|
|
||||||
private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpenAndForbidClosed();
|
|
||||||
|
|
||||||
SealIndicesRequest() {
|
SealIndicesRequest() {
|
||||||
}
|
}
|
||||||
|
@ -46,54 +36,14 @@ public class SealIndicesRequest extends ActionRequest implements IndicesRequest.
|
||||||
* be sealed.
|
* be sealed.
|
||||||
*/
|
*/
|
||||||
public SealIndicesRequest(String... indices) {
|
public SealIndicesRequest(String... indices) {
|
||||||
this.indices = indices;
|
super(indices);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeTo(StreamOutput out) throws IOException {
|
|
||||||
super.writeTo(out);
|
|
||||||
out.writeStringArrayNullable(indices);
|
|
||||||
indicesOptions.writeIndicesOptions(out);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SealIndicesRequest{" +
|
return "SealIndicesRequest{" +
|
||||||
"indices=" + Arrays.toString(indices) +
|
"indices=" + Arrays.toString(indices) +
|
||||||
", indicesOptions=" + indicesOptions +
|
", indicesOptions=" + indicesOptions() +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ActionRequestValidationException validate() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFrom(StreamInput in) throws IOException {
|
|
||||||
super.readFrom(in);
|
|
||||||
indices = in.readStringArray();
|
|
||||||
indicesOptions = IndicesOptions.readIndicesOptions(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SealIndicesRequest indices(String[] indices) {
|
|
||||||
this.indices = indices;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] indices() {
|
|
||||||
return indices;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IndicesOptions indicesOptions() {
|
|
||||||
return indicesOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public final SealIndicesRequest indicesOptions(IndicesOptions indicesOptions) {
|
|
||||||
this.indicesOptions = indicesOptions;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue