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 Cluster { transport : Transport ; constructor ( transport ) { this . transport = transport ; } async allocationExplain ( this , params ? , options ? ) ; async allocationExplain ( this , params ? , options ? ) ; async allocationExplain ( this , params ? , options ? ) ; async allocationExplain ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'current_node' , 'index' , 'primary' , 'shard' ] ; 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 ] ; } } const method = body != null ? 'POST' : 'GET' ; const path = '/_cluster/allocation/explain' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteComponentTemplate ( this , params , options ? ) ; async deleteComponentTemplate ( this , params , options ? ) ; async deleteComponentTemplate ( this , params , options ? ) ; async deleteComponentTemplate ( this , params , options ? ) { const acceptedPath = [ 'name' ] ; 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 = `/_component_template/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteVotingConfigExclusions ( this , params ? , options ? ) ; async deleteVotingConfigExclusions ( this , params ? , options ? ) ; async deleteVotingConfigExclusions ( this , params ? , options ? ) ; async deleteVotingConfigExclusions ( 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 = 'DELETE' ; const path = '/_cluster/voting_config_exclusions' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async existsComponentTemplate ( this , params , options ? ) ; async existsComponentTemplate ( this , params , options ? ) ; async existsComponentTemplate ( this , params , options ? ) ; async existsComponentTemplate ( this , params , options ? ) { const acceptedPath = [ 'name' ] ; 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 = 'HEAD' ; const path = `/_component_template/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getComponentTemplate ( this , params ? , options ? ) ; async getComponentTemplate ( this , params ? , options ? ) ; async getComponentTemplate ( this , params ? , options ? ) ; async getComponentTemplate ( this , params ? , options ? ) { const acceptedPath = [ 'name' ] ; 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 . name != null ) { method = 'GET' ; path = `/_component_template/${ encodeURIComponent ( params . name . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_component_template' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getSettings ( this , params ? , options ? ) ; async getSettings ( this , params ? , options ? ) ; async getSettings ( this , params ? , options ? ) ; async getSettings ( 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 = '/_cluster/settings' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async health ( this , params ? , options ? ) ; async health ( this , params ? , options ? ) ; async health ( this , params ? , options ? ) ; async health ( this , params ? , options ? ) { const acceptedPath = [ 'index' ] ; 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 . index != null ) { method = 'GET' ; path = `/_cluster/health/${ encodeURIComponent ( params . index . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_cluster/health' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async pendingTasks ( this , params ? , options ? ) ; async pendingTasks ( this , params ? , options ? ) ; async pendingTasks ( this , params ? , options ? ) ; async pendingTasks ( 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 = '/_cluster/pending_tasks' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async postVotingConfigExclusions ( this , params ? , options ? ) ; async postVotingConfigExclusions ( this , params ? , options ? ) ; async postVotingConfigExclusions ( this , params ? , options ? ) ; async postVotingConfigExclusions ( 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 = '/_cluster/voting_config_exclusions' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putComponentTemplate ( this , params , options ? ) ; async putComponentTemplate ( this , params , options ? ) ; async putComponentTemplate ( this , params , options ? ) ; async putComponentTemplate ( this , params , options ? ) { const acceptedPath = [ 'name' ] ; const acceptedBody = [ 'template' , 'aliases' , 'mappings' , 'settings' , 'version' , '_meta' ] ; 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 = `/_component_template/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putSettings ( this , params ? , options ? ) ; async putSettings ( this , params ? , options ? ) ; async putSettings ( this , params ? , options ? ) ; async putSettings ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'persistent' , 'transient' ] ; 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 ] ; } } const method = 'PUT' ; const path = '/_cluster/settings' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async remoteInfo ( this , params ? , options ? ) ; async remoteInfo ( this , params ? , options ? ) ; async remoteInfo ( this , params ? , options ? ) ; async remoteInfo ( 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 = '/_remote/info' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async reroute ( this , params ? , options ? ) ; async reroute ( this , params ? , options ? ) ; async reroute ( this , params ? , options ? ) ; async reroute ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'commands' ] ; 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 ] ; } } const method = 'POST' ; const path = '/_cluster/reroute' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async state ( this , params ? , options ? ) ; async state ( this , params ? , options ? ) ; async state ( this , params ? , options ? ) ; async state ( this , params ? , options ? ) { const acceptedPath = [ 'metric' , 'index' ] ; 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 . metric != null && params . index != null ) { method = 'GET' ; path = `/_cluster/state/${ encodeURIComponent ( params . metric . toString ( ) ) }/${ encodeURIComponent ( params . index . toString ( ) ) }` ; } else if ( params . metric != null ) { method = 'GET' ; path = `/_cluster/state/${ encodeURIComponent ( params . metric . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_cluster/state' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async stats ( this , params ? , options ? ) ; async stats ( this , params ? , options ? ) ; async stats ( this , params ? , options ? ) ; async stats ( this , params ? , options ? ) { const acceptedPath = [ 'node_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 . node_id != null ) { method = 'GET' ; path = `/_cluster/stats/nodes/${ encodeURIComponent ( params . node_id . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_cluster/stats' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } }