-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ingest] Add additional attributes to the Datasources Saved Object (#…
…66127) * add additional properties to ingest-datasources SO * Adjusted Types and test generators * Added datasources migrations to SO * Add `user` object to calls to datasource.create()
- Loading branch information
1 parent
e4c68f1
commit ad39997
Showing
11 changed files
with
103 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
x-pack/plugins/ingest_manager/server/saved_objects/migrations/datasources_v790.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { SavedObjectMigrationFn } from 'kibana/server'; | ||
import { cloneDeep } from 'lodash'; | ||
import { Datasource } from '../../types/models'; | ||
|
||
type Pre790Datasource = Exclude< | ||
Datasource, | ||
'created_at' | 'created_by' | 'updated_at' | 'updated_by' | ||
>; | ||
|
||
export const migrateDatasourcesToV790: SavedObjectMigrationFn< | ||
Pre790Datasource, | ||
Datasource | ||
> = doc => { | ||
const updatedDatasource = cloneDeep(doc); | ||
const defDate = new Date().toISOString(); | ||
|
||
updatedDatasource.attributes.created_by = 'system'; | ||
updatedDatasource.attributes.created_at = updatedDatasource?.updated_at ?? defDate; | ||
updatedDatasource.attributes.updated_by = 'system'; | ||
updatedDatasource.attributes.updated_at = updatedDatasource?.updated_at ?? defDate; | ||
|
||
return updatedDatasource; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters