@@ -146,7 +146,7 @@ public void cleanup() {
146146
147147 public void testRolloverLifecycle () throws Exception {
148148 // empty lifecycle contains the default rollover
149- DataStreamLifecycle lifecycle = new DataStreamLifecycle () ;
149+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle . Template . DEFAULT ;
150150
151151 putComposableIndexTemplate ("id1" , null , List .of ("metrics-foo*" ), null , null , lifecycle , false );
152152 String dataStreamName = "metrics-foo" ;
@@ -178,7 +178,7 @@ public void testRolloverLifecycle() throws Exception {
178178 }
179179
180180 public void testRolloverAndRetention () throws Exception {
181- DataStreamLifecycle lifecycle = DataStreamLifecycle .newBuilder ().dataRetention (0 ).build ();
181+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle .Template . builder ().dataRetention (TimeValue . ZERO ).build ();
182182
183183 putComposableIndexTemplate ("id1" , null , List .of ("metrics-foo*" ), null , null , lifecycle , false );
184184
@@ -321,7 +321,7 @@ public void testOriginationDate() throws Exception {
321321 * days ago, and one with an origination date 1 day ago. After data stream lifecycle runs, we expect the one with the old
322322 * origination date to have been deleted, and the one with the newer origination date to remain.
323323 */
324- DataStreamLifecycle lifecycle = DataStreamLifecycle .newBuilder ().dataRetention (TimeValue .timeValueDays (7 )).build ();
324+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle .Template . builder ().dataRetention (TimeValue .timeValueDays (7 )).build ();
325325
326326 putComposableIndexTemplate ("id1" , null , List .of ("metrics-foo*" ), null , null , lifecycle , false );
327327
@@ -393,7 +393,7 @@ public void testOriginationDate() throws Exception {
393393 }
394394
395395 public void testUpdatingLifecycleAppliesToAllBackingIndices () throws Exception {
396- DataStreamLifecycle lifecycle = new DataStreamLifecycle () ;
396+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle . Template . DEFAULT ;
397397
398398 putComposableIndexTemplate ("id1" , null , List .of ("metrics-foo*" ), null , null , lifecycle , false );
399399
@@ -437,7 +437,7 @@ public void testAutomaticForceMerge() throws Exception {
437437 * because all necessary merging has already happened automatically. So in order to detect whether forcemerge has been called, we
438438 * use a SendRequestBehavior in the MockTransportService to detect it.
439439 */
440- DataStreamLifecycle lifecycle = new DataStreamLifecycle () ;
440+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle . Template . DEFAULT ;
441441 disableDataStreamLifecycle ();
442442 String dataStreamName = "metrics-foo" ;
443443 putComposableIndexTemplate (
@@ -539,7 +539,7 @@ private static void disableDataStreamLifecycle() {
539539
540540 public void testErrorRecordingOnRollover () throws Exception {
541541 // empty lifecycle contains the default rollover
542- DataStreamLifecycle lifecycle = new DataStreamLifecycle () ;
542+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle . Template . DEFAULT ;
543543 /*
544544 * We set index.auto_expand_replicas to 0-1 so that if we get a single-node cluster it is not yellow. The cluster being yellow
545545 * could result in data stream lifecycle's automatic forcemerge failing, which would result in an unexpected error in the error
@@ -697,7 +697,7 @@ public void testErrorRecordingOnRollover() throws Exception {
697697 public void testErrorRecordingOnRetention () throws Exception {
698698 // starting with a lifecycle without retention so we can rollover the data stream and manipulate the second generation index such
699699 // that its retention execution fails
700- DataStreamLifecycle lifecycle = new DataStreamLifecycle () ;
700+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle . Template . DEFAULT ;
701701
702702 /*
703703 * We set index.auto_expand_replicas to 0-1 so that if we get a single-node cluster it is not yellow. The cluster being yellow
@@ -871,7 +871,7 @@ public void testErrorRecordingOnRetention() throws Exception {
871871 }
872872
873873 public void testDataLifecycleServiceConfiguresTheMergePolicy () throws Exception {
874- DataStreamLifecycle lifecycle = new DataStreamLifecycle () ;
874+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle . Template . DEFAULT ;
875875
876876 putComposableIndexTemplate (
877877 "id1" ,
@@ -970,7 +970,7 @@ public void testDataLifecycleServiceConfiguresTheMergePolicy() throws Exception
970970
971971 public void testReenableDataStreamLifecycle () throws Exception {
972972 // start with a lifecycle that's not enabled
973- DataStreamLifecycle lifecycle = new DataStreamLifecycle ( null , null , false );
973+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle . Template . builder (). enabled ( false ). build ( );
974974
975975 putComposableIndexTemplate ("id1" , null , List .of ("metrics-foo*" ), null , null , lifecycle , false );
976976 String dataStreamName = "metrics-foo" ;
@@ -1029,15 +1029,13 @@ public void testReenableDataStreamLifecycle() throws Exception {
10291029
10301030 public void testLifecycleAppliedToFailureStore () throws Exception {
10311031 // We configure a lifecycle with downsampling to ensure it doesn't fail
1032- DataStreamLifecycle lifecycle = DataStreamLifecycle .newBuilder ()
1033- .dataRetention (20_000 )
1032+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle .Template . builder ()
1033+ .dataRetention (TimeValue . timeValueSeconds ( 20 ) )
10341034 .downsampling (
1035- new DataStreamLifecycle .Downsampling (
1036- List .of (
1037- new DataStreamLifecycle .Downsampling .Round (
1038- TimeValue .timeValueMillis (10 ),
1039- new DownsampleConfig (new DateHistogramInterval ("10m" ))
1040- )
1035+ List .of (
1036+ new DataStreamLifecycle .DownsamplingRound (
1037+ TimeValue .timeValueMillis (10 ),
1038+ new DownsampleConfig (new DateHistogramInterval ("10m" ))
10411039 )
10421040 )
10431041 )
@@ -1202,7 +1200,7 @@ static void putComposableIndexTemplate(
12021200 List <String > patterns ,
12031201 @ Nullable Settings settings ,
12041202 @ Nullable Map <String , Object > metadata ,
1205- @ Nullable DataStreamLifecycle lifecycle ,
1203+ @ Nullable DataStreamLifecycle . Template lifecycle ,
12061204 boolean withFailureStore
12071205 ) throws IOException {
12081206 TransportPutComposableIndexTemplateAction .Request request = new TransportPutComposableIndexTemplateAction .Request (id );
@@ -1265,7 +1263,7 @@ public Collection<SystemDataStreamDescriptor> getSystemDataStreamDescriptors() {
12651263 Template .builder ()
12661264 .settings (Settings .EMPTY )
12671265 .lifecycle (
1268- DataStreamLifecycle .newBuilder ()
1266+ DataStreamLifecycle .Template . builder ()
12691267 .dataRetention (TimeValue .timeValueDays (SYSTEM_DATA_STREAM_RETENTION_DAYS ))
12701268 )
12711269 )
0 commit comments