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 Ingest { transport : Transport ; constructor ( transport ) { this . transport = transport ; } async deletePipeline ( this , params , options ? ) ; async deletePipeline ( this , params , options ? ) ; async deletePipeline ( this , params , options ? ) ; async deletePipeline ( this , params , options ? ) { const acceptedPath = [ '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 = `/_ingest/pipeline/${ encodeURIComponent ( params . id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async geoIpStats ( this , params ? , options ? ) ; async geoIpStats ( this , params ? , options ? ) ; async geoIpStats ( this , params ? , options ? ) ; async geoIpStats ( 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 = '/_ingest/geoip/stats' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getPipeline ( this , params ? , options ? ) ; async getPipeline ( this , params ? , options ? ) ; async getPipeline ( this , params ? , options ? ) ; async getPipeline ( this , params ? , options ? ) { const acceptedPath = [ '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 . id != null ) { method = 'GET' ; path = `/_ingest/pipeline/${ encodeURIComponent ( params . id . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_ingest/pipeline' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async processorGrok ( this , params ? , options ? ) ; async processorGrok ( this , params ? , options ? ) ; async processorGrok ( this , params ? , options ? ) ; async processorGrok ( 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 = '/_ingest/processor/grok' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putPipeline ( this , params , options ? ) ; async putPipeline ( this , params , options ? ) ; async putPipeline ( this , params , options ? ) ; async putPipeline ( this , params , options ? ) { const acceptedPath = [ 'id' ] ; const acceptedBody = [ '_meta' , 'description' , 'on_failure' , 'processors' , 'version' ] ; 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 = `/_ingest/pipeline/${ encodeURIComponent ( params . id . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async simulate ( this , params ? , options ? ) ; async simulate ( this , params ? , options ? ) ; async simulate ( this , params ? , options ? ) ; async simulate ( this , params ? , options ? ) { const acceptedPath = [ 'id' ] ; const acceptedBody = [ 'docs' , 'pipeline' ] ; const querystring = { } ; const userBody = params ?. body ; let body ; if ( typeof userBody === 'string' ) { body = userBody ; } else { body = userBody != null ? { ... userBody } : undefined ; } params = params ?? { } ; 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 ] ; } } let method = '' ; let path = '' ; if ( params . id != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_ingest/pipeline/${ encodeURIComponent ( params . id . toString ( ) ) }/_simulate` ; } else { method = body != null ? 'POST' : 'GET' ; path = '/_ingest/pipeline/_simulate' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } }