Alerting: Split grafana and lotex routes (#44742)
* split Lotex and Grafana routes * update template to use authorize function for every route
This commit is contained in:
@@ -10,17 +10,26 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/services/secrets"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/pkg/errors"
|
||||
amv2 "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/config"
|
||||
"github.com/prometheus/alertmanager/pkg/labels"
|
||||
"github.com/prometheus/common/model"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||
"github.com/grafana/grafana/pkg/services/secrets"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
// swagger:route POST /api/alertmanager/grafana/config/api/v1/alerts alertmanager RoutePostGrafanaAlertingConfig
|
||||
//
|
||||
// sets an Alerting config
|
||||
//
|
||||
// Responses:
|
||||
// 201: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/{Recipient}/config/api/v1/alerts alertmanager RoutePostAlertingConfig
|
||||
//
|
||||
// sets an Alerting config
|
||||
@@ -29,6 +38,14 @@ import (
|
||||
// 201: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/grafana/config/api/v1/alerts alertmanager RouteGetGrafanaAlertingConfig
|
||||
//
|
||||
// gets an Alerting config
|
||||
//
|
||||
// Responses:
|
||||
// 200: GettableUserConfig
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/config/api/v1/alerts alertmanager RouteGetAlertingConfig
|
||||
//
|
||||
// gets an Alerting config
|
||||
@@ -37,6 +54,14 @@ import (
|
||||
// 200: GettableUserConfig
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/alertmanager/grafana/config/api/v1/alerts alertmanager RouteDeleteGrafanaAlertingConfig
|
||||
//
|
||||
// deletes the Alerting config for a tenant
|
||||
//
|
||||
// Responses:
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/alertmanager/{Recipient}/config/api/v1/alerts alertmanager RouteDeleteAlertingConfig
|
||||
//
|
||||
// deletes the Alerting config for a tenant
|
||||
@@ -45,6 +70,14 @@ import (
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/grafana/api/v2/status alertmanager RouteGetGrafanaAMStatus
|
||||
//
|
||||
// get alertmanager status and configuration
|
||||
//
|
||||
// Responses:
|
||||
// 200: GettableStatus
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/status alertmanager RouteGetAMStatus
|
||||
//
|
||||
// get alertmanager status and configuration
|
||||
@@ -53,6 +86,14 @@ import (
|
||||
// 200: GettableStatus
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/grafana/api/v2/alerts alertmanager RouteGetGrafanaAMAlerts
|
||||
//
|
||||
// get alertmanager alerts
|
||||
//
|
||||
// Responses:
|
||||
// 200: gettableAlerts
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/alerts alertmanager RouteGetAMAlerts
|
||||
//
|
||||
// get alertmanager alerts
|
||||
@@ -61,6 +102,14 @@ import (
|
||||
// 200: gettableAlerts
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/grafana/api/v2/alerts alertmanager RoutePostGrafanaAMAlerts
|
||||
//
|
||||
// create alertmanager alerts
|
||||
//
|
||||
// Responses:
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/{Recipient}/api/v2/alerts alertmanager RoutePostAMAlerts
|
||||
//
|
||||
// create alertmanager alerts
|
||||
@@ -69,6 +118,14 @@ import (
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/grafana/api/v2/alerts/groups alertmanager RouteGetGrafanaAMAlertGroups
|
||||
//
|
||||
// get alertmanager alerts
|
||||
//
|
||||
// Responses:
|
||||
// 200: alertGroups
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/alerts/groups alertmanager RouteGetAMAlertGroups
|
||||
//
|
||||
// get alertmanager alerts
|
||||
@@ -77,6 +134,20 @@ import (
|
||||
// 200: alertGroups
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/grafana/config/api/v1/receivers/test alertmanager RoutePostTestGrafanaReceivers
|
||||
//
|
||||
// Test Grafana managed receivers without saving them.
|
||||
//
|
||||
// Responses:
|
||||
//
|
||||
// 200: Ack
|
||||
// 207: MultiStatus
|
||||
// 400: ValidationError
|
||||
// 403: PermissionDenied
|
||||
// 404: AlertManagerNotFound
|
||||
// 408: Failure
|
||||
// 409: AlertManagerNotReady
|
||||
|
||||
// swagger:route POST /api/alertmanager/{Recipient}/config/api/v1/receivers/test alertmanager RoutePostTestReceivers
|
||||
//
|
||||
// Test Grafana managed receivers without saving them.
|
||||
@@ -91,6 +162,14 @@ import (
|
||||
// 408: Failure
|
||||
// 409: AlertManagerNotReady
|
||||
|
||||
// swagger:route GET /api/alertmanager/grafana/api/v2/silences alertmanager RouteGetGrafanaSilences
|
||||
//
|
||||
// get silences
|
||||
//
|
||||
// Responses:
|
||||
// 200: gettableSilences
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/silences alertmanager RouteGetSilences
|
||||
//
|
||||
// get silences
|
||||
@@ -99,6 +178,14 @@ import (
|
||||
// 200: gettableSilences
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/grafana/api/v2/silences alertmanager RouteCreateGrafanaSilence
|
||||
//
|
||||
// create silence
|
||||
//
|
||||
// Responses:
|
||||
// 201: gettableSilence
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/alertmanager/{Recipient}/api/v2/silences alertmanager RouteCreateSilence
|
||||
//
|
||||
// create silence
|
||||
@@ -107,6 +194,14 @@ import (
|
||||
// 201: gettableSilence
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/grafana/api/v2/silence/{SilenceId} alertmanager RouteGetGrafanaSilence
|
||||
//
|
||||
// get silence
|
||||
//
|
||||
// Responses:
|
||||
// 200: gettableSilence
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/alertmanager/{Recipient}/api/v2/silence/{SilenceId} alertmanager RouteGetSilence
|
||||
//
|
||||
// get silence
|
||||
@@ -115,6 +210,14 @@ import (
|
||||
// 200: gettableSilence
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/alertmanager/grafana/api/v2/silence/{SilenceId} alertmanager RouteDeleteGrafanaSilence
|
||||
//
|
||||
// delete silence
|
||||
//
|
||||
// Responses:
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/alertmanager/{Recipient}/api/v2/silence/{SilenceId} alertmanager RouteDeleteSilence
|
||||
//
|
||||
// delete silence
|
||||
@@ -135,7 +238,7 @@ type AlertManagerNotReady struct{}
|
||||
// swagger:model
|
||||
type MultiStatus struct{}
|
||||
|
||||
// swagger:parameters RoutePostTestReceivers
|
||||
// swagger:parameters RoutePostTestReceivers RoutePostTestGrafanaReceivers
|
||||
type TestReceiversConfigParams struct {
|
||||
// in:body
|
||||
Body TestReceiversConfigBodyParams
|
||||
@@ -176,25 +279,25 @@ type TestReceiverConfigResult struct {
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// swagger:parameters RouteCreateSilence
|
||||
// swagger:parameters RouteCreateSilence RouteCreateGrafanaSilence
|
||||
type CreateSilenceParams struct {
|
||||
// in:body
|
||||
Silence PostableSilence
|
||||
}
|
||||
|
||||
// swagger:parameters RouteGetSilence RouteDeleteSilence
|
||||
// swagger:parameters RouteGetSilence RouteDeleteSilence RouteGetGrafanaSilence RouteDeleteGrafanaSilence
|
||||
type GetDeleteSilenceParams struct {
|
||||
// in:path
|
||||
SilenceId string
|
||||
}
|
||||
|
||||
// swagger:parameters RouteGetSilences
|
||||
// swagger:parameters RouteGetSilences RouteGetGrafanaSilences
|
||||
type GetSilencesParams struct {
|
||||
// in:query
|
||||
Filter []string `json:"filter"`
|
||||
}
|
||||
|
||||
// swagger:parameters RouteGetRuleStatuses
|
||||
// swagger:parameters RouteGetRuleStatuses RouteGetGrafanaRuleStatuses
|
||||
type GetRuleStatusesParams struct {
|
||||
// in: query
|
||||
DashboardUID string
|
||||
@@ -299,7 +402,7 @@ type AlertGroup = amv2.AlertGroup
|
||||
// swagger:model receiver
|
||||
type Receiver = amv2.Receiver
|
||||
|
||||
// swagger:parameters RouteGetAMAlerts RouteGetAMAlertGroups
|
||||
// swagger:parameters RouteGetAMAlerts RouteGetAMAlertGroups RouteGetGrafanaAMAlerts RouteGetGrafanaAMAlertGroups
|
||||
type AlertsParams struct {
|
||||
|
||||
// Show active alerts
|
||||
@@ -331,13 +434,13 @@ type AlertsParams struct {
|
||||
Receivers string `json:"receiver"`
|
||||
}
|
||||
|
||||
// swagger:parameters RoutePostAMAlerts
|
||||
// swagger:parameters RoutePostAMAlerts RoutePostGrafanaAMAlerts
|
||||
type PostableAlerts struct {
|
||||
// in:body
|
||||
PostableAlerts []amv2.PostableAlert `yaml:"" json:""`
|
||||
}
|
||||
|
||||
// swagger:parameters RoutePostAlertingConfig
|
||||
// swagger:parameters RoutePostAlertingConfig RoutePostGrafanaAlertingConfig
|
||||
type BodyAlertingConfig struct {
|
||||
// in:body
|
||||
Body PostableUserConfig
|
||||
@@ -352,10 +455,9 @@ type BodyAlertingConfig struct {
|
||||
// testing routes
|
||||
// swagger:parameters RouteTestReceiverConfig RouteTestRuleConfig
|
||||
type DatasourceReference struct {
|
||||
// Recipient should be "grafana" for requests to be handled by grafana
|
||||
// and the numeric datasource id for requests to be forwarded to a datasource
|
||||
// Recipient should be the numeric datasource id
|
||||
// in:path
|
||||
Recipient string
|
||||
Recipient int
|
||||
}
|
||||
|
||||
// swagger:model
|
||||
|
||||
@@ -5,10 +5,22 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
)
|
||||
|
||||
// swagger:route Get /api/ruler/grafana/api/v1/rules ruler RouteGetGrafanaRulesConfig
|
||||
//
|
||||
// List rule groups
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 202: NamespaceConfigResponse
|
||||
//
|
||||
|
||||
// swagger:route Get /api/ruler/{Recipient}/api/v1/rules ruler RouteGetRulesConfig
|
||||
//
|
||||
// List rule groups
|
||||
@@ -19,6 +31,18 @@ import (
|
||||
// Responses:
|
||||
// 202: NamespaceConfigResponse
|
||||
|
||||
// swagger:route POST /api/ruler/grafana/api/v1/rules/{Namespace} ruler RoutePostNameGrafanaRulesConfig
|
||||
//
|
||||
// Creates or updates a rule group
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
// - application/yaml
|
||||
//
|
||||
// Responses:
|
||||
// 202: Ack
|
||||
//
|
||||
|
||||
// swagger:route POST /api/ruler/{Recipient}/api/v1/rules/{Namespace} ruler RoutePostNameRulesConfig
|
||||
//
|
||||
// Creates or updates a rule group
|
||||
@@ -30,6 +54,16 @@ import (
|
||||
// Responses:
|
||||
// 202: Ack
|
||||
|
||||
// swagger:route Get /api/ruler/grafana/api/v1/rules/{Namespace} ruler RouteGetNamespaceGrafanaRulesConfig
|
||||
//
|
||||
// Get rule groups by namespace
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 202: NamespaceConfigResponse
|
||||
|
||||
// swagger:route Get /api/ruler/{Recipient}/api/v1/rules/{Namespace} ruler RouteGetNamespaceRulesConfig
|
||||
//
|
||||
// Get rule groups by namespace
|
||||
@@ -40,6 +74,13 @@ import (
|
||||
// Responses:
|
||||
// 202: NamespaceConfigResponse
|
||||
|
||||
// swagger:route Delete /api/ruler/grafana/api/v1/rules/{Namespace} ruler RouteDeleteNamespaceGrafanaRulesConfig
|
||||
//
|
||||
// Delete namespace
|
||||
//
|
||||
// Responses:
|
||||
// 202: Ack
|
||||
|
||||
// swagger:route Delete /api/ruler/{Recipient}/api/v1/rules/{Namespace} ruler RouteDeleteNamespaceRulesConfig
|
||||
//
|
||||
// Delete namespace
|
||||
@@ -47,6 +88,16 @@ import (
|
||||
// Responses:
|
||||
// 202: Ack
|
||||
|
||||
// swagger:route Get /api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname} ruler RouteGetGrafanaRuleGroupConfig
|
||||
//
|
||||
// Get rule group
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 202: RuleGroupConfigResponse
|
||||
|
||||
// swagger:route Get /api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname} ruler RouteGetRulegGroupConfig
|
||||
//
|
||||
// Get rule group
|
||||
@@ -57,6 +108,13 @@ import (
|
||||
// Responses:
|
||||
// 202: RuleGroupConfigResponse
|
||||
|
||||
// swagger:route Delete /api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname} ruler RouteDeleteGrafanaRuleGroupConfig
|
||||
//
|
||||
// Delete rule group
|
||||
//
|
||||
// Responses:
|
||||
// 202: Ack
|
||||
|
||||
// swagger:route Delete /api/ruler/{Recipient}/api/v1/rules/{Namespace}/{Groupname} ruler RouteDeleteRuleGroupConfig
|
||||
//
|
||||
// Delete rule group
|
||||
@@ -64,7 +122,7 @@ import (
|
||||
// Responses:
|
||||
// 202: Ack
|
||||
|
||||
// swagger:parameters RoutePostNameRulesConfig
|
||||
// swagger:parameters RoutePostNameRulesConfig RoutePostNameGrafanaRulesConfig
|
||||
type NamespaceConfig struct {
|
||||
// in:path
|
||||
Namespace string
|
||||
@@ -72,13 +130,13 @@ type NamespaceConfig struct {
|
||||
Body PostableRuleGroupConfig
|
||||
}
|
||||
|
||||
// swagger:parameters RouteGetNamespaceRulesConfig RouteDeleteNamespaceRulesConfig
|
||||
// swagger:parameters RouteGetNamespaceRulesConfig RouteDeleteNamespaceRulesConfig RouteGetNamespaceGrafanaRulesConfig RouteDeleteNamespaceGrafanaRulesConfig
|
||||
type PathNamespaceConfig struct {
|
||||
// in: path
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// swagger:parameters RouteGetRulegGroupConfig RouteDeleteRuleGroupConfig
|
||||
// swagger:parameters RouteGetRulegGroupConfig RouteDeleteRuleGroupConfig RouteGetGrafanaRuleGroupConfig RouteDeleteGrafanaRuleGroupConfig
|
||||
type PathRouleGroupConfig struct {
|
||||
// in: path
|
||||
Namespace string
|
||||
@@ -86,7 +144,7 @@ type PathRouleGroupConfig struct {
|
||||
Groupname string
|
||||
}
|
||||
|
||||
// swagger:parameters RouteGetRulesConfig
|
||||
// swagger:parameters RouteGetRulesConfig RouteGetGrafanaRulesConfig
|
||||
type PathGetRulesParams struct {
|
||||
// in: query
|
||||
DashboardUID string
|
||||
|
||||
@@ -6,6 +6,13 @@ import (
|
||||
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
|
||||
)
|
||||
|
||||
// swagger:route GET /api/prometheus/grafana/api/v1/rules prometheus RouteGetGrafanaRuleStatuses
|
||||
//
|
||||
// gets the evaluation statuses of all rules
|
||||
//
|
||||
// Responses:
|
||||
// 200: RuleResponse
|
||||
|
||||
// swagger:route GET /api/prometheus/{Recipient}/api/v1/rules prometheus RouteGetRuleStatuses
|
||||
//
|
||||
// gets the evaluation statuses of all rules
|
||||
@@ -13,6 +20,13 @@ import (
|
||||
// Responses:
|
||||
// 200: RuleResponse
|
||||
|
||||
// swagger:route GET /api/prometheus/grafana/api/v1/alerts prometheus RouteGetGrafanaAlertStatuses
|
||||
//
|
||||
// gets the current alerts
|
||||
//
|
||||
// Responses:
|
||||
// 200: AlertResponse
|
||||
|
||||
// swagger:route GET /api/prometheus/{Recipient}/api/v1/alerts prometheus RouteGetAlertStatuses
|
||||
//
|
||||
// gets the current alerts
|
||||
|
||||
@@ -7,14 +7,28 @@ import (
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
"github.com/prometheus/alertmanager/config"
|
||||
"github.com/prometheus/prometheus/promql"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/ngalert/models"
|
||||
)
|
||||
|
||||
// swagger:route Post /api/v1/rule/test/grafana testing RouteTestRuleGrafanaConfig
|
||||
//
|
||||
// Test a rule against Grafana ruler
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
//
|
||||
// Produces:
|
||||
// - application/json
|
||||
//
|
||||
// Responses:
|
||||
// 200: TestRuleResponse
|
||||
|
||||
// swagger:route Post /api/v1/rule/test/{Recipient} testing RouteTestRuleConfig
|
||||
//
|
||||
// Test rule
|
||||
// Test a rule against external data source ruler
|
||||
//
|
||||
// Consumes:
|
||||
// - application/json
|
||||
@@ -44,7 +58,7 @@ type TestReceiverRequest struct {
|
||||
Body ExtendedReceiver
|
||||
}
|
||||
|
||||
// swagger:parameters RouteTestRuleConfig
|
||||
// swagger:parameters RouteTestRuleConfig RouteTestRuleGrafanaConfig
|
||||
type TestRuleRequest struct {
|
||||
// in:body
|
||||
Body TestRulePayload
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,454 @@
|
||||
},
|
||||
"basePath": "/api/v1",
|
||||
"paths": {
|
||||
"/api/alertmanager/grafana/api/v2/alerts": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaAMAlerts",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"x-go-name": "Active",
|
||||
"description": "Show active alerts",
|
||||
"name": "active",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"x-go-name": "Silenced",
|
||||
"description": "Show silenced alerts",
|
||||
"name": "silenced",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"x-go-name": "Inhibited",
|
||||
"description": "Show inhibited alerts",
|
||||
"name": "inhibited",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "Matchers",
|
||||
"description": "A list of matchers to filter alerts by",
|
||||
"name": "filter",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "Receivers",
|
||||
"description": "A regex matching receivers to filter alerts by",
|
||||
"name": "receiver",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "gettableAlerts",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gettableAlerts"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaAMAlertGroups",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"x-go-name": "Active",
|
||||
"description": "Show active alerts",
|
||||
"name": "active",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"x-go-name": "Silenced",
|
||||
"description": "Show silenced alerts",
|
||||
"name": "silenced",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"x-go-name": "Inhibited",
|
||||
"description": "Show inhibited alerts",
|
||||
"name": "inhibited",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "Matchers",
|
||||
"description": "A list of matchers to filter alerts by",
|
||||
"name": "filter",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"x-go-name": "Receivers",
|
||||
"description": "A regex matching receivers to filter alerts by",
|
||||
"name": "receiver",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "alertGroups",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/alertGroups"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/grafana/api/v2/silence/{SilenceId}": {
|
||||
"get": {
|
||||
"description": "get silence",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaSilence",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "SilenceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "gettableSilence",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gettableSilence"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "delete silence",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteDeleteGrafanaSilence",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "SilenceId",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/grafana/api/v2/silences": {
|
||||
"get": {
|
||||
"description": "get silences",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaSilences",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "Filter",
|
||||
"name": "filter",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "gettableSilences",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gettableSilences"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "create silence",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteCreateGrafanaSilence",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Silence",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/postableSilence"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "gettableSilence",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/gettableSilence"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/grafana/api/v2/status": {
|
||||
"get": {
|
||||
"description": "get alertmanager status and configuration",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaAMStatus",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "GettableStatus",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GettableStatus"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/grafana/config/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets an Alerting config",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaAlertingConfig",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "GettableUserConfig",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/GettableUserConfig"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "sets an Alerting config",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RoutePostGrafanaAlertingConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/PostableUserConfig"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "deletes the Alerting config for a tenant",
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"operationId": "RouteDeleteGrafanaAlertingConfig",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "ValidationError",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ValidationError"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/grafana/config/api/v1/receivers/test": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"alertmanager"
|
||||
],
|
||||
"summary": "Test Grafana managed receivers without saving them.",
|
||||
"operationId": "RoutePostTestGrafanaReceivers",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/TestReceiversConfigBodyParams"
|
||||
}
|
||||
}
|
||||
],
|
||||
"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": "AlertManagerNotFound",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/AlertManagerNotFound"
|
||||
}
|
||||
},
|
||||
"408": {
|
||||
"description": "Failure",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Failure"
|
||||
}
|
||||
},
|
||||
"409": {
|
||||
"description": "AlertManagerNotReady",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/AlertManagerNotReady"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/alertmanager/{Recipient}/api/v2/alerts": {
|
||||
"get": {
|
||||
"description": "get alertmanager alerts",
|
||||
@@ -67,8 +515,9 @@
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -107,8 +556,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -180,8 +630,9 @@
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -218,8 +669,9 @@
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -254,8 +706,9 @@
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -295,8 +748,9 @@
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -332,8 +786,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -364,8 +819,9 @@
|
||||
"operationId": "RouteGetAMStatus",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -396,8 +852,9 @@
|
||||
"operationId": "RouteGetAlertingConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -433,8 +890,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -463,8 +921,9 @@
|
||||
"operationId": "RouteDeleteAlertingConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -502,8 +961,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -555,6 +1015,53 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/prometheus/grafana/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets the current alerts",
|
||||
"tags": [
|
||||
"prometheus"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaAlertStatuses",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "AlertResponse",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/AlertResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/prometheus/grafana/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "gets the evaluation statuses of all rules",
|
||||
"tags": [
|
||||
"prometheus"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaRuleStatuses",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "DashboardUID",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"name": "PanelID",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "RuleResponse",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/RuleResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/prometheus/{Recipient}/api/v1/alerts": {
|
||||
"get": {
|
||||
"description": "gets the current alerts",
|
||||
@@ -564,8 +1071,9 @@
|
||||
"operationId": "RouteGetAlertStatuses",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -601,8 +1109,9 @@
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -618,6 +1127,187 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ruler/grafana/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "List rule groups",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ruler"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "DashboardUID",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"name": "PanelID",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"202": {
|
||||
"description": "NamespaceConfigResponse",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/NamespaceConfigResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ruler/grafana/api/v1/rules/{Namespace}": {
|
||||
"get": {
|
||||
"description": "Get rule groups by namespace",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ruler"
|
||||
],
|
||||
"operationId": "RouteGetNamespaceGrafanaRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "Namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"202": {
|
||||
"description": "NamespaceConfigResponse",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/NamespaceConfigResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"description": "Creates or updates a rule group",
|
||||
"consumes": [
|
||||
"application/json",
|
||||
"application/yaml"
|
||||
],
|
||||
"tags": [
|
||||
"ruler"
|
||||
],
|
||||
"operationId": "RoutePostNameGrafanaRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "Namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"name": "Body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/PostableRuleGroupConfig"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"202": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "Delete namespace",
|
||||
"tags": [
|
||||
"ruler"
|
||||
],
|
||||
"operationId": "RouteDeleteNamespaceGrafanaRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "Namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"202": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ruler/grafana/api/v1/rules/{Namespace}/{Groupname}": {
|
||||
"get": {
|
||||
"description": "Get rule group",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"ruler"
|
||||
],
|
||||
"operationId": "RouteGetGrafanaRuleGroupConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "Namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "Groupname",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"202": {
|
||||
"description": "RuleGroupConfigResponse",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/RuleGroupConfigResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"description": "Delete rule group",
|
||||
"tags": [
|
||||
"ruler"
|
||||
],
|
||||
"operationId": "RouteDeleteGrafanaRuleGroupConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "Namespace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "Groupname",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"202": {
|
||||
"description": "Ack",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Ack"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ruler/{Recipient}/api/v1/rules": {
|
||||
"get": {
|
||||
"description": "List rule groups",
|
||||
@@ -630,8 +1320,9 @@
|
||||
"operationId": "RouteGetRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -670,8 +1361,9 @@
|
||||
"operationId": "RouteGetNamespaceRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -704,8 +1396,9 @@
|
||||
"operationId": "RoutePostNameRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -741,8 +1434,9 @@
|
||||
"operationId": "RouteDeleteNamespaceRulesConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -776,8 +1470,9 @@
|
||||
"operationId": "RouteGetRulegGroupConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -812,8 +1507,9 @@
|
||||
"operationId": "RouteDeleteRuleGroupConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -982,9 +1678,41 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/rule/test/grafana": {
|
||||
"post": {
|
||||
"description": "Test a rule against Grafana ruler",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"testing"
|
||||
],
|
||||
"operationId": "RouteTestRuleGrafanaConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "Body",
|
||||
"in": "body",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/TestRulePayload"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "TestRuleResponse",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/TestRuleResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/v1/rule/test/{Recipient}": {
|
||||
"post": {
|
||||
"description": "Test rule",
|
||||
"description": "Test a rule against external data source ruler",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
@@ -997,8 +1725,9 @@
|
||||
"operationId": "RouteTestRuleConfig",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Recipient should be \"grafana\" for requests to be handled by grafana\nand the numeric datasource id for requests to be forwarded to a datasource",
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Recipient should be the numeric datasource id",
|
||||
"name": "Recipient",
|
||||
"in": "path",
|
||||
"required": true
|
||||
@@ -3957,12 +4686,11 @@
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
"alertGroups": {
|
||||
"description": "AlertGroups alert groups",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/alertGroup"
|
||||
},
|
||||
"x-go-name": "AlertGroups",
|
||||
"x-go-package": "github.com/prometheus/alertmanager/api/v2/models",
|
||||
"$ref": "#/definitions/alertGroups"
|
||||
},
|
||||
"alertStatus": {
|
||||
|
||||
@@ -17,10 +17,6 @@ type {{classname}}ForkingService interface { {{#operation}}
|
||||
{{nickname}}(*models.ReqContext) response.Response{{/operation}}
|
||||
}
|
||||
|
||||
type {{classname}}Service interface { {{#operation}}
|
||||
{{nickname}}(*models.ReqContext{{#bodyParams}}, apimodels.{{dataType}}{{/bodyParams}}) response.Response{{/operation}}
|
||||
}
|
||||
|
||||
{{#operations}}{{#operation}}
|
||||
func (f *Forked{{classname}}) {{nickname}}(ctx *models.ReqContext) response.Response {
|
||||
{{#bodyParams}}
|
||||
@@ -40,6 +36,7 @@ func (api *API) Register{{classname}}Endpoints(srv {{classname}}ForkingService,
|
||||
api.RouteRegister.Group("", func(group routing.RouteRegister){ {{#operations}}{{#operation}}
|
||||
group.{{httpMethod}}(
|
||||
toMacaronPath("{{{path}}}"),
|
||||
api.authorize(http.Method{{httpMethod}}, "{{{path}}}"),
|
||||
metrics.Instrument(
|
||||
http.Method{{httpMethod}},
|
||||
"{{{path}}}",
|
||||
@@ -47,6 +44,6 @@ func (api *API) Register{{classname}}Endpoints(srv {{classname}}ForkingService,
|
||||
m,
|
||||
),
|
||||
){{/operation}}{{/operations}}
|
||||
}, middleware.ReqSignedIn)
|
||||
})
|
||||
}{{#operation}}
|
||||
{{/operation}}{{/operations}}
|
||||
Reference in New Issue
Block a user