mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
This commit is contained in:
parent
b752da9c23
commit
f8cb87be7d
3 changed files with 10 additions and 6 deletions
|
@ -13,10 +13,10 @@ export const outputType = {
|
|||
Elasticsearch: 'elasticsearch',
|
||||
} as const;
|
||||
|
||||
export const DEFAULT_OUTPUT_ID = 'default';
|
||||
export const DEFAULT_OUTPUT_ID = 'fleet-default-output';
|
||||
|
||||
export const DEFAULT_OUTPUT: NewOutput = {
|
||||
name: DEFAULT_OUTPUT_ID,
|
||||
name: 'default',
|
||||
is_default: true,
|
||||
is_default_monitoring: true,
|
||||
type: outputType.Elasticsearch,
|
||||
|
|
|
@ -46,6 +46,7 @@ export {
|
|||
DEFAULT_AGENT_POLICY,
|
||||
DEFAULT_FLEET_SERVER_AGENT_POLICY,
|
||||
DEFAULT_OUTPUT,
|
||||
DEFAULT_OUTPUT_ID,
|
||||
DEFAULT_PACKAGES,
|
||||
PACKAGE_POLICY_DEFAULT_INDEX_PRIVILEGES,
|
||||
AGENT_POLICY_DEFAULT_MONITORING_DATASETS,
|
||||
|
|
|
@ -9,7 +9,7 @@ import type { SavedObject, SavedObjectsClientContract } from 'src/core/server';
|
|||
import uuid from 'uuid/v5';
|
||||
|
||||
import type { NewOutput, Output, OutputSOAttributes } from '../types';
|
||||
import { DEFAULT_OUTPUT, OUTPUT_SAVED_OBJECT_TYPE } from '../constants';
|
||||
import { DEFAULT_OUTPUT, DEFAULT_OUTPUT_ID, OUTPUT_SAVED_OBJECT_TYPE } from '../constants';
|
||||
import { decodeCloudId, normalizeHostsForAgents, SO_SEARCH_LIMIT } from '../../common';
|
||||
import { OutputUnauthorizedError } from '../errors';
|
||||
|
||||
|
@ -75,7 +75,10 @@ class OutputService {
|
|||
is_default_monitoring: !defaultMonitoringOutput,
|
||||
} as NewOutput;
|
||||
|
||||
return await this.create(soClient, newDefaultOutput);
|
||||
return await this.create(soClient, newDefaultOutput, {
|
||||
id: DEFAULT_OUTPUT_ID,
|
||||
overwrite: true,
|
||||
});
|
||||
}
|
||||
|
||||
return defaultOutput;
|
||||
|
@ -118,7 +121,7 @@ class OutputService {
|
|||
public async create(
|
||||
soClient: SavedObjectsClientContract,
|
||||
output: NewOutput,
|
||||
options?: { id?: string; fromPreconfiguration?: boolean }
|
||||
options?: { id?: string; fromPreconfiguration?: boolean; overwrite?: boolean }
|
||||
): Promise<Output> {
|
||||
const data: OutputSOAttributes = { ...output };
|
||||
|
||||
|
@ -155,7 +158,7 @@ class OutputService {
|
|||
}
|
||||
|
||||
const newSo = await soClient.create<OutputSOAttributes>(SAVED_OBJECT_TYPE, data, {
|
||||
overwrite: options?.fromPreconfiguration,
|
||||
overwrite: options?.overwrite || options?.fromPreconfiguration,
|
||||
id: options?.id ? outputIdToUuid(options.id) : undefined,
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue