Commit graph

2 commits

Author SHA1 Message Date
Kevin Lacabane
ae6c1f6213
[eem] update builtin definitions (#188351)
## Summary

Update built in definitions on plugin start. The update overwrites index
templates and ingest pipelines with the latest versions but has to
delete the transforms since we can only update a subset of settings in
the [update
api](https://www.elastic.co/guide/en/elasticsearch/reference/current/update-transform.html)
which does not include the aggregations.

## Testing
### api tests
Since the upgrade logic happens in plugin startup method we cannot
directly trigger it from api tests without some tweaks. I've added a
[fixture
plugin](a87ae8b210/x-pack/test/api_integration/apis/entity_manager/fixture_plugin/server/plugin.ts)
that is launched in the entity manager test server, this plugin creates
a test route exposing the upgrade api which can then be called in api
tests.

### manual
- install builtin definitions `PUT
kbn:/internal/api/entities/managed/enablement`
- bump builtin [service
definition](https://github.com/elastic/kibana/blob/main/x-pack/plugins/observability_solution/entity_manager/server/lib/entities/built_in/services.ts#L23)
version
- restart kibana server
- logs should output `[INFO ][plugins.entityManager] Updating built-in
entity definition [builtin_services] from v0.1.0 to v<new version>`
- `GET kbn:/internal/api/entities/definition` should output the new
definition
- verify latest version of definition components are installed

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-15 17:00:31 +02:00
Kevin Lacabane
f918fdc4da
[eem] update enable/disable flow (#188532)
Updates to the EEM enable/disable endpoint:
- disable endpoint was not verifying the current user permissions, it
was just pulling the api key and removing all resources if the key was
valid. We're now checking that current user can stop/delete resources
and not using the api key at all
- the enable/disable flow now use use current user (the api caller)
clients instead of clients scoped to the api key
- updated apikey calls made with the internal user instead of the
current user
- refactored the privileges file to make it clearer
- created entity manager api tests config with enablement flow tests

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-24 15:13:21 +02:00