Conversation
8536609 to
56e33a9
Compare
make uuid type generic
75df7ea to
8bbfa52
Compare
3ecddae to
aeb5c52
Compare
marshallmain
left a comment
There was a problem hiding this comment.
Security solution changes generally LGTM now, thanks for making the updates! I noticed a few last type casts that look like they're leftovers that can be removed now.
| }, | ||
| }, | ||
| ], | ||
| ] as unknown as RuleAction[], |
There was a problem hiding this comment.
This type cast and the 2 below seem unnecessary now that uuid is optional?
banderror
left a comment
There was a problem hiding this comment.
@ersin-erdal Fantastic! This is so much simpler than the previous implementations. Just one nit comment for your consideration, otherwise LGTM 👍
| actionRef: '1', | ||
| actionTypeId: '1', | ||
| params: { foo: true }, | ||
| uuid: expect.any(String), |
There was a problem hiding this comment.
@ersin-erdal Sorry, what I meant is checking that the uuid must not be an empty string. I believe the assertion should throw if uuid: '', but expect.any(String) would not throw in this case. Anyway, that's a rather nitpicky comment.
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: cc @ersin-erdal |
WafaaNasr
left a comment
There was a problem hiding this comment.
Platform changes LGTM!
Great work, Thanks @ersin-erdal for clarifying why the uuid is optional in some places :) in the PR description.
Resolves: #149587
This PR intends to add a
uuidfield to the rule actions.A migration script add a uuid to all the existing actions.
Create method of the rule_client (and create endpoint) accepts a rule.actions data without uuid and adds a new uuid to the all actions.
Update and bulkEdit methods of the rule_client (and update and bulk_edit endpoints) accepts rule.actions data with and without uuid. As a user can add a new action to an existing rule, UI should send the uuid of an existing action back then update and bulkEdit methods would add the uuid's to all the new actions.
All the get methods return uuid in the actions.
Since we don't query by the uuid of an action, I marked actions as
dynamic: falsein the mappings so we don't need to add the uuid to the mappings.I tried not to modify the legacy APIs, therefore i used some type castings there, but please let me know if they need to be modified as well.
To verify:
Create a rule with some actions and save.
Then add some more actions and expect all of them to have an auto-generated uuid field and still work as they were.
Note:
Initialy uuid in
RuleActionwas not optional but as it created tons of changes on types and tests we decided to add it optional. It is still required inRawRuleActionwhich reflects the action object in Kibana SO.There are 3 APIs in the
rulesClientthat adds a uuid: create, update, bulkEdit. All of them generates a uuid if there isn't any in an action, and since there is amigration script to add uuid to the existing actions, all the actions would have a uuid...