diff --git a/docs/api-generated/rules/rule-apis-passthru.asciidoc b/docs/api-generated/rules/rule-apis-passthru.asciidoc index 2b193c2c20201..45a6ab4c4f43a 100644 --- a/docs/api-generated/rules/rule-apis-passthru.asciidoc +++ b/docs/api-generated/rules/rule-apis-passthru.asciidoc @@ -18,10 +18,52 @@ Any modifications made to this file will be overwritten.

Alerting

Alerting

+
+
+ Up +
delete /s/{spaceId}/api/alerting/rule/{ruleId}
+
Deletes a rule. (deleteRule)
+
You must have all privileges for the appropriate Kibana features, depending on the consumer and rule_type_id of the rule you're deleting. For example, the Management > Stack Rules feature, Analytics > Discover or Machine Learning features, Observability, or Security features. WARNING: After you delete a rule, you cannot recover it.
+ +

Path parameters

+
+
ruleId (required)
+ +
Path Parameter — An identifier for the rule. default: null
spaceId (required)
+ +
Path Parameter — An identifier for the space. If /s/ and the identifier are omitted from the path, the default space is used. default: null
+
+ + + +

Request headers

+
+
kbn-xsrf (required)
+ +
Header Parameter — default: null
+ +
+ + + + + + + + +

Responses

+

204

+ Indicates a successful call. + +
+
Up @@ -76,17 +118,17 @@ Any modifications made to this file will be overwritten.

Example data

Content-Type: application/json
{
-  "per_page" : 2,
-  "total" : 7,
+  "per_page" : 6,
+  "total" : 1,
   "data" : [ {
     "throttle" : "10m",
     "created_at" : "2022-12-05T23:36:58.284Z",
     "last_run" : {
       "alerts_count" : {
-        "new" : 0,
         "ignored" : 6,
-        "recovered" : 1,
-        "active" : 5
+        "new" : 1,
+        "recovered" : 5,
+        "active" : 0
       },
       "outcome_msg" : "outcome_msg",
       "warning" : "warning",
@@ -136,10 +178,10 @@ Any modifications made to this file will be overwritten.
     "created_at" : "2022-12-05T23:36:58.284Z",
     "last_run" : {
       "alerts_count" : {
-        "new" : 0,
         "ignored" : 6,
-        "recovered" : 1,
-        "active" : 5
+        "new" : 1,
+        "recovered" : 5,
+        "active" : 0
       },
       "outcome_msg" : "outcome_msg",
       "warning" : "warning",
@@ -185,7 +227,7 @@ Any modifications made to this file will be overwritten.
     } ],
     "consumer" : "alerts"
   } ],
-  "page" : 5
+  "page" : 0
 }

Produces

@@ -201,121 +243,357 @@ Any modifications made to this file will be overwritten. findRules_200_response

+
+
+ Up +
get /s/{spaceId}/api/alerting/rule/{ruleId}
+
Retrieve a rule by its identifier. (getRule)
+
You must have read privileges for the appropriate Kibana features, depending on the consumer and rule_type_id of the rules you're seeking. For example, the Management > Stack Rules feature, Analytics > Discover and Machine Learning features, Observability features, or Security features. To get rules associated with the Stack Monitoring feature, use the monitoring_user built-in role.
+ +

Path parameters

+
+
ruleId (required)
+ +
Path Parameter — An identifier for the rule. default: null
spaceId (required)
+ +
Path Parameter — An identifier for the space. If /s/ and the identifier are omitted from the path, the default space is used. default: null
+
+ + + + + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "throttle" : "10m",
+  "created_at" : "2022-12-05T23:36:58.284Z",
+  "last_run" : {
+    "alerts_count" : {
+      "ignored" : 6,
+      "new" : 1,
+      "recovered" : 5,
+      "active" : 0
+    },
+    "outcome_msg" : "outcome_msg",
+    "warning" : "warning",
+    "outcome" : "succeeded"
+  },
+  "params" : {
+    "key" : ""
+  },
+  "created_by" : "elastic",
+  "enabled" : true,
+  "muted_alert_ids" : [ "muted_alert_ids", "muted_alert_ids" ],
+  "rule_type_id" : "monitoring_alert_cluster_health",
+  "tags" : [ "tags", "tags" ],
+  "api_key_owner" : "elastic",
+  "schedule" : {
+    "interval" : "1m"
+  },
+  "notify_when" : "onActiveAlert",
+  "next_run" : "2022-12-06T00:14:43.818Z",
+  "updated_at" : "2022-12-05T23:36:58.284Z",
+  "execution_status" : {
+    "last_execution_date" : "2022-12-06T00:13:43.89Z",
+    "last_duration" : 55,
+    "status" : "ok"
+  },
+  "name" : "cluster_health_rule",
+  "updated_by" : "elastic",
+  "scheduled_task_id" : "b530fed0-74f5-11ed-9801-35303b735aef",
+  "id" : "b530fed0-74f5-11ed-9801-35303b735aef",
+  "mute_all" : false,
+  "actions" : [ {
+    "id" : "9dca3e00-74f5-11ed-9801-35303b735aef",
+    "params" : {
+      "key" : ""
+    },
+    "group" : "default"
+  }, {
+    "id" : "9dca3e00-74f5-11ed-9801-35303b735aef",
+    "params" : {
+      "key" : ""
+    },
+    "group" : "default"
+  } ],
+  "consumer" : "alerts"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. + + +

Responses

+

200

+ Indicates a successful call. + rule_response_properties +
+
+
+
+ Up +
put /s/{spaceId}/api/alerting/rule/{ruleId}
+
Updates the attributes for a rule. (updateRule)
+
You must have all privileges for the appropriate Kibana features, depending on the consumer and rule_type_id of the rule you're updating. For example, you must have privileges for the Management > Stack rules feature, Analytics > Discover and Machine Learning features, Observability features, or Security features. If the rule has actions, you must also have read privileges for the Management > Actions and Connectors feature. NOTE: This API supports only token-based authentication. When you update a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If you have different privileges than the user that created or most recently updated the rule, you might change its behavior. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values.
+ +

Path parameters

+
+
ruleId (required)
+ +
Path Parameter — An identifier for the rule. default: null
spaceId (required)
+ +
Path Parameter — An identifier for the space. If /s/ and the identifier are omitted from the path, the default space is used. default: null
+
+ +

Consumes

+ This API call consumes the following media types via the Content-Type request header: + + +

Request body

+
+
update_rule_request update_rule_request (required)
+ +
Body Parameter
+ +
+ +

Request headers

+
+
kbn-xsrf (required)
+ +
Header Parameter — default: null
+ +
+ + + +

Return type

+ + + + +

Example data

+
Content-Type: application/json
+
{
+  "throttle" : "10m",
+  "created_at" : "2022-12-05T23:36:58.284Z",
+  "last_run" : {
+    "alerts_count" : {
+      "ignored" : 6,
+      "new" : 1,
+      "recovered" : 5,
+      "active" : 0
+    },
+    "outcome_msg" : "outcome_msg",
+    "warning" : "warning",
+    "outcome" : "succeeded"
+  },
+  "params" : {
+    "key" : ""
+  },
+  "created_by" : "elastic",
+  "enabled" : true,
+  "muted_alert_ids" : [ "muted_alert_ids", "muted_alert_ids" ],
+  "rule_type_id" : "monitoring_alert_cluster_health",
+  "tags" : [ "tags", "tags" ],
+  "api_key_owner" : "elastic",
+  "schedule" : {
+    "interval" : "1m"
+  },
+  "notify_when" : "onActiveAlert",
+  "next_run" : "2022-12-06T00:14:43.818Z",
+  "updated_at" : "2022-12-05T23:36:58.284Z",
+  "execution_status" : {
+    "last_execution_date" : "2022-12-06T00:13:43.89Z",
+    "last_duration" : 55,
+    "status" : "ok"
+  },
+  "name" : "cluster_health_rule",
+  "updated_by" : "elastic",
+  "scheduled_task_id" : "b530fed0-74f5-11ed-9801-35303b735aef",
+  "id" : "b530fed0-74f5-11ed-9801-35303b735aef",
+  "mute_all" : false,
+  "actions" : [ {
+    "id" : "9dca3e00-74f5-11ed-9801-35303b735aef",
+    "params" : {
+      "key" : ""
+    },
+    "group" : "default"
+  }, {
+    "id" : "9dca3e00-74f5-11ed-9801-35303b735aef",
+    "params" : {
+      "key" : ""
+    },
+    "group" : "default"
+  } ],
+  "consumer" : "alerts"
+}
+ +

Produces

+ This API call produces the following media types according to the Accept request header; + the media type will be conveyed by the Content-Type response header. + + +

