-
Notifications
You must be signed in to change notification settings - Fork 11.7k
/
admin.go
82 lines (71 loc) · 2.18 KB
/
admin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package definitions
import (
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
)
// 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"
)
// swagger:model
type PostableNGalertConfig struct {
Alertmanagers []string `json:"alertmanagers"`
AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"`
}
// swagger:model
type GettableNGalertConfig struct {
Alertmanagers []string `json:"alertmanagers"`
AlertmanagersChoice AlertmanagersChoice `json:"alertmanagersChoice"`
}
// swagger:model
type GettableAlertmanagers struct {
Status string `json:"status"`
Data v1.AlertManagersResult `json:"data"`
}