import { CustomLink , CustomLinkES , } from '../../../../common/custom_link/custom_link_types' ; import { Setup } from '../../../lib/helpers/setup_request' ; import { toESFormat } from './helper' ; import { APMIndexDocumentParams } from '../../../lib/helpers/create_es_client/create_internal_es_client' ; export function createOrUpdateCustomLink ( { customLinkId , customLink , setup , } ) { const { internalClient , indices } = setup ; const params = { refresh : true , index : indices . apmCustomLinkIndex , body : { '@timestamp' : Date . now ( ) , ... toESFormat ( customLink ) , } , } ; if ( customLinkId ) { params . id = customLinkId ; } return internalClient . index ( 'create_or_update_custom_link' , params ) ; }