diff --git a/pkg/services/ngalert/api/tooling/api.json b/pkg/services/ngalert/api/tooling/api.json index 1ea96215152e2..b019b68082a66 100644 --- a/pkg/services/ngalert/api/tooling/api.json +++ b/pkg/services/ngalert/api/tooling/api.json @@ -188,7 +188,7 @@ "condition": { "type": "string" }, - "dasboardUid": { + "dashboardUid": { "type": "string" }, "data": { @@ -225,6 +225,9 @@ ], "type": "string" }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettingsExport" + }, "panelId": { "format": "int64", "type": "integer" @@ -294,6 +297,91 @@ }, "type": "object" }, + "AlertRuleNotificationSettings": { + "description": "swagger: model", + "properties": { + "group_by": { + "default": [ + "alertname", + "grafana_folder" + ], + "description": "Override the labels by which incoming alerts are grouped together. For example, multiple alerts coming in for\ncluster=A and alertname=LatencyHigh would be batched into a single group. To aggregate by all possible labels\nuse the special value '...' as the sole label name.\nThis effectively disables aggregation entirely, passing through all alerts as-is. This is unlikely to be what\nyou want, unless you have a very low alert volume or your upstream notification system performs its own grouping.\nMust include 'alertname' and 'grafana_folder' if not using '...'.", + "example": [ + "alertname", + "grafana_folder", + "cluster" + ], + "items": { + "type": "string" + }, + "type": "array" + }, + "group_interval": { + "description": "Override how long to wait before sending a notification about new alerts that are added to a group of alerts for\nwhich an initial notification has already been sent. (Usually ~5m or more.)", + "example": "5m", + "type": "string" + }, + "group_wait": { + "description": "Override how long to initially wait to send a notification for a group of alerts. Allows to wait for an\ninhibiting alert to arrive or collect more initial alerts for the same group. (Usually ~0s to few minutes.)", + "example": "30s", + "type": "string" + }, + "mute_time_intervals": { + "description": "Override the times when notifications should be muted. These must match the name of a mute time interval defined\nin the alertmanager configuration mute_time_intervals section. When muted it will not send any notifications, but\notherwise acts normally.", + "example": [ + "maintenance" + ], + "items": { + "type": "string" + }, + "type": "array" + }, + "receiver": { + "description": "Name of the receiver to send notifications to.", + "example": "grafana-default-email", + "type": "string" + }, + "repeat_interval": { + "description": "Override how long to wait before sending a notification again if it has already been sent successfully for an\nalert. (Usually ~3h or more).\nNote that this parameter is implicitly bound by Alertmanager's `--data.retention` configuration flag.\nNotifications will be resent after either repeat_interval or the data retention period have passed, whichever\noccurs first. `repeat_interval` should not be less than `group_interval`.", + "example": "4h", + "type": "string" + } + }, + "required": [ + "receiver" + ], + "type": "object" + }, + "AlertRuleNotificationSettingsExport": { + "properties": { + "group_by": { + "items": { + "type": "string" + }, + "type": "array" + }, + "group_interval": { + "type": "string" + }, + "group_wait": { + "type": "string" + }, + "mute_time_intervals": { + "items": { + "type": "string" + }, + "type": "array" + }, + "receiver": { + "type": "string" + }, + "repeat_interval": { + "type": "string" + } + }, + "title": "AlertRuleNotificationSettingsExport is the provisioned export of models.NotificationSettings.", + "type": "object" + }, "AlertRuleUpgrade": { "properties": { "sendsTo": { @@ -752,6 +840,9 @@ }, "webhook_url": { "$ref": "#/definitions/SecretURL" + }, + "webhook_url_file": { + "type": "string" } }, "title": "DiscordConfig configures notifications via Discord.", @@ -856,23 +947,23 @@ "type": { "enum": [ "alertmanager", - " dingding", - " discord", - " email", - " googlechat", - " kafka", - " line", - " opsgenie", - " pagerduty", - " pushover", - " sensugo", - " slack", - " teams", - " telegram", - " threema", - " victorops", - " webhook", - " wecom" + "dingding", + "discord", + "email", + "googlechat", + "kafka", + "line", + "opsgenie", + "pagerduty", + "pushover", + "sensugo", + "slack", + "teams", + "telegram", + "threema", + "victorops", + "webhook", + "wecom" ], "example": "webhook", "type": "string" @@ -971,7 +1062,9 @@ }, "type": "object" }, - "EvalQueriesResponse": {}, + "EvalQueriesResponse": { + "type": "object" + }, "ExplorePanelsState": { "description": "This is an object constructed with the keys as the values of the enum VisType and the value being a bag of properties" }, @@ -1271,7 +1364,7 @@ "type": "object" }, "FrameType": { - "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.", + "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.\n+enum", "type": "string" }, "FrameTypeVersion": { @@ -1560,6 +1653,9 @@ ], "type": "string" }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettings" + }, "orgId": { "format": "int64", "type": "integer" @@ -2028,6 +2124,9 @@ "send_resolved": { "type": "boolean" }, + "summary": { + "type": "string" + }, "text": { "type": "string" }, @@ -2036,6 +2135,9 @@ }, "webhook_url": { "$ref": "#/definitions/SecretURL" + }, + "webhook_url_file": { + "type": "string" } }, "type": "object" @@ -2531,24 +2633,6 @@ "PermissionDenied": { "type": "object" }, - "Point": { - "description": "If H is not nil, then this is a histogram point and only (T, H) is valid.\nIf H is nil, then only (T, V) is valid.", - "properties": { - "H": { - "$ref": "#/definitions/FloatHistogram" - }, - "T": { - "format": "int64", - "type": "integer" - }, - "V": { - "format": "double", - "type": "number" - } - }, - "title": "Point represents a single data point for a given timestamp.", - "type": "object" - }, "PostableApiAlertingConfig": { "properties": { "global": { @@ -2803,6 +2887,9 @@ ], "type": "string" }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettings" + }, "title": { "type": "string" }, @@ -2979,6 +3066,9 @@ ], "type": "string" }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettings" + }, "orgID": { "format": "int64", "type": "integer" @@ -3659,7 +3749,12 @@ "type": "object" }, "Sample": { + "description": "Sample is a single sample belonging to a metric. It represents either a float\nsample or a histogram sample. If H is nil, it is a float sample. Otherwise,\nit is a histogram sample.", "properties": { + "F": { + "format": "double", + "type": "number" + }, "H": { "$ref": "#/definitions/FloatHistogram" }, @@ -3669,13 +3764,8 @@ "T": { "format": "int64", "type": "integer" - }, - "V": { - "format": "double", - "type": "number" } }, - "title": "Sample is a single sample belonging to a metric.", "type": "object" }, "Secret": { @@ -4270,6 +4360,7 @@ "type": "object" }, "URL": { + "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nThe Host field contains the host and port subcomponents of the URL.\nWhen the port is present, it is separated from the host with a colon.\nWhen the host is an IPv6 address, it must be enclosed in square brackets:\n\"[fe80::1]:80\". The [net.JoinHostPort] function combines a host and port\ninto a string suitable for the Host field, adding square brackets to\nthe host when necessary.\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use the [URL.EscapedPath] method, which preserves\nthe original encoding of Path.\n\nThe RawPath field is an optional field which is only set when the default\nencoding of Path is different from the escaped path. See the EscapedPath method\nfor more details.\n\nURL's String method uses the EscapedPath method to obtain the path.", "properties": { "ForceQuery": { "type": "boolean" @@ -4305,7 +4396,7 @@ "$ref": "#/definitions/Userinfo" } }, - "title": "URL is a custom URL type that allows validation at configuration load time.", + "title": "A URL represents a parsed URL (technically, a URI reference).", "type": "object" }, "UpdateRuleGroupResponse": { @@ -4335,7 +4426,7 @@ "type": "object" }, "Userinfo": { - "description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a URL. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.", + "description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a [URL]. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.", "type": "object" }, "ValidationError": { @@ -4358,7 +4449,7 @@ "type": "array" }, "Vector": { - "description": "Vector is basically only an alias for model.Samples, but the\ncontract is that in a Vector, all Samples have the same timestamp.", + "description": "Vector is basically only an alias for []Sample, but the contract is that\nin a Vector, all Samples have the same timestamp.", "items": { "$ref": "#/definitions/Sample" }, @@ -4511,6 +4602,7 @@ "type": "object" }, "alertGroup": { + "description": "AlertGroup alert group", "properties": { "alerts": { "description": "alerts", @@ -4534,8 +4626,10 @@ "type": "object" }, "alertGroups": { + "description": "AlertGroups alert groups", "items": { - "$ref": "#/definitions/alertGroup" + "$ref": "#/definitions/alertGroup", + "type": "object" }, "type": "array" }, @@ -4638,48 +4732,6 @@ "type": "object" }, "gettableAlert": { - "properties": { - "annotations": { - "$ref": "#/definitions/labelSet" - }, - "endsAt": { - "description": "ends at", - "format": "date-time", - "type": "string" - }, - "fingerprint": { - "description": "fingerprint", - "type": "string" - }, - "generatorURL": { - "description": "generator URL\nFormat: uri", - "format": "uri", - "type": "string" - }, - "labels": { - "$ref": "#/definitions/labelSet" - }, - "receivers": { - "description": "receivers", - "items": { - "$ref": "#/definitions/receiver" - }, - "type": "array" - }, - "startsAt": { - "description": "starts at", - "format": "date-time", - "type": "string" - }, - "status": { - "$ref": "#/definitions/alertStatus" - }, - "updatedAt": { - "description": "updated at", - "format": "date-time", - "type": "string" - } - }, "required": [ "labels", "annotations", @@ -4693,48 +4745,13 @@ "type": "object" }, "gettableAlerts": { - "description": "GettableAlerts gettable alerts", "items": { - "$ref": "#/definitions/gettableAlert" + "$ref": "#/definitions/gettableAlert", + "type": "object" }, "type": "array" }, "gettableSilence": { - "properties": { - "comment": { - "description": "comment", - "type": "string" - }, - "createdBy": { - "description": "created by", - "type": "string" - }, - "endsAt": { - "description": "ends at", - "format": "date-time", - "type": "string" - }, - "id": { - "description": "id", - "type": "string" - }, - "matchers": { - "$ref": "#/definitions/matchers" - }, - "startsAt": { - "description": "starts at", - "format": "date-time", - "type": "string" - }, - "status": { - "$ref": "#/definitions/silenceStatus" - }, - "updatedAt": { - "description": "updated at", - "format": "date-time", - "type": "string" - } - }, "required": [ "comment", "createdBy", @@ -4748,9 +4765,9 @@ "type": "object" }, "gettableSilences": { - "description": "GettableSilences gettable silences", "items": { - "$ref": "#/definitions/gettableSilence" + "$ref": "#/definitions/gettableSilence", + "type": "object" }, "type": "array" }, @@ -4899,33 +4916,6 @@ "type": "array" }, "postableSilence": { - "properties": { - "comment": { - "description": "comment", - "type": "string" - }, - "createdBy": { - "description": "created by", - "type": "string" - }, - "endsAt": { - "description": "ends at", - "format": "date-time", - "type": "string" - }, - "id": { - "description": "id", - "type": "string" - }, - "matchers": { - "$ref": "#/definitions/matchers" - }, - "startsAt": { - "description": "starts at", - "format": "date-time", - "type": "string" - } - }, "required": [ "comment", "createdBy", @@ -4936,6 +4926,7 @@ "type": "object" }, "receiver": { + "description": "Receiver receiver", "properties": { "active": { "description": "active", diff --git a/pkg/services/ngalert/api/tooling/post.json b/pkg/services/ngalert/api/tooling/post.json index 0f28aa4f8b50e..4ebdb6caa6847 100644 --- a/pkg/services/ngalert/api/tooling/post.json +++ b/pkg/services/ngalert/api/tooling/post.json @@ -188,7 +188,7 @@ "condition": { "type": "string" }, - "dasboardUid": { + "dashboardUid": { "type": "string" }, "data": { @@ -225,6 +225,9 @@ ], "type": "string" }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettingsExport" + }, "panelId": { "format": "int64", "type": "integer" @@ -294,6 +297,91 @@ }, "type": "object" }, + "AlertRuleNotificationSettings": { + "description": "swagger: model", + "properties": { + "group_by": { + "default": [ + "alertname", + "grafana_folder" + ], + "description": "Override the labels by which incoming alerts are grouped together. For example, multiple alerts coming in for\ncluster=A and alertname=LatencyHigh would be batched into a single group. To aggregate by all possible labels\nuse the special value '...' as the sole label name.\nThis effectively disables aggregation entirely, passing through all alerts as-is. This is unlikely to be what\nyou want, unless you have a very low alert volume or your upstream notification system performs its own grouping.\nMust include 'alertname' and 'grafana_folder' if not using '...'.", + "example": [ + "alertname", + "grafana_folder", + "cluster" + ], + "items": { + "type": "string" + }, + "type": "array" + }, + "group_interval": { + "description": "Override how long to wait before sending a notification about new alerts that are added to a group of alerts for\nwhich an initial notification has already been sent. (Usually ~5m or more.)", + "example": "5m", + "type": "string" + }, + "group_wait": { + "description": "Override how long to initially wait to send a notification for a group of alerts. Allows to wait for an\ninhibiting alert to arrive or collect more initial alerts for the same group. (Usually ~0s to few minutes.)", + "example": "30s", + "type": "string" + }, + "mute_time_intervals": { + "description": "Override the times when notifications should be muted. These must match the name of a mute time interval defined\nin the alertmanager configuration mute_time_intervals section. When muted it will not send any notifications, but\notherwise acts normally.", + "example": [ + "maintenance" + ], + "items": { + "type": "string" + }, + "type": "array" + }, + "receiver": { + "description": "Name of the receiver to send notifications to.", + "example": "grafana-default-email", + "type": "string" + }, + "repeat_interval": { + "description": "Override how long to wait before sending a notification again if it has already been sent successfully for an\nalert. (Usually ~3h or more).\nNote that this parameter is implicitly bound by Alertmanager's `--data.retention` configuration flag.\nNotifications will be resent after either repeat_interval or the data retention period have passed, whichever\noccurs first. `repeat_interval` should not be less than `group_interval`.", + "example": "4h", + "type": "string" + } + }, + "required": [ + "receiver" + ], + "type": "object" + }, + "AlertRuleNotificationSettingsExport": { + "properties": { + "group_by": { + "items": { + "type": "string" + }, + "type": "array" + }, + "group_interval": { + "type": "string" + }, + "group_wait": { + "type": "string" + }, + "mute_time_intervals": { + "items": { + "type": "string" + }, + "type": "array" + }, + "receiver": { + "type": "string" + }, + "repeat_interval": { + "type": "string" + } + }, + "title": "AlertRuleNotificationSettingsExport is the provisioned export of models.NotificationSettings.", + "type": "object" + }, "AlertRuleUpgrade": { "properties": { "sendsTo": { @@ -752,6 +840,9 @@ }, "webhook_url": { "$ref": "#/definitions/SecretURL" + }, + "webhook_url_file": { + "type": "string" } }, "title": "DiscordConfig configures notifications via Discord.", @@ -856,23 +947,23 @@ "type": { "enum": [ "alertmanager", - " dingding", - " discord", - " email", - " googlechat", - " kafka", - " line", - " opsgenie", - " pagerduty", - " pushover", - " sensugo", - " slack", - " teams", - " telegram", - " threema", - " victorops", - " webhook", - " wecom" + "dingding", + "discord", + "email", + "googlechat", + "kafka", + "line", + "opsgenie", + "pagerduty", + "pushover", + "sensugo", + "slack", + "teams", + "telegram", + "threema", + "victorops", + "webhook", + "wecom" ], "example": "webhook", "type": "string" @@ -971,7 +1062,9 @@ }, "type": "object" }, - "EvalQueriesResponse": {}, + "EvalQueriesResponse": { + "type": "object" + }, "ExplorePanelsState": { "description": "This is an object constructed with the keys as the values of the enum VisType and the value being a bag of properties" }, @@ -1271,7 +1364,7 @@ "type": "object" }, "FrameType": { - "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.", + "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.\n+enum", "type": "string" }, "FrameTypeVersion": { @@ -1560,6 +1653,9 @@ ], "type": "string" }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettings" + }, "orgId": { "format": "int64", "type": "integer" @@ -2028,6 +2124,9 @@ "send_resolved": { "type": "boolean" }, + "summary": { + "type": "string" + }, "text": { "type": "string" }, @@ -2036,6 +2135,9 @@ }, "webhook_url": { "$ref": "#/definitions/SecretURL" + }, + "webhook_url_file": { + "type": "string" } }, "type": "object" @@ -2531,24 +2633,6 @@ "PermissionDenied": { "type": "object" }, - "Point": { - "description": "If H is not nil, then this is a histogram point and only (T, H) is valid.\nIf H is nil, then only (T, V) is valid.", - "properties": { - "H": { - "$ref": "#/definitions/FloatHistogram" - }, - "T": { - "format": "int64", - "type": "integer" - }, - "V": { - "format": "double", - "type": "number" - } - }, - "title": "Point represents a single data point for a given timestamp.", - "type": "object" - }, "PostableApiAlertingConfig": { "properties": { "global": { @@ -2803,6 +2887,9 @@ ], "type": "string" }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettings" + }, "title": { "type": "string" }, @@ -2979,6 +3066,9 @@ ], "type": "string" }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettings" + }, "orgID": { "format": "int64", "type": "integer" @@ -3659,7 +3749,12 @@ "type": "object" }, "Sample": { + "description": "Sample is a single sample belonging to a metric. It represents either a float\nsample or a histogram sample. If H is nil, it is a float sample. Otherwise,\nit is a histogram sample.", "properties": { + "F": { + "format": "double", + "type": "number" + }, "H": { "$ref": "#/definitions/FloatHistogram" }, @@ -3669,13 +3764,8 @@ "T": { "format": "int64", "type": "integer" - }, - "V": { - "format": "double", - "type": "number" } }, - "title": "Sample is a single sample belonging to a metric.", "type": "object" }, "Secret": { @@ -4270,7 +4360,7 @@ "type": "object" }, "URL": { - "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use the EscapedPath method, which preserves\nthe original encoding of Path.\n\nThe RawPath field is an optional field which is only set when the default\nencoding of Path is different from the escaped path. See the EscapedPath method\nfor more details.\n\nURL's String method uses the EscapedPath method to obtain the path.", + "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nThe Host field contains the host and port subcomponents of the URL.\nWhen the port is present, it is separated from the host with a colon.\nWhen the host is an IPv6 address, it must be enclosed in square brackets:\n\"[fe80::1]:80\". The [net.JoinHostPort] function combines a host and port\ninto a string suitable for the Host field, adding square brackets to\nthe host when necessary.\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use the [URL.EscapedPath] method, which preserves\nthe original encoding of Path.\n\nThe RawPath field is an optional field which is only set when the default\nencoding of Path is different from the escaped path. See the EscapedPath method\nfor more details.\n\nURL's String method uses the EscapedPath method to obtain the path.", "properties": { "ForceQuery": { "type": "boolean" @@ -4336,7 +4426,7 @@ "type": "object" }, "Userinfo": { - "description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a URL. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.", + "description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a [URL]. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.", "type": "object" }, "ValidationError": { @@ -4359,7 +4449,7 @@ "type": "array" }, "Vector": { - "description": "Vector is basically only an alias for model.Samples, but the\ncontract is that in a Vector, all Samples have the same timestamp.", + "description": "Vector is basically only an alias for []Sample, but the contract is that\nin a Vector, all Samples have the same timestamp.", "items": { "$ref": "#/definitions/Sample" }, @@ -4512,21 +4602,6 @@ "type": "object" }, "alertGroup": { - "properties": { - "alerts": { - "description": "alerts", - "items": { - "$ref": "#/definitions/gettableAlert" - }, - "type": "array" - }, - "labels": { - "$ref": "#/definitions/labelSet" - }, - "receiver": { - "$ref": "#/definitions/receiver" - } - }, "required": [ "alerts", "labels", @@ -4537,7 +4612,8 @@ "alertGroups": { "description": "AlertGroups alert groups", "items": { - "$ref": "#/definitions/alertGroup" + "$ref": "#/definitions/alertGroup", + "type": "object" }, "type": "array" }, @@ -4697,11 +4773,13 @@ }, "gettableAlerts": { "items": { - "$ref": "#/definitions/gettableAlert" + "$ref": "#/definitions/gettableAlert", + "type": "object" }, "type": "array" }, "gettableSilence": { + "description": "GettableSilence gettable silence", "properties": { "comment": { "description": "comment", @@ -4750,8 +4828,10 @@ "type": "object" }, "gettableSilences": { + "description": "GettableSilences gettable silences", "items": { - "$ref": "#/definitions/gettableSilence" + "$ref": "#/definitions/gettableSilence", + "type": "object" }, "type": "array" }, @@ -4900,6 +4980,7 @@ "type": "array" }, "postableSilence": { + "description": "PostableSilence postable silence", "properties": { "comment": { "description": "comment", @@ -4937,6 +5018,7 @@ "type": "object" }, "receiver": { + "description": "Receiver receiver", "properties": { "active": { "description": "active", @@ -7113,6 +7195,12 @@ "200": { "$ref": "#/responses/GetReceiverResponse" }, + "403": { + "description": "PermissionDenied", + "schema": { + "$ref": "#/definitions/PermissionDenied" + } + }, "404": { "description": "NotFound", "schema": { diff --git a/pkg/services/ngalert/api/tooling/spec.json b/pkg/services/ngalert/api/tooling/spec.json index 9b208a3ea17f8..e05fe575f6973 100644 --- a/pkg/services/ngalert/api/tooling/spec.json +++ b/pkg/services/ngalert/api/tooling/spec.json @@ -2078,6 +2078,12 @@ "200": { "$ref": "#/responses/GetReceiverResponse" }, + "403": { + "description": "PermissionDenied", + "schema": { + "$ref": "#/definitions/PermissionDenied" + } + }, "404": { "description": "NotFound", "schema": { @@ -3746,7 +3752,7 @@ "condition": { "type": "string" }, - "dasboardUid": { + "dashboardUid": { "type": "string" }, "data": { @@ -3783,6 +3789,9 @@ "OK" ] }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettingsExport" + }, "panelId": { "type": "integer", "format": "int64" @@ -3850,6 +3859,91 @@ } } }, + "AlertRuleNotificationSettings": { + "description": "swagger: model", + "type": "object", + "required": [ + "receiver" + ], + "properties": { + "group_by": { + "description": "Override the labels by which incoming alerts are grouped together. For example, multiple alerts coming in for\ncluster=A and alertname=LatencyHigh would be batched into a single group. To aggregate by all possible labels\nuse the special value '...' as the sole label name.\nThis effectively disables aggregation entirely, passing through all alerts as-is. This is unlikely to be what\nyou want, unless you have a very low alert volume or your upstream notification system performs its own grouping.\nMust include 'alertname' and 'grafana_folder' if not using '...'.", + "type": "array", + "default": [ + "alertname", + "grafana_folder" + ], + "items": { + "type": "string" + }, + "example": [ + "alertname", + "grafana_folder", + "cluster" + ] + }, + "group_interval": { + "description": "Override how long to wait before sending a notification about new alerts that are added to a group of alerts for\nwhich an initial notification has already been sent. (Usually ~5m or more.)", + "type": "string", + "example": "5m" + }, + "group_wait": { + "description": "Override how long to initially wait to send a notification for a group of alerts. Allows to wait for an\ninhibiting alert to arrive or collect more initial alerts for the same group. (Usually ~0s to few minutes.)", + "type": "string", + "example": "30s" + }, + "mute_time_intervals": { + "description": "Override the times when notifications should be muted. These must match the name of a mute time interval defined\nin the alertmanager configuration mute_time_intervals section. When muted it will not send any notifications, but\notherwise acts normally.", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "maintenance" + ] + }, + "receiver": { + "description": "Name of the receiver to send notifications to.", + "type": "string", + "example": "grafana-default-email" + }, + "repeat_interval": { + "description": "Override how long to wait before sending a notification again if it has already been sent successfully for an\nalert. (Usually ~3h or more).\nNote that this parameter is implicitly bound by Alertmanager's `--data.retention` configuration flag.\nNotifications will be resent after either repeat_interval or the data retention period have passed, whichever\noccurs first. `repeat_interval` should not be less than `group_interval`.", + "type": "string", + "example": "4h" + } + } + }, + "AlertRuleNotificationSettingsExport": { + "type": "object", + "title": "AlertRuleNotificationSettingsExport is the provisioned export of models.NotificationSettings.", + "properties": { + "group_by": { + "type": "array", + "items": { + "type": "string" + } + }, + "group_interval": { + "type": "string" + }, + "group_wait": { + "type": "string" + }, + "mute_time_intervals": { + "type": "array", + "items": { + "type": "string" + } + }, + "receiver": { + "type": "string" + }, + "repeat_interval": { + "type": "string" + } + } + }, "AlertRuleUpgrade": { "type": "object", "properties": { @@ -4310,6 +4404,9 @@ }, "webhook_url": { "$ref": "#/definitions/SecretURL" + }, + "webhook_url_file": { + "type": "string" } } }, @@ -4419,23 +4516,23 @@ "type": "string", "enum": [ "alertmanager", - " dingding", - " discord", - " email", - " googlechat", - " kafka", - " line", - " opsgenie", - " pagerduty", - " pushover", - " sensugo", - " slack", - " teams", - " telegram", - " threema", - " victorops", - " webhook", - " wecom" + "dingding", + "discord", + "email", + "googlechat", + "kafka", + "line", + "opsgenie", + "pagerduty", + "pushover", + "sensugo", + "slack", + "teams", + "telegram", + "threema", + "victorops", + "webhook", + "wecom" ], "example": "webhook" }, @@ -4529,7 +4626,7 @@ } }, "EvalQueriesResponse": { - "$ref": "#/definitions/EvalQueriesResponse" + "type": "object" }, "ExplorePanelsState": { "description": "This is an object constructed with the keys as the values of the enum VisType and the value being a bag of properties" @@ -4830,7 +4927,7 @@ } }, "FrameType": { - "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.", + "description": "A FrameType string, when present in a frame's metadata, asserts that the\nframe's structure conforms to the FrameType's specification.\nThis property is currently optional, so FrameType may be FrameTypeUnknown even if the properties of\nthe Frame correspond to a defined FrameType.\n+enum", "type": "string" }, "FrameTypeVersion": { @@ -5120,6 +5217,9 @@ "OK" ] }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettings" + }, "orgId": { "type": "integer", "format": "int64" @@ -5588,6 +5688,9 @@ "send_resolved": { "type": "boolean" }, + "summary": { + "type": "string" + }, "text": { "type": "string" }, @@ -5596,6 +5699,9 @@ }, "webhook_url": { "$ref": "#/definitions/SecretURL" + }, + "webhook_url_file": { + "type": "string" } } }, @@ -6091,24 +6197,6 @@ "PermissionDenied": { "type": "object" }, - "Point": { - "description": "If H is not nil, then this is a histogram point and only (T, H) is valid.\nIf H is nil, then only (T, V) is valid.", - "type": "object", - "title": "Point represents a single data point for a given timestamp.", - "properties": { - "H": { - "$ref": "#/definitions/FloatHistogram" - }, - "T": { - "type": "integer", - "format": "int64" - }, - "V": { - "type": "number", - "format": "double" - } - } - }, "PostableApiAlertingConfig": { "type": "object", "properties": { @@ -6364,6 +6452,9 @@ "OK" ] }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettings" + }, "title": { "type": "string" }, @@ -6551,6 +6642,9 @@ "OK" ] }, + "notification_settings": { + "$ref": "#/definitions/AlertRuleNotificationSettings" + }, "orgID": { "type": "integer", "format": "int64" @@ -7219,9 +7313,13 @@ } }, "Sample": { + "description": "Sample is a single sample belonging to a metric. It represents either a float\nsample or a histogram sample. If H is nil, it is a float sample. Otherwise,\nit is a histogram sample.", "type": "object", - "title": "Sample is a single sample belonging to a metric.", "properties": { + "F": { + "type": "number", + "format": "double" + }, "H": { "$ref": "#/definitions/FloatHistogram" }, @@ -7231,10 +7329,6 @@ "T": { "type": "integer", "format": "int64" - }, - "V": { - "type": "number", - "format": "double" } } }, @@ -7830,7 +7924,7 @@ } }, "URL": { - "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use the EscapedPath method, which preserves\nthe original encoding of Path.\n\nThe RawPath field is an optional field which is only set when the default\nencoding of Path is different from the escaped path. See the EscapedPath method\nfor more details.\n\nURL's String method uses the EscapedPath method to obtain the path.", + "description": "The general form represented is:\n\n[scheme:][//[userinfo@]host][/]path[?query][#fragment]\n\nURLs that do not start with a slash after the scheme are interpreted as:\n\nscheme:opaque[?query][#fragment]\n\nThe Host field contains the host and port subcomponents of the URL.\nWhen the port is present, it is separated from the host with a colon.\nWhen the host is an IPv6 address, it must be enclosed in square brackets:\n\"[fe80::1]:80\". The [net.JoinHostPort] function combines a host and port\ninto a string suitable for the Host field, adding square brackets to\nthe host when necessary.\n\nNote that the Path field is stored in decoded form: /%47%6f%2f becomes /Go/.\nA consequence is that it is impossible to tell which slashes in the Path were\nslashes in the raw URL and which were %2f. This distinction is rarely important,\nbut when it is, the code should use the [URL.EscapedPath] method, which preserves\nthe original encoding of Path.\n\nThe RawPath field is an optional field which is only set when the default\nencoding of Path is different from the escaped path. See the EscapedPath method\nfor more details.\n\nURL's String method uses the EscapedPath method to obtain the path.", "type": "object", "title": "A URL represents a parsed URL (technically, a URI reference).", "properties": { @@ -7896,7 +7990,7 @@ } }, "Userinfo": { - "description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a URL. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.", + "description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a [URL]. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.", "type": "object" }, "ValidationError": { @@ -7919,7 +8013,7 @@ } }, "Vector": { - "description": "Vector is basically only an alias for model.Samples, but the\ncontract is that in a Vector, all Samples have the same timestamp.", + "description": "Vector is basically only an alias for []Sample, but the contract is that\nin a Vector, all Samples have the same timestamp.", "type": "array", "items": { "$ref": "#/definitions/Sample" @@ -8077,31 +8171,15 @@ "alerts", "labels", "receiver" - ], - "properties": { - "alerts": { - "description": "alerts", - "type": "array", - "items": { - "$ref": "#/definitions/gettableAlert" - } - }, - "labels": { - "$ref": "#/definitions/labelSet" - }, - "receiver": { - "$ref": "#/definitions/receiver" - } - }, - "$ref": "#/definitions/alertGroup" + ] }, "alertGroups": { "description": "AlertGroups alert groups", "type": "array", "items": { + "type": "object", "$ref": "#/definitions/alertGroup" - }, - "$ref": "#/definitions/alertGroups" + } }, "alertStatus": { "description": "AlertStatus alert status", @@ -8255,17 +8333,17 @@ "type": "string", "format": "date-time" } - }, - "$ref": "#/definitions/gettableAlert" + } }, "gettableAlerts": { "type": "array", "items": { + "type": "object", "$ref": "#/definitions/gettableAlert" - }, - "$ref": "#/definitions/gettableAlerts" + } }, "gettableSilence": { + "description": "GettableSilence gettable silence", "type": "object", "required": [ "comment", @@ -8311,15 +8389,15 @@ "type": "string", "format": "date-time" } - }, - "$ref": "#/definitions/gettableSilence" + } }, "gettableSilences": { + "description": "GettableSilences gettable silences", "type": "array", "items": { + "type": "object", "$ref": "#/definitions/gettableSilence" - }, - "$ref": "#/definitions/gettableSilences" + } }, "integration": { "description": "Integration integration", @@ -8350,8 +8428,7 @@ "description": "send resolved", "type": "boolean" } - }, - "$ref": "#/definitions/integration" + } }, "labelSet": { "description": "LabelSet label set", @@ -8467,6 +8544,7 @@ } }, "postableSilence": { + "description": "PostableSilence postable silence", "type": "object", "required": [ "comment", @@ -8501,10 +8579,10 @@ "type": "string", "format": "date-time" } - }, - "$ref": "#/definitions/postableSilence" + } }, "receiver": { + "description": "Receiver receiver", "type": "object", "required": [ "active", @@ -8527,8 +8605,7 @@ "description": "name", "type": "string" } - }, - "$ref": "#/definitions/receiver" + } }, "silence": { "description": "Silence silence",