Responses

+

200

+ Indicates a successful call. + rule_response_properties +
+

Models

[ Jump to Methods ]

Table of Contents

    +
  1. actions_inner -
  2. findRules_200_response -
  3. -
  4. findRules_200_response_data_inner -
  5. -
  6. findRules_200_response_data_inner_actions_inner -
  7. -
  8. findRules_200_response_data_inner_execution_status -
  9. -
  10. findRules_200_response_data_inner_last_run -
  11. -
  12. findRules_200_response_data_inner_last_run_alerts_count -
  13. -
  14. findRules_200_response_data_inner_schedule -
  15. findRules_has_reference_parameter -
  16. findRules_search_fields_parameter -
  17. +
  18. notify_when -
  19. +
  20. rule_response_properties - Rule response properties
  21. +
  22. rule_response_properties_execution_status -
  23. +
  24. rule_response_properties_last_run -
  25. +
  26. rule_response_properties_last_run_alerts_count -
  27. +
  28. schedule -
  29. +
  30. update_rule_request - Update rule request
+
+

actions_inner - Up

+
+
+
group (optional)
String The group name for the actions. If you don't need to group actions, set to default.
+
id (optional)
String The identifier for the connector saved object.
+
params (optional)
map[String, oas_any_type_not_mapped] The parameters for the action, which are sent to the connector. The params are handled as Mustache templates and passed a default set of context.
+
+

findRules_200_response - Up

-
data (optional)
+
data (optional)
page (optional)
per_page (optional)
total (optional)
-

findRules_200_response_data_inner - Up

+

findRules_has_reference_parameter - Up

-
actions (optional)
-
api_key_owner (optional)
-
consumer (optional)
String The application or feature that owns the rule. For example, alerts, apm, discover, infrastructure, logs, metrics, ml, monitoring, securitySolution, siem, stackAlerts, or uptime.
-
created_at (optional)
Date The date and time that the rule as created. format: date-time
-
created_by (optional)
String The identifier for the user that created the rule.
-
enabled (optional)
Boolean Indicates whether the rule is currently enabled.
-
execution_status (optional)
-
id (optional)
String The identifier for the rule.
-
last_run (optional)
-
muted_alert_ids (optional)
-
mute_all (optional)
-
name (optional)
String The name of the rule.
-
next_run (optional)
Date format: date-time
-
notify_when (optional)
String Indicates how often alerts generate actions.
-
Enum:
-
onActionGroupChange
onActiveAlert
onThrottleInterval
-
params (optional)
map[String, oas_any_type_not_mapped] The parameters for the rule.
-
rule_type_id (optional)
String The identifier for the type of rule. For example, .es-query, .index-threshold, logs.alert.document.count, monitoring_alert_cluster_health, siem.thresholdRule, or xpack.ml.anomaly_detection_alert.
-
schedule (optional)
-
scheduled_task_id (optional)
-
tags (optional)
array[String] The tags for the rule.
-
throttle (optional)
String The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if notify_when is set to onThrottleInterval. It is specified in seconds, minutes, hours, or days.
-
updated_at (optional)
String The date and time that the rule was updated most recently.
-
updated_by (optional)
String The identifier for the user that updated this rule most recently.
+
id (optional)
+
type (optional)
-

findRules_200_response_data_inner_actions_inner - Up

+

findRules_search_fields_parameter - Up

-
group (optional)
String The group name for the actions.
-
id (optional)
String The identifier for the connector saved object.
-
params (optional)
map[String, oas_any_type_not_mapped] The parameters for the action, which are sent to the connector.
+
+
+
+

notify_when - Up

+
Indicates how often alerts generate actions. Valid values include: onActionGroupChange: Actions run when the alert status changes; onActiveAlert: Actions run when the alert becomes active and at each check interval while the rule conditions are met; onThrottleInterval: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met.
+
+
+
+
+

rule_response_properties - Rule response properties Up

+
+
+
actions
+
api_key_owner
+
consumer
String The application or feature that owns the rule. For example, alerts, apm, discover, infrastructure, logs, metrics, ml, monitoring, securitySolution, siem, stackAlerts, or uptime.
+
created_at
Date The date and time that the rule was created. format: date-time
+
created_by
String The identifier for the user that created the rule.
+
enabled
Boolean Indicates whether the rule is currently enabled.
+
execution_status
+
id
String The identifier for the rule.
+
last_run (optional)
+
muted_alert_ids
+
mute_all
+
name
String The name of the rule.
+
next_run (optional)
Date format: date-time
+
notify_when
+
params
map[String, oas_any_type_not_mapped] The parameters for the rule.
+
rule_type_id
String The identifier for the type of rule. For example, .es-query, .index-threshold, logs.alert.document.count, monitoring_alert_cluster_health, siem.thresholdRule, or xpack.ml.anomaly_detection_alert.
+
schedule
+
scheduled_task_id (optional)
+
tags
array[String] The tags for the rule.
+
throttle
String The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if notify_when is set to onThrottleInterval. It is specified in seconds, minutes, hours, or days.
+
updated_at
String The date and time that the rule was updated most recently.
+
updated_by
String The identifier for the user that updated this rule most recently.
-

findRules_200_response_data_inner_execution_status - Up

+

rule_response_properties_execution_status - Up

-
status (optional)
+
last_duration (optional)
last_execution_date (optional)
Date format: date-time
-
last_duration (optional)
+
status (optional)
-

findRules_200_response_data_inner_last_run - Up

+

rule_response_properties_last_run - Up

-
alerts_count (optional)
+
alerts_count (optional)
+
outcome (optional)
outcome_msg (optional)
warning (optional)
-
outcome (optional)
-

findRules_200_response_data_inner_last_run_alerts_count - Up

+

rule_response_properties_last_run_alerts_count - Up

-
new (optional)
+
active (optional)
ignored (optional)
+
new (optional)
recovered (optional)
-
active (optional)
-

findRules_200_response_data_inner_schedule - Up

+

schedule - Up

The check interval, which specifies how frequently the rule conditions are checked. The interval is specified in seconds, minutes, hours, or days.
interval (optional)
-

findRules_has_reference_parameter - Up

-
+

update_rule_request - Update rule request Up

+
The update rule API request body varies depending on the type of rule and actions.
-
id (optional)
-
type (optional)
+
actions (optional)
+
name
String The name of the rule.
+
notify_when
+
params
map[String, oas_any_type_not_mapped] The parameters for the rule.
+
schedule
+
tags (optional)
array[String] The tags for the rule.
+
throttle (optional)
String The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if notify_when is set to onThrottleInterval. It is specified in seconds, minutes, hours, or days.
-
-

findRules_search_fields_parameter - Up

