import { Transport , TransportRequestOptions , TransportRequestOptionsWithMeta , TransportRequestOptionsWithOutMeta , TransportResult } from '@elastic/transport' ; import * as T from '../types' ; import * as TB from '../typesWithBodyKey' ; interface That { transport : Transport ; } export default class Slm { transport : Transport ; constructor ( transport ) { this . transport = transport ; } async deleteLifecycle ( this , params , options ? ) ; async deleteLifecycle ( this , params , options ? ) ; async deleteLifecycle ( this , params , options ? ) ; async deleteLifecycle ( this , params , options ? ) { const acceptedPath = [ 'policy_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'DELETE' ; const path = `/_slm/policy/${ encodeURIComponent ( params . policy_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async executeLifecycle ( this , params , options ? ) ; async executeLifecycle ( this , params , options ? ) ; async executeLifecycle ( this , params , options ? ) ; async executeLifecycle ( this , params , options ? ) { const acceptedPath = [ 'policy_id' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_slm/policy/${ encodeURIComponent ( params . policy_id . toString ( ) ) }/_execute` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async executeRetention ( this , params ? , options ? ) ; async executeRetention ( this , params ? , options ? ) ; async executeRetention ( this , params ? , options ? ) ; async executeRetention ( this , params ? , options ? ) { const acceptedPath = [ ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = '/_slm/_execute_retention' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getLifecycle ( this , params ? , options ? ) ; async getLifecycle ( this , params ? , options ? ) ; async getLifecycle ( this , params ? , options ? ) ; async getLifecycle ( this , params ? , options ? ) { const acceptedPath = [ 'policy_id' ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . policy_id != null ) { method = 'GET' ; path = `/_slm/policy/${ encodeURIComponent ( params . policy_id . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_slm/policy' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getStats ( this , params ? , options ? ) ; async getStats ( this , params ? , options ? ) ; async getStats ( this , params ? , options ? ) ; async getStats ( this , params ? , options ? ) { const acceptedPath = [ ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'GET' ; const path = '/_slm/stats' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getStatus ( this , params ? , options ? ) ; async getStatus ( this , params ? , options ? ) ; async getStatus ( this , params ? , options ? ) ; async getStatus ( this , params ? , options ? ) { const acceptedPath = [ ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'GET' ; const path = '/_slm/status' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putLifecycle ( this , params , options ? ) ; async putLifecycle ( this , params , options ? ) ; async putLifecycle ( this , params , options ? ) ; async putLifecycle ( this , params , options ? ) { const acceptedPath = [ 'policy_id' ] ; const acceptedBody = [ 'config' , 'name' , 'repository' , 'retention' , 'schedule' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = body ?? { } ; body [ key ] = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = `/_slm/policy/${ encodeURIComponent ( params . policy_id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async start ( this , params ? , options ? ) ; async start ( this , params ? , options ? ) ; async start ( this , params ? , options ? ) ; async start ( this , params ? , options ? ) { const acceptedPath = [ ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = '/_slm/start' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async stop ( this , params ? , options ? ) ; async stop ( this , params ? , options ? ) ; async stop ( this , params ? , options ? ) ; async stop ( this , params ? , options ? ) { const acceptedPath = [ ] ; const querystring = { } ; const body = undefined ; params = params ?? { } ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'POST' ; const path = '/_slm/stop' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } }