From c0891fec08b02bc98d909a2352bf267516e91590 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Tue, 10 Jan 2023 20:40:51 -0500 Subject: [PATCH] [8.6] [DOCS] Create open API specification for disable/enable rule and mute/unmute all alerts #148360 (#148494) (#148695) # Backport This will backport the following commits from `main` to `8.6`: - [[DOCS] Create open API specification for disable/enable rule and mute/unmute all alerts #148360 (#148494)](https://github.com/elastic/kibana/pull/148494) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Lisa Cawley --- .../rules/rule-apis-passthru.asciidoc | 244 ++++++++++++++++++ docs/api/alerting/disable_rule.asciidoc | 10 +- docs/api/alerting/enable_rule.asciidoc | 10 +- docs/api/alerting/mute_alert.asciidoc | 10 +- docs/api/alerting/mute_all_alerts.asciidoc | 10 +- docs/api/alerting/unmute_alert.asciidoc | 10 +- docs/api/alerting/unmute_all_alerts.asciidoc | 10 +- .../alerting/docs/openapi/bundled.json | 232 +++++++++++++++++ .../alerting/docs/openapi/bundled.yaml | 124 +++++++++ .../components/parameters/alert_id.yaml | 7 + .../alerting/docs/openapi/entrypoint.yaml | 24 +- ...}@api@alerting@rule@{ruleid}@_disable.yaml | 21 ++ ...d}@api@alerting@rule@{ruleid}@_enable.yaml | 22 ++ ...@api@alerting@rule@{ruleid}@_mute_all.yaml | 25 ++ ...pi@alerting@rule@{ruleid}@_unmute_all.yaml | 24 ++ ...g@rule@{ruleid}@alert@{alertid}@_mute.yaml | 24 ++ ...rule@{ruleid}@alert@{alertid}@_unmute.yaml | 24 ++ 17 files changed, 807 insertions(+), 24 deletions(-) create mode 100644 x-pack/plugins/alerting/docs/openapi/components/parameters/alert_id.yaml create mode 100644 x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_disable.yaml create mode 100644 x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_enable.yaml create mode 100644 x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_mute_all.yaml create mode 100644 x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_unmute_all.yaml create mode 100644 x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_mute.yaml create mode 100644 x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_unmute.yaml diff --git a/docs/api-generated/rules/rule-apis-passthru.asciidoc b/docs/api-generated/rules/rule-apis-passthru.asciidoc index 45a6ab4c4f43a..0e9260905cbc8 100644 --- a/docs/api-generated/rules/rule-apis-passthru.asciidoc +++ b/docs/api-generated/rules/rule-apis-passthru.asciidoc @@ -19,8 +19,14 @@ Any modifications made to this file will be overwritten.

Alerting

@@ -54,6 +60,84 @@ Any modifications made to this file will be overwritten. + + + + +

Responses

+

204

+ Indicates a successful call. + + +
+
+
+ Up +
post /s/{spaceId}/api/alerting/rule/{ruleId}/_disable
+
Disable a rule. (disableRule)
+
You must have all privileges for the appropriate Kibana features, depending on the consumer and rule_type_id of the rule. For example, the Management > Stack Rules feature, Analytics > Discover and Machine Learning features, Observability, and Security features.
+ +

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 +
post /s/{spaceId}/api/alerting/rule/{ruleId}/_enable
+
Enable a rule. (enableRule)
+
This API supports token-based authentication only. You must have all privileges for the appropriate Kibana features, depending on the consumer and rule_type_id of the rule. For example, the Management > Stack Rules feature, Analytics > Discover and Machine Learning features, Observability, and Security features.
+ +

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
+ +
+ + + + @@ -342,6 +426,166 @@ Any modifications made to this file will be overwritten. rule_response_properties

+
+
+ Up +
post /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute
+
Mute an alert. (muteAlert)
+
You must have all privileges for the appropriate Kibana features, depending on the consumer and rule_type_id of the rule. For example, the Management > Stack Rules feature, Analytics > Discover and Machine Learning features, Observability, and Security features. If the rule has actions, you must also have read privileges for the Management > Actions and Connectors feature.
+ +

Path parameters

+
+
alertId (required)
+ +
Path Parameter — An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. default: null
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 +
post /s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all
+
Mute all alerts. (muteAllAlerts)
+
This API snoozes the notifications for the rule indefinitely. The rule checks continue to occur but alerts will not trigger any actions. You must have all privileges for the appropriate Kibana features, depending on the consumer and rule_type_id of the rule. For example, the Management > Stack Rules feature, Analytics > Discover and Machine Learning features, Observability, and Security features. If the rule has actions, you must also have read privileges for the Management > Actions and Connectors feature.
+ +

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 +
post /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute
+
Unmute an alert. (unmuteAlert)
+
You must have all privileges for the appropriate Kibana features, depending on the consumer and rule_type_id of the rule. For example, the Management > Stack Rules feature, Analytics > Discover and Machine Learning features, Observability, and Security features. If the rule has actions, you must also have read privileges for the Management > Actions and Connectors feature.
+ +

Path parameters

+
+
alertId (required)
+ +
Path Parameter — An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. default: null
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 +
post /s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all
+
Unmute all alerts. (unmuteAllAlerts)
+
If the rule has its notifications snoozed indefinitely, this API cancels the snooze. You must have all privileges for the appropriate Kibana features, depending on the consumer and rule_type_id of the rule. For example, the Management > Stack Rules feature, Analytics > Discover and Machine Learning features, Observability, and Security features. If the rule has actions, you must also have read privileges for the Management > Actions and Connectors feature.
+ +

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 diff --git a/docs/api/alerting/disable_rule.asciidoc b/docs/api/alerting/disable_rule.asciidoc index e9b8542d30144..d1c41eed9eaf1 100644 --- a/docs/api/alerting/disable_rule.asciidoc +++ b/docs/api/alerting/disable_rule.asciidoc @@ -6,6 +6,12 @@ Disable a 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 <>. +==== + [[disable-rule-api-request]] === {api-request-title} @@ -17,7 +23,7 @@ Disable a rule. === {api-prereq-title} You must have `all` privileges for the appropriate {kib} features, depending on -the `consumer` and `rule_type_id` of the rules you're disabling. For example, +the `consumer` and `rule_type_id` of the rule. For example, the *Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}* features, *{observability}*, and *Security* features. For more details, refer to <>. @@ -35,7 +41,7 @@ the URL, the default space is used. [[disable-rule-api-response-codes]] === {api-response-codes-title} -`200`:: +`204`:: Indicates a successful call. === {api-examples-title} diff --git a/docs/api/alerting/enable_rule.asciidoc b/docs/api/alerting/enable_rule.asciidoc index 4e4d05246e759..b87c0b9228b1b 100644 --- a/docs/api/alerting/enable_rule.asciidoc +++ b/docs/api/alerting/enable_rule.asciidoc @@ -8,6 +8,12 @@ Enable a rule. WARNING: This API supports <> only. +[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 <>. +==== + [[enable-rule-api-request]] === {api-request-title} @@ -18,7 +24,7 @@ WARNING: This API supports <> only. === {api-prereq-title} You must have `all` privileges for the appropriate {kib} features, depending on -the `consumer` and `rule_type_id` of the rules you're enabling. For example, the +the `consumer` and `rule_type_id` of the rule. For example, the *Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}* features, *{observability}*, and *Security* features. For more details, refer to <>. @@ -36,7 +42,7 @@ the URL, the default space is used. [[enable-rule-api-response-codes]] === {api-response-codes-title} -`200`:: +`204`:: Indicates a successful call. === {api-examples-title} diff --git a/docs/api/alerting/mute_alert.asciidoc b/docs/api/alerting/mute_alert.asciidoc index 92c42e1be682c..3ac99f0d3dda0 100644 --- a/docs/api/alerting/mute_alert.asciidoc +++ b/docs/api/alerting/mute_alert.asciidoc @@ -6,6 +6,12 @@ Mute an alert. +[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 <>. +==== + [[mute-alert-api-request]] === {api-request-title} @@ -16,7 +22,7 @@ Mute an alert. === {api-prereq-title} You must have `all` privileges for the appropriate {kib} features, depending on -the `consumer` and `rule_type_id` of the rules you're creating. For example, the +the `consumer` and `rule_type_id` of the rule. For example, the *Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}* features, *{observability}*, and *Security* features. If the rule has `actions`, you must also have `read` privileges for the *Management* > @@ -38,7 +44,7 @@ you must also have `read` privileges for the *Management* > [[mute-alert-api-response-codes]] === {api-response-codes-title} -`200`:: +`204`:: Indicates a successful call. === {api-examples-title} diff --git a/docs/api/alerting/mute_all_alerts.asciidoc b/docs/api/alerting/mute_all_alerts.asciidoc index 043b329a14dd4..a3c1fc0084245 100644 --- a/docs/api/alerting/mute_all_alerts.asciidoc +++ b/docs/api/alerting/mute_all_alerts.asciidoc @@ -6,6 +6,12 @@ Mute all alerts. +[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 <>. +==== + [[mute-all-alerts-api-request]] === {api-request-title} @@ -16,7 +22,7 @@ Mute all alerts. === {api-prereq-title} You must have `all` privileges for the appropriate {kib} features, depending on -the `consumer` and `rule_type_id` of the rules you're creating. For example, the +the `consumer` and `rule_type_id` of the rule. For example, the *Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}* features, *{observability}*, and *Security* features. If the rule has `actions`, you must also have `read` privileges for the *Management* > @@ -40,7 +46,7 @@ continue to occur but alerts will not trigger any actions. [[mute-all-alerts-api-response-codes]] === {api-response-codes-title} -`200`:: +`204`:: Indicates a successful call. === {api-examples-title} diff --git a/docs/api/alerting/unmute_alert.asciidoc b/docs/api/alerting/unmute_alert.asciidoc index 6bda4cb5c039a..8efa95a16edd7 100644 --- a/docs/api/alerting/unmute_alert.asciidoc +++ b/docs/api/alerting/unmute_alert.asciidoc @@ -6,6 +6,12 @@ Unmute an alert. +[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 <>. +==== + [[unmute-alert-api-request]] === {api-request-title} @@ -16,7 +22,7 @@ Unmute an alert. === {api-prereq-title} You must have `all` privileges for the appropriate {kib} features, depending on -the `consumer` and `rule_type_id` of the rules you're creating. For example, the +the `consumer` and `rule_type_id` of the rule. For example, the *Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}* features, *{observability}*, and *Security* features. If the rule has `actions`, you must also have `read` privileges for the *Management* > @@ -38,7 +44,7 @@ you must also have `read` privileges for the *Management* > [[unmute-alert-api-response-codes]] === {api-response-codes-title} -`200`:: +`204`:: Indicates a successful call. === {api-examples-title} diff --git a/docs/api/alerting/unmute_all_alerts.asciidoc b/docs/api/alerting/unmute_all_alerts.asciidoc index 7c0972bb0c53b..a4e2a91847397 100644 --- a/docs/api/alerting/unmute_all_alerts.asciidoc +++ b/docs/api/alerting/unmute_all_alerts.asciidoc @@ -6,6 +6,12 @@ Unmute all alerts. +[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 <>. +==== + [[unmute-all-alerts-api-all-request]] === {api-request-title} @@ -16,7 +22,7 @@ Unmute all alerts. === {api-prereq-title} You must have `all` privileges for the appropriate {kib} features, depending on -the `consumer` and `rule_type_id` of the rules you're creating. For example, the +the `consumer` and `rule_type_id` of the rule. For example, the *Management* > *Stack Rules* feature, *Analytics* > *Discover* and *{ml-app}* features, *{observability}*, and *Security* features. If the rule has `actions`, you must also have `read` privileges for the *Management* > @@ -40,7 +46,7 @@ snooze. [[unmute-all-alerts-api-response-codes]] === {api-response-codes-title} -`200`:: +`204`:: Indicates a successful call. === {api-examples-title} diff --git a/x-pack/plugins/alerting/docs/openapi/bundled.json b/x-pack/plugins/alerting/docs/openapi/bundled.json index 51665e76f2f97..8adf80f41a836 100644 --- a/x-pack/plugins/alerting/docs/openapi/bundled.json +++ b/x-pack/plugins/alerting/docs/openapi/bundled.json @@ -150,6 +150,78 @@ } ] }, + "/s/{spaceId}/api/alerting/rule/{ruleId}/_disable": { + "post": { + "summary": "Disable a rule.", + "operationId": "disableRule", + "description": "You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features.\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" + } + ] + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "/s/{spaceId}/api/alerting/rule/{ruleId}/_enable": { + "post": { + "summary": "Enable a rule.", + "operationId": "enableRule", + "description": "This API supports token-based authentication only. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features.\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" + } + ] + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, "/s/{spaceId}/api/alerting/rules/_find": { "get": { "summary": "Retrieves information about rules.", @@ -321,6 +393,156 @@ "url": "https://localhost:5601" } ] + }, + "/s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all": { + "post": { + "summary": "Mute all alerts.", + "operationId": "muteAllAlerts", + "description": "This API snoozes the notifications for the rule indefinitely. The rule checks continue to occur but alerts will not trigger any actions. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature.\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" + } + ] + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "/s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all": { + "post": { + "summary": "Unmute all alerts.", + "operationId": "unmuteAllAlerts", + "description": "If the rule has its notifications snoozed indefinitely, this API cancels the snooze. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature.\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" + } + ] + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "/s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute": { + "post": { + "summary": "Mute an alert.", + "operationId": "muteAlert", + "description": "You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. \n", + "tags": [ + "alerting" + ], + "parameters": [ + { + "$ref": "#/components/parameters/kbn_xsrf" + }, + { + "$ref": "#/components/parameters/alert_id" + }, + { + "$ref": "#/components/parameters/rule_id" + }, + { + "$ref": "#/components/parameters/space_id" + } + ], + "responses": { + "204": { + "description": "Indicates a successful call." + } + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "/s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute": { + "post": { + "summary": "Unmute an alert.", + "operationId": "unmuteAlert", + "description": "You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. \n", + "tags": [ + "alerting" + ], + "parameters": [ + { + "$ref": "#/components/parameters/kbn_xsrf" + }, + { + "$ref": "#/components/parameters/alert_id" + }, + { + "$ref": "#/components/parameters/rule_id" + }, + { + "$ref": "#/components/parameters/space_id" + } + ], + "responses": { + "204": { + "description": "Indicates a successful call." + } + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] + }, + "servers": [ + { + "url": "https://localhost:5601" + } + ] } }, "components": { @@ -363,6 +585,16 @@ "in": "header", "name": "kbn-xsrf", "required": true + }, + "alert_id": { + "in": "path", + "name": "alertId", + "description": "An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string.", + "required": true, + "schema": { + "type": "string", + "example": "ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74" + } } }, "schemas": { diff --git a/x-pack/plugins/alerting/docs/openapi/bundled.yaml b/x-pack/plugins/alerting/docs/openapi/bundled.yaml index c2c572cfe6619..029c6293557ce 100644 --- a/x-pack/plugins/alerting/docs/openapi/bundled.yaml +++ b/x-pack/plugins/alerting/docs/openapi/bundled.yaml @@ -86,6 +86,44 @@ paths: - url: https://localhost:5601 servers: - url: https://localhost:5601 + /s/{spaceId}/api/alerting/rule/{ruleId}/_disable: + post: + summary: Disable a rule. + operationId: disableRule + description: | + You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. + 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 + servers: + - url: https://localhost:5601 + /s/{spaceId}/api/alerting/rule/{ruleId}/_enable: + post: + summary: Enable a rule. + operationId: enableRule + description: | + This API supports token-based authentication only. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. + 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 + servers: + - url: https://localhost:5601 /s/{spaceId}/api/alerting/rules/_find: get: summary: Retrieves information about rules. @@ -195,6 +233,84 @@ paths: - url: https://localhost:5601 servers: - url: https://localhost:5601 + /s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all: + post: + summary: Mute all alerts. + operationId: muteAllAlerts + description: | + This API snoozes the notifications for the rule indefinitely. The rule checks continue to occur but alerts will not trigger any actions. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. + 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 + servers: + - url: https://localhost:5601 + /s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all: + post: + summary: Unmute all alerts. + operationId: unmuteAllAlerts + description: | + If the rule has its notifications snoozed indefinitely, this API cancels the snooze. You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. + 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 + servers: + - url: https://localhost:5601 + /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute: + post: + summary: Mute an alert. + operationId: muteAlert + description: | + You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. + tags: + - alerting + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/alert_id' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' + responses: + '204': + description: Indicates a successful call. + servers: + - url: https://localhost:5601 + servers: + - url: https://localhost:5601 + /s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute: + post: + summary: Unmute an alert. + operationId: unmuteAlert + description: | + You must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule. For example, the **Management > Stack Rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability**, and **Security** features. If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature. + tags: + - alerting + parameters: + - $ref: '#/components/parameters/kbn_xsrf' + - $ref: '#/components/parameters/alert_id' + - $ref: '#/components/parameters/rule_id' + - $ref: '#/components/parameters/space_id' + responses: + '204': + description: Indicates a successful call. + servers: + - url: https://localhost:5601 + servers: + - url: https://localhost:5601 components: securitySchemes: basicAuth: @@ -227,6 +343,14 @@ components: in: header name: kbn-xsrf required: true + alert_id: + in: path + name: alertId + description: An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. + required: true + schema: + type: string + example: ac4e6b90-6be7-11eb-ba0d-9b1c1f912d74 schemas: actions: type: array diff --git a/x-pack/plugins/alerting/docs/openapi/components/parameters/alert_id.yaml b/x-pack/plugins/alerting/docs/openapi/components/parameters/alert_id.yaml new file mode 100644 index 0000000000000..27427e1ec6758 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/components/parameters/alert_id.yaml @@ -0,0 +1,7 @@ +in: path +name: alertId +description: An identifier for the alert. The identifier is generated by the rule and might be any arbitrary string. +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/entrypoint.yaml b/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml index ea46f385b8c5e..b26443cfc8dce 100644 --- a/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml +++ b/x-pack/plugins/alerting/docs/openapi/entrypoint.yaml @@ -17,24 +17,24 @@ servers: paths: '/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': -# $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}@_enable.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': + $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}@_enable.yaml' '/s/{spaceId}/api/alerting/rules/_find': $ref: 'paths/s@{spaceid}@api@alerting@rules@_find.yaml' # '/s/{spaceId}/api/alerting/_health': # $ref: paths/s@{spaceid}@api@alerting@_health.yaml # '/s/{spaceId}/api/alerting/rule_types': # $ref: 'paths/s@{spaceid}@api@alerting@rule_types.yaml' -# '/s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all': -# $ref: 'paths/s@{spaceid}@api@rule@{ruleid}@_mute_all.yaml' -# '/s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all': -# $ref: 'paths/s@{spaceid}@api@rule@{ruleid}@_unmute_all.yaml' -# '/s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute': -# $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_mute.yaml' -# '/s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute': -# $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_unmute.yaml' + '/s/{spaceId}/api/alerting/rule/{ruleId}/_mute_all': + $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}@_mute_all.yaml' + '/s/{spaceId}/api/alerting/rule/{ruleId}/_unmute_all': + $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}@_unmute_all.yaml' + '/s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_mute': + $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_mute.yaml' + '/s/{spaceId}/api/alerting/rule/{ruleId}/alert/{alertId}/_unmute': + $ref: 'paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_unmute.yaml' # Deprecated APIs # '/s/{spaceId}/api/alerts/alert/{alertId}': diff --git a/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_disable.yaml b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_disable.yaml new file mode 100644 index 0000000000000..8c8a60ae2ce2e --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_disable.yaml @@ -0,0 +1,21 @@ +post: + summary: Disable a rule. + operationId: disableRule + description: > + You must have `all` privileges for the appropriate Kibana features, + depending on the `consumer` and `rule_type_id` of the rule. For example, the + **Management > Stack Rules** feature, **Analytics > Discover** and + **Machine Learning** features, **Observability**, and **Security** features. + 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 +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@rule@{ruleid}@_enable.yaml b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_enable.yaml new file mode 100644 index 0000000000000..ee4ef54fc43f6 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_enable.yaml @@ -0,0 +1,22 @@ +post: + summary: Enable a rule. + operationId: enableRule + description: > + This API supports token-based authentication only. + You must have `all` privileges for the appropriate Kibana features, + depending on the `consumer` and `rule_type_id` of the rule. For example, the + **Management > Stack Rules** feature, **Analytics > Discover** and + **Machine Learning** features, **Observability**, and **Security** features. + 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 +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@rule@{ruleid}@_mute_all.yaml b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_mute_all.yaml new file mode 100644 index 0000000000000..a816ed0b0b7ef --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_mute_all.yaml @@ -0,0 +1,25 @@ +post: + summary: Mute all alerts. + operationId: muteAllAlerts + description: > + This API snoozes the notifications for the rule indefinitely. The rule + checks continue to occur but alerts will not trigger any actions. + You must have `all` privileges for the appropriate Kibana features, + depending on the `consumer` and `rule_type_id` of the rule. For example, the + **Management > Stack Rules** feature, **Analytics > Discover** and + **Machine Learning** features, **Observability**, and **Security** features. + If the rule has actions, you must also have `read` privileges for the + **Management > Actions and Connectors** feature. + 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 +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@rule@{ruleid}@_unmute_all.yaml b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_unmute_all.yaml new file mode 100644 index 0000000000000..38e8f0807c998 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@_unmute_all.yaml @@ -0,0 +1,24 @@ +post: + summary: Unmute all alerts. + operationId: unmuteAllAlerts + description: > + If the rule has its notifications snoozed indefinitely, this API cancels the snooze. + You must have `all` privileges for the appropriate Kibana features, + depending on the `consumer` and `rule_type_id` of the rule. For example, the + **Management > Stack Rules** feature, **Analytics > Discover** and + **Machine Learning** features, **Observability**, and **Security** features. + If the rule has actions, you must also have `read` privileges for the + **Management > Actions and Connectors** feature. + 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 +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@rule@{ruleid}@alert@{alertid}@_mute.yaml b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_mute.yaml new file mode 100644 index 0000000000000..d120c06e7a6c4 --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_mute.yaml @@ -0,0 +1,24 @@ +post: + summary: Mute an alert. + operationId: muteAlert + description: > + You must have `all` privileges for the appropriate Kibana features, + depending on the `consumer` and `rule_type_id` of the rule. For example, the + **Management > Stack Rules** feature, **Analytics > Discover** and + **Machine Learning** features, **Observability**, and **Security** features. + If the rule has actions, you must also have `read` privileges for the + **Management > Actions and Connectors** feature. + tags: + - alerting + parameters: + - $ref: ../components/headers/kbn_xsrf.yaml + - $ref: '../components/parameters/alert_id.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 +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@rule@{ruleid}@alert@{alertid}@_unmute.yaml b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_unmute.yaml new file mode 100644 index 0000000000000..bbc92453e236b --- /dev/null +++ b/x-pack/plugins/alerting/docs/openapi/paths/s@{spaceid}@api@alerting@rule@{ruleid}@alert@{alertid}@_unmute.yaml @@ -0,0 +1,24 @@ +post: + summary: Unmute an alert. + operationId: unmuteAlert + description: > + You must have `all` privileges for the appropriate Kibana features, + depending on the `consumer` and `rule_type_id` of the rule. For example, the + **Management > Stack Rules** feature, **Analytics > Discover** and + **Machine Learning** features, **Observability**, and **Security** features. + If the rule has actions, you must also have `read` privileges for the + **Management > Actions and Connectors** feature. + tags: + - alerting + parameters: + - $ref: ../components/headers/kbn_xsrf.yaml + - $ref: '../components/parameters/alert_id.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 +servers: + - url: https://localhost:5601 \ No newline at end of file