1515import  org .elasticsearch .action .IndicesRequest ;
1616import  org .elasticsearch .action .admin .indices .rollover .RolloverConfiguration ;
1717import  org .elasticsearch .action .support .IndicesOptions ;
18- import  org .elasticsearch .action .support .master . MasterNodeReadRequest ;
18+ import  org .elasticsearch .action .support .local . LocalClusterStateRequest ;
1919import  org .elasticsearch .cluster .metadata .DataStreamGlobalRetention ;
2020import  org .elasticsearch .common .collect .Iterators ;
2121import  org .elasticsearch .common .io .stream .StreamInput ;
2424import  org .elasticsearch .common .xcontent .ChunkedToXContentObject ;
2525import  org .elasticsearch .core .Nullable ;
2626import  org .elasticsearch .core .TimeValue ;
27+ import  org .elasticsearch .core .UpdateForV10 ;
28+ import  org .elasticsearch .tasks .CancellableTask ;
29+ import  org .elasticsearch .tasks .Task ;
30+ import  org .elasticsearch .tasks .TaskId ;
2731import  org .elasticsearch .xcontent .ParseField ;
2832import  org .elasticsearch .xcontent .ToXContent ;
2933import  org .elasticsearch .xcontent .ToXContentObject ;
3337import  java .util .Arrays ;
3438import  java .util .Iterator ;
3539import  java .util .List ;
40+ import  java .util .Map ;
3641import  java .util .Objects ;
3742
3843/** 
@@ -44,7 +49,7 @@ public class GetDataStreamLifecycleAction {
4449
4550    private  GetDataStreamLifecycleAction () {/* no instances */ }
4651
47-     public  static  class  Request  extends  MasterNodeReadRequest < Request >  implements  IndicesRequest .Replaceable  {
52+     public  static  class  Request  extends  LocalClusterStateRequest  implements  IndicesRequest .Replaceable  {
4853
4954        private  String [] names ;
5055        private  IndicesOptions  indicesOptions  = IndicesOptions .builder ()
@@ -89,21 +94,23 @@ public ActionRequestValidationException validate() {
8994            return  null ;
9095        }
9196
97+         @ Override 
98+         public  Task  createTask (long  id , String  type , String  action , TaskId  parentTaskId , Map <String , String > headers ) {
99+             return  new  CancellableTask (id , type , action , "" , parentTaskId , headers );
100+         }
101+ 
102+         /** 
103+          * NB prior to 9.0 this was a TransportMasterNodeReadAction so for BwC we must remain able to read these requests until 
104+          * we no longer need to support calling this action remotely. 
105+          */ 
106+         @ UpdateForV10 (owner  = UpdateForV10 .Owner .DATA_MANAGEMENT )
92107        public  Request (StreamInput  in ) throws  IOException  {
93108            super (in );
94109            this .names  = in .readOptionalStringArray ();
95110            this .indicesOptions  = IndicesOptions .readIndicesOptions (in );
96111            this .includeDefaults  = in .readBoolean ();
97112        }
98113
99-         @ Override 
100-         public  void  writeTo (StreamOutput  out ) throws  IOException  {
101-             super .writeTo (out );
102-             out .writeOptionalStringArray (names );
103-             indicesOptions .writeIndicesOptions (out );
104-             out .writeBoolean (includeDefaults );
105-         }
106- 
107114        @ Override 
108115        public  boolean  equals (Object  o ) {
109116            if  (this  == o ) return  true ;
@@ -169,14 +176,11 @@ public record DataStreamLifecycle(
169176            public  static  final  ParseField  NAME_FIELD  = new  ParseField ("name" );
170177            public  static  final  ParseField  LIFECYCLE_FIELD  = new  ParseField ("lifecycle" );
171178
172-             DataStreamLifecycle (StreamInput  in ) throws  IOException  {
173-                 this (
174-                     in .readString (),
175-                     in .readOptionalWriteable (org .elasticsearch .cluster .metadata .DataStreamLifecycle ::new ),
176-                     in .getTransportVersion ().onOrAfter (TransportVersions .V_8_15_0 ) && in .readBoolean ()
177-                 );
178-             }
179- 
179+             /** 
180+              * NB prior to 9.0 this was a TransportMasterNodeReadAction so for BwC we must remain able to write these responses until 
181+              * we no longer need to support calling this action remotely. 
182+              */ 
183+             @ UpdateForV10 (owner  = UpdateForV10 .Owner .DATA_MANAGEMENT )
180184            @ Override 
181185            public  void  writeTo (StreamOutput  out ) throws  IOException  {
182186                out .writeString (dataStreamName );
@@ -238,16 +242,6 @@ public Response(
238242            this .globalRetention  = globalRetention ;
239243        }
240244
241-         public  Response (StreamInput  in ) throws  IOException  {
242-             this (
243-                 in .readCollectionAsList (DataStreamLifecycle ::new ),
244-                 in .readOptionalWriteable (RolloverConfiguration ::new ),
245-                 in .getTransportVersion ().onOrAfter (TransportVersions .V_8_14_0 )
246-                     ? in .readOptionalWriteable (DataStreamGlobalRetention ::read )
247-                     : null 
248-             );
249-         }
250- 
251245        public  List <DataStreamLifecycle > getDataStreamLifecycles () {
252246            return  dataStreamLifecycles ;
253247        }
@@ -261,6 +255,11 @@ public DataStreamGlobalRetention getGlobalRetention() {
261255            return  globalRetention ;
262256        }
263257
258+         /** 
259+          * NB prior to 9.0 this was a TransportMasterNodeReadAction so for BwC we must remain able to write these responses until 
260+          * we no longer need to support calling this action remotely. 
261+          */ 
262+         @ UpdateForV10 (owner  = UpdateForV10 .Owner .DATA_MANAGEMENT )
264263        @ Override 
265264        public  void  writeTo (StreamOutput  out ) throws  IOException  {
266265            out .writeCollection (dataStreamLifecycles );
0 commit comments