-
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.
[Logs+] API to create a basic integration (#160777)
## Summary Closes #159991 Fields that have been utilised to fulfil `basic` and `agent` fields can be easily amended if these are incorrect. Multiple datasets are supported, and these can contain more than one type. ## Testing A curl command similar to the following should allow you to hit the API (check the credentials etc): ``` curl -XPOST -u 'elastic:changeme' -H 'kbn-xsrf: something' -d '{ "integrationName": "web_custom_nginx", "datasets": [{"name": "access", "type": "logs"}, {"name": "error", "type": "metrics"}, {"name": "warning", "type":"logs"}] }' 'http://localhost:5601/<BASE_PATH>/api/fleet/epm/custom_integrations' ``` ## History / context - [Prototype learnings](#158552 (comment)) - [Prototype PR](#160003) ## Results / expectations API response (with installed assets): ![Screenshot 2023-07-05 at 16 56 33](https://github.com/elastic/kibana/assets/471693/fc4a0bab-7057-430a-8c03-18dd4ee17ab7) We see the custom integration in "installed integrations" (albeit with a verification warning): ![Screenshot 2023-07-05 at 16 57 14](https://github.com/elastic/kibana/assets/471693/0c9177d2-2871-490f-9b5c-f338e96484c4) We see the custom integration in Discover with the logs explorer profile: ![Screenshot 2023-07-05 at 16 58 20](https://github.com/elastic/kibana/assets/471693/30c556f2-9fcd-416e-8047-5976fc11ffa2) The assets are installed correctly: ![Screenshot 2023-07-05 at 16 59 06](https://github.com/elastic/kibana/assets/471693/abb82632-f619-4fc3-be93-dc6ce97abedd) ![Screenshot 2023-07-05 at 16 59 20](https://github.com/elastic/kibana/assets/471693/ca1c1da5-1e4b-422c-9edb-0f56e0ed3f98) ![Screenshot 2023-07-05 at 16 59 36](https://github.com/elastic/kibana/assets/471693/8bd60d7e-aebc-4833-b423-eba3336fb42c)
- Loading branch information
Showing
21 changed files
with
821 additions
and
3 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
24 changes: 24 additions & 0 deletions
24
x-pack/plugins/fleet/server/services/epm/packages/custom_integrations/assets/cache.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,24 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { setArchiveEntry, setArchiveFilelist } from '../../../archive'; | ||
|
||
interface Assets { | ||
path: string; | ||
content: Buffer; | ||
} | ||
export const cacheAssets = (assets: Assets[], name: string, version: string) => { | ||
const paths = assets.map((asset) => asset.path); | ||
|
||
setArchiveFilelist({ name, version }, paths); | ||
|
||
assets.forEach((asset) => { | ||
setArchiveEntry(asset.path, asset.content); | ||
}); | ||
|
||
return paths; | ||
}; |
Oops, something went wrong.