@@ -330,32 +330,25 @@ export default class Indices {
330
330
return await this . transport . request ( { path, method, querystring, body } , options )
331
331
}
332
332
333
- async deleteDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . TODO >
334
- async deleteDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . TODO , unknown > >
335
- async deleteDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < T . TODO >
336
- async deleteDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < any > {
333
+ async deleteDataLifecycle ( this : That , params : T . IndicesDeleteDataLifecycleRequest | TB . IndicesDeleteDataLifecycleRequest , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . IndicesDeleteDataLifecycleResponse >
334
+ async deleteDataLifecycle ( this : That , params : T . IndicesDeleteDataLifecycleRequest | TB . IndicesDeleteDataLifecycleRequest , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . IndicesDeleteDataLifecycleResponse , unknown > >
335
+ async deleteDataLifecycle ( this : That , params : T . IndicesDeleteDataLifecycleRequest | TB . IndicesDeleteDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < T . IndicesDeleteDataLifecycleResponse >
336
+ async deleteDataLifecycle ( this : That , params : T . IndicesDeleteDataLifecycleRequest | TB . IndicesDeleteDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < any > {
337
337
const acceptedPath : string [ ] = [ 'name' ]
338
338
const querystring : Record < string , any > = { }
339
339
const body = undefined
340
340
341
- params = params ?? { }
342
341
for ( const key in params ) {
343
342
if ( acceptedPath . includes ( key ) ) {
344
343
continue
345
344
} else if ( key !== 'body' ) {
345
+ // @ts -expect-error
346
346
querystring [ key ] = params [ key ]
347
347
}
348
348
}
349
349
350
- let method = ''
351
- let path = ''
352
- if ( params . name != null ) {
353
- method = 'DELETE'
354
- path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
355
- } else {
356
- method = 'DELETE'
357
- path = '/_data_stream/_lifecycle'
358
- }
350
+ const method = 'DELETE'
351
+ const path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
359
352
return await this . transport . request ( { path, method, querystring, body } , options )
360
353
}
361
354
@@ -569,24 +562,24 @@ export default class Indices {
569
562
return await this . transport . request ( { path, method, querystring, body } , options )
570
563
}
571
564
572
- async explainDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . TODO >
573
- async explainDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . TODO , unknown > >
574
- async explainDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < T . TODO >
575
- async explainDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < any > {
565
+ async explainDataLifecycle ( this : That , params : T . IndicesExplainDataLifecycleRequest | TB . IndicesExplainDataLifecycleRequest , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . IndicesExplainDataLifecycleResponse >
566
+ async explainDataLifecycle ( this : That , params : T . IndicesExplainDataLifecycleRequest | TB . IndicesExplainDataLifecycleRequest , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . IndicesExplainDataLifecycleResponse , unknown > >
567
+ async explainDataLifecycle ( this : That , params : T . IndicesExplainDataLifecycleRequest | TB . IndicesExplainDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < T . IndicesExplainDataLifecycleResponse >
568
+ async explainDataLifecycle ( this : That , params : T . IndicesExplainDataLifecycleRequest | TB . IndicesExplainDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < any > {
576
569
const acceptedPath : string [ ] = [ 'index' ]
577
570
const querystring : Record < string , any > = { }
578
571
const body = undefined
579
572
580
- params = params ?? { }
581
573
for ( const key in params ) {
582
574
if ( acceptedPath . includes ( key ) ) {
583
575
continue
584
576
} else if ( key !== 'body' ) {
577
+ // @ts -expect-error
585
578
querystring [ key ] = params [ key ]
586
579
}
587
580
}
588
581
589
- const method = 'POST '
582
+ const method = 'GET '
590
583
const path = `/${ encodeURIComponent ( params . index . toString ( ) ) } /_lifecycle/explain`
591
584
return await this . transport . request ( { path, method, querystring, body } , options )
592
585
}
@@ -731,32 +724,25 @@ export default class Indices {
731
724
return await this . transport . request ( { path, method, querystring, body } , options )
732
725
}
733
726
734
- async getDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . TODO >
735
- async getDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . TODO , unknown > >
736
- async getDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < T . TODO >
737
- async getDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < any > {
727
+ async getDataLifecycle ( this : That , params : T . IndicesGetDataLifecycleRequest | TB . IndicesGetDataLifecycleRequest , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . IndicesGetDataLifecycleResponse >
728
+ async getDataLifecycle ( this : That , params : T . IndicesGetDataLifecycleRequest | TB . IndicesGetDataLifecycleRequest , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . IndicesGetDataLifecycleResponse , unknown > >
729
+ async getDataLifecycle ( this : That , params : T . IndicesGetDataLifecycleRequest | TB . IndicesGetDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < T . IndicesGetDataLifecycleResponse >
730
+ async getDataLifecycle ( this : That , params : T . IndicesGetDataLifecycleRequest | TB . IndicesGetDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < any > {
738
731
const acceptedPath : string [ ] = [ 'name' ]
739
732
const querystring : Record < string , any > = { }
740
733
const body = undefined
741
734
742
- params = params ?? { }
743
735
for ( const key in params ) {
744
736
if ( acceptedPath . includes ( key ) ) {
745
737
continue
746
738
} else if ( key !== 'body' ) {
739
+ // @ts -expect-error
747
740
querystring [ key ] = params [ key ]
748
741
}
749
742
}
750
743
751
- let method = ''
752
- let path = ''
753
- if ( params . name != null ) {
754
- method = 'GET'
755
- path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
756
- } else {
757
- method = 'GET'
758
- path = '/_data_stream/_lifecycle'
759
- }
744
+ const method = 'GET'
745
+ const path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
760
746
return await this . transport . request ( { path, method, querystring, body } , options )
761
747
}
762
748
@@ -1086,32 +1072,37 @@ export default class Indices {
1086
1072
return await this . transport . request ( { path, method, querystring, body } , options )
1087
1073
}
1088
1074
1089
- async putDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . TODO >
1090
- async putDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . TODO , unknown > >
1091
- async putDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < T . TODO >
1092
- async putDataLifecycle ( this : That , params ? : T . TODO | TB . TODO , options ?: TransportRequestOptions ) : Promise < any > {
1075
+ async putDataLifecycle ( this : That , params : T . IndicesPutDataLifecycleRequest | TB . IndicesPutDataLifecycleRequest , options ?: TransportRequestOptionsWithOutMeta ) : Promise < T . IndicesPutDataLifecycleResponse >
1076
+ async putDataLifecycle ( this : That , params : T . IndicesPutDataLifecycleRequest | TB . IndicesPutDataLifecycleRequest , options ?: TransportRequestOptionsWithMeta ) : Promise < TransportResult < T . IndicesPutDataLifecycleResponse , unknown > >
1077
+ async putDataLifecycle ( this : That , params : T . IndicesPutDataLifecycleRequest | TB . IndicesPutDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < T . IndicesPutDataLifecycleResponse >
1078
+ async putDataLifecycle ( this : That , params : T . IndicesPutDataLifecycleRequest | TB . IndicesPutDataLifecycleRequest , options ?: TransportRequestOptions ) : Promise < any > {
1093
1079
const acceptedPath : string [ ] = [ 'name' ]
1080
+ const acceptedBody : string [ ] = [ 'data_retention' ]
1094
1081
const querystring : Record < string , any > = { }
1095
- const body = undefined
1082
+ // @ts -expect-error
1083
+ const userBody : any = params ?. body
1084
+ let body : Record < string , any > | string
1085
+ if ( typeof userBody === 'string' ) {
1086
+ body = userBody
1087
+ } else {
1088
+ body = userBody != null ? { ...userBody } : undefined
1089
+ }
1096
1090
1097
- params = params ?? { }
1098
1091
for ( const key in params ) {
1099
- if ( acceptedPath . includes ( key ) ) {
1092
+ if ( acceptedBody . includes ( key ) ) {
1093
+ body = body ?? { }
1094
+ // @ts -expect-error
1095
+ body [ key ] = params [ key ]
1096
+ } else if ( acceptedPath . includes ( key ) ) {
1100
1097
continue
1101
1098
} else if ( key !== 'body' ) {
1099
+ // @ts -expect-error
1102
1100
querystring [ key ] = params [ key ]
1103
1101
}
1104
1102
}
1105
1103
1106
- let method = ''
1107
- let path = ''
1108
- if ( params . name != null ) {
1109
- method = 'PUT'
1110
- path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
1111
- } else {
1112
- method = 'PUT'
1113
- path = '/_data_stream/_lifecycle'
1114
- }
1104
+ const method = 'PUT'
1105
+ const path = `/_data_stream/${ encodeURIComponent ( params . name . toString ( ) ) } /_lifecycle`
1115
1106
return await this . transport . request ( { path, method, querystring, body } , options )
1116
1107
}
1117
1108
0 commit comments