Skip to content

Commit

Permalink
migrate siem consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
gmmorris committed Sep 15, 2020
1 parent 696a7cb commit b32e62e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
17 changes: 17 additions & 0 deletions x-pack/plugins/alerts/server/saved_objects/migrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,23 @@ describe('7.10.0', () => {
});
});

test('migrates the consumer for siem', () => {
const migration710 = getMigrations(encryptedSavedObjectsSetup)['7.10.0'];
const alert = getMockData({
consumer: 'securitySolution',
});
expect(migration710(alert, { log })).toMatchObject({
...alert,
attributes: {
...alert.attributes,
consumer: 'siem',
meta: {
versionApiKeyLastmodified: 'pre-7.10.0',
},
},
});
});

test('migrates the consumer for alerting', () => {
const migration710 = getMigrations(encryptedSavedObjectsSetup)['7.10.0'];
const alert = getMockData({
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/alerts/server/saved_objects/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import {
} from '../../../../../src/core/server';
import { RawAlert } from '../types';
import { EncryptedSavedObjectsPluginSetup } from '../../../encrypted_saved_objects/server';
import {
APP_ID as SIEM_APP_ID,
SERVER_APP_ID as SIEM_SERVER_APP_ID,
} from '../../../security_solution/common/constants';

export const LEGACY_LAST_MODIFIED_VERSION = 'pre-7.10.0';

Expand Down Expand Up @@ -45,6 +49,7 @@ const consumersToChange: Map<string, string> = new Map(
Object.entries({
alerting: 'alerts',
metrics: 'infrastructure',
[SIEM_APP_ID]: SIEM_SERVER_APP_ID,
})
);
function markAsLegacyAndChangeConsumer(
Expand Down

0 comments on commit b32e62e

Please sign in to comment.