@@ -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" ,
@@ -972,7 +972,7 @@ public void testDataLifecycleServiceConfiguresTheMergePolicy() throws Exception
972972
973973 public void testReenableDataStreamLifecycle () throws Exception {
974974 // start with a lifecycle that's not enabled
975- DataStreamLifecycle lifecycle = new DataStreamLifecycle ( null , null , false );
975+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle . Template . builder (). enabled ( false ). build ( );
976976
977977 putComposableIndexTemplate ("id1" , null , List .of ("metrics-foo*" ), null , null , lifecycle , false );
978978 String dataStreamName = "metrics-foo" ;
@@ -1031,15 +1031,13 @@ public void testReenableDataStreamLifecycle() throws Exception {
10311031
10321032 public void testLifecycleAppliedToFailureStore () throws Exception {
10331033 // We configure a lifecycle with downsampling to ensure it doesn't fail
1034- DataStreamLifecycle lifecycle = DataStreamLifecycle .newBuilder ()
1035- .dataRetention (20_000 )
1034+ DataStreamLifecycle . Template lifecycle = DataStreamLifecycle .Template . builder ()
1035+ .dataRetention (TimeValue . timeValueSeconds ( 20 ) )
10361036 .downsampling (
1037- new DataStreamLifecycle .Downsampling (
1038- List .of (
1039- new DataStreamLifecycle .Downsampling .Round (
1040- TimeValue .timeValueMillis (10 ),
1041- new DownsampleConfig (new DateHistogramInterval ("10m" ))
1042- )
1037+ List .of (
1038+ new DataStreamLifecycle .DownsamplingRound (
1039+ TimeValue .timeValueMillis (10 ),
1040+ new DownsampleConfig (new DateHistogramInterval ("10m" ))
10431041 )
10441042 )
10451043 )
@@ -1205,7 +1203,7 @@ static void putComposableIndexTemplate(
12051203 List <String > patterns ,
12061204 @ Nullable Settings settings ,
12071205 @ Nullable Map <String , Object > metadata ,
1208- @ Nullable DataStreamLifecycle lifecycle ,
1206+ @ Nullable DataStreamLifecycle . Template lifecycle ,
12091207 boolean withFailureStore
12101208 ) throws IOException {
12111209 TransportPutComposableIndexTemplateAction .Request request = new TransportPutComposableIndexTemplateAction .Request (id );
@@ -1268,7 +1266,7 @@ public Collection<SystemDataStreamDescriptor> getSystemDataStreamDescriptors() {
12681266 Template .builder ()
12691267 .settings (Settings .EMPTY )
12701268 .lifecycle (
1271- DataStreamLifecycle .newBuilder ()
1269+ DataStreamLifecycle .Template . builder ()
12721270 .dataRetention (TimeValue .timeValueDays (SYSTEM_DATA_STREAM_RETENTION_DAYS ))
12731271 )
12741272 )
0 commit comments