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 Snapshot { transport : Transport ; constructor ( transport ) { this . transport = transport ; } async cleanupRepository ( this , params , options ? ) ; async cleanupRepository ( this , params , options ? ) ; async cleanupRepository ( this , params , options ? ) ; async cleanupRepository ( 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 = 'POST' ; const path = `/_snapshot/${ encodeURIComponent ( params . name . toString ( ) ) }/_cleanup` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async clone ( this , params , options ? ) ; async clone ( this , params , options ? ) ; async clone ( this , params , options ? ) ; async clone ( this , params , options ? ) { const acceptedPath = [ 'repository' , 'snapshot' , 'target_snapshot' ] ; const acceptedBody = [ 'indices' ] ; 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 = `/_snapshot/${ encodeURIComponent ( params . repository . toString ( ) ) }/${ encodeURIComponent ( params . snapshot . toString ( ) ) }/_clone/${ encodeURIComponent ( params . target_snapshot . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async create ( this , params , options ? ) ; async create ( this , params , options ? ) ; async create ( this , params , options ? ) ; async create ( this , params , options ? ) { const acceptedPath = [ 'repository' , 'snapshot' ] ; const acceptedBody = [ 'ignore_unavailable' , 'include_global_state' , 'indices' , 'feature_states' , 'metadata' , 'partial' ] ; 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 = `/_snapshot/${ encodeURIComponent ( params . repository . toString ( ) ) }/${ encodeURIComponent ( params . snapshot . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async createRepository ( this , params , options ? ) ; async createRepository ( this , params , options ? ) ; async createRepository ( this , params , options ? ) ; async createRepository ( this , params , options ? ) { const acceptedPath = [ 'name' ] ; const acceptedBody = [ 'repository' , 'type' , 'settings' ] ; 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 = `/_snapshot/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async delete ( this , params , options ? ) ; async delete ( this , params , options ? ) ; async delete ( this , params , options ? ) ; async delete ( this , params , options ? ) { const acceptedPath = [ 'repository' , 'snapshot' ] ; 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 = `/_snapshot/${ encodeURIComponent ( params . repository . toString ( ) ) }/${ encodeURIComponent ( params . snapshot . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteRepository ( this , params , options ? ) ; async deleteRepository ( this , params , options ? ) ; async deleteRepository ( this , params , options ? ) ; async deleteRepository ( 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 = `/_snapshot/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async get ( this , params , options ? ) ; async get ( this , params , options ? ) ; async get ( this , params , options ? ) ; async get ( this , params , options ? ) { const acceptedPath = [ 'repository' , 'snapshot' ] ; 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 = 'GET' ; const path = `/_snapshot/${ encodeURIComponent ( params . repository . toString ( ) ) }/${ encodeURIComponent ( params . snapshot . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getRepository ( this , params ? , options ? ) ; async getRepository ( this , params ? , options ? ) ; async getRepository ( this , params ? , options ? ) ; async getRepository ( 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 = `/_snapshot/${ encodeURIComponent ( params . name . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_snapshot' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async repositoryAnalyze ( this , params ? , options ? ) ; async repositoryAnalyze ( this , params ? , options ? ) ; async repositoryAnalyze ( this , params ? , options ? ) ; async repositoryAnalyze ( this , params ? , options ? ) { const acceptedPath = [ 'repository' ] ; 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 = `/_snapshot/${ encodeURIComponent ( params . repository . toString ( ) ) }/_analyze` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async restore ( this , params , options ? ) ; async restore ( this , params , options ? ) ; async restore ( this , params , options ? ) ; async restore ( this , params , options ? ) { const acceptedPath = [ 'repository' , 'snapshot' ] ; const acceptedBody = [ 'ignore_index_settings' , 'ignore_unavailable' , 'include_aliases' , 'include_global_state' , 'index_settings' , 'indices' , 'partial' , 'rename_pattern' , 'rename_replacement' ] ; 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 = 'POST' ; const path = `/_snapshot/${ encodeURIComponent ( params . repository . toString ( ) ) }/${ encodeURIComponent ( params . snapshot . toString ( ) ) }/_restore` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async status ( this , params ? , options ? ) ; async status ( this , params ? , options ? ) ; async status ( this , params ? , options ? ) ; async status ( this , params ? , options ? ) { const acceptedPath = [ 'repository' , 'snapshot' ] ; 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 . repository != null && params . snapshot != null ) { method = 'GET' ; path = `/_snapshot/${ encodeURIComponent ( params . repository . toString ( ) ) }/${ encodeURIComponent ( params . snapshot . toString ( ) ) }/_status` ; } else if ( params . repository != null ) { method = 'GET' ; path = `/_snapshot/${ encodeURIComponent ( params . repository . toString ( ) ) }/_status` ; } else { method = 'GET' ; path = '/_snapshot/_status' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async verifyRepository ( this , params , options ? ) ; async verifyRepository ( this , params , options ? ) ; async verifyRepository ( this , params , options ? ) ; async verifyRepository ( 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 = 'POST' ; const path = `/_snapshot/${ encodeURIComponent ( params . name . toString ( ) ) }/_verify` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } }