Files
grafana/pkg/services/ngalert/api/tooling/definitions/admin.go
Alex Moreno 45facbba11 Alerting: Remove url based external alertmanagers config (#57918)
* Remove URL-based alertmanagers from endpoint config

* WIP

* Add migration and alertmanagers from admin_configuration

* Empty comment removed

* set BasicAuth true when user is present in url

* Remove Alertmanagers from GET /admin_config payload

* Remove URL-based alertmanager configuration from UI

* Fix new uid generation in external alertmanagers migration

* Fix tests for URL-based external alertmanagers

* Fix API tests

* Add more tests, move migration code to separate file, and remove possible am duplicate urls

* Fix edge cases in migration

* Fix imports

* Remove useless fields and fix created_at/updated_at retrieval

Co-authored-by: George Robinson <george.robinson@grafana.com>
Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>
2022-11-10 16:34:13 +01:00

97 lines
2.5 KiB
Go

package definitions
import (
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
)
// swagger:route GET /api/v1/ngalert configuration RouteGetStatus
//
// Get the status of the alerting engine
//
// Produces:
// - application/json
//
// Responses:
// 200: AlertingStatus
// swagger:route GET /api/v1/ngalert/alertmanagers configuration RouteGetAlertmanagers
//
// Get the discovered and dropped Alertmanagers of the user's organization based on the specified configuration.
//
// Produces:
// - application/json
//
// Responses:
// 200: GettableAlertmanagers
// swagger:route GET /api/v1/ngalert/admin_config configuration RouteGetNGalertConfig
//
// Get the NGalert configuration of the user's organization, returns 404 if no configuration is present.
//
// Produces:
// - application/json
//
// Responses:
// 200: GettableNGalertConfig
// 404: Failure
// 500: Failure
// swagger:route POST /api/v1/ngalert/admin_config configuration RoutePostNGalertConfig
//
// Creates or updates the NGalert configuration of the user's organization. If no value is sent for alertmanagersChoice, it defaults to "all".
//
// Consumes:
// - application/json
//
// Responses:
// 201: Ack
// 400: ValidationError
// swagger:route DELETE /api/v1/ngalert/admin_config configuration RouteDeleteNGalertConfig
//
// Deletes the NGalert configuration of the user's organization.
//
// Consumes:
// - application/json
//
// Responses:
// 200: Ack
// 500: Failure
// swagger:parameters RoutePostNGalertConfig
type NGalertConfig struct {
// in:body
Body PostableNGalertConfig
}
// swagger:enum AlertmanagersChoice
type AlertmanagersChoice string
const (
AllAlertmanagers AlertmanagersChoice = "all"
InternalAlertmanager AlertmanagersChoice = "internal"
ExternalAlertmanagers AlertmanagersChoice = "external"
HandleGrafanaManagedAlerts = "handleGrafanaManagedAlerts"
)
// swagger:model
type PostableNGalertConfig struct {
AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"`
}
// swagger:model
type GettableNGalertConfig struct {
AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"`
}
// swagger:model
type GettableAlertmanagers struct {
Status string `json:"status"`
Data v1.AlertManagersResult `json:"data"`
}
// swagger:model
type AlertingStatus struct {
AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"`
}