Merge remote-tracking branch 'origin/master' into add-rules-endpoints
This commit is contained in:
commit
e2fb5533c9
352 files changed
+62706
-199
No files matched your search
@@ -0,0 +1,113 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
amv2 "github.com/prometheus/alertmanager/api/v2/models"
|
||||
"github.com/prometheus/alertmanager/config"
|
||||
)
|
||||
|
||||
// swagger:route POST /api/v1/config alertmanager RoutePostAlertingConfig
|
||||
//
|
||||
// sets an Alerting config
|
||||
//
|
||||
// Responses:
|
||||
// 201: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/v1/config alertmanager RouteGetAlertingConfig
|
||||
//
|
||||
// gets an Alerting config
|
||||
//
|
||||
// Responses:
|
||||
// 200: AlertingConfigResponse
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/v1/config alertmanager RouteDeleteAlertingConfig
|
||||
//
|
||||
// deletes the Alerting config for a tenant
|
||||
//
|
||||
// Responses:
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/v1/alerts alertmanager RouteGetAmAlerts
|
||||
//
|
||||
// get alertmanager alerts
|
||||
//
|
||||
// Responses:
|
||||
// 200: GettableAlerts
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/v1/alerts/groups alertmanager RouteGetAmAlertGroups
|
||||
//
|
||||
// get alertmanager alerts
|
||||
//
|
||||
// Responses:
|
||||
// 200: AlertGroups
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:model
|
||||
type GettableAlerts amv2.GettableAlerts
|
||||
|
||||
// swagger:model
|
||||
type AlertGroups amv2.AlertGroups
|
||||
|
||||
// swagger:parameters RouteGetAmAlerts RouteGetAmAlertGroups
|
||||
type AlertsParams struct {
|
||||
|
||||
// Show active alerts
|
||||
// in: query
|
||||
// required: false
|
||||
Active bool `json:"active"`
|
||||
|
||||
// Show silenced alerts
|
||||
// in: query
|
||||
// required: false
|
||||
Silenced bool `json:"silenced"`
|
||||
|
||||
// Show inhibited alerts
|
||||
// in: query
|
||||
// required: false
|
||||
Inhibited bool `json:"inhibited"`
|
||||
|
||||
// A list of matchers to filter alerts by
|
||||
// in: query
|
||||
// required: false
|
||||
Matchers []string `json:"matchers"`
|
||||
|
||||
// A list of receivers to filter alerts by
|
||||
// in: query
|
||||
// required: false
|
||||
Receivers []string `json:"receivers"`
|
||||
}
|
||||
|
||||
// swagger:parameters RoutePostAlertingConfig
|
||||
type BodyAlertingConfig struct {
|
||||
// in:body
|
||||
Body UserConfig
|
||||
}
|
||||
|
||||
// swagger:model
|
||||
type UserConfig struct {
|
||||
TemplateFiles map[string]string `yaml:"template_files" json:"template_files"`
|
||||
AlertmanagerConfig ApiAlertingConfig `yaml:"alertmanager_config" json:"alertmanager_config"`
|
||||
}
|
||||
|
||||
// swagger:model
|
||||
type AlertingConfigResponse struct {
|
||||
BodyAlertingConfig
|
||||
}
|
||||
|
||||
type ApiAlertingConfig struct {
|
||||
config.Config
|
||||
|
||||
// Override with our superset receiver type
|
||||
Receivers []*ApiReceiver `yaml:"receivers,omitempty" json:"receivers,omitempty"`
|
||||
}
|
||||
|
||||
type GrafanaReceiver models.CreateAlertNotificationCommand
|
||||
|
||||
type ApiReceiver struct {
|
||||
config.Receiver
|
||||
GrafanaManagedReceivers []*GrafanaReceiver `yaml:"grafana_managed_receiver_configs,omitempty" json:"grafana_managed_receiver_configs,omitempty"`
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
// swagger:route GET /api/v1/namespace/{Namespace}/permissions permissions RouteGetNamespacePermissions
|
||||
//
|
||||
// sets an Alerting config
|
||||
//
|
||||
// Responses:
|
||||
// 200: Permissions
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route POST /api/v1/namespace/{Namespace}/permissions permissions RouteSetNamespacePermissions
|
||||
//
|
||||
// gets an Alerting config
|
||||
//
|
||||
// Responses:
|
||||
// 201: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/api/dtos"
|
||||
)
|
||||
|
||||
// swagger:model
|
||||
type Permissions []dtos.UpdateDashboardAclCommand
|
||||
|
||||
// swagger:parameters RouteGetNamespacePermissions
|
||||
type GetNamespacePermsEndpointParams struct {
|
||||
// Namespace name
|
||||
// in: path
|
||||
Namespace string
|
||||
}
|
||||
|
||||
// swagger:parameters RouteSetNamespacePermissions
|
||||
type SetNamespacePermsEndpointParams struct {
|
||||
// Namespace name to apply perms to
|
||||
// in: path
|
||||
Namespace string
|
||||
|
||||
// New namespace permissions
|
||||
// in: body
|
||||
Body Permissions
|
||||
}
|
||||
+2
-2
@@ -6,14 +6,14 @@ import (
|
||||
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
|
||||
)
|
||||
|
||||
// swagger:route GET /api/v1/status/rules RuleStatus RouteGetRuleStatuses
|
||||
// swagger:route GET /api/v1/status/rules prometheus RouteGetRuleStatuses
|
||||
//
|
||||
// gets the evaluation statuses of all rules
|
||||
//
|
||||
// Responses:
|
||||
// 200: RuleResponse
|
||||
|
||||
// swagger:route GET /api/v1/status/alerts RuleStatus RouteGetAlertStatuses
|
||||
// swagger:route GET /api/v1/status/alerts prometheus RouteGetAlertStatuses
|
||||
//
|
||||
// gets the current alerts
|
||||
//
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/prometheus/alertmanager/config"
|
||||
)
|
||||
|
||||
// swagger:route POST /api/v1/alerts AlertingConfig RoutePostAlertingConfig
|
||||
//
|
||||
// sets an Alerting config
|
||||
//
|
||||
// Responses:
|
||||
// 201: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route GET /api/v1/alerts AlertingConfig RouteGetAlertingConfig
|
||||
//
|
||||
// gets an Alerting config
|
||||
//
|
||||
// Responses:
|
||||
// 200: AlertingConfigResponse
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:route DELETE /api/v1/alerts AlertingConfig RouteDeleteAlertingConfig
|
||||
//
|
||||
// deletes the Alerting config for a tenant
|
||||
//
|
||||
// Responses:
|
||||
// 200: Ack
|
||||
// 400: ValidationError
|
||||
|
||||
// swagger:parameters RoutePostAlertingConfig
|
||||
type BodyAlertingConfig struct {
|
||||
// in:body
|
||||
Body AlertingConfig
|
||||
}
|
||||
|
||||
// swagger:model
|
||||
type AlertingConfigResponse struct {
|
||||
BodyAlertingConfig
|
||||
}
|
||||
|
||||
// swagger:model
|
||||
type AlertingConfig struct {
|
||||
config.Config
|
||||
|
||||
// Override with our superset receiver type
|
||||
Receivers []*Receiver `yaml:"receivers,omitempty" json:"receivers,omitempty"`
|
||||
}
|
||||
|
||||
type GrafanaReceiver models.CreateAlertNotificationCommand
|
||||
|
||||
type Receiver struct {
|
||||
config.Receiver
|
||||
GrafanaManagedReceivers []*GrafanaReceiver
|
||||
}
|
||||
Reference in new issue
Block a user