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 Security { transport : Transport ; constructor ( transport ) { this . transport = transport ; } async authenticate ( this , params ? , options ? ) ; async authenticate ( this , params ? , options ? ) ; async authenticate ( this , params ? , options ? ) ; async authenticate ( 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 = '/_security/_authenticate' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async changePassword ( this , params ? , options ? ) ; async changePassword ( this , params ? , options ? ) ; async changePassword ( this , params ? , options ? ) ; async changePassword ( this , params ? , options ? ) { const acceptedPath = [ 'username' ] ; const acceptedBody = [ 'password' , 'password_hash' ] ; 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 . username != null ) { method = 'PUT' ; path = `/_security/user/${ encodeURIComponent ( params . username . toString ( ) ) }/_password` ; } else { method = 'PUT' ; path = '/_security/user/_password' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async clearApiKeyCache ( this , params , options ? ) ; async clearApiKeyCache ( this , params , options ? ) ; async clearApiKeyCache ( this , params , options ? ) ; async clearApiKeyCache ( this , params , options ? ) { const acceptedPath = [ 'ids' ] ; 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 = `/_security/api_key/${ encodeURIComponent ( params . ids . toString ( ) ) }/_clear_cache` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async clearCachedPrivileges ( this , params , options ? ) ; async clearCachedPrivileges ( this , params , options ? ) ; async clearCachedPrivileges ( this , params , options ? ) ; async clearCachedPrivileges ( this , params , options ? ) { const acceptedPath = [ 'application' ] ; 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 = `/_security/privilege/${ encodeURIComponent ( params . application . toString ( ) ) }/_clear_cache` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async clearCachedRealms ( this , params , options ? ) ; async clearCachedRealms ( this , params , options ? ) ; async clearCachedRealms ( this , params , options ? ) ; async clearCachedRealms ( this , params , options ? ) { const acceptedPath = [ 'realms' ] ; 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 = `/_security/realm/${ encodeURIComponent ( params . realms . toString ( ) ) }/_clear_cache` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async clearCachedRoles ( this , params , options ? ) ; async clearCachedRoles ( this , params , options ? ) ; async clearCachedRoles ( this , params , options ? ) ; async clearCachedRoles ( 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 = `/_security/role/${ encodeURIComponent ( params . name . toString ( ) ) }/_clear_cache` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async clearCachedServiceTokens ( this , params , options ? ) ; async clearCachedServiceTokens ( this , params , options ? ) ; async clearCachedServiceTokens ( this , params , options ? ) ; async clearCachedServiceTokens ( this , params , options ? ) { const acceptedPath = [ 'namespace' , 'service' , '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 = `/_security/service/${ encodeURIComponent ( params . namespace . toString ( ) ) }/${ encodeURIComponent ( params . service . toString ( ) ) }/credential/token/${ encodeURIComponent ( params . name . toString ( ) ) }/_clear_cache` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async createApiKey ( this , params ? , options ? ) ; async createApiKey ( this , params ? , options ? ) ; async createApiKey ( this , params ? , options ? ) ; async createApiKey ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'expiration' , 'name' , 'role_descriptors' , 'metadata' ] ; 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 = '/_security/api_key' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async createServiceToken ( this , params , options ? ) ; async createServiceToken ( this , params , options ? ) ; async createServiceToken ( this , params , options ? ) ; async createServiceToken ( this , params , options ? ) { const acceptedPath = [ 'namespace' , 'service' , 'name' ] ; const querystring = { } ; const body = undefined ; for ( const key in params ) { if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } let method = '' ; let path = '' ; if ( params . namespace != null && params . service != null && params . name != null ) { method = 'PUT' ; path = `/_security/service/${ encodeURIComponent ( params . namespace . toString ( ) ) }/${ encodeURIComponent ( params . service . toString ( ) ) }/credential/token/${ encodeURIComponent ( params . name . toString ( ) ) }` ; } else { method = 'POST' ; path = `/_security/service/${ encodeURIComponent ( params . namespace . toString ( ) ) }/${ encodeURIComponent ( params . service . toString ( ) ) }/credential/token` ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deletePrivileges ( this , params , options ? ) ; async deletePrivileges ( this , params , options ? ) ; async deletePrivileges ( this , params , options ? ) ; async deletePrivileges ( this , params , options ? ) { const acceptedPath = [ 'application' , '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 = `/_security/privilege/${ encodeURIComponent ( params . application . toString ( ) ) }/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteRole ( this , params , options ? ) ; async deleteRole ( this , params , options ? ) ; async deleteRole ( this , params , options ? ) ; async deleteRole ( 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 = `/_security/role/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteRoleMapping ( this , params , options ? ) ; async deleteRoleMapping ( this , params , options ? ) ; async deleteRoleMapping ( this , params , options ? ) ; async deleteRoleMapping ( 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 = `/_security/role_mapping/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteServiceToken ( this , params , options ? ) ; async deleteServiceToken ( this , params , options ? ) ; async deleteServiceToken ( this , params , options ? ) ; async deleteServiceToken ( this , params , options ? ) { const acceptedPath = [ 'namespace' , 'service' , '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 = `/_security/service/${ encodeURIComponent ( params . namespace . toString ( ) ) }/${ encodeURIComponent ( params . service . toString ( ) ) }/credential/token/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async deleteUser ( this , params , options ? ) ; async deleteUser ( this , params , options ? ) ; async deleteUser ( this , params , options ? ) ; async deleteUser ( this , params , options ? ) { const acceptedPath = [ 'username' ] ; 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 = `/_security/user/${ encodeURIComponent ( params . username . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async disableUser ( this , params , options ? ) ; async disableUser ( this , params , options ? ) ; async disableUser ( this , params , options ? ) ; async disableUser ( this , params , options ? ) { const acceptedPath = [ 'username' ] ; 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 = `/_security/user/${ encodeURIComponent ( params . username . toString ( ) ) }/_disable` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async enableUser ( this , params , options ? ) ; async enableUser ( this , params , options ? ) ; async enableUser ( this , params , options ? ) ; async enableUser ( this , params , options ? ) { const acceptedPath = [ 'username' ] ; 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 = `/_security/user/${ encodeURIComponent ( params . username . toString ( ) ) }/_enable` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async enrollKibana ( this , params ? , options ? ) ; async enrollKibana ( this , params ? , options ? ) ; async enrollKibana ( this , params ? , options ? ) ; async enrollKibana ( 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 = '/_security/enroll/kibana' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async enrollNode ( this , params ? , options ? ) ; async enrollNode ( this , params ? , options ? ) ; async enrollNode ( this , params ? , options ? ) ; async enrollNode ( 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 = '/_security/enroll/node' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getApiKey ( this , params ? , options ? ) ; async getApiKey ( this , params ? , options ? ) ; async getApiKey ( this , params ? , options ? ) ; async getApiKey ( 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 = '/_security/api_key' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getBuiltinPrivileges ( this , params ? , options ? ) ; async getBuiltinPrivileges ( this , params ? , options ? ) ; async getBuiltinPrivileges ( this , params ? , options ? ) ; async getBuiltinPrivileges ( 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 = '/_security/privilege/_builtin' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getPrivileges ( this , params ? , options ? ) ; async getPrivileges ( this , params ? , options ? ) ; async getPrivileges ( this , params ? , options ? ) ; async getPrivileges ( this , params ? , options ? ) { const acceptedPath = [ 'application' , '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 . application != null && params . name != null ) { method = 'GET' ; path = `/_security/privilege/${ encodeURIComponent ( params . application . toString ( ) ) }/${ encodeURIComponent ( params . name . toString ( ) ) }` ; } else if ( params . application != null ) { method = 'GET' ; path = `/_security/privilege/${ encodeURIComponent ( params . application . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_security/privilege' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getRole ( this , params ? , options ? ) ; async getRole ( this , params ? , options ? ) ; async getRole ( this , params ? , options ? ) ; async getRole ( 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 = `/_security/role/${ encodeURIComponent ( params . name . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_security/role' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getRoleMapping ( this , params ? , options ? ) ; async getRoleMapping ( this , params ? , options ? ) ; async getRoleMapping ( this , params ? , options ? ) ; async getRoleMapping ( 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 = `/_security/role_mapping/${ encodeURIComponent ( params . name . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_security/role_mapping' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getServiceAccounts ( this , params ? , options ? ) ; async getServiceAccounts ( this , params ? , options ? ) ; async getServiceAccounts ( this , params ? , options ? ) ; async getServiceAccounts ( this , params ? , options ? ) { const acceptedPath = [ 'namespace' , 'service' ] ; 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 . namespace != null && params . service != null ) { method = 'GET' ; path = `/_security/service/${ encodeURIComponent ( params . namespace . toString ( ) ) }/${ encodeURIComponent ( params . service . toString ( ) ) }` ; } else if ( params . namespace != null ) { method = 'GET' ; path = `/_security/service/${ encodeURIComponent ( params . namespace . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_security/service' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getServiceCredentials ( this , params , options ? ) ; async getServiceCredentials ( this , params , options ? ) ; async getServiceCredentials ( this , params , options ? ) ; async getServiceCredentials ( this , params , options ? ) { const acceptedPath = [ 'namespace' , 'service' ] ; 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 = `/_security/service/${ encodeURIComponent ( params . namespace . toString ( ) ) }/${ encodeURIComponent ( params . service . toString ( ) ) }/credential` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getToken ( this , params ? , options ? ) ; async getToken ( this , params ? , options ? ) ; async getToken ( this , params ? , options ? ) ; async getToken ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'grant_type' , 'scope' , 'password' , 'kerberos_ticket' , 'refresh_token' , 'username' ] ; 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 = '/_security/oauth2/token' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getUser ( this , params ? , options ? ) ; async getUser ( this , params ? , options ? ) ; async getUser ( this , params ? , options ? ) ; async getUser ( this , params ? , options ? ) { const acceptedPath = [ 'username' ] ; 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 . username != null ) { method = 'GET' ; path = `/_security/user/${ encodeURIComponent ( params . username . toString ( ) ) }` ; } else { method = 'GET' ; path = '/_security/user' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async getUserPrivileges ( this , params ? , options ? ) ; async getUserPrivileges ( this , params ? , options ? ) ; async getUserPrivileges ( this , params ? , options ? ) ; async getUserPrivileges ( 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 = '/_security/user/_privileges' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async grantApiKey ( this , params , options ? ) ; async grantApiKey ( this , params , options ? ) ; async grantApiKey ( this , params , options ? ) ; async grantApiKey ( this , params , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'api_key' , 'grant_type' , 'access_token' , 'username' , 'password' ] ; 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 = '/_security/api_key/grant' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async hasPrivileges ( this , params ? , options ? ) ; async hasPrivileges ( this , params ? , options ? ) ; async hasPrivileges ( this , params ? , options ? ) ; async hasPrivileges ( this , params ? , options ? ) { const acceptedPath = [ 'user' ] ; const acceptedBody = [ 'application' , 'cluster' , 'index' ] ; 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 . user != null ) { method = body != null ? 'POST' : 'GET' ; path = `/_security/user/${ encodeURIComponent ( params . user . toString ( ) ) }/_has_privileges` ; } else { method = body != null ? 'POST' : 'GET' ; path = '/_security/user/_has_privileges' ; } return await this . transport . request ( { path , method , querystring , body } , options ) ; } async invalidateApiKey ( this , params ? , options ? ) ; async invalidateApiKey ( this , params ? , options ? ) ; async invalidateApiKey ( this , params ? , options ? ) ; async invalidateApiKey ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'id' , 'ids' , 'name' , 'owner' , 'realm_name' , 'username' ] ; 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 = 'DELETE' ; const path = '/_security/api_key' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async invalidateToken ( this , params ? , options ? ) ; async invalidateToken ( this , params ? , options ? ) ; async invalidateToken ( this , params ? , options ? ) ; async invalidateToken ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'token' , 'refresh_token' , 'realm_name' , 'username' ] ; 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 = 'DELETE' ; const path = '/_security/oauth2/token' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putPrivileges ( this , params , options ? ) ; async putPrivileges ( this , params , options ? ) ; async putPrivileges ( this , params , options ? ) ; async putPrivileges ( this , params , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'privileges' ] ; const querystring = { } ; let body = params . body ?? undefined ; for ( const key in params ) { if ( acceptedBody . includes ( key ) ) { body = params [ key ] ; } else if ( acceptedPath . includes ( key ) ) { continue ; } else if ( key !== 'body' ) { querystring [ key ] = params [ key ] ; } } const method = 'PUT' ; const path = '/_security/privilege/' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putRole ( this , params , options ? ) ; async putRole ( this , params , options ? ) ; async putRole ( this , params , options ? ) ; async putRole ( this , params , options ? ) { const acceptedPath = [ 'name' ] ; const acceptedBody = [ 'applications' , 'cluster' , 'global' , 'indices' , 'metadata' , 'run_as' , 'transient_metadata' ] ; 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 = `/_security/role/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putRoleMapping ( this , params , options ? ) ; async putRoleMapping ( this , params , options ? ) ; async putRoleMapping ( this , params , options ? ) ; async putRoleMapping ( this , params , options ? ) { const acceptedPath = [ 'name' ] ; const acceptedBody = [ 'enabled' , 'metadata' , 'roles' , 'rules' , 'run_as' ] ; 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 = `/_security/role_mapping/${ encodeURIComponent ( params . name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async putUser ( this , params , options ? ) ; async putUser ( this , params , options ? ) ; async putUser ( this , params , options ? ) ; async putUser ( this , params , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'username' , 'email' , 'full_name' , 'metadata' , 'password' , 'password_hash' , 'roles' , 'enabled' ] ; 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 = `/_security/user/${ encodeURIComponent ( params . username . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async queryApiKeys ( this , params ? , options ? ) ; async queryApiKeys ( this , params ? , options ? ) ; async queryApiKeys ( this , params ? , options ? ) ; async queryApiKeys ( this , params ? , options ? ) { const acceptedPath = [ ] ; const acceptedBody = [ 'query' , 'from' , 'sort' , 'size' , 'search_after' ] ; 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 = '/_security/_query/api_key' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async samlAuthenticate ( this , params ? , options ? ) ; async samlAuthenticate ( this , params ? , options ? ) ; async samlAuthenticate ( this , params ? , options ? ) ; async samlAuthenticate ( 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 = '/_security/saml/authenticate' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async samlCompleteLogout ( this , params ? , options ? ) ; async samlCompleteLogout ( this , params ? , options ? ) ; async samlCompleteLogout ( this , params ? , options ? ) ; async samlCompleteLogout ( 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 = '/_security/saml/complete_logout' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async samlInvalidate ( this , params ? , options ? ) ; async samlInvalidate ( this , params ? , options ? ) ; async samlInvalidate ( this , params ? , options ? ) ; async samlInvalidate ( 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 = '/_security/saml/invalidate' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async samlLogout ( this , params ? , options ? ) ; async samlLogout ( this , params ? , options ? ) ; async samlLogout ( this , params ? , options ? ) ; async samlLogout ( 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 = '/_security/saml/logout' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async samlPrepareAuthentication ( this , params ? , options ? ) ; async samlPrepareAuthentication ( this , params ? , options ? ) ; async samlPrepareAuthentication ( this , params ? , options ? ) ; async samlPrepareAuthentication ( 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 = '/_security/saml/prepare' ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } async samlServiceProviderMetadata ( this , params ? , options ? ) ; async samlServiceProviderMetadata ( this , params ? , options ? ) ; async samlServiceProviderMetadata ( this , params ? , options ? ) ; async samlServiceProviderMetadata ( this , params ? , options ? ) { const acceptedPath = [ 'realm_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 ] ; } } const method = 'GET' ; const path = `/_security/saml/metadata/${ encodeURIComponent ( params . realm_name . toString ( ) ) }` ; return await this . transport . request ( { path , method , querystring , body } , options ) ; } }