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] Create the rule params package #196971

Merged
merged 12 commits into from
Oct 23, 2024

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Oct 19, 2024

Summary

This PR creates a package containing the schema of the params of all rule types. It starts as schema.recordOf(schema.string(), schema.maybe(schema.any())) which is the current one. In subsequent PRs, the schema will be updated to schema.oneOf([apmRuleType, esQueryRuleType, ....]). I also substituted the definition of params in the alerting plugin with the params exported from the package.

Towards: #187356
Fixes: #195183

For maintainers

@cnasikas cnasikas added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v9.0.0 Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) v8.17.0 labels Oct 19, 2024
@cnasikas cnasikas self-assigned this Oct 19, 2024
@cnasikas cnasikas requested a review from a team as a code owner October 19, 2024 08:43
@elasticmachine
Copy link
Contributor

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

@cnasikas cnasikas added the release_note:skip Skip the PR/issue when compiling release notes label Oct 19, 2024
…t --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions --include-path /api/security/role --include-path /api/spaces --include-path /api/fleet --update'
@@ -2413,7 +2414,6 @@
"consumer",
"schedule",
"actions",
"params",
Copy link
Member Author

Choose a reason for hiding this comment

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

Why it get removed from the required? What is it because it has a defaultValue?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd would think it's because of the default value, yes. You could try removing it and checking the bundle by yourself. Just follow the instructions in x-pack/plugins/alerting/docs/openapi/README.md

Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you add the defaultValue? Shouldn't it throw if it's missing in the request?

@cnasikas cnasikas requested a review from jcger October 22, 2024 15:20
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/response-ops-rule-params - 8 +8
Unknown metric groups

API count

id before after diff
@kbn/response-ops-rule-params - 8 +8

History

cc @cnasikas

@cnasikas cnasikas merged commit a7a81c2 into elastic:main Oct 23, 2024
40 checks passed
@cnasikas cnasikas deleted the rule_params branch October 23, 2024 06:44
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11474523248

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Oct 23, 2024
## Summary

This PR creates a package containing the schema of the params of all
rule types. It starts as `schema.recordOf(schema.string(),
schema.maybe(schema.any()))` which is the current one. In subsequent
PRs, the schema will be updated to `schema.oneOf([apmRuleType,
esQueryRuleType, ....])`. I also substituted the definition of `params`
in the alerting plugin with the `params` exported from the package.

Towards: elastic#187356
Fixes: elastic#195183

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)
- [ ] This will appear in the **Release Notes** and follow the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit a7a81c2)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Oct 23, 2024
…197367)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ResponseOps][Rules] Create the rule params package
(#196971)](#196971)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Christos
Nasikas","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-23T06:44:38Z","message":"[ResponseOps][Rules]
Create the rule params package (#196971)\n\n## Summary\r\n\r\nThis PR
creates a package containing the schema of the params of all\r\nrule
types. It starts as
`schema.recordOf(schema.string(),\r\nschema.maybe(schema.any()))` which
is the current one. In subsequent\r\nPRs, the schema will be updated to
`schema.oneOf([apmRuleType,\r\nesQueryRuleType, ....])`. I also
substituted the definition of `params`\r\nin the alerting plugin with
the `params` exported from the package.\r\n\r\nTowards:
https://github.com/elastic/kibana/issues/187356\r\nFixes:
https://github.com/elastic/kibana/issues/195183\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"a7a81c28973fd9b5bfc585b8e9b3cb7c5a86eb0b","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","v9.0.0","Feature:Alerting/RulesFramework","backport:prev-minor","v8.17.0"],"title":"[ResponseOps][Rules]
Create the rule params
package","number":196971,"url":"https://github.com/elastic/kibana/pull/196971","mergeCommit":{"message":"[ResponseOps][Rules]
Create the rule params package (#196971)\n\n## Summary\r\n\r\nThis PR
creates a package containing the schema of the params of all\r\nrule
types. It starts as
`schema.recordOf(schema.string(),\r\nschema.maybe(schema.any()))` which
is the current one. In subsequent\r\nPRs, the schema will be updated to
`schema.oneOf([apmRuleType,\r\nesQueryRuleType, ....])`. I also
substituted the definition of `params`\r\nin the alerting plugin with
the `params` exported from the package.\r\n\r\nTowards:
https://github.com/elastic/kibana/issues/187356\r\nFixes:
https://github.com/elastic/kibana/issues/195183\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"a7a81c28973fd9b5bfc585b8e9b3cb7c5a86eb0b"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196971","number":196971,"mergeCommit":{"message":"[ResponseOps][Rules]
Create the rule params package (#196971)\n\n## Summary\r\n\r\nThis PR
creates a package containing the schema of the params of all\r\nrule
types. It starts as
`schema.recordOf(schema.string(),\r\nschema.maybe(schema.any()))` which
is the current one. In subsequent\r\nPRs, the schema will be updated to
`schema.oneOf([apmRuleType,\r\nesQueryRuleType, ....])`. I also
substituted the definition of `params`\r\nin the alerting plugin with
the `params` exported from the package.\r\n\r\nTowards:
https://github.com/elastic/kibana/issues/187356\r\nFixes:
https://github.com/elastic/kibana/issues/195183\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)\r\n-
[ ] This will appear in the **Release Notes** and follow
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"a7a81c28973fd9b5bfc585b8e9b3cb7c5a86eb0b"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Christos Nasikas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) 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.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ResponseOps][Rules] Create a rule's parameters package.
4 participants