Alerting: Fix swagger specification (#49273)

* Alerting: fix specification

* Update merged swagger specification
This commit is contained in:
Sofia Papagiannaki 2022-05-26 14:43:59 +03:00 committed by GitHub
parent a95ba8eb3f
commit 7cf321d7bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 481 additions and 1900 deletions

View File

@ -1371,6 +1371,21 @@
},
"type": "array"
},
"MessageTemplate": {
"properties": {
"Name": {
"type": "string"
},
"Template": {
"type": "string"
},
"provenance": {
"$ref": "#/definitions/Provenance"
}
},
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MessageTemplateContent": {
"properties": {
"Template": {
@ -1380,6 +1395,13 @@
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MessageTemplates": {
"items": {
"$ref": "#/definitions/MessageTemplate"
},
"type": "array",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MonthRange": {
"properties": {
"Begin": {
@ -1417,6 +1439,30 @@
"type": "object",
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"MuteTiming": {
"properties": {
"name": {
"type": "string",
"x-go-name": "Name"
},
"time_intervals": {
"items": {
"$ref": "#/definitions/TimeInterval"
},
"type": "array",
"x-go-name": "TimeIntervals"
}
},
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MuteTimings": {
"items": {
"$ref": "#/definitions/MuteTiming"
},
"type": "array",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"NamespaceConfigResponse": {
"additionalProperties": {
"items": {
@ -1427,6 +1473,10 @@
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"NotFound": {
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"NotifierConfig": {
"properties": {
"send_resolved": {
@ -2890,6 +2940,7 @@
"x-go-package": "github.com/prometheus/alertmanager/timeinterval"
},
"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.",
"properties": {
"ForceQuery": {
"type": "boolean"
@ -2922,9 +2973,9 @@
"$ref": "#/definitions/Userinfo"
}
},
"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).",
"type": "object",
"x-go-package": "github.com/prometheus/common/config"
"x-go-package": "net/url"
},
"Userinfo": {
"description": "The Userinfo type is an immutable encapsulation of username and\npassword details for a URL. An existing Userinfo value is guaranteed\nto have a username set (potentially empty, as allowed by RFC 2396),\nand optionally a password.",
@ -3147,11 +3198,12 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"alertGroups": {
"description": "AlertGroups alert groups",
"items": {
"$ref": "#/definitions/alertGroup"
},
"type": "array"
"type": "array",
"x-go-name": "AlertGroups",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"alertStatus": {
"description": "AlertStatus alert status",
@ -3333,14 +3385,14 @@
"type": "object"
},
"gettableAlerts": {
"description": "GettableAlerts gettable alerts",
"items": {
"$ref": "#/definitions/gettableAlert"
},
"type": "array",
"x-go-name": "GettableAlerts",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
"type": "array"
},
"gettableSilence": {
"description": "GettableSilence gettable silence",
"properties": {
"comment": {
"description": "comment",
@ -3392,16 +3444,15 @@
"status",
"updatedAt"
],
"type": "object",
"x-go-name": "GettableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
"type": "object"
},
"gettableSilences": {
"description": "GettableSilences gettable silences",
"items": {
"$ref": "#/definitions/gettableSilence"
},
"type": "array"
"type": "array",
"x-go-name": "GettableSilences",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"labelSet": {
"additionalProperties": {
@ -3530,7 +3581,6 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"properties": {
"comment": {
"description": "comment",
@ -3570,7 +3620,9 @@
"matchers",
"startsAt"
],
"type": "object"
"type": "object",
"x-go-name": "PostableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"receiver": {
"properties": {

View File

@ -29,9 +29,6 @@ type ValidationError struct {
Msg string `json:"msg"`
}
// swagger:model
type Ack struct{}
type Backend int
const (

View File

@ -23,7 +23,7 @@ import (
// - application/json
//
// Responses:
// 202: Accepted
// 202: Ack
// 400: ValidationError
// swagger:route PUT /api/provisioning/contact-points/{ID} provisioning RoutePutContactpoint
@ -34,7 +34,7 @@ import (
// - application/json
//
// Responses:
// 202: Accepted
// 202: Ack
// 400: ValidationError
// swagger:route DELETE /api/provisioning/contact-points/{ID} provisioning RouteDeleteContactpoints
@ -45,9 +45,16 @@ import (
// - application/json
//
// Responses:
// 202: Accepted
// 202: Ack
// 400: ValidationError
// swagger:parameters RoutePutContactpoint RouteDeleteContactpoints
type ContactPointUIDReference struct {
// ContactPointUID should be the contact point UID identifier
// in:path
ID string
}
// swagger:parameters RoutePostContactpoints RoutePutContactpoint
type ContactPointPayload struct {
// in:body

View File

@ -7,7 +7,7 @@ import prometheus "github.com/prometheus/alertmanager/config"
// Get all the mute timings.
//
// Responses:
// 200: []MuteTiming
// 200: MuteTimings
// 400: ValidationError
// swagger:route GET /api/provisioning/mute-timings/{name} provisioning RouteGetMuteTiming
@ -18,6 +18,17 @@ import prometheus "github.com/prometheus/alertmanager/config"
// 200: MuteTiming
// 400: ValidationError
// swagger:model
type MuteTiming struct {
prometheus.MuteTimeInterval
}
// swagger:model
type MuteTimings []MuteTiming
// swagger:parameters RouteGetTemplate RouteGetMuteTiming
type RouteGetMuteTimingParam struct {
// Template Name
// in:path
Name string `json:"name"`
}

View File

@ -16,7 +16,7 @@ package definitions
// - application/json
//
// Responses:
// 202: Accepted
// 202: Ack
// 400: ValidationError
// swagger:parameters RoutePutPolicyTree

View File

@ -14,7 +14,7 @@ import (
// Get all message templates.
//
// Responses:
// 200: []MessageTemplate
// 200: MessageTemplate
// 400: ValidationError
// swagger:route GET /api/provisioning/templates/{name} provisioning RouteGetTemplate
@ -33,7 +33,7 @@ import (
// - application/json
//
// Responses:
// 202: Accepted
// 202: Ack
// 400: ValidationError
// swagger:route DELETE /api/provisioning/templates/{name} provisioning RouteDeleteTemplate
@ -41,14 +41,25 @@ import (
// Delete a template.
//
// Responses:
// 204: Accepted
// 204: Ack
// swagger:parameters RouteGetTemplate RoutePutTemplate RouteDeleteTemplate
type RouteGetTemplateParam struct {
// Template Name
// in:path
Name string `json:"name"`
}
// swagger:model
type MessageTemplate struct {
Name string
Template string
Provenance models.Provenance `json:"provenance,omitempty"`
}
// swagger:model
type MessageTemplates []MessageTemplate
type MessageTemplateContent struct {
Template string
}

View File

@ -1,3 +1,7 @@
package definitions
// swagger:model
type NotFound struct{}
// swagger:model
type Ack struct{}

View File

@ -1371,6 +1371,21 @@
},
"type": "array"
},
"MessageTemplate": {
"properties": {
"Name": {
"type": "string"
},
"Template": {
"type": "string"
},
"provenance": {
"$ref": "#/definitions/Provenance"
}
},
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MessageTemplateContent": {
"properties": {
"Template": {
@ -1380,6 +1395,13 @@
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MessageTemplates": {
"items": {
"$ref": "#/definitions/MessageTemplate"
},
"type": "array",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MonthRange": {
"properties": {
"Begin": {
@ -1417,6 +1439,30 @@
"type": "object",
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"MuteTiming": {
"properties": {
"name": {
"type": "string",
"x-go-name": "Name"
},
"time_intervals": {
"items": {
"$ref": "#/definitions/TimeInterval"
},
"type": "array",
"x-go-name": "TimeIntervals"
}
},
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MuteTimings": {
"items": {
"$ref": "#/definitions/MuteTiming"
},
"type": "array",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"NamespaceConfigResponse": {
"additionalProperties": {
"items": {
@ -1427,6 +1473,10 @@
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"NotFound": {
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"NotifierConfig": {
"properties": {
"send_resolved": {
@ -3121,6 +3171,7 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"alertGroup": {
"description": "AlertGroup alert group",
"properties": {
"alerts": {
"description": "alerts",
@ -3142,9 +3193,7 @@
"labels",
"receiver"
],
"type": "object",
"x-go-name": "AlertGroup",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
"type": "object"
},
"alertGroups": {
"description": "AlertGroups alert groups",
@ -3529,7 +3578,6 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"properties": {
"comment": {
"description": "comment",
@ -3569,7 +3617,9 @@
"matchers",
"startsAt"
],
"type": "object"
"type": "object",
"x-go-name": "PostableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"receiver": {
"properties": {
@ -4841,7 +4891,10 @@
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
@ -4862,9 +4915,21 @@
"application/json"
],
"operationId": "RouteDeleteContactpoints",
"parameters": [
{
"description": "ContactPointUID should be the contact point UID identifier",
"in": "path",
"name": "ID",
"required": true,
"type": "string"
}
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
@ -4884,6 +4949,13 @@
],
"operationId": "RoutePutContactpoint",
"parameters": [
{
"description": "ContactPointUID should be the contact point UID identifier",
"in": "path",
"name": "ID",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "Body",
@ -4894,7 +4966,10 @@
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
@ -4914,7 +4989,10 @@
"operationId": "RouteGetMuteTimings",
"responses": {
"200": {
"$ref": "#/responses/MuteTiming"
"description": "MuteTimings",
"schema": {
"$ref": "#/definitions/MuteTimings"
}
},
"400": {
"description": "ValidationError",
@ -4932,9 +5010,22 @@
"/api/provisioning/mute-timings/{name}": {
"get": {
"operationId": "RouteGetMuteTiming",
"parameters": [
{
"description": "Template Name",
"in": "path",
"name": "name",
"required": true,
"type": "string",
"x-go-name": "Name"
}
],
"responses": {
"200": {
"$ref": "#/responses/MuteTiming"
"description": "MuteTiming",
"schema": {
"$ref": "#/definitions/MuteTiming"
}
},
"400": {
"description": "ValidationError",
@ -4987,7 +5078,10 @@
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
@ -5007,7 +5101,10 @@
"operationId": "RouteGetTemplates",
"responses": {
"200": {
"$ref": "#/responses/MessageTemplate"
"description": "MessageTemplate",
"schema": {
"$ref": "#/definitions/MessageTemplate"
}
},
"400": {
"description": "ValidationError",
@ -5025,9 +5122,22 @@
"/api/provisioning/templates/{name}": {
"delete": {
"operationId": "RouteDeleteTemplate",
"parameters": [
{
"description": "Template Name",
"in": "path",
"name": "name",
"required": true,
"type": "string",
"x-go-name": "Name"
}
],
"responses": {
"204": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
}
},
"summary": "Delete a template.",
@ -5037,12 +5147,28 @@
},
"get": {
"operationId": "RouteGetTemplate",
"parameters": [
{
"description": "Template Name",
"in": "path",
"name": "name",
"required": true,
"type": "string",
"x-go-name": "Name"
}
],
"responses": {
"200": {
"$ref": "#/responses/MessageTemplate"
"description": "MessageTemplate",
"schema": {
"$ref": "#/definitions/MessageTemplate"
}
},
"404": {
"$ref": "#/responses/NotFound"
"description": "NotFound",
"schema": {
"$ref": "#/definitions/NotFound"
}
}
},
"summary": "Get a message template.",
@ -5056,6 +5182,14 @@
],
"operationId": "RoutePutTemplate",
"parameters": [
{
"description": "Template Name",
"in": "path",
"name": "name",
"required": true,
"type": "string",
"x-go-name": "Name"
},
{
"in": "body",
"name": "Body",
@ -5066,7 +5200,10 @@
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",

View File

@ -1164,7 +1164,10 @@
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
@ -1186,6 +1189,13 @@
"summary": "Update an existing contact point.",
"operationId": "RoutePutContactpoint",
"parameters": [
{
"type": "string",
"description": "ContactPointUID should be the contact point UID identifier",
"name": "ID",
"in": "path",
"required": true
},
{
"name": "Body",
"in": "body",
@ -1196,7 +1206,10 @@
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
@ -1215,9 +1228,21 @@
],
"summary": "Delete a contact point.",
"operationId": "RouteDeleteContactpoints",
"parameters": [
{
"type": "string",
"description": "ContactPointUID should be the contact point UID identifier",
"name": "ID",
"in": "path",
"required": true
}
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
@ -1237,7 +1262,10 @@
"operationId": "RouteGetMuteTimings",
"responses": {
"200": {
"$ref": "#/responses/MuteTiming"
"description": "MuteTimings",
"schema": {
"$ref": "#/definitions/MuteTimings"
}
},
"400": {
"description": "ValidationError",
@ -1255,9 +1283,22 @@
],
"summary": "Get a mute timing.",
"operationId": "RouteGetMuteTiming",
"parameters": [
{
"type": "string",
"x-go-name": "Name",
"description": "Template Name",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/MuteTiming"
"description": "MuteTiming",
"schema": {
"$ref": "#/definitions/MuteTiming"
}
},
"400": {
"description": "ValidationError",
@ -1310,7 +1351,10 @@
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
@ -1330,7 +1374,10 @@
"operationId": "RouteGetTemplates",
"responses": {
"200": {
"$ref": "#/responses/MessageTemplate"
"description": "MessageTemplate",
"schema": {
"$ref": "#/definitions/MessageTemplate"
}
},
"400": {
"description": "ValidationError",
@ -1348,12 +1395,28 @@
],
"summary": "Get a message template.",
"operationId": "RouteGetTemplate",
"parameters": [
{
"type": "string",
"x-go-name": "Name",
"description": "Template Name",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/MessageTemplate"
"description": "MessageTemplate",
"schema": {
"$ref": "#/definitions/MessageTemplate"
}
},
"404": {
"$ref": "#/responses/NotFound"
"description": "NotFound",
"schema": {
"$ref": "#/definitions/NotFound"
}
}
}
},
@ -1367,6 +1430,14 @@
"summary": "Updates an existing template.",
"operationId": "RoutePutTemplate",
"parameters": [
{
"type": "string",
"x-go-name": "Name",
"description": "Template Name",
"name": "name",
"in": "path",
"required": true
},
{
"name": "Body",
"in": "body",
@ -1377,7 +1448,10 @@
],
"responses": {
"202": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
},
"400": {
"description": "ValidationError",
@ -1393,9 +1467,22 @@
],
"summary": "Delete a template.",
"operationId": "RouteDeleteTemplate",
"parameters": [
{
"type": "string",
"x-go-name": "Name",
"description": "Template Name",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"$ref": "#/responses/Accepted"
"description": "Ack",
"schema": {
"$ref": "#/definitions/Ack"
}
}
}
}
@ -3389,6 +3476,21 @@
},
"$ref": "#/definitions/Matchers"
},
"MessageTemplate": {
"type": "object",
"properties": {
"Name": {
"type": "string"
},
"Template": {
"type": "string"
},
"provenance": {
"$ref": "#/definitions/Provenance"
}
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MessageTemplateContent": {
"type": "object",
"properties": {
@ -3398,6 +3500,13 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MessageTemplates": {
"type": "array",
"items": {
"$ref": "#/definitions/MessageTemplate"
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MonthRange": {
"type": "object",
"title": "A MonthRange is an inclusive range between [1, 12] where 1 = January.",
@ -3435,6 +3544,30 @@
},
"x-go-package": "github.com/prometheus/alertmanager/config"
},
"MuteTiming": {
"type": "object",
"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/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"MuteTimings": {
"type": "array",
"items": {
"$ref": "#/definitions/MuteTiming"
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"NamespaceConfigResponse": {
"type": "object",
"additionalProperties": {
@ -3445,6 +3578,10 @@
},
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"NotFound": {
"type": "object",
"x-go-package": "github.com/grafana/grafana/pkg/services/ngalert/api/tooling/definitions"
},
"NotifierConfig": {
"type": "object",
"title": "NotifierConfig contains base options common across all notifier configurations.",
@ -5139,6 +5276,7 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"alertGroup": {
"description": "AlertGroup alert group",
"type": "object",
"required": [
"alerts",
@ -5161,8 +5299,6 @@
"$ref": "#/definitions/receiver"
}
},
"x-go-name": "AlertGroup",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/alertGroup"
},
"alertGroups": {
@ -5553,7 +5689,6 @@
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models"
},
"postableSilence": {
"description": "PostableSilence postable silence",
"type": "object",
"required": [
"comment",
@ -5594,6 +5729,8 @@
"x-go-name": "StartsAt"
}
},
"x-go-name": "PostableSilence",
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
"$ref": "#/definitions/postableSilence"
},
"receiver": {

File diff suppressed because it is too large Load Diff