Alerting: Fix API specification (#42282)

* Alerting: Fix API specification
This commit is contained in:
Sofia Papagiannaki
2021-11-30 20:55:54 +01:00
committed by GitHub
parent 1d4b2593ec
commit 9c7b52fd36
10 changed files with 459 additions and 62 deletions
+219 -20
View File
@@ -11,7 +11,8 @@
],
"swagger": "2.0",
"info": {
"description": "Package definitions includes the types required for generating or consuming an OpenAPI\nspec for the Unified Alerting API.\nDocumentation of the API.",
"description": "Package definitions includes the types required for generating or consuming an OpenAPI\nspec for the Grafana Alerting API.",
"title": "Grafana Alerting API.",
"version": "1.1.0"
},
"basePath": "/api/v1",
@@ -494,22 +495,10 @@
"operationId": "RoutePostTestReceivers",
"parameters": [
{
"x-go-name": "Alert",
"name": "alert",
"name": "Body",
"in": "body",
"schema": {
"$ref": "#/definitions/TestReceiversConfigAlertParams"
}
},
{
"x-go-name": "Receivers",
"name": "receivers",
"in": "body",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/PostableApiReceiver"
}
"$ref": "#/definitions/TestReceiversConfigBodyParams"
}
},
{
@@ -1351,6 +1340,13 @@
},
"x-go-name": "InhibitRules"
},
"mute_time_intervals": {
"type": "array",
"items": {
"$ref": "#/definitions/MuteTimeInterval"
},
"x-go-name": "MuteTimeIntervals"
},
"route": {
"$ref": "#/definitions/Route"
},
@@ -1370,6 +1366,21 @@
"format": "date-time",
"x-go-package": "github.com/go-openapi/strfmt"
},
"DayOfMonthRange": {
"type": "object",
"title": "A DayOfMonthRange is an inclusive range that may have negative Beginning/End values that represent distance from the End of the month Beginning at -1.",
"properties": {
"Begin": {
"type": "integer",
"format": "int64"
},
"End": {
"type": "integer",
"format": "int64"
}
},
"x-go-package": "github.com/prometheus/alertmanager/timeinterval"
},
"DiscoveryBase": {
"type": "object",
"required": [
@@ -1570,6 +1581,13 @@
},
"x-go-name": "InhibitRules"
},
"mute_time_intervals": {
"type": "array",
"items": {
"$ref": "#/definitions/MuteTimeInterval"
},
"x-go-name": "MuteTimeIntervals"
},
"receivers": {
"description": "Override with our superset receiver type",
"type": "array",
@@ -1774,6 +1792,7 @@
"enum": [
"Alerting"
],
"x-go-enum-desc": "Alerting AlertingErrState",
"x-go-name": "ExecErrState"
},
"id": {
@@ -1802,6 +1821,7 @@
"NoData",
"OK"
],
"x-go-enum-desc": "Alerting Alerting\nNoData NoData\nOK OK",
"x-go-name": "NoDataState"
},
"orgId": {
@@ -1920,6 +1940,10 @@
"opsgenie_api_key": {
"$ref": "#/definitions/Secret"
},
"opsgenie_api_key_file": {
"type": "string",
"x-go-name": "OpsGenieAPIKeyFile"
},
"opsgenie_api_url": {
"$ref": "#/definitions/URL"
},
@@ -2032,6 +2056,21 @@
},
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"InclusiveRange": {
"type": "object",
"title": "InclusiveRange is used to hold the Beginning and End values of many time interval components.",
"properties": {
"Begin": {
"type": "integer",
"format": "int64"
},
"End": {
"type": "integer",
"format": "int64"
}
},
"x-go-package": "github.com/prometheus/alertmanager/timeinterval"
},
"InhibitRule": {
"description": "InhibitRule defines an inhibition rule that mutes alerts that match the\ntarget labels if an alert matching the source labels exists.\nBoth alerts have to have a set of labels being equal.",
"type": "object",
@@ -2157,10 +2196,43 @@
},
"$ref": "#/definitions/Matchers"
},
"MonthRange": {
"type": "object",
"title": "A MonthRange is an inclusive range between [1, 12] where 1 = January.",
"properties": {
"Begin": {
"type": "integer",
"format": "int64"
},
"End": {
"type": "integer",
"format": "int64"
}
},
"x-go-package": "github.com/prometheus/alertmanager/timeinterval"
},
"MultiStatus": {
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MuteTimeInterval": {
"type": "object",
"title": "MuteTimeInterval represents a named set of time intervals for which a route should be muted.",
"properties": {
"name": {
"type": "string",
"x-go-name": "Name"
},
"time_intervals": {
"type": "array",
"items": {
"$ref": "#/definitions/TimeInterval"
},
"x-go-name": "TimeIntervals"
}
},
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"NamespaceConfigResponse": {
"type": "object",
"additionalProperties": {
@@ -2186,6 +2258,9 @@
"type": "object",
"title": "OAuth2 is the oauth2 client configuration.",
"properties": {
"TLSConfig": {
"$ref": "#/definitions/TLSConfig"
},
"client_id": {
"type": "string",
"x-go-name": "ClientID"
@@ -2226,9 +2301,17 @@
"type": "object",
"title": "OpsGenieConfig configures notifications via OpsGenie.",
"properties": {
"actions": {
"type": "string",
"x-go-name": "Actions"
},
"api_key": {
"$ref": "#/definitions/Secret"
},
"api_key_file": {
"type": "string",
"x-go-name": "APIKeyFile"
},
"api_url": {
"$ref": "#/definitions/URL"
},
@@ -2243,6 +2326,10 @@
},
"x-go-name": "Details"
},
"entity": {
"type": "string",
"x-go-name": "Entity"
},
"http_config": {
"$ref": "#/definitions/HTTPClientConfig"
},
@@ -2446,6 +2533,13 @@
},
"x-go-name": "InhibitRules"
},
"mute_time_intervals": {
"type": "array",
"items": {
"$ref": "#/definitions/MuteTimeInterval"
},
"x-go-name": "MuteTimeIntervals"
},
"receivers": {
"description": "Override with our superset receiver type",
"type": "array",
@@ -2650,6 +2744,7 @@
"enum": [
"Alerting"
],
"x-go-enum-desc": "Alerting AlertingErrState",
"x-go-name": "ExecErrState"
},
"no_data_state": {
@@ -2659,6 +2754,7 @@
"NoData",
"OK"
],
"x-go-enum-desc": "Alerting Alerting\nNoData NoData\nOK OK",
"x-go-name": "NoDataState"
},
"title": {
@@ -3462,6 +3558,22 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"TestReceiversConfigBodyParams": {
"type": "object",
"properties": {
"alert": {
"$ref": "#/definitions/TestReceiversConfigAlertParams"
},
"receivers": {
"type": "array",
"items": {
"$ref": "#/definitions/PostableApiReceiver"
},
"x-go-name": "Receivers"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"TestReceiversResult": {
"type": "object",
"properties": {
@@ -3509,6 +3621,64 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"TimeInterval": {
"description": "TimeInterval describes intervals of time. ContainsTime will tell you if a golang time is contained\nwithin the interval.",
"type": "object",
"properties": {
"days_of_month": {
"type": "array",
"items": {
"$ref": "#/definitions/DayOfMonthRange"
},
"x-go-name": "DaysOfMonth"
},
"months": {
"type": "array",
"items": {
"$ref": "#/definitions/MonthRange"
},
"x-go-name": "Months"
},
"times": {
"type": "array",
"items": {
"$ref": "#/definitions/TimeRange"
},
"x-go-name": "Times"
},
"weekdays": {
"type": "array",
"items": {
"$ref": "#/definitions/WeekdayRange"
},
"x-go-name": "Weekdays"
},
"years": {
"type": "array",
"items": {
"$ref": "#/definitions/YearRange"
},
"x-go-name": "Years"
}
},
"x-go-package": "github.com/prometheus/alertmanager/timeinterval"
},
"TimeRange": {
"description": "For example, 4:00PM to End of the day would Begin at 1020 and End at 1440.",
"type": "object",
"title": "TimeRange represents a range of minutes within a 1440 minute day, exclusive of the End minute. A day consists of 1440 minutes.",
"properties": {
"EndMinute": {
"type": "integer",
"format": "int64"
},
"StartMinute": {
"type": "integer",
"format": "int64"
}
},
"x-go-package": "github.com/prometheus/alertmanager/timeinterval"
},
"URL": {
"type": "object",
"title": "URL is a custom URL type that allows validation at configuration load time.",
@@ -3690,6 +3860,36 @@
},
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"WeekdayRange": {
"type": "object",
"title": "A WeekdayRange is an inclusive range between [0, 6] where 0 = Sunday.",
"properties": {
"Begin": {
"type": "integer",
"format": "int64"
},
"End": {
"type": "integer",
"format": "int64"
}
},
"x-go-package": "github.com/prometheus/alertmanager/timeinterval"
},
"YearRange": {
"type": "object",
"title": "A YearRange is a positive inclusive range.",
"properties": {
"Begin": {
"type": "integer",
"format": "int64"
},
"End": {
"type": "integer",
"format": "int64"
}
},
"x-go-package": "github.com/prometheus/alertmanager/timeinterval"
},
"alert": {
"description": "Alert alert",
"type": "object",
@@ -3711,7 +3911,6 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"alertGroup": {
"description": "AlertGroup alert group",
"type": "object",
"required": [
"alerts",
@@ -3734,6 +3933,8 @@
"$ref": "#/definitions/receiver"
}
},
"x-go-name": "AlertGroup",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/alertGroup"
},
"alertGroups": {
@@ -4126,6 +4327,7 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"type": "object",
"required": [
"comment",
@@ -4166,11 +4368,10 @@
"x-go-name": "StartsAt"
}
},
"x-go-name": "PostableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/postableSilence"
},
"receiver": {
"description": "Receiver receiver",
"type": "object",
"required": [
"name"
@@ -4182,8 +4383,6 @@
"x-go-name": "Name"
}
},
"x-go-name": "Receiver",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/receiver"
},
"silence": {