Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ResponseOps][Rules] Version disable rule route #188659

Merged
merged 7 commits into from
Jul 25, 2024

Conversation

adcoelho
Copy link
Contributor

Summary

Parent Issue: #187572

Versions the POST /rule/{id}/_disable endpoint.

Checklist

@adcoelho adcoelho added release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework v8.16.0 labels Jul 18, 2024
@adcoelho adcoelho requested review from cnasikas and umbopepato July 18, 2024 14:01
@adcoelho adcoelho self-assigned this Jul 18, 2024
@adcoelho adcoelho requested a review from a team as a code owner July 18, 2024 14:01
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@adcoelho adcoelho requested a review from JiaweiWu July 18, 2024 14:09
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @adcoelho

Copy link
Member

@umbopepato umbopepato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected, LGTM! 🚀

image

@@ -585,6 +585,16 @@ describe('disable()', () => {
expect(taskManager.removeIfExists).not.toHaveBeenCalledWith();
});

test('throws if API params do not match the schema', async () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super nit: should we also validate the untrack param?


import { schema } from '@kbn/config-schema';

export const disableRuleRequestBodySchema = schema.nullable(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: we can give this entire body schema a default value so we wouldn't have to check for null in the route level

const { id } = req.params;
const { untrack = false } = req.body || {};
const { id }: DisableRuleRequestParamsV1 = req.params;
const body: DisableRuleRequestBodyV1 = req.body || {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above is referring to this

try {
await rulesClient.disable({ id, untrack });
await rulesClient.disable(disableParams);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's rename this to disableRule, so disable.ts -> disable_rule.ts

@adcoelho adcoelho requested a review from a team as a code owner July 24, 2024 09:38
@adcoelho adcoelho requested a review from maximpn July 24, 2024 09:38
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @adcoelho

Copy link
Contributor

@maximpn maximpn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@adcoelho adcoelho merged commit 425d6b1 into elastic:main Jul 25, 2024
40 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants