ngalert openapi: Use same basePath as rest of Grafana (#79025)

* ngalert openapi: Use same `basePath` as rest of Grafana
Currently, there are two issues that prevent easily merging `ngalert` and grafana openapi specs:
- The basePath is different. `grafana` has `/api` and `ngalert` has `/api/v1`. I changed `ngalert` to use `/api`
- The `ngalert` endpoints have their basePath in the each operation path. The basePath should actually be omitted
---------

Co-authored-by: Yuriy Tseretyan <yuriy.tseretyan@grafana.com>
This commit is contained in:
Julien Duchesne
2024-01-17 11:53:16 -05:00
committed by GitHub
co-authored by Yuriy Tseretyan
parent dce9d1e87c
commit c9211fbd69
22 changed files with 2639 additions and 2586 deletions
+63 -66
View File
@@ -1,5 +1,5 @@
{
"basePath": "/api/v1",
"basePath": "/api",
"consumes": [
"application/json"
],
@@ -4172,7 +4172,6 @@
"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.",
"properties": {
"ForceQuery": {
"type": "boolean"
@@ -4208,7 +4207,7 @@
"$ref": "#/definitions/Userinfo"
}
},
"title": "A URL represents a parsed URL (technically, a URI reference).",
"title": "URL is a custom URL type that allows validation at configuration load time.",
"type": "object"
},
"UpdateRuleGroupResponse": {
@@ -4414,7 +4413,6 @@
"type": "object"
},
"alertGroup": {
"description": "AlertGroup alert group",
"properties": {
"alerts": {
"description": "alerts",
@@ -4599,13 +4597,13 @@
"type": "object"
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"items": {
"$ref": "#/definitions/gettableAlert"
},
"type": "array"
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"properties": {
"comment": {
"description": "comment",
@@ -4842,7 +4840,6 @@
"type": "object"
},
"receiver": {
"description": "Receiver receiver",
"properties": {
"active": {
"description": "active",
@@ -4962,7 +4959,7 @@
"version": "1.1.0"
},
"paths": {
"/api/alertmanager/grafana/api/v2/alerts": {
"/alertmanager/grafana/api/v2/alerts": {
"get": {
"description": "get alertmanager alerts",
"operationId": "RouteGetGrafanaAMAlerts",
@@ -5023,7 +5020,7 @@
]
}
},
"/api/alertmanager/grafana/api/v2/alerts/groups": {
"/alertmanager/grafana/api/v2/alerts/groups": {
"get": {
"description": "get alertmanager alerts",
"operationId": "RouteGetGrafanaAMAlertGroups",
@@ -5084,7 +5081,7 @@
]
}
},
"/api/alertmanager/grafana/api/v2/silence/{SilenceId}": {
"/alertmanager/grafana/api/v2/silence/{SilenceId}": {
"delete": {
"description": "delete silence",
"operationId": "RouteDeleteGrafanaSilence",
@@ -5144,7 +5141,7 @@
]
}
},
"/api/alertmanager/grafana/api/v2/silences": {
"/alertmanager/grafana/api/v2/silences": {
"get": {
"description": "get silences",
"operationId": "RouteGetGrafanaSilences",
@@ -5207,7 +5204,7 @@
]
}
},
"/api/alertmanager/grafana/api/v2/status": {
"/alertmanager/grafana/api/v2/status": {
"get": {
"description": "get alertmanager status and configuration",
"operationId": "RouteGetGrafanaAMStatus",
@@ -5230,7 +5227,7 @@
]
}
},
"/api/alertmanager/grafana/config/api/v1/alerts": {
"/alertmanager/grafana/config/api/v1/alerts": {
"delete": {
"description": "deletes the Alerting config for a tenant",
"operationId": "RouteDeleteGrafanaAlertingConfig",
@@ -5304,7 +5301,7 @@
]
}
},
"/api/alertmanager/grafana/config/api/v1/receivers": {
"/alertmanager/grafana/config/api/v1/receivers": {
"get": {
"description": "Get a list of all receivers",
"operationId": "RouteGetGrafanaReceivers",
@@ -5318,7 +5315,7 @@
]
}
},
"/api/alertmanager/grafana/config/api/v1/receivers/test": {
"/alertmanager/grafana/config/api/v1/receivers/test": {
"post": {
"operationId": "RoutePostTestGrafanaReceivers",
"parameters": [
@@ -5380,7 +5377,7 @@
]
}
},
"/api/alertmanager/grafana/config/api/v1/templates/test": {
"/alertmanager/grafana/config/api/v1/templates/test": {
"post": {
"operationId": "RoutePostTestGrafanaTemplates",
"parameters": [
@@ -5427,7 +5424,7 @@
]
}
},
"/api/alertmanager/grafana/config/history": {
"/alertmanager/grafana/config/history": {
"get": {
"description": "gets Alerting configurations that were successfully applied in the past",
"operationId": "RouteGetGrafanaAlertingConfigHistory",
@@ -5450,7 +5447,7 @@
]
}
},
"/api/alertmanager/grafana/config/history/{id}/_activate": {
"/alertmanager/grafana/config/history/{id}/_activate": {
"post": {
"description": "revert Alerting configuration to the historical configuration specified by the given id",
"operationId": "RoutePostGrafanaAlertingConfigHistoryActivate",
@@ -5489,7 +5486,7 @@
]
}
},
"/api/alertmanager/{DatasourceUID}/api/v2/alerts": {
"/alertmanager/{DatasourceUID}/api/v2/alerts": {
"get": {
"description": "get alertmanager alerts",
"operationId": "RouteGetAMAlerts",
@@ -5609,7 +5606,7 @@
]
}
},
"/api/alertmanager/{DatasourceUID}/api/v2/alerts/groups": {
"/alertmanager/{DatasourceUID}/api/v2/alerts/groups": {
"get": {
"description": "get alertmanager alerts",
"operationId": "RouteGetAMAlertGroups",
@@ -5683,7 +5680,7 @@
]
}
},
"/api/alertmanager/{DatasourceUID}/api/v2/silence/{SilenceId}": {
"/alertmanager/{DatasourceUID}/api/v2/silence/{SilenceId}": {
"delete": {
"description": "delete silence",
"operationId": "RouteDeleteSilence",
@@ -5769,7 +5766,7 @@
]
}
},
"/api/alertmanager/{DatasourceUID}/api/v2/silences": {
"/alertmanager/{DatasourceUID}/api/v2/silences": {
"get": {
"description": "get silences",
"operationId": "RouteGetSilences",
@@ -5858,7 +5855,7 @@
]
}
},
"/api/alertmanager/{DatasourceUID}/api/v2/status": {
"/alertmanager/{DatasourceUID}/api/v2/status": {
"get": {
"description": "get alertmanager status and configuration",
"operationId": "RouteGetAMStatus",
@@ -5896,7 +5893,7 @@
]
}
},
"/api/alertmanager/{DatasourceUID}/config/api/v1/alerts": {
"/alertmanager/{DatasourceUID}/config/api/v1/alerts": {
"delete": {
"description": "deletes the Alerting config for a tenant",
"operationId": "RouteDeleteAlertingConfig",
@@ -6013,7 +6010,7 @@
]
}
},
"/api/prometheus/grafana/api/v1/alerts": {
"/prometheus/grafana/api/v1/alerts": {
"get": {
"description": "gets the current alerts",
"operationId": "RouteGetGrafanaAlertStatuses",
@@ -6039,7 +6036,7 @@
]
}
},
"/api/prometheus/grafana/api/v1/rules": {
"/prometheus/grafana/api/v1/rules": {
"get": {
"description": "gets the evaluation statuses of all rules",
"operationId": "RouteGetGrafanaRuleStatuses",
@@ -6078,7 +6075,7 @@
]
}
},
"/api/prometheus/{DatasourceUID}/api/v1/alerts": {
"/prometheus/{DatasourceUID}/api/v1/alerts": {
"get": {
"description": "gets the current alerts",
"operationId": "RouteGetAlertStatuses",
@@ -6110,7 +6107,7 @@
]
}
},
"/api/prometheus/{DatasourceUID}/api/v1/rules": {
"/prometheus/{DatasourceUID}/api/v1/rules": {
"get": {
"description": "gets the evaluation statuses of all rules",
"operationId": "RouteGetRuleStatuses",
@@ -6142,7 +6139,7 @@
]
}
},
"/api/ruler/grafana/api/v1/export/rules": {
"/ruler/grafana/api/v1/export/rules": {
"get": {
"consumes": [
"application/json",
@@ -6209,7 +6206,7 @@
]
}
},
"/api/ruler/grafana/api/v1/rules": {
"/ruler/grafana/api/v1/rules": {
"get": {
"description": "List rule groups",
"operationId": "RouteGetGrafanaRulesConfig",
@@ -6248,7 +6245,7 @@
]
}
},
"/api/ruler/grafana/api/v1/rules/{Namespace}": {
"/ruler/grafana/api/v1/rules/{Namespace}": {
"delete": {
"description": "Delete namespace",
"operationId": "RouteDeleteNamespaceGrafanaRulesConfig",
@@ -6354,7 +6351,7 @@
]
}
},
"/api/ruler/grafana/api/v1/rules/{Namespace}/export": {
"/ruler/grafana/api/v1/rules/{Namespace}/export": {
"post": {
"consumes": [
"application/json",
@@ -6414,7 +6411,7 @@
]
}
},
"/api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname}": {
"/ruler/grafana/api/v1/rules/{Namespace}/{Groupname}": {
"delete": {
"description": "Delete rule group",
"operationId": "RouteDeleteGrafanaRuleGroupConfig",
@@ -6491,7 +6488,7 @@
]
}
},
"/api/ruler/{DatasourceUID}/api/v1/rules": {
"/ruler/{DatasourceUID}/api/v1/rules": {
"get": {
"description": "List rule groups",
"operationId": "RouteGetRulesConfig",
@@ -6543,7 +6540,7 @@
]
}
},
"/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}": {
"/ruler/{DatasourceUID}/api/v1/rules/{Namespace}": {
"delete": {
"description": "Delete namespace",
"operationId": "RouteDeleteNamespaceRulesConfig",
@@ -6688,7 +6685,7 @@
]
}
},
"/api/ruler/{DatasourceUID}/api/v1/rules/{Namespace}/{Groupname}": {
"/ruler/{DatasourceUID}/api/v1/rules/{Namespace}/{Groupname}": {
"delete": {
"description": "Delete rule group",
"operationId": "RouteDeleteRuleGroupConfig",
@@ -6791,7 +6788,7 @@
]
}
},
"/api/v1/eval": {
"/v1/eval": {
"post": {
"consumes": [
"application/json"
@@ -6823,7 +6820,7 @@
]
}
},
"/api/v1/ngalert": {
"/v1/ngalert": {
"get": {
"description": "Get the status of the alerting engine",
"operationId": "RouteGetStatus",
@@ -6843,7 +6840,7 @@
]
}
},
"/api/v1/ngalert/admin_config": {
"/v1/ngalert/admin_config": {
"delete": {
"consumes": [
"application/json"
@@ -6932,7 +6929,7 @@
]
}
},
"/api/v1/ngalert/alertmanagers": {
"/v1/ngalert/alertmanagers": {
"get": {
"operationId": "RouteGetAlertmanagers",
"produces": [
@@ -6952,7 +6949,7 @@
]
}
},
"/api/v1/provisioning/alert-rules": {
"/v1/provisioning/alert-rules": {
"get": {
"operationId": "RouteGetAlertRules",
"responses": {
@@ -7007,7 +7004,7 @@
]
}
},
"/api/v1/provisioning/alert-rules/export": {
"/v1/provisioning/alert-rules/export": {
"get": {
"operationId": "RouteGetAlertRulesExport",
"parameters": [
@@ -7064,7 +7061,7 @@
]
}
},
"/api/v1/provisioning/alert-rules/{UID}": {
"/v1/provisioning/alert-rules/{UID}": {
"delete": {
"operationId": "RouteDeleteAlertRule",
"parameters": [
@@ -7164,7 +7161,7 @@
]
}
},
"/api/v1/provisioning/alert-rules/{UID}/export": {
"/v1/provisioning/alert-rules/{UID}/export": {
"get": {
"operationId": "RouteGetAlertRuleExport",
"parameters": [
@@ -7212,7 +7209,7 @@
]
}
},
"/api/v1/provisioning/contact-points": {
"/v1/provisioning/contact-points": {
"get": {
"operationId": "RouteGetContactpoints",
"parameters": [
@@ -7275,7 +7272,7 @@
]
}
},
"/api/v1/provisioning/contact-points/export": {
"/v1/provisioning/contact-points/export": {
"get": {
"operationId": "RouteGetContactpointsExport",
"parameters": [
@@ -7327,7 +7324,7 @@
]
}
},
"/api/v1/provisioning/contact-points/{UID}": {
"/v1/provisioning/contact-points/{UID}": {
"delete": {
"consumes": [
"application/json"
@@ -7398,7 +7395,7 @@
]
}
},
"/api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": {
"/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": {
"get": {
"operationId": "RouteGetAlertRuleGroup",
"parameters": [
@@ -7482,7 +7479,7 @@
]
}
},
"/api/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}/export": {
"/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}/export": {
"get": {
"operationId": "RouteGetAlertRuleGroupExport",
"parameters": [
@@ -7535,7 +7532,7 @@
]
}
},
"/api/v1/provisioning/mute-timings": {
"/v1/provisioning/mute-timings": {
"get": {
"operationId": "RouteGetMuteTimings",
"responses": {
@@ -7590,7 +7587,7 @@
]
}
},
"/api/v1/provisioning/mute-timings/export": {
"/v1/provisioning/mute-timings/export": {
"get": {
"operationId": "RouteExportMuteTimings",
"parameters": [
@@ -7629,7 +7626,7 @@
]
}
},
"/api/v1/provisioning/mute-timings/{name}": {
"/v1/provisioning/mute-timings/{name}": {
"delete": {
"operationId": "RouteDeleteMuteTiming",
"parameters": [
@@ -7730,7 +7727,7 @@
]
}
},
"/api/v1/provisioning/mute-timings/{name}/export": {
"/v1/provisioning/mute-timings/{name}/export": {
"get": {
"operationId": "RouteExportMuteTiming",
"parameters": [
@@ -7776,7 +7773,7 @@
]
}
},
"/api/v1/provisioning/policies": {
"/v1/provisioning/policies": {
"delete": {
"consumes": [
"application/json"
@@ -7850,7 +7847,7 @@
]
}
},
"/api/v1/provisioning/policies/export": {
"/v1/provisioning/policies/export": {
"get": {
"operationId": "RouteGetPolicyTreeExport",
"responses": {
@@ -7873,7 +7870,7 @@
]
}
},
"/api/v1/provisioning/templates": {
"/v1/provisioning/templates": {
"get": {
"operationId": "RouteGetTemplates",
"responses": {
@@ -7893,7 +7890,7 @@
]
}
},
"/api/v1/provisioning/templates/{name}": {
"/v1/provisioning/templates/{name}": {
"delete": {
"operationId": "RouteDeleteTemplate",
"parameters": [
@@ -7988,7 +7985,7 @@
]
}
},
"/api/v1/rule/backtest": {
"/v1/rule/backtest": {
"post": {
"consumes": [
"application/json"
@@ -8020,7 +8017,7 @@
]
}
},
"/api/v1/rule/test/grafana": {
"/v1/rule/test/grafana": {
"post": {
"consumes": [
"application/json"
@@ -8061,7 +8058,7 @@
]
}
},
"/api/v1/rule/test/{DatasourceUID}": {
"/v1/rule/test/{DatasourceUID}": {
"post": {
"consumes": [
"application/json"
@@ -8106,7 +8103,7 @@
]
}
},
"/api/v1/rules/history": {
"/v1/rules/history": {
"get": {
"operationId": "RouteGetStateHistory",
"produces": [
@@ -8123,7 +8120,7 @@
]
}
},
"/api/v1/upgrade/channels": {
"/v1/upgrade/channels": {
"post": {
"operationId": "RoutePostUpgradeAllChannels",
"parameters": [
@@ -8152,7 +8149,7 @@
]
}
},
"/api/v1/upgrade/channels/{ChannelID}": {
"/v1/upgrade/channels/{ChannelID}": {
"post": {
"operationId": "RoutePostUpgradeChannel",
"parameters": [
@@ -8181,7 +8178,7 @@
]
}
},
"/api/v1/upgrade/dashboards": {
"/v1/upgrade/dashboards": {
"post": {
"operationId": "RoutePostUpgradeAllDashboards",
"produces": [
@@ -8201,7 +8198,7 @@
]
}
},
"/api/v1/upgrade/dashboards/{DashboardID}": {
"/v1/upgrade/dashboards/{DashboardID}": {
"post": {
"operationId": "RoutePostUpgradeDashboard",
"parameters": [
@@ -8237,7 +8234,7 @@
]
}
},
"/api/v1/upgrade/dashboards/{DashboardID}/panels/{PanelID}": {
"/v1/upgrade/dashboards/{DashboardID}/panels/{PanelID}": {
"post": {
"operationId": "RoutePostUpgradeAlert",
"parameters": [
@@ -8273,7 +8270,7 @@
]
}
},
"/api/v1/upgrade/org": {
"/v1/upgrade/org": {
"delete": {
"operationId": "RouteDeleteOrgUpgrade",
"produces": [