Alerting: Get grafana-managed alert rule by UID (#86845)

* Add auth checks and test

* Check user is authorized to view rule and add tests

* Change naming

* Update Swagger params

* Update auth test and swagger gen

* Update swagger gen

* Change response to GettableExtendedRuleNode

* openapi3-gen

* Update tests with refactors models pkg
This commit is contained in:
Fayzal Ghantiwala
2024-05-02 15:24:59 +01:00
committed by GitHub
parent 9e6de035c0
commit df25e9197e
12 changed files with 227 additions and 13 deletions
+41 -3
View File
@@ -1272,6 +1272,43 @@
}
}
},
"/ruler/grafana/api/v1/rule/{RuleUID}": {
"get": {
"description": "Get rule by UID",
"produces": [
"application/json"
],
"tags": [
"ruler"
],
"operationId": "RouteGetRuleByUID",
"parameters": [
{
"type": "string",
"name": "RuleUID",
"in": "path",
"required": true
}
],
"responses": {
"202": {
"description": "GettableGrafanaRule",
"schema": {
"$ref": "#/definitions/GettableGrafanaRule"
}
},
"403": {
"description": "ForbiddenError",
"schema": {
"$ref": "#/definitions/ForbiddenError"
}
},
"404": {
"description": " Not found."
}
}
}
},
"/ruler/grafana/api/v1/rules": {
"get": {
"description": "List rule groups",
@@ -7654,8 +7691,9 @@
}
},
"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.",
"type": "object",
"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).",
"properties": {
"ForceQuery": {
"type": "boolean"
@@ -8025,6 +8063,7 @@
}
},
"gettableAlert": {
"description": "GettableAlert gettable alert",
"type": "object",
"required": [
"labels",
@@ -8088,7 +8127,6 @@
"$ref": "#/definitions/gettableAlerts"
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"type": "object",
"required": [
"comment",
@@ -8146,7 +8184,6 @@
"$ref": "#/definitions/gettableSilences"
},
"integration": {
"description": "Integration integration",
"type": "object",
"required": [
"name",
@@ -8291,6 +8328,7 @@
}
},
"postableSilence": {
"description": "PostableSilence postable silence",
"type": "object",
"required": [
"comment",