Alerting: Fix invalid swagger specification (#51907)

* Alerting: Fix invalid swagger specification

* Add make targets for validating the generated swagger spec
This commit is contained in:
Sofia Papagiannaki
2022-07-13 12:34:54 +03:00
committed by GitHub
parent b3992df988
commit 21632817c5
11 changed files with 720 additions and 145 deletions

View File

@@ -253,7 +253,7 @@ func (srv *ProvisioningSrv) RouteRouteGetAlertRule(c *models.ReqContext, UID str
return response.JSON(http.StatusOK, definitions.NewAlertRule(rule, provenace))
}
func (srv *ProvisioningSrv) RoutePostAlertRule(c *models.ReqContext, ar definitions.AlertRule) response.Response {
func (srv *ProvisioningSrv) RoutePostAlertRule(c *models.ReqContext, ar definitions.ProvisionedAlertRule) response.Response {
createdAlertRule, err := srv.alertRules.CreateAlertRule(c.Req.Context(), ar.UpstreamModel(), alerting_models.ProvenanceAPI)
if errors.Is(err, alerting_models.ErrAlertRuleFailedValidation) {
return ErrResp(http.StatusBadRequest, err, "")
@@ -270,7 +270,7 @@ func (srv *ProvisioningSrv) RoutePostAlertRule(c *models.ReqContext, ar definiti
return response.JSON(http.StatusCreated, ar)
}
func (srv *ProvisioningSrv) RoutePutAlertRule(c *models.ReqContext, ar definitions.AlertRule, UID string) response.Response {
func (srv *ProvisioningSrv) RoutePutAlertRule(c *models.ReqContext, ar definitions.ProvisionedAlertRule, UID string) response.Response {
updated := ar.UpstreamModel()
updated.UID = UID
updatedAlertRule, err := srv.alertRules.UpdateAlertRule(c.Req.Context(), ar.UpstreamModel(), alerting_models.ProvenanceAPI)

View File

@@ -418,12 +418,12 @@ func createInvalidMuteTiming() definitions.MuteTimeInterval {
}
}
func createInvalidAlertRule() definitions.AlertRule {
return definitions.AlertRule{}
func createInvalidAlertRule() definitions.ProvisionedAlertRule {
return definitions.ProvisionedAlertRule{}
}
func createTestAlertRule(title string, orgID int64) definitions.AlertRule {
return definitions.AlertRule{
func createTestAlertRule(title string, orgID int64) definitions.ProvisionedAlertRule {
return definitions.ProvisionedAlertRule{
OrgID: orgID,
Title: title,
Condition: "A",
@@ -445,7 +445,7 @@ func createTestAlertRule(title string, orgID int64) definitions.AlertRule {
}
}
func insertRule(t *testing.T, srv ProvisioningSrv, rule definitions.AlertRule) {
func insertRule(t *testing.T, srv ProvisioningSrv, rule definitions.ProvisionedAlertRule) {
t.Helper()
rc := createTestRequestCtx()

View File

@@ -87,11 +87,11 @@ func (f *ForkedProvisioningApi) forkRouteGetAlertRule(ctx *models.ReqContext, UI
return f.svc.RouteRouteGetAlertRule(ctx, UID)
}
func (f *ForkedProvisioningApi) forkRoutePostAlertRule(ctx *models.ReqContext, ar apimodels.AlertRule) response.Response {
func (f *ForkedProvisioningApi) forkRoutePostAlertRule(ctx *models.ReqContext, ar apimodels.ProvisionedAlertRule) response.Response {
return f.svc.RoutePostAlertRule(ctx, ar)
}
func (f *ForkedProvisioningApi) forkRoutePutAlertRule(ctx *models.ReqContext, ar apimodels.AlertRule, UID string) response.Response {
func (f *ForkedProvisioningApi) forkRoutePutAlertRule(ctx *models.ReqContext, ar apimodels.ProvisionedAlertRule, UID string) response.Response {
return f.svc.RoutePutAlertRule(ctx, ar, UID)
}

View File

@@ -89,7 +89,7 @@ func (f *ForkedProvisioningApi) RouteGetTemplates(ctx *models.ReqContext) respon
return f.forkRouteGetTemplates(ctx)
}
func (f *ForkedProvisioningApi) RoutePostAlertRule(ctx *models.ReqContext) response.Response {
conf := apimodels.AlertRule{}
conf := apimodels.ProvisionedAlertRule{}
if err := web.Bind(ctx.Req, &conf); err != nil {
return response.Error(http.StatusBadRequest, "bad request data", err)
}
@@ -111,7 +111,7 @@ func (f *ForkedProvisioningApi) RoutePostMuteTiming(ctx *models.ReqContext) resp
}
func (f *ForkedProvisioningApi) RoutePutAlertRule(ctx *models.ReqContext) response.Response {
uIDParam := web.Params(ctx.Req)[":UID"]
conf := apimodels.AlertRule{}
conf := apimodels.ProvisionedAlertRule{}
if err := web.Bind(ctx.Req, &conf); err != nil {
return response.Error(http.StatusBadRequest, "bad request data", err)
}

View File

@@ -30,6 +30,12 @@ post.json: spec.json
api.json: spec-stable.json
go run cmd/clean-swagger/main.go -if $(<) -of $@
validate-stable: spec-stable.json $(SWAGGER)
$(SWAGGER) validate $(<)
validate: spec.json $(SWAGGER)
$(SWAGGER) validate $(<)
swagger-codegen-api:
docker run --rm -v $$(pwd):/local --user $$(id -u):$$(id -g) parsertongue/swagger-codegen-cli:3.0.32 generate \
-i /local/post.json \
@@ -59,4 +65,4 @@ serve: post.json
serve-stable: api.json
docker run --rm -p 80:8080 -v $$(pwd):/tmp -e SWAGGER_FILE=/tmp/$(<) swaggerapi/swagger-editor
all: post.json api.json swagger-codegen-api fix copy-files clean
all: post.json validate api.json validate-stable swagger-codegen-api fix copy-files clean

View File

@@ -1821,6 +1821,149 @@
"Provenance": {
"type": "string"
},
"ProvisionedAlertRule": {
"properties": {
"annotations": {
"additionalProperties": {
"type": "string"
},
"example": {
"runbook_url": "https://supercoolrunbook.com/page/13"
},
"type": "object"
},
"condition": {
"example": "A",
"type": "string"
},
"data": {
"example": [
{
"datasourceUid": "-100",
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": []
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"datasource": {
"type": "__expr__",
"uid": "__expr__"
},
"expression": "1 == 1",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"refId": "A",
"type": "math"
},
"queryType": "",
"refId": "A",
"relativeTimeRange": {
"from": 0,
"to": 0
}
}
],
"items": {
"$ref": "#/definitions/AlertQuery"
},
"type": "array"
},
"execErrState": {
"enum": [
"Alerting",
"Error",
"OK"
],
"type": "string"
},
"folderUID": {
"example": "project_x",
"type": "string"
},
"for": {
"$ref": "#/definitions/Duration"
},
"id": {
"format": "int64",
"type": "integer"
},
"labels": {
"additionalProperties": {
"type": "string"
},
"example": {
"team": "sre-team-1"
},
"type": "object"
},
"noDataState": {
"enum": [
"Alerting",
"NoData",
"OK"
],
"type": "string"
},
"orgID": {
"format": "int64",
"type": "integer"
},
"provenance": {
"$ref": "#/definitions/Provenance"
},
"ruleGroup": {
"example": "eval_group_1",
"maxLength": 190,
"minLength": 1,
"type": "string"
},
"title": {
"example": "Always firing",
"maxLength": 190,
"minLength": 1,
"type": "string"
},
"uid": {
"type": "string"
},
"updated": {
"format": "date-time",
"readOnly": true,
"type": "string"
}
},
"required": [
"orgID",
"folderUID",
"ruleGroup",
"title",
"condition",
"data",
"noDataState",
"execErrState",
"for"
],
"type": "object"
},
"PushoverConfig": {
"properties": {
"expire": {
@@ -3269,15 +3412,15 @@
"in": "body",
"name": "Body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],
"responses": {
"201": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"400": {
@@ -3328,9 +3471,9 @@
],
"responses": {
"200": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"404": {
@@ -3359,15 +3502,15 @@
"in": "body",
"name": "Body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],
"responses": {
"200": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"400": {

View File

@@ -11,7 +11,7 @@ import (
// Get a specific alert rule by UID.
//
// Responses:
// 200: AlertRule
// 200: ProvisionedAlertRule
// 404: description: Not found.
// swagger:route POST /api/v1/provisioning/alert-rules provisioning stable RoutePostAlertRule
@@ -22,7 +22,7 @@ import (
// - application/json
//
// Responses:
// 201: AlertRule
// 201: ProvisionedAlertRule
// 400: ValidationError
// swagger:route PUT /api/v1/provisioning/alert-rules/{UID} provisioning stable RoutePutAlertRule
@@ -33,7 +33,7 @@ import (
// - application/json
//
// Responses:
// 200: AlertRule
// 200: ProvisionedAlertRule
// 400: ValidationError
// swagger:route DELETE /api/v1/provisioning/alert-rules/{UID} provisioning stable RouteDeleteAlertRule
@@ -53,10 +53,10 @@ type AlertRuleUIDReference struct {
// swagger:parameters RoutePostAlertRule RoutePutAlertRule
type AlertRulePayload struct {
// in:body
Body AlertRule
Body ProvisionedAlertRule
}
type AlertRule struct {
type ProvisionedAlertRule struct {
ID int64 `json:"id"`
UID string `json:"uid"`
// required: true
@@ -96,7 +96,7 @@ type AlertRule struct {
Provenance models.Provenance `json:"provenance,omitempty"`
}
func (a *AlertRule) UpstreamModel() models.AlertRule {
func (a *ProvisionedAlertRule) UpstreamModel() models.AlertRule {
return models.AlertRule{
ID: a.ID,
UID: a.UID,
@@ -115,8 +115,8 @@ func (a *AlertRule) UpstreamModel() models.AlertRule {
}
}
func NewAlertRule(rule models.AlertRule, provenance models.Provenance) AlertRule {
return AlertRule{
func NewAlertRule(rule models.AlertRule, provenance models.Provenance) ProvisionedAlertRule {
return ProvisionedAlertRule{
ID: rule.ID,
UID: rule.UID,
OrgID: rule.OrgID,
@@ -172,6 +172,7 @@ type AlertRuleGroupPayload struct {
Body AlertRuleGroupMetadata
}
// swagger:model
type AlertRuleGroupMetadata struct {
Interval int64 `json:"interval"`
}

View File

@@ -1821,6 +1821,149 @@
"Provenance": {
"type": "string"
},
"ProvisionedAlertRule": {
"properties": {
"annotations": {
"additionalProperties": {
"type": "string"
},
"example": {
"runbook_url": "https://supercoolrunbook.com/page/13"
},
"type": "object"
},
"condition": {
"example": "A",
"type": "string"
},
"data": {
"example": [
{
"datasourceUid": "-100",
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": []
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"datasource": {
"type": "__expr__",
"uid": "__expr__"
},
"expression": "1 == 1",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"refId": "A",
"type": "math"
},
"queryType": "",
"refId": "A",
"relativeTimeRange": {
"from": 0,
"to": 0
}
}
],
"items": {
"$ref": "#/definitions/AlertQuery"
},
"type": "array"
},
"execErrState": {
"enum": [
"Alerting",
"Error",
"OK"
],
"type": "string"
},
"folderUID": {
"example": "project_x",
"type": "string"
},
"for": {
"$ref": "#/definitions/Duration"
},
"id": {
"format": "int64",
"type": "integer"
},
"labels": {
"additionalProperties": {
"type": "string"
},
"example": {
"team": "sre-team-1"
},
"type": "object"
},
"noDataState": {
"enum": [
"Alerting",
"NoData",
"OK"
],
"type": "string"
},
"orgID": {
"format": "int64",
"type": "integer"
},
"provenance": {
"$ref": "#/definitions/Provenance"
},
"ruleGroup": {
"example": "eval_group_1",
"maxLength": 190,
"minLength": 1,
"type": "string"
},
"title": {
"example": "Always firing",
"maxLength": 190,
"minLength": 1,
"type": "string"
},
"uid": {
"type": "string"
},
"updated": {
"format": "date-time",
"readOnly": true,
"type": "string"
}
},
"required": [
"orgID",
"folderUID",
"ruleGroup",
"title",
"condition",
"data",
"noDataState",
"execErrState",
"for"
],
"type": "object"
},
"PushoverConfig": {
"properties": {
"expire": {
@@ -4893,7 +5036,7 @@
"in": "body",
"name": "Body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],
@@ -4983,7 +5126,7 @@
"in": "body",
"name": "Body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],

View File

@@ -1659,15 +1659,15 @@
"name": "Body",
"in": "body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],
"responses": {
"201": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"400": {
@@ -1698,9 +1698,9 @@
],
"responses": {
"200": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"404": {
@@ -1730,15 +1730,15 @@
"name": "Body",
"in": "body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],
"responses": {
"200": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"400": {
@@ -4206,6 +4206,149 @@
"Provenance": {
"type": "string"
},
"ProvisionedAlertRule": {
"type": "object",
"required": [
"orgID",
"folderUID",
"ruleGroup",
"title",
"condition",
"data",
"noDataState",
"execErrState",
"for"
],
"properties": {
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"example": {
"runbook_url": "https://supercoolrunbook.com/page/13"
}
},
"condition": {
"type": "string",
"example": "A"
},
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/AlertQuery"
},
"example": [
{
"datasourceUid": "-100",
"model": {
"conditions": [
{
"evaluator": {
"params": [
0,
0
],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": []
},
"reducer": {
"params": [],
"type": "avg"
},
"type": "query"
}
],
"datasource": {
"type": "__expr__",
"uid": "__expr__"
},
"expression": "1 == 1",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"refId": "A",
"type": "math"
},
"queryType": "",
"refId": "A",
"relativeTimeRange": {
"from": 0,
"to": 0
}
}
]
},
"execErrState": {
"type": "string",
"enum": [
"Alerting",
"Error",
"OK"
]
},
"folderUID": {
"type": "string",
"example": "project_x"
},
"for": {
"$ref": "#/definitions/Duration"
},
"id": {
"type": "integer",
"format": "int64"
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"example": {
"team": "sre-team-1"
}
},
"noDataState": {
"type": "string",
"enum": [
"Alerting",
"NoData",
"OK"
]
},
"orgID": {
"type": "integer",
"format": "int64"
},
"provenance": {
"$ref": "#/definitions/Provenance"
},
"ruleGroup": {
"type": "string",
"maxLength": 190,
"minLength": 1,
"example": "eval_group_1"
},
"title": {
"type": "string",
"maxLength": 190,
"minLength": 1,
"example": "Always firing"
},
"uid": {
"type": "string"
},
"updated": {
"type": "string",
"format": "date-time",
"readOnly": true
}
}
},
"PushoverConfig": {
"type": "object",
"properties": {

View File

@@ -8428,15 +8428,15 @@
"name": "Body",
"in": "body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],
"responses": {
"201": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"400": {
@@ -8464,9 +8464,9 @@
],
"responses": {
"200": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"404": {
@@ -8491,15 +8491,15 @@
"name": "Body",
"in": "body",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
}
],
"responses": {
"200": {
"description": "AlertRule",
"description": "ProvisionedAlertRule",
"schema": {
"$ref": "#/definitions/AlertRule"
"$ref": "#/definitions/ProvisionedAlertRule"
}
},
"400": {
@@ -8633,6 +8633,36 @@
}
},
"/v1/provisioning/folder/{FolderUID}/rule-groups/{Group}": {
"get": {
"tags": ["provisioning"],
"summary": "Get a rule group.",
"operationId": "RouteGetAlertRuleGroup",
"parameters": [
{
"type": "string",
"name": "FolderUID",
"in": "path",
"required": true
},
{
"type": "string",
"name": "Group",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "AlertRuleGroup",
"schema": {
"$ref": "#/definitions/AlertRuleGroup"
}
},
"404": {
"description": " Not found."
}
}
},
"put": {
"consumes": ["application/json"],
"tags": ["provisioning"],
@@ -8655,15 +8685,15 @@
"name": "Body",
"in": "body",
"schema": {
"$ref": "#/definitions/AlertRuleGroup"
"$ref": "#/definitions/AlertRuleGroupMetadata"
}
}
],
"responses": {
"200": {
"description": "AlertRuleGroup",
"description": "AlertRuleGroupMetadata",
"schema": {
"$ref": "#/definitions/AlertRuleGroup"
"$ref": "#/definitions/AlertRuleGroupMetadata"
}
},
"400": {
@@ -9546,137 +9576,107 @@
},
"AlertRule": {
"type": "object",
"required": [
"orgID",
"folderUID",
"ruleGroup",
"title",
"condition",
"data",
"noDataState",
"execErrState",
"for"
],
"title": "AlertRule is the model for alert rules in unified alerting.",
"properties": {
"annotations": {
"Annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"example": {
"runbook_url": "https://supercoolrunbook.com/page/13"
}
},
"condition": {
"type": "string",
"example": "A"
"Condition": {
"type": "string"
},
"data": {
"DashboardUID": {
"type": "string"
},
"Data": {
"type": "array",
"items": {
"$ref": "#/definitions/AlertQuery"
},
"example": [
{
"datasourceUid": "-100",
"model": {
"conditions": [
{
"evaluator": {
"params": [0, 0],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": null
},
"reducer": {
"params": null,
"type": "avg"
},
"type": "query"
}
],
"datasource": {
"type": "__expr__",
"uid": "__expr__"
},
"expression": "1 == 1",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"refId": "A",
"type": "math"
},
"queryType": "",
"refId": "A",
"relativeTimeRange": {
"from": 0,
"to": 0
}
}
]
}
},
"execErrState": {
"ExecErrState": {
"type": "string",
"enum": ["Alerting", "Error", "OK"]
},
"folderUID": {
"type": "string",
"example": "project_x"
},
"for": {
"For": {
"$ref": "#/definitions/Duration"
},
"id": {
"ID": {
"type": "integer",
"format": "int64"
},
"labels": {
"IntervalSeconds": {
"type": "integer",
"format": "int64"
},
"Labels": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"example": {
"team": "sre-team-1"
}
},
"noDataState": {
"NamespaceUID": {
"type": "string"
},
"NoDataState": {
"type": "string",
"enum": ["Alerting", "NoData", "OK"]
},
"orgID": {
"OrgID": {
"type": "integer",
"format": "int64"
},
"provenance": {
"$ref": "#/definitions/Provenance"
"PanelID": {
"type": "integer",
"format": "int64"
},
"ruleGroup": {
"type": "string",
"maxLength": 190,
"minLength": 1,
"example": "eval_group_1"
},
"title": {
"type": "string",
"maxLength": 190,
"minLength": 1,
"example": "Always firing"
},
"uid": {
"RuleGroup": {
"type": "string"
},
"updated": {
"RuleGroupIndex": {
"type": "integer",
"format": "int64"
},
"Title": {
"type": "string"
},
"UID": {
"type": "string"
},
"Updated": {
"type": "string",
"format": "date-time",
"readOnly": true
"format": "date-time"
},
"Version": {
"type": "integer",
"format": "int64"
}
}
},
"AlertRuleGroup": {
"type": "object",
"properties": {
"folderUid": {
"type": "string"
},
"interval": {
"type": "integer",
"format": "int64"
},
"rules": {
"type": "array",
"items": {
"$ref": "#/definitions/AlertRule"
}
},
"title": {
"type": "string"
}
}
},
"AlertRuleGroupMetadata": {
"type": "object",
"properties": {
"interval": {
@@ -12622,6 +12622,9 @@
"type": "string",
"example": "now-1h"
},
"publicDashboardAccessToken": {
"type": "string"
},
"queries": {
"description": "queries.refId Specifies an identifier of the query. Is optional and default to “A”.\nqueries.datasourceId Specifies the data source to be queried. Each query in the request must have an unique datasourceId.\nqueries.maxDataPoints - Species maximum amount of data points that dashboard panel can render. Is optional and default to 100.\nqueries.intervalMs - Specifies the time interval in milliseconds of time series. Is optional and defaults to 1000.",
"type": "array",
@@ -13715,6 +13718,138 @@
"Provenance": {
"type": "string"
},
"ProvisionedAlertRule": {
"type": "object",
"required": [
"orgID",
"folderUID",
"ruleGroup",
"title",
"condition",
"data",
"noDataState",
"execErrState",
"for"
],
"properties": {
"annotations": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"example": {
"runbook_url": "https://supercoolrunbook.com/page/13"
}
},
"condition": {
"type": "string",
"example": "A"
},
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/AlertQuery"
},
"example": [
{
"datasourceUid": "-100",
"model": {
"conditions": [
{
"evaluator": {
"params": [0, 0],
"type": "gt"
},
"operator": {
"type": "and"
},
"query": {
"params": null
},
"reducer": {
"params": null,
"type": "avg"
},
"type": "query"
}
],
"datasource": {
"type": "__expr__",
"uid": "__expr__"
},
"expression": "1 == 1",
"hide": false,
"intervalMs": 1000,
"maxDataPoints": 43200,
"refId": "A",
"type": "math"
},
"queryType": "",
"refId": "A",
"relativeTimeRange": {
"from": 0,
"to": 0
}
}
]
},
"execErrState": {
"type": "string",
"enum": ["Alerting", "Error", "OK"]
},
"folderUID": {
"type": "string",
"example": "project_x"
},
"for": {
"$ref": "#/definitions/Duration"
},
"id": {
"type": "integer",
"format": "int64"
},
"labels": {
"type": "object",
"additionalProperties": {
"type": "string"
},
"example": {
"team": "sre-team-1"
}
},
"noDataState": {
"type": "string",
"enum": ["Alerting", "NoData", "OK"]
},
"orgID": {
"type": "integer",
"format": "int64"
},
"provenance": {
"$ref": "#/definitions/Provenance"
},
"ruleGroup": {
"type": "string",
"maxLength": 190,
"minLength": 1,
"example": "eval_group_1"
},
"title": {
"type": "string",
"maxLength": 190,
"minLength": 1,
"example": "Always firing"
},
"uid": {
"type": "string"
},
"updated": {
"type": "string",
"format": "date-time",
"readOnly": true
}
}
},
"PushoverConfig": {
"type": "object",
"properties": {
@@ -15361,8 +15496,9 @@
"type": "string"
},
"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 RawPath, an optional field which only gets\nset if the default encoding is different from Path.\n\nURL's String method uses the EscapedPath method to obtain the path. See the\nEscapedPath method for more details.",
"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"
@@ -16162,7 +16298,6 @@
}
},
"alertGroup": {
"description": "AlertGroup alert group",
"type": "object",
"required": ["alerts", "labels", "receiver"],
"properties": {
@@ -16319,13 +16454,13 @@
}
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"type": "array",
"items": {
"$ref": "#/definitions/gettableAlert"
}
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"type": "object",
"required": ["comment", "createdBy", "endsAt", "matchers", "startsAt", "id", "status", "updatedAt"],
"properties": {
@@ -16499,6 +16634,7 @@
}
},
"receiver": {
"description": "Receiver receiver",
"type": "object",
"required": ["name"],
"properties": {

View File

@@ -10952,6 +10952,9 @@
"type": "string",
"example": "now-1h"
},
"publicDashboardAccessToken": {
"type": "string"
},
"queries": {
"description": "queries.refId Specifies an identifier of the query. Is optional and default to “A”.\nqueries.datasourceId Specifies the data source to be queried. Each query in the request must have an unique datasourceId.\nqueries.maxDataPoints - Species maximum amount of data points that dashboard panel can render. Is optional and default to 100.\nqueries.intervalMs - Specifies the time interval in milliseconds of time series. Is optional and defaults to 1000.",
"type": "array",