[RAM] Adds Bulk Edit API to rulesClient#126904
Conversation
…ithub.com/vitaliidm/kibana into security-solution/bulk-update-rulesClient
|
@elasticmachine merge upstream |
# Conflicts: # x-pack/plugins/alerting/server/routes/index.ts # x-pack/plugins/alerting/server/rules_client.mock.ts # x-pack/plugins/alerting/server/rules_client/audit_events.ts # x-pack/plugins/alerting/server/rules_client/rules_client.ts
…dex.ts Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
…dex.ts Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
…ypted_saved_objects_api.ts Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
…dex.ts Co-authored-by: Aleh Zasypkin <aleh.zasypkin@gmail.com>
| async ({ key: [ruleType, consumer] }) => { | ||
| this.ruleTypeRegistry.ensureRuleTypeEnabled(ruleType); | ||
|
|
||
| await this.authorization.ensureAuthorized({ |
There was a problem hiding this comment.
We audit these attempts on individual update. Should we also be auditing this action?
There was a problem hiding this comment.
Good catch! Thank you, I've added audit of the error
| // validate schedule interval | ||
| if (attributes.schedule.interval) { | ||
| const intervalInMs = parseDuration(attributes.schedule.interval as string); | ||
| if (intervalInMs < this.minimumScheduleIntervalInMs) { |
There was a problem hiding this comment.
We've updated this logic to add an enforce option, so we throw if enforce = true and log a warning if it's false
if (intervalInMs < this.minimumScheduleIntervalInMs && this.minimumScheduleInterval.enforce) {
throw Boom.badRequest(
`Error creating rule: the interval is less than the allowed minimum interval of ${this.minimumScheduleInterval.value}`
);
}
if (intervalInMs < this.minimumScheduleIntervalInMs && !this.minimumScheduleInterval.enforce) {
this.logger.warn(
`Rule schedule interval (${data.schedule.interval}) for "${createdAlert.attributes.alertTypeId}" rule type with ID "${createdAlert.id}" is less than the minimum value (${this.minimumScheduleInterval.value}). Running rules at this interval may impact alerting performance. Set "xpack.alerting.rules.minimumScheduleInterval.enforce" to true to prevent creation of these rules.`
);
}
There was a problem hiding this comment.
thanks for letting know about recent changes in interval validation. I've updated it
x-pack/test/alerting_api_integration/spaces_only/tests/alerting/bulk_edit.ts
Show resolved
Hide resolved
mikecote
left a comment
There was a problem hiding this comment.
Looking good! I finished my first pass to get this PR reviewed. I'll review tests, pull down, etc next time but wanted to get my questions / some feedback out first.
...k/plugins/alerting/server/invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation.ts
Show resolved
Hide resolved
...k/plugins/alerting/server/invalidate_pending_api_keys/bulk_mark_api_keys_for_invalidation.ts
Show resolved
Hide resolved
# Conflicts: # x-pack/test/alerting_api_integration/security_and_spaces/alerting/bulk_edit.ts # x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/index.ts
|
@elasticmachine merge upstream |
mikecote
left a comment
There was a problem hiding this comment.
Tested locally, changes LGTM!
Thanks, @mikecote
Here is a commit. Please let me know if it makes sense. |
Yup the change makes sense and looks good 👍 , thanks! |
💚 Build SucceededMetrics [docs]Public APIs missing comments
Unknown metric groupsAPI count
History
To update your PR or re-run it, just comment with: cc @vitaliidm |
Addresses
Summary
Checklist
Delete any items that are not applicable to this PR.
Release note
Adds new
bulkEditmethod to alerting rulesClient and internal _bulk_edit API, that allow bulk editing of rules.