Alerting: Fix "Not Implemented" responses (#57710)
* fix swagger spec, return 404 instead of 501 when an endpoint does not exist * update number of paths in authorization_test.go
This commit is contained in:
@@ -3301,6 +3301,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
@@ -3405,6 +3406,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"gettableAlert": {
|
||||
"description": "GettableAlert gettable alert",
|
||||
"properties": {
|
||||
"annotations": {
|
||||
"$ref": "#/definitions/labelSet"
|
||||
@@ -3460,6 +3462,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
@@ -3664,7 +3667,6 @@
|
||||
"type": "array"
|
||||
},
|
||||
"postableSilence": {
|
||||
"description": "PostableSilence postable silence",
|
||||
"properties": {
|
||||
"comment": {
|
||||
"description": "comment",
|
||||
@@ -3702,6 +3704,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"receiver": {
|
||||
"description": "Receiver receiver",
|
||||
"properties": {
|
||||
"active": {
|
||||
"description": "active",
|
||||
|
||||
@@ -108,14 +108,6 @@ import (
|
||||
// 400: ValidationError
|
||||
// 404: NotFound
|
||||
|
||||
// swagger:route POST /api/alertmanager/grafana/api/v2/alerts alertmanager RoutePostGrafanaAMAlerts
|
||||
//
|
||||
// create alertmanager alerts
|
||||
//
|
||||
// Responses:
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/{DatasourceUID}/api/v2/alerts alertmanager RoutePostAMAlerts
|
||||
//
|
||||
// create alertmanager alerts
|
||||
@@ -163,20 +155,6 @@ import (
|
||||
// 408: Failure
|
||||
// 409: AlertManagerNotReady
|
||||
|
||||
// swagger:route POST /api/alertmanager/{DatasourceUID}/config/api/v1/receivers/test alertmanager RoutePostTestReceivers
|
||||
//
|
||||
// Test Grafana managed receivers without saving them.
|
||||
//
|
||||
// Responses:
|
||||
//
|
||||
// 200: Ack
|
||||
// 207: MultiStatus
|
||||
// 400: ValidationError
|
||||
// 403: PermissionDenied
|
||||
// 404: NotFound
|
||||
// 408: Failure
|
||||
// 409: AlertManagerNotReady
|
||||
|
||||
// swagger:route GET /api/alertmanager/grafana/api/v2/silences alertmanager RouteGetGrafanaSilences
|
||||
//
|
||||
// get silences
|
||||
@@ -254,7 +232,7 @@ type AlertManagerNotReady struct{}
|
||||
// swagger:model
|
||||
type MultiStatus struct{}
|
||||
|
||||
// swagger:parameters RoutePostTestReceivers RoutePostTestGrafanaReceivers
|
||||
// swagger:parameters RoutePostTestGrafanaReceivers
|
||||
type TestReceiversConfigParams struct {
|
||||
// in:body
|
||||
Body TestReceiversConfigBodyParams
|
||||
@@ -457,7 +435,7 @@ type AlertsParams struct {
|
||||
Receivers string `json:"receiver"`
|
||||
}
|
||||
|
||||
// swagger:parameters RoutePostAMAlerts RoutePostGrafanaAMAlerts
|
||||
// swagger:parameters RoutePostAMAlerts
|
||||
type PostableAlerts struct {
|
||||
// in:body
|
||||
PostableAlerts []amv2.PostableAlert `yaml:"" json:""`
|
||||
@@ -470,7 +448,7 @@ type BodyAlertingConfig struct {
|
||||
}
|
||||
|
||||
// alertmanager routes
|
||||
// swagger:parameters RoutePostAlertingConfig RouteGetAlertingConfig RouteDeleteAlertingConfig RouteGetAMStatus RouteGetAMAlerts RoutePostAMAlerts RouteGetAMAlertGroups RouteGetSilences RouteCreateSilence RouteGetSilence RouteDeleteSilence RoutePostAlertingConfig RoutePostTestReceivers
|
||||
// swagger:parameters RoutePostAlertingConfig RouteGetAlertingConfig RouteDeleteAlertingConfig RouteGetAMStatus RouteGetAMAlerts RoutePostAMAlerts RouteGetAMAlertGroups RouteGetSilences RouteCreateSilence RouteGetSilence RouteDeleteSilence RoutePostAlertingConfig
|
||||
// testing routes
|
||||
// swagger:parameters RouteTestRuleConfig
|
||||
// prom routes
|
||||
|
||||
@@ -3302,7 +3302,6 @@
|
||||
"type": "object"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
@@ -3463,6 +3462,7 @@
|
||||
"type": "object"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
@@ -3668,7 +3668,6 @@
|
||||
"type": "array"
|
||||
},
|
||||
"postableSilence": {
|
||||
"description": "PostableSilence postable silence",
|
||||
"properties": {
|
||||
"comment": {
|
||||
"description": "comment",
|
||||
@@ -3884,39 +3883,6 @@
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
]
|
||||
},
|
||||
"post": {
|
||||
"description": "create alertmanager alerts",
|
||||
"operationId": "RoutePostGrafanaAMAlerts",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "PostableAlerts",
|
||||
"schema": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/postableAlert"
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/grafana/api/v2/alerts/groups": {
|
||||
@@ -4800,75 +4766,6 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{DatasourceUID}/config/api/v1/receivers/test": {
|
||||
"post": {
|
||||
"operationId": "RoutePostTestReceivers",
|
||||
"parameters": [
|
||||
{
|
||||
"in": "body",
|
||||
"name": "Body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/TestReceiversConfigBodyParams"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "DatasoureUID should be the datasource UID identifier",
|
||||
"in": "path",
|
||||
"name": "DatasourceUID",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
},
|
||||
"207": {
|
||||
"description": "MultiStatus",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/MultiStatus"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "PermissionDenied",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/PermissionDenied"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "NotFound",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/NotFound"
|
||||
}
|
||||
},
|
||||
"408": {
|
||||
"description": "Failure",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Failure"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "AlertManagerNotReady",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/AlertManagerNotReady"
|
||||
}
|
||||
}
|
||||
},
|
||||
"summary": "Test Grafana managed receivers without saving them.",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/prometheus/grafana/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets the current alerts",
|
||||
|
||||
@@ -76,39 +76,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "create alertmanager alerts",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RoutePostGrafanaAMAlerts",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "PostableAlerts",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/postableAlert"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/grafana/api/v2/alerts/groups": {
|
||||
@@ -992,75 +959,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{DatasourceUID}/config/api/v1/receivers/test": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"summary": "Test Grafana managed receivers without saving them.",
|
||||
"operationId": "RoutePostTestReceivers",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/TestReceiversConfigBodyParams"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "DatasoureUID should be the datasource UID identifier",
|
||||
"name": "DatasourceUID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
},
|
||||
"207": {
|
||||
"description": "MultiStatus",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/MultiStatus"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "PermissionDenied",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/PermissionDenied"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "NotFound",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/NotFound"
|
||||
}
|
||||
},
|
||||
"408": {
|
||||
"description": "Failure",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Failure"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "AlertManagerNotReady",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/AlertManagerNotReady"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/prometheus/grafana/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets the current alerts",
|
||||
@@ -5842,7 +5740,6 @@
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
@@ -6005,6 +5902,7 @@
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
},
|
||||
"gettableAlerts": {
|
||||
"description": "GettableAlerts gettable alerts",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/gettableAlert"
|
||||
@@ -6214,7 +6112,6 @@
|
||||
}
|
||||
},
|
||||
"postableSilence": {
|
||||
"description": "PostableSilence postable silence",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"comment",
|
||||
|
||||
Reference in New Issue
Block a user