kibana/test/common/services/es_archiver.ts
Spencer b4de7f47a5
[esArchiver] upgrade to new ES client (#89874) (#90109)
Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-02 19:21:29 -07:00

43 lines
1.2 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* and the Server Side Public License, v 1; you may not use this file except in
* compliance with, at your election, the Elastic License or the Server Side
* Public License, v 1.
*/
import { EsArchiver } from '@kbn/es-archiver';
import { FtrProviderContext } from '../ftr_provider_context';
// @ts-ignore not TS yet
import * as KibanaServer from './kibana_server';
export function EsArchiverProvider({ getService }: FtrProviderContext): EsArchiver {
const config = getService('config');
const client = getService('es');
const log = getService('log');
const kibanaServer = getService('kibanaServer');
const retry = getService('retry');
if (!config.get('esArchiver')) {
throw new Error(`esArchiver can't be used unless you specify it's config in your config file`);
}
const dataDir = config.get('esArchiver.directory');
const esArchiver = new EsArchiver({
client,
dataDir,
log,
kbnClient: kibanaServer,
});
KibanaServer.extendEsArchiver({
esArchiver,
kibanaServer,
retry,
defaults: config.get('uiSettings.defaults'),
});
return esArchiver;
}