-
-
-
-
++++ diff --git a/docs/api/alerting/delete_rule.asciidoc b/docs/api/alerting/delete_rule.asciidoc index 12b07c5bb0f12..143507fa20600 100644 --- a/docs/api/alerting/delete_rule.asciidoc +++ b/docs/api/alerting/delete_rule.asciidoc @@ -8,6 +8,12 @@ Permanently removes a rule. WARNING: After you delete a rule, you cannot recover it. +[NOTE] +==== +For the most up-to-date API details, refer to the +{kib-repo}/tree/{branch}/x-pack/plugins/alerting/docs/openapi[open API specification]. For a preview, check out <>. +==== + [[delete-rule-api-request]] === {api-request-title} @@ -36,7 +42,7 @@ default space is used. [[delete-rule-api-response-codes]] === {api-response-codes-title} -`200`:: +`204`:: Indicates a successful call. === {api-examples-title} diff --git a/docs/api/alerting/get_rules.asciidoc b/docs/api/alerting/get_rules.asciidoc index 41aa01df01a47..fd291617e08d3 100644 --- a/docs/api/alerting/get_rules.asciidoc +++ b/docs/api/alerting/get_rules.asciidoc @@ -6,6 +6,12 @@ Retrieve a rule by ID. +[NOTE] +==== +For the most up-to-date API details, refer to the +{kib-repo}/tree/{branch}/x-pack/plugins/alerting/docs/openapi[open API specification]. For a preview, check out <>. +==== + [[get-rule-api-request]] === {api-request-title} @@ -55,33 +61,63 @@ The API returns the following: [source,sh] -------------------------------------------------- { - "id": "0a037d60-6b62-11eb-9e0d-85d233e3ee35", - "notify_when": "onActionGroupChange", - "params": { - "aggType": "avg", + "id":"31697a40-7b36-11ed-aa79-f742c05329b2", + "consumer":"alerts", + "tags":["cpu"], + "name":"my alert", + "enabled":true, + "throttle":null, + "schedule":{ + "interval":"1m" + }, + "params":{ + "aggType":"avg", + "termSize":6, + "thresholdComparator":">", + "timeWindowSize":5, + "timeWindowUnit":"m", + "groupBy":"top", + "threshold":[1000], + "index":["test-index"], + "timeField":"@timestamp", + "aggField":"sheet.version", + "termField":"name.keyword" + }, + "rule_type_id":".index-threshold", + "created_by":"elastic", + "updated_by":"elastic", + "created_at":"2022-12-13T22:33:41.163Z", + "updated_at":"2022-12-13T22:33:41.163Z", + "api_key_owner":"elastic", + "notify_when":"onActionGroupChange", + "muted_alert_ids":[], + "mute_all":false, + "scheduled_task_id":"31697a40-7b36-11ed-aa79-f742c05329b2", + "execution_status":{ + "status":"ok", + "last_execution_date":"2022-12-13T22:33:44.388Z", + "last_duration":83 }, - "consumer": "alerts", - "rule_type_id": "test.rule.type", - "schedule": { - "interval": "1m" + "actions":[{ + "group":"threshold met", + "id":"1007a0c0-7a6e-11ed-89d5-abec321c0def", + "params":{ + "level":"info", + "message":"alert {{alertName}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}\n- Timestamp: {{context.date}}" + }, + "connector_type_id":".server-log" + }], + "last_run":{ + "alerts_count":{ + "new":0, + "ignored":0, + "recovered":0, + "active":0 + }, + "outcome_msg":null, + "warning":null, + "outcome":"succeeded" }, - "actions": [], - "tags": [], - "name": "test rule", - "enabled": true, - "throttle": null, - "api_key_owner": "elastic", - "created_by": "elastic", - "updated_by": "elastic", - "mute_all": false, - "muted_alert_ids": [], - "updated_at": "2021-02-10T05:37:19.086Z", - "created_at": "2021-02-10T05:37:19.086Z", - "scheduled_task_id": "0b092d90-6b62-11eb-9e0d-85d233e3ee35", - "execution_status": { - "last_execution_date": "2021-02-10T17:55:14.262Z", - "status": "ok", - "last_duration": 359 - } + "next_run":"2022-12-13T22:34:44.314Z" } -------------------------------------------------- diff --git a/docs/api/alerting/update_rule.asciidoc b/docs/api/alerting/update_rule.asciidoc index fe5e91212d7d1..0db4c2cf38195 100644 --- a/docs/api/alerting/update_rule.asciidoc +++ b/docs/api/alerting/update_rule.asciidoc @@ -6,6 +6,12 @@ Update the attributes for an existing rule. +[NOTE] +==== +For the most up-to-date API details, refer to the +{kib-repo}/tree/{branch}/x-pack/plugins/alerting/docs/openapi[open API specification]. For a preview, check out <>. +==== + [[update-rule-api-request]] === {api-request-title} @@ -132,7 +138,6 @@ PUT api/alerting/rule/ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 "timeWindowUnit":"m", "thresholdComparator":">", "threshold":[1000], - "aggType":"avg", "aggField":"sheet.version", "termField":"name.keyword", "termSize":6 @@ -180,16 +185,28 @@ The API returns the following: "updated_by": "elastic", "rule_type_id": ".index-threshold", "scheduled_task_id": "4c5eda00-e74f-11ec-b72f-5b18752ff9ea", - "created_at": "2022-06-08T17:20:31.632Z", - "updated_at": "2022-06-09T23:36:36.090Z", + "created_at": "2022-12-12T22:43:20.578Z", + "updated_at": "2022-12-12T22:44:21.783Z", "notify_when": "onActionGroupChange", "mute_all": false, "muted_alert_ids": [], "execution_status": { "status": "ok", - "last_execution_date": "2022-06-09T23:36:17.332Z", - "last_duration": 577 + "last_execution_date": "2022-12-12T22:43:21.723Z", + "last_duration": 125 + }, + "actions":[], + "last_run":{ + "alerts_count": { + "new": 0, + "ignored": 0, + "recovered": 0, + "active": 0 + }, + "outcome_msg" :null, + "warning": null, + "outcome": "succeeded" }, - "actions":[] + "next_run": "2022-12-12T22:44:21.653Z" } -------------------------------------------------- diff --git a/x-pack/plugins/alerting/docs/openapi/bundled.json b/x-pack/plugins/alerting/docs/openapi/bundled.json index f5aa50c5d45e0..51665e76f2f97 100644 --- a/x-pack/plugins/alerting/docs/openapi/bundled.json +++ b/x-pack/plugins/alerting/docs/openapi/bundled.json @@ -25,6 +25,131 @@ } ], "paths": { + "/s/{spaceId}/api/alerting/rule/{ruleId}": { + "get": { + "summary": "Retrieve a rule by its identifier.", + "operationId": "getRule", + "description": "You must have `read` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rules you're seeking. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. To get rules associated with the **Stack Monitoring** feature, use the `monitoring_user` built-in role.\n", + "tags": [ + "alerting" + ], + "parameters": [ + { + "$ref": "#/components/parameters/rule_id" + }, + { + "$ref": "#/components/parameters/space_id" + } + ], + "responses": { + "200": { + "description": "Indicates a successful call.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/rule_response_properties" + }, + "examples": { + "updateRuleResponse": { + "$ref": "#/components/examples/get_rule_response" + } + } + } + } + } + } + }, + "delete": { + "summary": "Deletes a rule.", + "operationId": "deleteRule", + "description": "You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it.\n", + "tags": [ + "alerting" + ], + "parameters": [ + { + "$ref": "#/components/parameters/kbn_xsrf" + }, + { + "$ref": "#/components/parameters/rule_id" + }, + { + "$ref": "#/components/parameters/space_id" + } + ], + "responses": { + "204": { + "description": "Indicates a successful call." + } + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "put": { + "summary": "Updates the attributes for a rule.", + "operationId": "updateRule", + "description": "You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you update a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If you have different privileges than the user that created or most recently updated the rule, you might change its behavior. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values.\n", + "tags": [ + "alerting" + ], + "parameters": [ + { + "$ref": "#/components/parameters/kbn_xsrf" + }, + { + "$ref": "#/components/parameters/rule_id" + }, + { + "$ref": "#/components/parameters/space_id" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/update_rule_request" + }, + "examples": { + "updateCaseRequest": { + "$ref": "#/components/examples/update_rule_request" + } + } + } + } + }, + "responses": { + "200": { + "description": "Indicates a successful call.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/rule_response_properties" + }, + "examples": { + "updateRuleResponse": { + "$ref": "#/components/examples/update_rule_response" + } + } + } + } + } + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, "/s/{spaceId}/api/alerting/rules/_find": { "get": { "summary": "Retrieves information about rules.", @@ -162,201 +287,7 @@ "data": { "type": "array", "items": { - "type": "object", - "properties": { - "actions": { - "type": "array", - "items": { - "type": "object", - "properties": { - "group": { - "type": "string", - "description": "The group name for the actions.", - "example": "default" - }, - "id": { - "type": "string", - "description": "The identifier for the connector saved object.", - "example": "9dca3e00-74f5-11ed-9801-35303b735aef" - }, - "params": { - "type": "object", - "description": "The parameters for the action, which are sent to the connector.", - "additionalProperties": true - } - } - } - }, - "api_key_owner": { - "type": "string", - "nullable": true, - "example": "elastic" - }, - "consumer": { - "type": "string", - "description": "The application or feature that owns the rule. For example, `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`.", - "example": "alerts" - }, - "created_at": { - "type": "string", - "description": "The date and time that the rule as created.", - "format": "date-time", - "example": "2022-12-05T23:36:58.284Z" - }, - "created_by": { - "type": "string", - "description": "The identifier for the user that created the rule.", - "nullable": true, - "example": "elastic" - }, - "enabled": { - "type": "boolean", - "description": "Indicates whether the rule is currently enabled.", - "example": true - }, - "execution_status": { - "type": "object", - "properties": { - "status": { - "type": "string", - "example": "ok" - }, - "last_execution_date": { - "type": "string", - "format": "date-time", - "example": "2022-12-06T00:13:43.890Z" - }, - "last_duration": { - "type": "integer", - "example": 55 - } - } - }, - "id": { - "type": "string", - "description": "The identifier for the rule.", - "example": "b530fed0-74f5-11ed-9801-35303b735aef" - }, - "last_run": { - "type": "object", - "properties": { - "alerts_count": { - "type": "object", - "properties": { - "new": { - "type": "integer", - "nullable": true - }, - "ignored": { - "type": "integer", - "nullable": true - }, - "recovered": { - "type": "integer", - "nullable": true - }, - "active": { - "type": "integer", - "nullable": true - } - } - }, - "outcome_msg": { - "type": "string", - "nullable": true, - "example": null - }, - "warning": { - "type": "string", - "nullable": true, - "example": null - }, - "outcome": { - "type": "string", - "example": "succeeded" - } - } - }, - "muted_alert_ids": { - "type": "array", - "items": { - "type": "string" - } - }, - "mute_all": { - "type": "boolean", - "example": false - }, - "name": { - "type": "string", - "description": "The name of the rule.", - "example": "cluster_health_rule" - }, - "next_run": { - "type": "string", - "format": "date-time", - "nullable": true, - "example": "2022-12-06T00:14:43.818Z" - }, - "notify_when": { - "type": "string", - "description": "Indicates how often alerts generate actions.", - "enum": [ - "onActionGroupChange", - "onActiveAlert", - "onThrottleInterval" - ], - "example": "onActiveAlert" - }, - "params": { - "type": "object", - "description": "The parameters for the rule.", - "additionalProperties": true - }, - "rule_type_id": { - "type": "string", - "description": "The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`.", - "example": "monitoring_alert_cluster_health" - }, - "schedule": { - "type": "object", - "description": "The check interval, which specifies how frequently the rule conditions are checked. The interval is specified in seconds, minutes, hours, or days.", - "properties": { - "interval": { - "type": "string", - "example": "1m" - } - } - }, - "scheduled_task_id": { - "type": "string", - "example": "b530fed0-74f5-11ed-9801-35303b735aef" - }, - "tags": { - "type": "array", - "description": "The tags for the rule.", - "items": { - "type": "string" - } - }, - "throttle": { - "type": "string", - "description": "The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days.", - "nullable": true, - "example": "10m" - }, - "updated_at": { - "type": "string", - "description": "The date and time that the rule was updated most recently.", - "example": "2022-12-05T23:36:58.284Z" - }, - "updated_by": { - "type": "string", - "description": "The identifier for the user that updated this rule most recently.", - "nullable": true, - "example": "elastic" - } - } + "$ref": "#/components/schemas/rule_response_properties" } }, "page": { @@ -405,6 +336,16 @@ } }, "parameters": { + "rule_id": { + "in": "path", + "name": "ruleId", + "description": "An identifier for the rule.", + "required": true, + "schema": { + "type": "string", + "example": "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" + } + }, "space_id": { "in": "path", "name": "spaceId", @@ -414,9 +355,457 @@ "type": "string", "example": "default" } + }, + "kbn_xsrf": { + "schema": { + "type": "string" + }, + "in": "header", + "name": "kbn-xsrf", + "required": true + } + }, + "schemas": { + "actions": { + "type": "array", + "default": [], + "required": [ + "group", + "id", + "params" + ], + "nullable": true, + "items": { + "type": "object", + "properties": { + "group": { + "type": "string", + "description": "The group name for the actions. If you don't need to group actions, set to `default`.", + "example": "default" + }, + "id": { + "type": "string", + "description": "The identifier for the connector saved object.", + "example": "9dca3e00-74f5-11ed-9801-35303b735aef" + }, + "params": { + "type": "object", + "description": "The parameters for the action, which are sent to the connector. The `params` are handled as Mustache templates and passed a default set of context.", + "additionalProperties": true + } + } + } + }, + "notify_when": { + "type": "string", + "description": "Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met.\n", + "enum": [ + "onActionGroupChange", + "onActiveAlert", + "onThrottleInterval" + ], + "example": "onActiveAlert" + }, + "schedule": { + "type": "object", + "description": "The check interval, which specifies how frequently the rule conditions are checked. The interval is specified in seconds, minutes, hours, or days.", + "properties": { + "interval": { + "type": "string", + "example": "1m" + } + } + }, + "tags": { + "type": "array", + "description": "The tags for the rule.", + "items": { + "type": "string" + }, + "default": [] + }, + "throttle": { + "type": "string", + "description": "The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days.", + "nullable": true, + "default": null, + "example": "10m" + }, + "rule_response_properties": { + "title": "Rule response properties", + "type": "object", + "required": [ + "actions", + "api_key_owner", + "consumer", + "created_at", + "created_by", + "enabled", + "execution_status", + "id", + "mute_all", + "muted_alert_ids", + "name", + "notify_when", + "params", + "rule_type_id", + "schedule", + "tags", + "throttle", + "updated_at", + "updated_by" + ], + "properties": { + "actions": { + "$ref": "#/components/schemas/actions" + }, + "api_key_owner": { + "type": "string", + "nullable": true, + "example": "elastic" + }, + "consumer": { + "type": "string", + "description": "The application or feature that owns the rule. For example, `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`.", + "example": "alerts" + }, + "created_at": { + "type": "string", + "description": "The date and time that the rule was created.", + "format": "date-time", + "example": "2022-12-05T23:36:58.284Z" + }, + "created_by": { + "type": "string", + "description": "The identifier for the user that created the rule.", + "nullable": true, + "example": "elastic" + }, + "enabled": { + "type": "boolean", + "description": "Indicates whether the rule is currently enabled.", + "example": true + }, + "execution_status": { + "type": "object", + "properties": { + "last_duration": { + "type": "integer", + "example": 55 + }, + "last_execution_date": { + "type": "string", + "format": "date-time", + "example": "2022-12-06T00:13:43.890Z" + }, + "status": { + "type": "string", + "example": "ok" + } + } + }, + "id": { + "type": "string", + "description": "The identifier for the rule.", + "example": "b530fed0-74f5-11ed-9801-35303b735aef" + }, + "last_run": { + "type": "object", + "properties": { + "alerts_count": { + "type": "object", + "properties": { + "active": { + "type": "integer" + }, + "ignored": { + "type": "integer" + }, + "new": { + "type": "integer" + }, + "recovered": { + "type": "integer" + } + } + }, + "outcome": { + "type": "string", + "example": "succeeded" + }, + "outcome_msg": { + "type": "string", + "nullable": true, + "example": null + }, + "warning": { + "type": "string", + "nullable": true, + "example": null + } + } + }, + "muted_alert_ids": { + "type": "array", + "nullable": true, + "items": { + "type": "string" + } + }, + "mute_all": { + "type": "boolean", + "example": false + }, + "name": { + "type": "string", + "description": "The name of the rule.", + "example": "cluster_health_rule" + }, + "next_run": { + "type": "string", + "format": "date-time", + "nullable": true, + "example": "2022-12-06T00:14:43.818Z" + }, + "notify_when": { + "$ref": "#/components/schemas/notify_when" + }, + "params": { + "type": "object", + "description": "The parameters for the rule.", + "additionalProperties": true + }, + "rule_type_id": { + "type": "string", + "description": "The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`.\n", + "example": "monitoring_alert_cluster_health" + }, + "schedule": { + "$ref": "#/components/schemas/schedule" + }, + "scheduled_task_id": { + "type": "string", + "example": "b530fed0-74f5-11ed-9801-35303b735aef" + }, + "tags": { + "$ref": "#/components/schemas/tags" + }, + "throttle": { + "$ref": "#/components/schemas/throttle" + }, + "updated_at": { + "type": "string", + "description": "The date and time that the rule was updated most recently.", + "example": "2022-12-05T23:36:58.284Z" + }, + "updated_by": { + "type": "string", + "description": "The identifier for the user that updated this rule most recently.", + "nullable": true, + "example": "elastic" + } + } + }, + "update_rule_request": { + "title": "Update rule request", + "description": "The update rule API request body varies depending on the type of rule and actions.", + "type": "object", + "required": [ + "name", + "notify_when", + "params", + "schedule" + ], + "properties": { + "actions": { + "$ref": "#/components/schemas/actions" + }, + "name": { + "type": "string", + "description": "The name of the rule.", + "example": "cluster_health_rule" + }, + "notify_when": { + "$ref": "#/components/schemas/notify_when" + }, + "params": { + "type": "object", + "description": "The parameters for the rule.", + "additionalProperties": true + }, + "schedule": { + "$ref": "#/components/schemas/schedule" + }, + "tags": { + "$ref": "#/components/schemas/tags" + }, + "throttle": { + "$ref": "#/components/schemas/throttle" + } + } } }, "examples": { + "get_rule_response": { + "summary": "The get rule API returns a JSON object that contains details about the rule.", + "value": { + "id": "31697a40-7b36-11ed-aa79-f742c05329b2", + "consumer": "alerts", + "tags": [ + "cpu" + ], + "name": "my alert", + "enabled": true, + "throttle": null, + "schedule": { + "interval": "1m" + }, + "params": { + "aggType": "avg", + "termSize": 6, + "thresholdComparator": ">", + "timeWindowSize": 5, + "timeWindowUnit": "m", + "groupBy": "top", + "threshold": [ + 1000 + ], + "index": [ + "test-index" + ], + "timeField": "@timestamp", + "aggField": "sheet.version", + "termField": "name.keyword" + }, + "rule_type_id": ".index-threshold", + "created_by": "elastic", + "updated_by": "elastic", + "created_at": "2022-12-13T22:33:41.163Z", + "updated_at": "2022-12-13T22:33:41.163Z", + "api_key_owner": "elastic", + "notify_when": "onActionGroupChange", + "muted_alert_ids": [], + "mute_all": false, + "scheduled_task_id": "31697a40-7b36-11ed-aa79-f742c05329b2", + "execution_status": { + "status": "ok", + "last_execution_date": "2022-12-13T22:33:44.388Z", + "last_duration": 83 + }, + "actions": [ + { + "group": "threshold met", + "id": "1007a0c0-7a6e-11ed-89d5-abec321c0def", + "params": { + "level": "info", + "message": "alert {{alertName}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}\n- Timestamp: {{context.date}", + "connector_type_id": ".server-log" + } + } + ], + "last_run": { + "alerts_count": { + "new": 0, + "ignored": 0, + "recovered": 0, + "active": 0 + }, + "outcome_msg": null, + "warning": null, + "outcome": "succeeded" + }, + "next_run": "2022-12-13T22:34:44.314Z" + } + }, + "update_rule_request": { + "summary": "Update an index threshold rule.", + "value": { + "notify_when": "onActionGroupChange", + "params": { + "index": [ + ".test-index" + ], + "timeField": "@timestamp", + "groupBy": "top", + "aggType": "avg", + "timeWindowSize": 5, + "timeWindowUnit": "m", + "thresholdComparator": ">", + "threshold": [ + 1000 + ], + "aggField": "sheet.version", + "termField": "name.keyword", + "termSize": 6 + }, + "schedule": { + "interval": "1m" + }, + "actions": [], + "tags": [], + "name": "new name", + "throttle": null + } + }, + "update_rule_response": { + "summary": "The update rule API returns a JSON object that contains details about the rule.", + "value": { + "id": "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74", + "consumer": "alerts", + "tags": [], + "name": "new name", + "enabled": true, + "throttle": null, + "schedule": { + "interval": "1m" + }, + "params": { + "index": [ + ".updated-index" + ], + "timeField": "@timestamp", + "groupBy": "top", + "aggType": "avg", + "timeWindowSize": 5, + "timeWindowUnit": "m", + "thresholdComparator": ">", + "threshold": [ + 1000 + ], + "aggField": "sheet.version", + "termField": "name.keyword", + "termSize": 6 + }, + "api_key_owner": "elastic", + "created_by": "elastic", + "updated_by": "elastic", + "rule_type_id": ".index-threshold", + "scheduled_task_id": "4c5eda00-e74f-11ec-b72f-5b18752ff9ea", + "created_at": "2022-12-12T22:43:20.578Z", + "updated_at": "2022-12-12T22:44:21.783Z", + "notify_when": "onActionGroupChange", + "mute_all": false, + "muted_alert_ids": [], + "execution_status": { + "status": "ok", + "last_execution_date": "2022-12-12T22:43:21.723Z", + "last_duration": 125 + }, + "actions": [], + "last_run": { + "alerts_count": { + "new": 0, + "ignored": 0, + "recovered": 0, + "active": 0 + }, + "outcome_msg": null, + "warning": null, + "outcome": "succeeded" + }, + "next_run": "2022-12-12T22:44:21.653Z" + } + }, "find_rules_response": { "summary": "Retrieve information about a rule.", "value": { diff --git a/x-pack/plugins/alerting/docs/openapi/bundled.yaml b/x-pack/plugins/alerting/docs/openapi/bundled.yaml index d8ae1f576af8d..c2c572cfe6619 100644 --- a/x-pack/plugins/alerting/docs/openapi/bundled.yaml +++ b/x-pack/plugins/alerting/docs/openapi/bundled.yaml @@ -15,6 +15,77 @@ servers: - url: http://localhost:5601 description: local paths: + /s/{spaceId}/api/alerting/rule/{ruleId}: + get: + summary: Retrieve a rule by its identifier. + operationId: getRule + description: | + You must have `read` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rules you're seeking. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. To get rules associated with the **Stack Monitoring** feature, use the `monitoring_user` built-in role. + tags: + - alerting + parameters: + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' + responses: + '200': + description: Indicates a successful call. + content: + application/json: + schema: + $ref: '#/components/schemas/rule_response_properties' + examples: + updateRuleResponse: + $ref: '#/components/examples/get_rule_response' + delete: + summary: Deletes a rule. + operationId: deleteRule + description: | + You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're deleting. For example, the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or **Machine Learning** features, **Observability**, or **Security** features. WARNING: After you delete a rule, you cannot recover it. + tags: + - alerting + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' + responses: + '204': + description: Indicates a successful call. + servers: + - url: https://localhost:5601 + put: + summary: Updates the attributes for a rule. + operationId: updateRule + description: | + You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're updating. For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. NOTE: This API supports only token-based authentication. When you update a rule, it identifies which roles you have at that point in time. Thereafter, when the rule performs queries, it uses those security privileges. If you have different privileges than the user that created or most recently updated the rule, you might change its behavior. Though some properties are optional, when you update the rule the existing property values are overwritten with default values. Therefore, it is recommended to explicitly set all property values. + tags: + - alerting + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/update_rule_request' + examples: + updateCaseRequest: + $ref: '#/components/examples/update_rule_request' + responses: + '200': + description: Indicates a successful call. + content: + application/json: + schema: + $ref: '#/components/schemas/rule_response_properties' + examples: + updateRuleResponse: + $ref: '#/components/examples/update_rule_response' + servers: + - url: https://localhost:5601 + servers: + - url: https://localhost:5601 /s/{spaceId}/api/alerting/rules/_find: get: summary: Retrieves information about rules. @@ -110,154 +181,7 @@ paths: data: type: array items: - type: object - properties: - actions: - type: array - items: - type: object - properties: - group: - type: string - description: The group name for the actions. - example: default - id: - type: string - description: The identifier for the connector saved object. - example: 9dca3e00-74f5-11ed-9801-35303b735aef - params: - type: object - description: The parameters for the action, which are sent to the connector. - additionalProperties: true - api_key_owner: - type: string - nullable: true - example: elastic - consumer: - type: string - description: The application or feature that owns the rule. For example, `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. - example: alerts - created_at: - type: string - description: The date and time that the rule as created. - format: date-time - example: '2022-12-05T23:36:58.284Z' - created_by: - type: string - description: The identifier for the user that created the rule. - nullable: true - example: elastic - enabled: - type: boolean - description: Indicates whether the rule is currently enabled. - example: true - execution_status: - type: object - properties: - status: - type: string - example: ok - last_execution_date: - type: string - format: date-time - example: '2022-12-06T00:13:43.890Z' - last_duration: - type: integer - example: 55 - id: - type: string - description: The identifier for the rule. - example: b530fed0-74f5-11ed-9801-35303b735aef - last_run: - type: object - properties: - alerts_count: - type: object - properties: - new: - type: integer - nullable: true - ignored: - type: integer - nullable: true - recovered: - type: integer - nullable: true - active: - type: integer - nullable: true - outcome_msg: - type: string - nullable: true - example: null - warning: - type: string - nullable: true - example: null - outcome: - type: string - example: succeeded - muted_alert_ids: - type: array - items: - type: string - mute_all: - type: boolean - example: false - name: - type: string - description: The name of the rule. - example: cluster_health_rule - next_run: - type: string - format: date-time - nullable: true - example: '2022-12-06T00:14:43.818Z' - notify_when: - type: string - description: Indicates how often alerts generate actions. - enum: - - onActionGroupChange - - onActiveAlert - - onThrottleInterval - example: onActiveAlert - params: - type: object - description: The parameters for the rule. - additionalProperties: true - rule_type_id: - type: string - description: The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. - example: monitoring_alert_cluster_health - schedule: - type: object - description: The check interval, which specifies how frequently the rule conditions are checked. The interval is specified in seconds, minutes, hours, or days. - properties: - interval: - type: string - example: 1m - scheduled_task_id: - type: string - example: b530fed0-74f5-11ed-9801-35303b735aef - tags: - type: array - description: The tags for the rule. - items: - type: string - throttle: - type: string - description: The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. - nullable: true - example: 10m - updated_at: - type: string - description: The date and time that the rule was updated most recently. - example: '2022-12-05T23:36:58.284Z' - updated_by: - type: string - description: The identifier for the user that updated this rule most recently. - nullable: true - example: elastic + $ref: '#/components/schemas/rule_response_properties' page: type: integer per_page: @@ -281,6 +205,14 @@ components: in: header name: ApiKey parameters: + rule_id: + in: path + name: ruleId + description: An identifier for the rule. + required: true + schema: + type: string + example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 space_id: in: path name: spaceId @@ -289,7 +221,365 @@ components: schema: type: string example: default + kbn_xsrf: + schema: + type: string + in: header + name: kbn-xsrf + required: true + schemas: + actions: + type: array + default: [] + required: + - group + - id + - params + nullable: true + items: + type: object + properties: + group: + type: string + description: The group name for the actions. If you don't need to group actions, set to `default`. + example: default + id: + type: string + description: The identifier for the connector saved object. + example: 9dca3e00-74f5-11ed-9801-35303b735aef + params: + type: object + description: The parameters for the action, which are sent to the connector. The `params` are handled as Mustache templates and passed a default set of context. + additionalProperties: true + notify_when: + type: string + description: | + Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. + enum: + - onActionGroupChange + - onActiveAlert + - onThrottleInterval + example: onActiveAlert + schedule: + type: object + description: The check interval, which specifies how frequently the rule conditions are checked. The interval is specified in seconds, minutes, hours, or days. + properties: + interval: + type: string + example: 1m + tags: + type: array + description: The tags for the rule. + items: + type: string + default: [] + throttle: + type: string + description: The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. + nullable: true + default: null + example: 10m + rule_response_properties: + title: Rule response properties + type: object + required: + - actions + - api_key_owner + - consumer + - created_at + - created_by + - enabled + - execution_status + - id + - mute_all + - muted_alert_ids + - name + - notify_when + - params + - rule_type_id + - schedule + - tags + - throttle + - updated_at + - updated_by + properties: + actions: + $ref: '#/components/schemas/actions' + api_key_owner: + type: string + nullable: true + example: elastic + consumer: + type: string + description: The application or feature that owns the rule. For example, `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. + example: alerts + created_at: + type: string + description: The date and time that the rule was created. + format: date-time + example: '2022-12-05T23:36:58.284Z' + created_by: + type: string + description: The identifier for the user that created the rule. + nullable: true + example: elastic + enabled: + type: boolean + description: Indicates whether the rule is currently enabled. + example: true + execution_status: + type: object + properties: + last_duration: + type: integer + example: 55 + last_execution_date: + type: string + format: date-time + example: '2022-12-06T00:13:43.890Z' + status: + type: string + example: ok + id: + type: string + description: The identifier for the rule. + example: b530fed0-74f5-11ed-9801-35303b735aef + last_run: + type: object + properties: + alerts_count: + type: object + properties: + active: + type: integer + ignored: + type: integer + new: + type: integer + recovered: + type: integer + outcome: + type: string + example: succeeded + outcome_msg: + type: string + nullable: true + example: null + warning: + type: string + nullable: true + example: null + muted_alert_ids: + type: array + nullable: true + items: + type: string + mute_all: + type: boolean + example: false + name: + type: string + description: The name of the rule. + example: cluster_health_rule + next_run: + type: string + format: date-time + nullable: true + example: '2022-12-06T00:14:43.818Z' + notify_when: + $ref: '#/components/schemas/notify_when' + params: + type: object + description: The parameters for the rule. + additionalProperties: true + rule_type_id: + type: string + description: | + The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. + example: monitoring_alert_cluster_health + schedule: + $ref: '#/components/schemas/schedule' + scheduled_task_id: + type: string + example: b530fed0-74f5-11ed-9801-35303b735aef + tags: + $ref: '#/components/schemas/tags' + throttle: + $ref: '#/components/schemas/throttle' + updated_at: + type: string + description: The date and time that the rule was updated most recently. + example: '2022-12-05T23:36:58.284Z' + updated_by: + type: string + description: The identifier for the user that updated this rule most recently. + nullable: true + example: elastic + update_rule_request: + title: Update rule request + description: The update rule API request body varies depending on the type of rule and actions. + type: object + required: + - name + - notify_when + - params + - schedule + properties: + actions: + $ref: '#/components/schemas/actions' + name: + type: string + description: The name of the rule. + example: cluster_health_rule + notify_when: + $ref: '#/components/schemas/notify_when' + params: + type: object + description: The parameters for the rule. + additionalProperties: true + schedule: + $ref: '#/components/schemas/schedule' + tags: + $ref: '#/components/schemas/tags' + throttle: + $ref: '#/components/schemas/throttle' examples: + get_rule_response: + summary: The get rule API returns a JSON object that contains details about the rule. + value: + id: 31697a40-7b36-11ed-aa79-f742c05329b2 + consumer: alerts + tags: + - cpu + name: my alert + enabled: true + throttle: null + schedule: + interval: 1m + params: + aggType: avg + termSize: 6 + thresholdComparator: '>' + timeWindowSize: 5 + timeWindowUnit: m + groupBy: top + threshold: + - 1000 + index: + - test-index + timeField: '@timestamp' + aggField: sheet.version + termField: name.keyword + rule_type_id: .index-threshold + created_by: elastic + updated_by: elastic + created_at: '2022-12-13T22:33:41.163Z' + updated_at: '2022-12-13T22:33:41.163Z' + api_key_owner: elastic + notify_when: onActionGroupChange + muted_alert_ids: [] + mute_all: false + scheduled_task_id: 31697a40-7b36-11ed-aa79-f742c05329b2 + execution_status: + status: ok + last_execution_date: '2022-12-13T22:33:44.388Z' + last_duration: 83 + actions: + - group: threshold met + id: 1007a0c0-7a6e-11ed-89d5-abec321c0def + params: + level: info + message: |- + alert {{alertName}} is active for group {{context.group}}: + + - Value: {{context.value}} + - Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}} + - Timestamp: {{context.date} + connector_type_id: .server-log + last_run: + alerts_count: + new: 0 + ignored: 0 + recovered: 0 + active: 0 + outcome_msg: null + warning: null + outcome: succeeded + next_run: '2022-12-13T22:34:44.314Z' + update_rule_request: + summary: Update an index threshold rule. + value: + notify_when: onActionGroupChange + params: + index: + - .test-index + timeField: '@timestamp' + groupBy: top + aggType: avg + timeWindowSize: 5 + timeWindowUnit: m + thresholdComparator: '>' + threshold: + - 1000 + aggField: sheet.version + termField: name.keyword + termSize: 6 + schedule: + interval: 1m + actions: [] + tags: [] + name: new name + throttle: null + update_rule_response: + summary: The update rule API returns a JSON object that contains details about the rule. + value: + id: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 + consumer: alerts + tags: [] + name: new name + enabled: true + throttle: null + schedule: + interval: 1m + params: + index: + - .updated-index + timeField: '@timestamp' + groupBy: top + aggType: avg + timeWindowSize: 5 + timeWindowUnit: m + thresholdComparator: '>' + threshold: + - 1000 + aggField: sheet.version + termField: name.keyword + termSize: 6 + api_key_owner: elastic + created_by: elastic + updated_by: elastic + rule_type_id: .index-threshold + scheduled_task_id: 4c5eda00-e74f-11ec-b72f-5b18752ff9ea + created_at: '2022-12-12T22:43:20.578Z' + updated_at: '2022-12-12T22:44:21.783Z' + notify_when: onActionGroupChange + mute_all: false + muted_alert_ids: [] + execution_status: + status: ok + last_execution_date: '2022-12-12T22:43:21.723Z' + last_duration: 125 + actions: [] + last_run: + alerts_count: + new: 0 + ignored: 0 + recovered: 0 + active: 0 + outcome_msg: null + warning: null + outcome: succeeded + next_run: '2022-12-12T22:44:21.653Z' find_rules_response: summary: Retrieve information about a rule. value: diff --git a/x-pack/plugins/alerting/docs/openapi/components/examples/get_rule_response.yaml b/x-pack/plugins/alerting/docs/openapi/components/examples/get_rule_response.yaml new file mode 100644 index 0000000000000..eb63c8aeb82a3 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/examples/get_rule_response.yaml @@ -0,0 +1,56 @@ +summary: The get rule API returns a JSON object that contains details about the rule. +value: + id: 31697a40-7b36-11ed-aa79-f742c05329b2 + consumer: alerts + tags: + - cpu + name: my alert + enabled: true + throttle: null + schedule: + interval: 1m + params: + aggType: avg + termSize: 6 + thresholdComparator: ">" + timeWindowSize: 5 + timeWindowUnit: m + groupBy: top + threshold: + - 1000 + index: + - test-index + timeField: "@timestamp" + aggField: sheet.version + termField: name.keyword + rule_type_id: .index-threshold + created_by: elastic + updated_by: elastic + created_at: '2022-12-13T22:33:41.163Z' + updated_at: '2022-12-13T22:33:41.163Z' + api_key_owner: elastic + notify_when: onActionGroupChange + muted_alert_ids: [] + mute_all: false + scheduled_task_id: 31697a40-7b36-11ed-aa79-f742c05329b2 + execution_status: + status: ok + last_execution_date: '2022-12-13T22:33:44.388Z' + last_duration: 83 + actions: + - group: threshold met + id: 1007a0c0-7a6e-11ed-89d5-abec321c0def + params: + level: info + message: "alert {{alertName}} is active for group {{context.group}}:\n\n- Value: {{context.value}}\n- Conditions Met: {{context.conditions}} over {{params.timeWindowSize}}{{params.timeWindowUnit}}\n- Timestamp: {{context.date}" + connector_type_id: .server-log + last_run: + alerts_count: + new: 0 + ignored: 0 + recovered: 0 + active: 0 + outcome_msg: null + warning: null + outcome: succeeded + next_run: '2022-12-13T22:34:44.314Z' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/components/examples/update_rule_request.yaml b/x-pack/plugins/alerting/docs/openapi/components/examples/update_rule_request.yaml new file mode 100644 index 0000000000000..de593e31724ed --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/examples/update_rule_request.yaml @@ -0,0 +1,21 @@ +summary: Update an index threshold rule. +value: + notify_when: onActionGroupChange + params: + index: [".test-index"] + timeField: "@timestamp" + groupBy: top + aggType: avg + timeWindowSize: 5 + timeWindowUnit: m + thresholdComparator: ">" + threshold: [1000] + aggField : sheet.version + termField: name.keyword + termSize: 6 + schedule: + interval: 1m + actions: [] + tags: [] + name: new name + throttle: null \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/components/examples/update_rule_response.yaml b/x-pack/plugins/alerting/docs/openapi/components/examples/update_rule_response.yaml new file mode 100644 index 0000000000000..7bbdba73774ac --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/examples/update_rule_response.yaml @@ -0,0 +1,47 @@ +summary: The update rule API returns a JSON object that contains details about the rule. +value: + id: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 + consumer: alerts + tags: [] + name: new name + enabled: true + throttle: null + schedule: + interval: 1m + params: + index: [".updated-index"] + timeField: "@timestamp" + groupBy: top + aggType: "avg" + timeWindowSize: 5 + timeWindowUnit: m + thresholdComparator: ">" + threshold: [1000] + aggField: sheet.version + termField: name.keyword + termSize: 6 + api_key_owner: elastic + created_by: elastic + updated_by: elastic + rule_type_id: .index-threshold + scheduled_task_id: 4c5eda00-e74f-11ec-b72f-5b18752ff9ea + created_at: '2022-12-12T22:43:20.578Z' + updated_at: '2022-12-12T22:44:21.783Z' + notify_when: onActionGroupChange + mute_all: false + muted_alert_ids: [] + execution_status: + status: ok + last_execution_date: '2022-12-12T22:43:21.723Z' + last_duration: 125 + actions: [] + last_run: + alerts_count: + new: 0 + ignored: 0 + recovered: 0 + active: 0 + outcome_msg: null + warning: null + outcome: succeeded + next_run: '2022-12-12T22:44:21.653Z' \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/components/parameters/rule_id.yaml b/x-pack/plugins/alerting/docs/openapi/components/parameters/rule_id.yaml new file mode 100644 index 0000000000000..4b5d14e207353 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/parameters/rule_id.yaml @@ -0,0 +1,7 @@ +in: path +name: ruleId +description: An identifier for the rule. +required: true +schema: + type: string + example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/components/schemas/actions.yaml b/x-pack/plugins/alerting/docs/openapi/components/schemas/actions.yaml new file mode 100644 index 0000000000000..ae381d6b370f3 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/schemas/actions.yaml @@ -0,0 +1,22 @@ +type: array +default: [] +required: + - group + - id + - params +nullable: true +items: + type: object + properties: + group: + type: string + description: The group name for the actions. If you don't need to group actions, set to `default`. + example: default + id: + type: string + description: The identifier for the connector saved object. + example: 9dca3e00-74f5-11ed-9801-35303b735aef + params: + type: object + description: The parameters for the action, which are sent to the connector. The `params` are handled as Mustache templates and passed a default set of context. + additionalProperties: true diff --git a/x-pack/plugins/alerting/docs/openapi/components/schemas/notify_when.yaml b/x-pack/plugins/alerting/docs/openapi/components/schemas/notify_when.yaml new file mode 100644 index 0000000000000..875fc057c25ca --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/schemas/notify_when.yaml @@ -0,0 +1,8 @@ +type: string +description: > + Indicates how often alerts generate actions. Valid values include: `onActionGroupChange`: Actions run when the alert status changes; `onActiveAlert`: Actions run when the alert becomes active and at each check interval while the rule conditions are met; `onThrottleInterval`: Actions run when the alert becomes active and at the interval specified in the throttle property while the rule conditions are met. +enum: + - onActionGroupChange + - onActiveAlert + - onThrottleInterval +example: onActiveAlert \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/components/schemas/rule_response_properties.yaml b/x-pack/plugins/alerting/docs/openapi/components/schemas/rule_response_properties.yaml new file mode 100644 index 0000000000000..39f35d97d846b --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/schemas/rule_response_properties.yaml @@ -0,0 +1,135 @@ +title: Rule response properties +type: object +required: + - actions + - api_key_owner + - consumer + - created_at + - created_by + - enabled + - execution_status + - id + - mute_all + - muted_alert_ids + - name + - notify_when + - params + - rule_type_id + - schedule + - tags + - throttle + - updated_at + - updated_by +properties: + actions: + $ref: 'actions.yaml' + api_key_owner: + type: string + nullable: true + example: elastic + consumer: + type: string + description: The application or feature that owns the rule. For example, `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. + example: alerts + created_at: + type: string + description: The date and time that the rule was created. + format: date-time + example: '2022-12-05T23:36:58.284Z' + created_by: + type: string + description: The identifier for the user that created the rule. + nullable: true + example: elastic + enabled: + type: boolean + description: Indicates whether the rule is currently enabled. + example: true + execution_status: + type: object + properties: + last_duration: + type: integer + example: 55 + last_execution_date: + type: string + format: date-time + example: '2022-12-06T00:13:43.890Z' + status: + type: string + example: ok + id: + type: string + description: The identifier for the rule. + example: b530fed0-74f5-11ed-9801-35303b735aef + last_run: + type: object + properties: + alerts_count: + type: object + properties: + active: + type: integer + ignored: + type: integer + new: + type: integer + recovered: + type: integer + outcome: + type: string + example: succeeded + outcome_msg: + type: string + nullable: true + example: null + warning: + type: string + nullable: true + example: null + muted_alert_ids: + type: array + nullable: true + items: + type: string + mute_all: + type: boolean + example: false + name: + type: string + description: The name of the rule. + example: cluster_health_rule + next_run: + type: string + format: date-time + nullable: true + example: '2022-12-06T00:14:43.818Z' + notify_when: + $ref: 'notify_when.yaml' + params: + type: object + description: The parameters for the rule. + additionalProperties: true + rule_type_id: + type: string + description: > + The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. + example: monitoring_alert_cluster_health + schedule: + $ref: 'schedule.yaml' + scheduled_task_id: + type: string + example: b530fed0-74f5-11ed-9801-35303b735aef + tags: + $ref: 'tags.yaml' + throttle: + $ref: 'throttle.yaml' + updated_at: + type: string + description: The date and time that the rule was updated most recently. + example: '2022-12-05T23:36:58.284Z' + updated_by: + type: string + description: The identifier for the user that updated this rule most recently. + nullable: true + example: elastic \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/components/schemas/schedule.yaml b/x-pack/plugins/alerting/docs/openapi/components/schemas/schedule.yaml new file mode 100644 index 0000000000000..57ddf84ceb413 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/schemas/schedule.yaml @@ -0,0 +1,6 @@ +type: object +description: The check interval, which specifies how frequently the rule conditions are checked. The interval is specified in seconds, minutes, hours, or days. +properties: + interval: + type: string + example: 1m \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/components/schemas/tags.yaml b/x-pack/plugins/alerting/docs/openapi/components/schemas/tags.yaml new file mode 100644 index 0000000000000..98015ced85844 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/schemas/tags.yaml @@ -0,0 +1,5 @@ +type: array +description: The tags for the rule. +items: + type: string +default: [] \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/components/schemas/throttle.yaml b/x-pack/plugins/alerting/docs/openapi/components/schemas/throttle.yaml new file mode 100644 index 0000000000000..a344013176f44 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/schemas/throttle.yaml @@ -0,0 +1,5 @@ +type: string +description: The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. +nullable: true +default: null +example: 10m \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/components/schemas/update_rule_request.yaml b/x-pack/plugins/alerting/docs/openapi/components/schemas/update_rule_request.yaml new file mode 100644 index 0000000000000..fb4bd9586ea1f --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/schemas/update_rule_request.yaml @@ -0,0 +1,28 @@ +title: Update rule request +description: >- + The update rule API request body varies depending on the type of rule and actions. +type: object +required: + - name + - notify_when + - params + - schedule +properties: + actions: + $ref: 'actions.yaml' + name: + type: string + description: The name of the rule. + example: cluster_health_rule + notify_when: + $ref: 'notify_when.yaml' + params: + type: object + description: The parameters for the rule. + additionalProperties: true + schedule: + $ref: 'schedule.yaml' + tags: + $ref: 'tags.yaml' + throttle: + $ref: 'throttle.yaml' diff --git a/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml b/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml index 05a3d79ec62a9..ea46f385b8c5e 100644 --- a/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml +++ b/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml @@ -15,8 +15,8 @@ servers: - url: 'http://localhost:5601' description: local paths: -# '/s/{spaceId}/api/alerting/rule/{ruleId}': -# $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}.yaml' + '/s/{spaceId}/api/alerting/rule/{ruleId}': + $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}.yaml' # '/s/{spaceId}/api/alerting/rule/{ruleId}/_disable': # $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}@_disable.yaml' # '/s/{spaceId}/api/alerting/rule/{ruleId}/_enable': diff --git a/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}.yaml b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}.yaml new file mode 100644 index 0000000000000..cb6a4a34525d9 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}.yaml @@ -0,0 +1,94 @@ +get: + summary: Retrieve a rule by its identifier. + operationId: getRule + description: > + You must have `read` privileges for the appropriate Kibana features, + depending on the `consumer` and `rule_type_id` of the rules you're seeking. + For example, the **Management > Stack Rules** feature, + **Analytics > Discover** and **Machine Learning** features, **Observability** + features, or **Security** features. To get rules associated with the + **Stack Monitoring** feature, use the `monitoring_user` built-in role. + tags: + - alerting + parameters: + - $ref: '../components/parameters/rule_id.yaml' + - $ref: '../components/parameters/space_id.yaml' + responses: + '200': + description: Indicates a successful call. + content: + application/json: + schema: + $ref: '../components/schemas/rule_response_properties.yaml' + examples: + updateRuleResponse: + $ref: '../components/examples/get_rule_response.yaml' + +delete: + summary: Deletes a rule. + operationId: deleteRule + description: > + You must have `all` privileges for the appropriate Kibana features, depending + on the `consumer` and `rule_type_id` of the rule you're deleting. For example, + the **Management** > **Stack Rules** feature, **Analytics** > **Discover** or + **Machine Learning** features, **Observability**, or **Security** features. + WARNING: After you delete a rule, you cannot recover it. + tags: + - alerting + parameters: + - $ref: ../components/headers/kbn_xsrf.yaml + - $ref: '../components/parameters/rule_id.yaml' + - $ref: '../components/parameters/space_id.yaml' + responses: + '204': + description: Indicates a successful call. + servers: + - url: https://localhost:5601 + +put: + summary: Updates the attributes for a rule. + operationId: updateRule + description: > + You must have `all` privileges for the appropriate Kibana features, + depending on the `consumer` and `rule_type_id` of the rule you're updating. + For example, you must have privileges for the **Management > Stack rules** + feature, **Analytics > Discover** and **Machine Learning** features, + **Observability** features, or **Security** features. If the rule has + actions, you must also have `read` privileges for the + **Management > Actions and Connectors** feature. NOTE: This API supports + only token-based authentication. When you update a rule, it identifies which + roles you have at that point in time. Thereafter, when the rule performs + queries, it uses those security privileges. If you have different privileges + than the user that created or most recently updated the rule, you might + change its behavior. Though some properties are optional, when you update + the rule the existing property values are overwritten with default values. + Therefore, it is recommended to explicitly set all property values. + tags: + - alerting + parameters: + - $ref: ../components/headers/kbn_xsrf.yaml + - $ref: '../components/parameters/rule_id.yaml' + - $ref: '../components/parameters/space_id.yaml' + requestBody: + required: true + content: + application/json: + schema: + $ref: '../components/schemas/update_rule_request.yaml' + examples: + updateCaseRequest: + $ref: '../components/examples/update_rule_request.yaml' + responses: + '200': + description: Indicates a successful call. + content: + application/json: + schema: + $ref: '../components/schemas/rule_response_properties.yaml' + examples: + updateRuleResponse: + $ref: '../components/examples/update_rule_response.yaml' + servers: + - url: https://localhost:5601 +servers: + - url: https://localhost:5601 \ No newline at end of file diff --git a/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rules@_find.yaml b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rules@_find.yaml index a6d0969efe614..42c4b817f7968 100644 --- a/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rules@_find.yaml +++ b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rules@_find.yaml @@ -103,154 +103,7 @@ get: data: type: array items: - type: object - properties: - actions: - type: array - items: - type: object - properties: - group: - type: string - description: The group name for the actions. - example: default - id: - type: string - description: The identifier for the connector saved object. - example: 9dca3e00-74f5-11ed-9801-35303b735aef - params: - type: object - description: The parameters for the action, which are sent to the connector. - additionalProperties: true - api_key_owner: - type: string - nullable: true - example: elastic - consumer: - type: string - description: The application or feature that owns the rule. For example, `alerts`, `apm`, `discover`, `infrastructure`, `logs`, `metrics`, `ml`, `monitoring`, `securitySolution`, `siem`, `stackAlerts`, or `uptime`. - example: alerts - created_at: - type: string - description: The date and time that the rule as created. - format: date-time - example: '2022-12-05T23:36:58.284Z' - created_by: - type: string - description: The identifier for the user that created the rule. - nullable: true - example: elastic - enabled: - type: boolean - description: Indicates whether the rule is currently enabled. - example: true - execution_status: - type: object - properties: - status: - type: string - example: ok - last_execution_date: - type: string - format: date-time - example: '2022-12-06T00:13:43.890Z' - last_duration: - type: integer - example: 55 - id: - type: string - description: The identifier for the rule. - example: b530fed0-74f5-11ed-9801-35303b735aef - last_run: - type: object - properties: - alerts_count: - type: object - properties: - new: - type: integer - nullable: true - ignored: - type: integer - nullable: true - recovered: - type: integer - nullable: true - active: - type: integer - nullable: true - outcome_msg: - type: string - nullable: true - example: null - warning: - type: string - nullable: true - example: null - outcome: - type: string - example: succeeded - muted_alert_ids: - type: array - items: - type: string - mute_all: - type: boolean - example: false - name: - type: string - description: The name of the rule. - example: cluster_health_rule - next_run: - type: string - format: date-time - nullable: true - example: '2022-12-06T00:14:43.818Z' - notify_when: - type: string - description: Indicates how often alerts generate actions. - enum: - - onActionGroupChange - - onActiveAlert - - onThrottleInterval - example: onActiveAlert - params: - type: object - description: The parameters for the rule. - additionalProperties: true - rule_type_id: - type: string - description: The identifier for the type of rule. For example, `.es-query`, `.index-threshold`, `logs.alert.document.count`, `monitoring_alert_cluster_health`, `siem.thresholdRule`, or `xpack.ml.anomaly_detection_alert`. - example: monitoring_alert_cluster_health - schedule: - type: object - description: The check interval, which specifies how frequently the rule conditions are checked. The interval is specified in seconds, minutes, hours, or days. - properties: - interval: - type: string - example: 1m - scheduled_task_id: - type: string - example: b530fed0-74f5-11ed-9801-35303b735aef - tags: - type: array - description: The tags for the rule. - items: - type: string - throttle: - type: string - description: The throttle interval, which defines how often an alert generates repeated actions. It is applicable only if `notify_when` is set to `onThrottleInterval`. It is specified in seconds, minutes, hours, or days. - nullable: true - example: 10m - updated_at: - type: string - description: The date and time that the rule was updated most recently. - example: '2022-12-05T23:36:58.284Z' - updated_by: - type: string - description: The identifier for the user that updated this rule most recently. - nullable: true - example: elastic + $ref: '../components/schemas/rule_response_properties.yaml' page: type: integer per_page: