|
@@ -13,7 +13,7 @@ import org.elasticsearch.action.ActionResponse;
|
|
|
import org.elasticsearch.action.ActionType;
|
|
|
import org.elasticsearch.action.IndicesRequest;
|
|
|
import org.elasticsearch.action.support.IndicesOptions;
|
|
|
-import org.elasticsearch.action.support.master.MasterNodeReadRequest;
|
|
|
+import org.elasticsearch.action.support.local.LocalClusterStateRequest;
|
|
|
import org.elasticsearch.cluster.metadata.DataStreamOptions;
|
|
|
import org.elasticsearch.common.collect.Iterators;
|
|
|
import org.elasticsearch.common.io.stream.StreamInput;
|
|
@@ -21,6 +21,10 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|
|
import org.elasticsearch.common.io.stream.Writeable;
|
|
|
import org.elasticsearch.common.xcontent.ChunkedToXContentObject;
|
|
|
import org.elasticsearch.core.TimeValue;
|
|
|
+import org.elasticsearch.core.UpdateForV10;
|
|
|
+import org.elasticsearch.tasks.CancellableTask;
|
|
|
+import org.elasticsearch.tasks.Task;
|
|
|
+import org.elasticsearch.tasks.TaskId;
|
|
|
import org.elasticsearch.xcontent.ParseField;
|
|
|
import org.elasticsearch.xcontent.ToXContent;
|
|
|
import org.elasticsearch.xcontent.ToXContentObject;
|
|
@@ -30,6 +34,7 @@ import java.io.IOException;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
|
|
|
/**
|
|
@@ -42,7 +47,7 @@ public class GetDataStreamOptionsAction {
|
|
|
|
|
|
private GetDataStreamOptionsAction() {/* no instances */}
|
|
|
|
|
|
- public static class Request extends MasterNodeReadRequest<Request> implements IndicesRequest.Replaceable {
|
|
|
+ public static class Request extends LocalClusterStateRequest implements IndicesRequest.Replaceable {
|
|
|
|
|
|
private String[] names;
|
|
|
private IndicesOptions indicesOptions = IndicesOptions.builder()
|
|
@@ -76,6 +81,16 @@ public class GetDataStreamOptionsAction {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Task createTask(long id, String type, String action, TaskId parentTaskId, Map<String, String> headers) {
|
|
|
+ return new CancellableTask(id, type, action, "", parentTaskId, headers);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * NB prior to 9.0 this was a TransportMasterNodeReadAction so for BwC we must remain able to read these requests until
|
|
|
+ * we no longer need to support calling this action remotely.
|
|
|
+ */
|
|
|
+ @UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT)
|
|
|
public Request(StreamInput in) throws IOException {
|
|
|
super(in);
|
|
|
this.names = in.readOptionalStringArray();
|
|
@@ -83,14 +98,6 @@ public class GetDataStreamOptionsAction {
|
|
|
this.includeDefaults = in.readBoolean();
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void writeTo(StreamOutput out) throws IOException {
|
|
|
- super.writeTo(out);
|
|
|
- out.writeOptionalStringArray(names);
|
|
|
- indicesOptions.writeIndicesOptions(out);
|
|
|
- out.writeBoolean(includeDefaults);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public boolean equals(Object o) {
|
|
|
if (this == o) return true;
|
|
@@ -152,10 +159,11 @@ public class GetDataStreamOptionsAction {
|
|
|
public static final ParseField NAME_FIELD = new ParseField("name");
|
|
|
public static final ParseField OPTIONS_FIELD = new ParseField("options");
|
|
|
|
|
|
- DataStreamEntry(StreamInput in) throws IOException {
|
|
|
- this(in.readString(), in.readOptionalWriteable(DataStreamOptions::read));
|
|
|
- }
|
|
|
-
|
|
|
+ /**
|
|
|
+ * NB prior to 9.0 this was a TransportMasterNodeReadAction so for BwC we must remain able to write these responses until
|
|
|
+ * we no longer need to support calling this action remotely.
|
|
|
+ */
|
|
|
+ @UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT)
|
|
|
@Override
|
|
|
public void writeTo(StreamOutput out) throws IOException {
|
|
|
out.writeString(dataStreamName);
|
|
@@ -180,14 +188,15 @@ public class GetDataStreamOptionsAction {
|
|
|
this.dataStreams = dataStreams;
|
|
|
}
|
|
|
|
|
|
- public Response(StreamInput in) throws IOException {
|
|
|
- this(in.readCollectionAsList(DataStreamEntry::new));
|
|
|
- }
|
|
|
-
|
|
|
public List<DataStreamEntry> getDataStreams() {
|
|
|
return dataStreams;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * NB prior to 9.0 this was a TransportMasterNodeReadAction so for BwC we must remain able to write these responses until
|
|
|
+ * we no longer need to support calling this action remotely.
|
|
|
+ */
|
|
|
+ @UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT)
|
|
|
@Override
|
|
|
public void writeTo(StreamOutput out) throws IOException {
|
|
|
out.writeCollection(dataStreams);
|