Fixes https://github.com/elastic/kibana/issues/209789 ## Summary For `inputs` type integrations ([docs](https://github.com/elastic/kibana/blob/main/x-pack/platform/plugins/shared/fleet/dev_docs/input_packages.md)), we install all the assets when creating the integration policy and not at integration install time (like for "regular": integrations). However the clean up of assets doesn't happen when removing the integration policy and this leaves around orphaned assets that are not working anymore. - This PR adds a new endpoint that removes the datastream assets ``` DELETE kbn:/api/fleet/epm/packages/{pkgName}/{pkgVersion}/datastream_assets?packagePolicyId={Id} ``` - The new endpoint is called by the UI when removing the integration policy; - Only the datastream assets that match exactly the dataset name are removed; assets that are common across the integration are kept and can only be deleted when the whole integration is uninstalled. Additional changes: - I did some light refactoring of the functions for inputs-type integrations to make the code more readable - Updated the dev_docs about input-type integrations that haven't been touched for long time ### Testing - Install an input-type package, for instance "custom logs" - Check the assets created under the tab `assets` - Check that the package has only this integration policy - Remove the integration policy for the package - a warning is shown: <img width="937" alt="Screenshot 2025-05-09 at 16 58 51" src="https://github.com/user-attachments/assets/0f86ab38-e0a9-47f5-91f5-71b83e17f2e3" /> - Verify that the assets related to the package are cleaned up as well - Try again but with several integration policies - In this case the clean up doesn't happen ### Delete assets when there are two integration policies with different dataset names Dataset names are`udp.generic` and `udp.test` - in the video I deleted policy `udp-2` having dataset name `udp.test` and the relative assets are no longer present: https://github.com/user-attachments/assets/23350051-1b26-4e52-914d-62f784809c80 ### Delete assets when there are two integration policies with same dataset names In this case there are two different policies having the same dataset name `udp.generic`, when deleting the policy there is no warning to remove the assets. In fact they can be deleted only when there is only one remaining policy using them: https://github.com/user-attachments/assets/f75668dd-a4ce-4f5a-ba5d-c99911278dfc ### Checklist - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: jillguyonnet <jill.guyonnet@gmail.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
---|---|---|
.. | ||
examples | ||
linters | ||
output | ||
overlays | ||
scripts | ||
bundle.json | ||
bundle.serverless.json | ||
kibana.info.serverless.yaml | ||
kibana.info.yaml | ||
makefile | ||
package-lock.json | ||
package.json | ||
README.md |
Kibana API reference documentation
Documentation about our OpenAPI bundling workflow and configuration. See Kibana's hosted stateful and serverless docs.
Workflow
The final goal of this workflow is to produce an OpenAPI bundle containing all Kibana's public APIs.
Step 0
OAS from Kibana's APIs are continuously extracted and captured in bundle.json
and bundle.serverless.json
as fully formed OAS documentation. See node scripts/capture_oas_snapshot --help
for more info.
These bundles form the basis of our OpenAPI bundles to which we append and layer extra information before publishing.
Step 1
Append pre-existing bundles not extracted from code using kbn-openapi-bundler
to produce the final resulting bundles.
To add more files into the final bundle, edit the appropriate oas_docs/scripts/merge*.js
files.
Step 2
Apply any final overalys to the document that might include examples or final tweaks (see the "Scripts" section for more details).
Scripts
The oas_docs/scripts
folder contains scripts that point to the source domain-specific OpenAPI bundles and specify additional parameters for producing the final output bundle. Currently, there are the following scripts:
-
merge_ess_oas.js
script produces production an output bundle for ESS -
merge_serverless_oas.js
script produces production an output bundle for Serverless
Output Kibana OpenAPI bundles
The oas_docs/output
folder contains the final resulting Kibana OpenAPI bundles
kibana.yaml
production ready ESS OpenAPI bundlekibana.serverless.yaml
production ready Serverless OpenAPI bundle
Bundling commands
Besides the scripts in the oas_docs/scripts
folder, there is an oas_docs/makefile
to simplify the workflow. Use make help
to see available commands.