|
@@ -15,7 +15,7 @@ import org.elasticsearch.action.ActionType;
|
|
|
import org.elasticsearch.action.IndicesRequest;
|
|
|
import org.elasticsearch.action.admin.indices.rollover.RolloverConfiguration;
|
|
|
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.DataStreamGlobalRetention;
|
|
|
import org.elasticsearch.common.collect.Iterators;
|
|
|
import org.elasticsearch.common.io.stream.StreamInput;
|
|
@@ -24,6 +24,10 @@ import org.elasticsearch.common.io.stream.Writeable;
|
|
|
import org.elasticsearch.common.xcontent.ChunkedToXContentObject;
|
|
|
import org.elasticsearch.core.Nullable;
|
|
|
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;
|
|
@@ -33,6 +37,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;
|
|
|
|
|
|
/**
|
|
@@ -44,7 +49,7 @@ public class GetDataStreamLifecycleAction {
|
|
|
|
|
|
private GetDataStreamLifecycleAction() {/* 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()
|
|
@@ -89,6 +94,16 @@ public class GetDataStreamLifecycleAction {
|
|
|
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();
|
|
@@ -96,14 +111,6 @@ public class GetDataStreamLifecycleAction {
|
|
|
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;
|
|
@@ -169,14 +176,11 @@ public class GetDataStreamLifecycleAction {
|
|
|
public static final ParseField NAME_FIELD = new ParseField("name");
|
|
|
public static final ParseField LIFECYCLE_FIELD = new ParseField("lifecycle");
|
|
|
|
|
|
- DataStreamLifecycle(StreamInput in) throws IOException {
|
|
|
- this(
|
|
|
- in.readString(),
|
|
|
- in.readOptionalWriteable(org.elasticsearch.cluster.metadata.DataStreamLifecycle::new),
|
|
|
- in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0) && in.readBoolean()
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 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);
|
|
@@ -238,16 +242,6 @@ public class GetDataStreamLifecycleAction {
|
|
|
this.globalRetention = globalRetention;
|
|
|
}
|
|
|
|
|
|
- public Response(StreamInput in) throws IOException {
|
|
|
- this(
|
|
|
- in.readCollectionAsList(DataStreamLifecycle::new),
|
|
|
- in.readOptionalWriteable(RolloverConfiguration::new),
|
|
|
- in.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)
|
|
|
- ? in.readOptionalWriteable(DataStreamGlobalRetention::read)
|
|
|
- : null
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
public List<DataStreamLifecycle> getDataStreamLifecycles() {
|
|
|
return dataStreamLifecycles;
|
|
|
}
|
|
@@ -261,6 +255,11 @@ public class GetDataStreamLifecycleAction {
|
|
|
return globalRetention;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 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(dataStreamLifecycles);
|