api

package
v0.0.0-kmdagger1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2023 License: AGPL-3.0 Imports: 59 Imported by: 0

Documentation

Overview

Package api contains base API implementation of unified alerting

*
*Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*
*Do not manually edit these files, please find ngalert/api/swagger-codegen/ for commands on how to generate them.

Package api contains base API implementation of unified alerting

*
*Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*
*Do not manually edit these files, please find ngalert/api/swagger-codegen/ for commands on how to generate them.

Package api contains base API implementation of unified alerting

*
*Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*
*Do not manually edit these files, please find ngalert/api/swagger-codegen/ for commands on how to generate them.

Package api contains base API implementation of unified alerting

*
*Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*
*Do not manually edit these files, please find ngalert/api/swagger-codegen/ for commands on how to generate them.

Package api contains base API implementation of unified alerting

*
*Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*
*Do not manually edit these files, please find ngalert/api/swagger-codegen/ for commands on how to generate them.

Package api contains base API implementation of unified alerting

*
*Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*
*Do not manually edit these files, please find ngalert/api/swagger-codegen/ for commands on how to generate them.

Package api contains base API implementation of unified alerting

*
*Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*
*Do not manually edit these files, please find ngalert/api/swagger-codegen/ for commands on how to generate them.

Index

Constants

View Source
const (
	Prometheus = "prometheus"
	Cortex     = "cortex"
	Mimir      = "mimir"
)
View Source
const (
	PrometheusDatasourceType = "prometheus"
	LokiDatasourceType       = "loki"
)

Variables

View Source
var (
	ErrAuthorization = errors.New("user is not authorized")
)

Functions

func AlertQueriesFromApiAlertQueries

func AlertQueriesFromApiAlertQueries(queries []definitions.AlertQuery) []models.AlertQuery

AlertQueriesFromApiAlertQueries converts a collection of definitions.AlertQuery to collection of models.AlertQuery

func AlertQueryExportFromAlertQuery

func AlertQueryExportFromAlertQuery(query models.AlertQuery) (definitions.AlertQueryExport, error)

AlertQueryExportFromAlertQuery creates a definitions.AlertQueryExport DTO from models.AlertQuery.

func AlertRuleExportFromAlertRule

func AlertRuleExportFromAlertRule(rule models.AlertRule) (definitions.AlertRuleExport, error)

AlertRuleExportFromAlertRule creates a definitions.AlertRuleExport DTO from models.AlertRule.

func AlertRuleFromProvisionedAlertRule

func AlertRuleFromProvisionedAlertRule(a definitions.ProvisionedAlertRule) (models.AlertRule, error)

AlertRuleFromProvisionedAlertRule converts definitions.ProvisionedAlertRule to models.AlertRule

func AlertRuleGroupExportFromAlertRuleGroupWithFolderTitle

func AlertRuleGroupExportFromAlertRuleGroupWithFolderTitle(d models.AlertRuleGroupWithFolderTitle) (definitions.AlertRuleGroupExport, error)

AlertRuleGroupExportFromAlertRuleGroupWithFolderTitle creates a definitions.AlertRuleGroupExport DTO from models.AlertRuleGroup.

func AlertRuleGroupFromApiAlertRuleGroup

func AlertRuleGroupFromApiAlertRuleGroup(a definitions.AlertRuleGroup) (models.AlertRuleGroup, error)

func AlertingFileExportFromAlertRuleGroupWithFolderTitle

func AlertingFileExportFromAlertRuleGroupWithFolderTitle(groups []models.AlertRuleGroupWithFolderTitle) (definitions.AlertingFileExport, error)

AlertingFileExportFromAlertRuleGroupWithFolderTitle creates an definitions.AlertingFileExport DTO from []models.AlertRuleGroupWithFolderTitle.

func ApiAlertQueriesFromAlertQueries

func ApiAlertQueriesFromAlertQueries(queries []models.AlertQuery) []definitions.AlertQuery

ApiAlertQueriesFromAlertQueries converts a collection of models.AlertQuery to collection of definitions.AlertQuery

func ApiAlertRuleGroupFromAlertRuleGroup

func ApiAlertRuleGroupFromAlertRuleGroup(d models.AlertRuleGroup) definitions.AlertRuleGroup

func ErrResp

func ErrResp(status int, err error, msg string, args ...interface{}) *response.NormalResponse

ErrorResp creates a response with a visible error

func NewFakeAlertInstanceManager

func NewFakeAlertInstanceManager(t *testing.T) *fakeAlertInstanceManager

func ProvisionedAlertRuleFromAlertRule

func ProvisionedAlertRuleFromAlertRule(rule models.AlertRule, provenance models.Provenance) definitions.ProvisionedAlertRule

ProvisionedAlertRuleFromAlertRule converts models.AlertRule to definitions.ProvisionedAlertRule and sets provided provenance status

func ProvisionedAlertRuleFromAlertRules

func ProvisionedAlertRuleFromAlertRules(rules []*models.AlertRule) definitions.ProvisionedAlertRules

ProvisionedAlertRuleFromAlertRules converts a collection of models.AlertRule to definitions.ProvisionedAlertRules with provenance status models.ProvenanceNone

func TimeFromMillis

func TimeFromMillis(ms int64) time.Time

TimeFromMillis Copied from https://github.com/grafana/mimir/blob/main/pkg/util/time.go as it doesn't seem worth it to import Mimir. TimeFromMillis is a helper to turn milliseconds -> time.Time

Types

type API

type API struct {
	Cfg                  *setting.Cfg
	DatasourceCache      datasources.CacheService
	DatasourceService    datasources.DataSourceService
	RouteRegister        routing.RouteRegister
	QuotaService         quota.Service
	TransactionManager   provisioning.TransactionManager
	ProvenanceStore      provisioning.ProvisioningStore
	RuleStore            RuleStore
	AlertingStore        AlertingStore
	AdminConfigStore     store.AdminConfigurationStore
	DataProxy            *datasourceproxy.DataSourceProxyService
	MultiOrgAlertmanager *notifier.MultiOrgAlertmanager
	StateManager         *state.Manager
	AccessControl        accesscontrol.AccessControl
	Policies             *provisioning.NotificationPolicyService
	ContactPointService  *provisioning.ContactPointService
	Templates            *provisioning.TemplateService
	MuteTimings          *provisioning.MuteTimingService
	AlertRules           *provisioning.AlertRuleService
	AlertsRouter         *sender.AlertsRouter
	EvaluatorFactory     eval.EvaluatorFactory
	FeatureManager       featuremgmt.FeatureToggles
	Historian            Historian

	AppUrl *url.URL

	// Hooks can be used to replace API handlers for specific paths.
	Hooks *Hooks
}

API handlers.

func (*API) RegisterAPIEndpoints

func (api *API) RegisterAPIEndpoints(m *metrics.API)

RegisterAPIEndpoints registers API handlers

func (*API) RegisterAlertmanagerApiEndpoints

func (api *API) RegisterAlertmanagerApiEndpoints(srv AlertmanagerApi, m *metrics.API)

func (*API) RegisterConfigurationApiEndpoints

func (api *API) RegisterConfigurationApiEndpoints(srv ConfigurationApi, m *metrics.API)

func (*API) RegisterHistoryApiEndpoints

func (api *API) RegisterHistoryApiEndpoints(srv HistoryApi, m *metrics.API)

func (*API) RegisterPrometheusApiEndpoints

func (api *API) RegisterPrometheusApiEndpoints(srv PrometheusApi, m *metrics.API)

func (*API) RegisterProvisioningApiEndpoints

func (api *API) RegisterProvisioningApiEndpoints(srv ProvisioningApi, m *metrics.API)

func (*API) RegisterRulerApiEndpoints

func (api *API) RegisterRulerApiEndpoints(srv RulerApi, m *metrics.API)

func (*API) RegisterTestingApiEndpoints

func (api *API) RegisterTestingApiEndpoints(srv TestingApi, m *metrics.API)

func (*API) Usage

func (api *API) Usage(ctx context.Context, scopeParams *quota.ScopeParameters) (*quota.Map, error)

type AlertRuleService

type AlertRuleService interface {
	GetAlertRules(ctx context.Context, orgID int64) ([]*alerting_models.AlertRule, error)
	GetAlertRule(ctx context.Context, orgID int64, ruleUID string) (alerting_models.AlertRule, alerting_models.Provenance, error)
	CreateAlertRule(ctx context.Context, rule alerting_models.AlertRule, provenance alerting_models.Provenance, userID int64) (alerting_models.AlertRule, error)
	UpdateAlertRule(ctx context.Context, rule alerting_models.AlertRule, provenance alerting_models.Provenance) (alerting_models.AlertRule, error)
	DeleteAlertRule(ctx context.Context, orgID int64, ruleUID string, provenance alerting_models.Provenance) error
	GetRuleGroup(ctx context.Context, orgID int64, folder, group string) (alerting_models.AlertRuleGroup, error)
	ReplaceRuleGroup(ctx context.Context, orgID int64, group alerting_models.AlertRuleGroup, userID int64, provenance alerting_models.Provenance) error
	GetAlertRuleWithFolderTitle(ctx context.Context, orgID int64, ruleUID string) (provisioning.AlertRuleWithFolderTitle, error)
	GetAlertRuleGroupWithFolderTitle(ctx context.Context, orgID int64, folder, group string) (alerting_models.AlertRuleGroupWithFolderTitle, error)
	GetAlertGroupsWithFolderTitle(ctx context.Context, orgID int64) ([]alerting_models.AlertRuleGroupWithFolderTitle, error)
}

type AlertingProxy

type AlertingProxy struct {
	DataProxy *datasourceproxy.DataSourceProxyService
	// contains filtered or unexported fields
}

type AlertingStore

type AlertingStore interface {
	GetLatestAlertmanagerConfiguration(ctx context.Context, query *models.GetLatestAlertmanagerConfigurationQuery) (*models.AlertConfiguration, error)
}

type Alertmanager

type Alertmanager interface {
	// Configuration
	SaveAndApplyConfig(ctx context.Context, config *apimodels.PostableUserConfig) error
	SaveAndApplyDefaultConfig(ctx context.Context) error
	GetStatus() apimodels.GettableStatus

	// Silences
	CreateSilence(ps *apimodels.PostableSilence) (string, error)
	DeleteSilence(silenceID string) error
	GetSilence(silenceID string) (apimodels.GettableSilence, error)
	ListSilences(filter []string) (apimodels.GettableSilences, error)

	// Alerts
	GetAlerts(active, silenced, inhibited bool, filter []string, receiver string) (apimodels.GettableAlerts, error)
	GetAlertGroups(active, silenced, inhibited bool, filter []string, receiver string) (apimodels.AlertGroups, error)

	// Receivers
	GetReceivers(ctx context.Context) []apimodels.Receiver
	TestReceivers(ctx context.Context, c apimodels.TestReceiversConfigBodyParams) (*notifier.TestReceiversResult, error)
	TestTemplate(ctx context.Context, c apimodels.TestTemplatesConfigBodyParams) (*notifier.TestTemplatesResults, error)
}

type AlertmanagerApi

type AlertmanagerApi interface {
	RouteCreateGrafanaSilence(*contextmodel.ReqContext) response.Response
	RouteCreateSilence(*contextmodel.ReqContext) response.Response
	RouteDeleteAlertingConfig(*contextmodel.ReqContext) response.Response
	RouteDeleteGrafanaAlertingConfig(*contextmodel.ReqContext) response.Response
	RouteDeleteGrafanaSilence(*contextmodel.ReqContext) response.Response
	RouteDeleteSilence(*contextmodel.ReqContext) response.Response
	RouteGetAMAlertGroups(*contextmodel.ReqContext) response.Response
	RouteGetAMAlerts(*contextmodel.ReqContext) response.Response
	RouteGetAMStatus(*contextmodel.ReqContext) response.Response
	RouteGetAlertingConfig(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaAMAlertGroups(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaAMAlerts(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaAMStatus(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaAlertingConfig(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaAlertingConfigHistory(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaReceivers(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaSilence(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaSilences(*contextmodel.ReqContext) response.Response
	RouteGetSilence(*contextmodel.ReqContext) response.Response
	RouteGetSilences(*contextmodel.ReqContext) response.Response
	RoutePostAMAlerts(*contextmodel.ReqContext) response.Response
	RoutePostAlertingConfig(*contextmodel.ReqContext) response.Response
	RoutePostGrafanaAlertingConfig(*contextmodel.ReqContext) response.Response
	RoutePostGrafanaAlertingConfigHistoryActivate(*contextmodel.ReqContext) response.Response
	RoutePostTestGrafanaReceivers(*contextmodel.ReqContext) response.Response
	RoutePostTestGrafanaTemplates(*contextmodel.ReqContext) response.Response
}

type AlertmanagerApiHandler

type AlertmanagerApiHandler struct {
	AMSvc           *LotexAM
	GrafanaSvc      *AlertmanagerSrv
	DatasourceCache datasources.CacheService
}

func NewForkingAM

func NewForkingAM(datasourceCache datasources.CacheService, proxy *LotexAM, grafana *AlertmanagerSrv) *AlertmanagerApiHandler

NewForkingAM implements a set of routes that proxy to various Alertmanager-compatible backends.

func (*AlertmanagerApiHandler) RouteCreateGrafanaSilence

func (f *AlertmanagerApiHandler) RouteCreateGrafanaSilence(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteCreateSilence

func (f *AlertmanagerApiHandler) RouteCreateSilence(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteDeleteAlertingConfig

func (f *AlertmanagerApiHandler) RouteDeleteAlertingConfig(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteDeleteGrafanaAlertingConfig

func (f *AlertmanagerApiHandler) RouteDeleteGrafanaAlertingConfig(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteDeleteGrafanaSilence

func (f *AlertmanagerApiHandler) RouteDeleteGrafanaSilence(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteDeleteSilence

func (f *AlertmanagerApiHandler) RouteDeleteSilence(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetAMAlertGroups

func (f *AlertmanagerApiHandler) RouteGetAMAlertGroups(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetAMAlerts

func (*AlertmanagerApiHandler) RouteGetAMStatus

func (*AlertmanagerApiHandler) RouteGetAlertingConfig

func (f *AlertmanagerApiHandler) RouteGetAlertingConfig(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetGrafanaAMAlertGroups

func (f *AlertmanagerApiHandler) RouteGetGrafanaAMAlertGroups(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetGrafanaAMAlerts

func (f *AlertmanagerApiHandler) RouteGetGrafanaAMAlerts(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetGrafanaAMStatus

func (f *AlertmanagerApiHandler) RouteGetGrafanaAMStatus(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetGrafanaAlertingConfig

func (f *AlertmanagerApiHandler) RouteGetGrafanaAlertingConfig(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetGrafanaAlertingConfigHistory

func (f *AlertmanagerApiHandler) RouteGetGrafanaAlertingConfigHistory(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetGrafanaReceivers

func (f *AlertmanagerApiHandler) RouteGetGrafanaReceivers(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetGrafanaSilence

func (f *AlertmanagerApiHandler) RouteGetGrafanaSilence(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetGrafanaSilences

func (f *AlertmanagerApiHandler) RouteGetGrafanaSilences(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RouteGetSilence

func (*AlertmanagerApiHandler) RouteGetSilences

func (*AlertmanagerApiHandler) RoutePostAMAlerts

func (f *AlertmanagerApiHandler) RoutePostAMAlerts(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RoutePostAlertingConfig

func (f *AlertmanagerApiHandler) RoutePostAlertingConfig(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RoutePostGrafanaAlertingConfig

func (f *AlertmanagerApiHandler) RoutePostGrafanaAlertingConfig(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RoutePostGrafanaAlertingConfigHistoryActivate

func (f *AlertmanagerApiHandler) RoutePostGrafanaAlertingConfigHistoryActivate(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RoutePostTestGrafanaReceivers

func (f *AlertmanagerApiHandler) RoutePostTestGrafanaReceivers(ctx *contextmodel.ReqContext) response.Response

func (*AlertmanagerApiHandler) RoutePostTestGrafanaTemplates

func (f *AlertmanagerApiHandler) RoutePostTestGrafanaTemplates(ctx *contextmodel.ReqContext) response.Response

type AlertmanagerSrv

type AlertmanagerSrv struct {
	// contains filtered or unexported fields
}

func (AlertmanagerSrv) AlertmanagerFor

func (srv AlertmanagerSrv) AlertmanagerFor(orgID int64) (Alertmanager, *response.NormalResponse)

func (AlertmanagerSrv) RouteCreateSilence

func (srv AlertmanagerSrv) RouteCreateSilence(c *contextmodel.ReqContext, postableSilence apimodels.PostableSilence) response.Response

func (AlertmanagerSrv) RouteDeleteAlertingConfig

func (srv AlertmanagerSrv) RouteDeleteAlertingConfig(c *contextmodel.ReqContext) response.Response

func (AlertmanagerSrv) RouteDeleteSilence

func (srv AlertmanagerSrv) RouteDeleteSilence(c *contextmodel.ReqContext, silenceID string) response.Response

func (AlertmanagerSrv) RouteGetAMAlertGroups

func (srv AlertmanagerSrv) RouteGetAMAlertGroups(c *contextmodel.ReqContext) response.Response

func (AlertmanagerSrv) RouteGetAMAlerts

func (srv AlertmanagerSrv) RouteGetAMAlerts(c *contextmodel.ReqContext) response.Response

func (AlertmanagerSrv) RouteGetAMStatus

func (srv AlertmanagerSrv) RouteGetAMStatus(c *contextmodel.ReqContext) response.Response

func (AlertmanagerSrv) RouteGetAlertingConfig

func (srv AlertmanagerSrv) RouteGetAlertingConfig(c *contextmodel.ReqContext) response.Response

func (AlertmanagerSrv) RouteGetAlertingConfigHistory

func (srv AlertmanagerSrv) RouteGetAlertingConfigHistory(c *contextmodel.ReqContext) response.Response

func (AlertmanagerSrv) RouteGetReceivers

func (srv AlertmanagerSrv) RouteGetReceivers(c *contextmodel.ReqContext) response.Response

func (AlertmanagerSrv) RouteGetSilence

func (srv AlertmanagerSrv) RouteGetSilence(c *contextmodel.ReqContext, silenceID string) response.Response

func (AlertmanagerSrv) RouteGetSilences

func (srv AlertmanagerSrv) RouteGetSilences(c *contextmodel.ReqContext) response.Response

func (AlertmanagerSrv) RoutePostAlertingConfig

func (AlertmanagerSrv) RoutePostGrafanaAlertingConfigHistoryActivate

func (srv AlertmanagerSrv) RoutePostGrafanaAlertingConfigHistoryActivate(c *contextmodel.ReqContext, id string) response.Response

func (AlertmanagerSrv) RoutePostTestReceivers

func (AlertmanagerSrv) RoutePostTestTemplates

type ConditionValidator

type ConditionValidator interface {
	// Validate validates that the condition is correct. Returns nil if the condition is correct. Otherwise, error that describes the failure
	Validate(ctx eval.EvaluationContext, condition ngmodels.Condition) error
}

type ConfigSrv

type ConfigSrv struct {
	// contains filtered or unexported fields
}

func (ConfigSrv) RouteDeleteNGalertConfig

func (srv ConfigSrv) RouteDeleteNGalertConfig(c *contextmodel.ReqContext) response.Response

func (ConfigSrv) RouteGetAlertingStatus

func (srv ConfigSrv) RouteGetAlertingStatus(c *contextmodel.ReqContext) response.Response

func (ConfigSrv) RouteGetAlertmanagers

func (srv ConfigSrv) RouteGetAlertmanagers(c *contextmodel.ReqContext) response.Response

func (ConfigSrv) RouteGetNGalertConfig

func (srv ConfigSrv) RouteGetNGalertConfig(c *contextmodel.ReqContext) response.Response

func (ConfigSrv) RoutePostNGalertConfig

func (srv ConfigSrv) RoutePostNGalertConfig(c *contextmodel.ReqContext, body apimodels.PostableNGalertConfig) response.Response

type ConfigurationApi

type ConfigurationApi interface {
	RouteDeleteNGalertConfig(*contextmodel.ReqContext) response.Response
	RouteGetAlertmanagers(*contextmodel.ReqContext) response.Response
	RouteGetNGalertConfig(*contextmodel.ReqContext) response.Response
	RouteGetStatus(*contextmodel.ReqContext) response.Response
	RoutePostNGalertConfig(*contextmodel.ReqContext) response.Response
}

type ConfigurationApiHandler

type ConfigurationApiHandler struct {
	// contains filtered or unexported fields
}

ConfigurationApiHandler always forwards requests to grafana backend

func NewConfiguration

func NewConfiguration(grafana *ConfigSrv) *ConfigurationApiHandler

func (*ConfigurationApiHandler) RouteDeleteNGalertConfig

func (f *ConfigurationApiHandler) RouteDeleteNGalertConfig(ctx *contextmodel.ReqContext) response.Response

func (*ConfigurationApiHandler) RouteGetAlertmanagers

func (f *ConfigurationApiHandler) RouteGetAlertmanagers(ctx *contextmodel.ReqContext) response.Response

func (*ConfigurationApiHandler) RouteGetNGalertConfig

func (f *ConfigurationApiHandler) RouteGetNGalertConfig(ctx *contextmodel.ReqContext) response.Response

func (*ConfigurationApiHandler) RouteGetStatus

func (*ConfigurationApiHandler) RoutePostNGalertConfig

func (f *ConfigurationApiHandler) RoutePostNGalertConfig(ctx *contextmodel.ReqContext) response.Response

type ContactPointService

type ContactPointService interface {
	GetContactPoints(ctx context.Context, q provisioning.ContactPointQuery) ([]definitions.EmbeddedContactPoint, error)
	CreateContactPoint(ctx context.Context, orgID int64, contactPoint definitions.EmbeddedContactPoint, p alerting_models.Provenance) (definitions.EmbeddedContactPoint, error)
	UpdateContactPoint(ctx context.Context, orgID int64, contactPoint definitions.EmbeddedContactPoint, p alerting_models.Provenance) error
	DeleteContactPoint(ctx context.Context, orgID int64, uid string) error
}

type ExternalAlertmanagerProvider

type ExternalAlertmanagerProvider interface {
	AlertmanagersFor(orgID int64) []*url.URL
	DroppedAlertmanagersFor(orgID int64) []*url.URL
}

type Historian

type Historian interface {
	Query(ctx context.Context, query models.HistoryQuery) (*data.Frame, error)
}

type HistoryApi

type HistoryApi interface {
	RouteGetStateHistory(*contextmodel.ReqContext) response.Response
}

type HistoryApiHandler

type HistoryApiHandler struct {
	// contains filtered or unexported fields
}

func NewStateHistoryApi

func NewStateHistoryApi(svc *HistorySrv) *HistoryApiHandler

func (*HistoryApiHandler) RouteGetStateHistory

func (f *HistoryApiHandler) RouteGetStateHistory(ctx *contextmodel.ReqContext) response.Response

type HistorySrv

type HistorySrv struct {
	// contains filtered or unexported fields
}

func (*HistorySrv) RouteQueryStateHistory

func (srv *HistorySrv) RouteQueryStateHistory(c *contextmodel.ReqContext) response.Response

type Hooks

type Hooks struct {
	// contains filtered or unexported fields
}

func NewHooks

func NewHooks(logger log.Logger) *Hooks

NewHooks creates an empty set of request handler hooks. Hooks can be used to replace handlers for specific paths.

func (*Hooks) Set

func (h *Hooks) Set(path string, hook RequestHandlerFunc)

Add creates a new request hook for a path, causing requests to the path to be handled by the hook function, and not the original handler.

func (*Hooks) Wrap

Wrap returns a new handler which will intercept paths with hooks configured, and invoke the hooked in handler instead. If no hook is configured for a path, then the given handler is invoked.

type LotexAM

type LotexAM struct {
	*AlertingProxy
	// contains filtered or unexported fields
}

func NewLotexAM

func NewLotexAM(proxy *AlertingProxy, log log.Logger) *LotexAM

func (*LotexAM) RouteCreateSilence

func (am *LotexAM) RouteCreateSilence(ctx *contextmodel.ReqContext, silenceBody apimodels.PostableSilence) response.Response

func (*LotexAM) RouteDeleteAlertingConfig

func (am *LotexAM) RouteDeleteAlertingConfig(ctx *contextmodel.ReqContext) response.Response

func (*LotexAM) RouteDeleteSilence

func (am *LotexAM) RouteDeleteSilence(ctx *contextmodel.ReqContext, silenceID string) response.Response

func (*LotexAM) RouteGetAMAlertGroups

func (am *LotexAM) RouteGetAMAlertGroups(ctx *contextmodel.ReqContext) response.Response

func (*LotexAM) RouteGetAMAlerts

func (am *LotexAM) RouteGetAMAlerts(ctx *contextmodel.ReqContext) response.Response

func (*LotexAM) RouteGetAMStatus

func (am *LotexAM) RouteGetAMStatus(ctx *contextmodel.ReqContext) response.Response

func (*LotexAM) RouteGetAlertingConfig

func (am *LotexAM) RouteGetAlertingConfig(ctx *contextmodel.ReqContext) response.Response

func (*LotexAM) RouteGetSilence

func (am *LotexAM) RouteGetSilence(ctx *contextmodel.ReqContext, silenceID string) response.Response

func (*LotexAM) RouteGetSilences

func (am *LotexAM) RouteGetSilences(ctx *contextmodel.ReqContext) response.Response

func (*LotexAM) RoutePostAMAlerts

func (am *LotexAM) RoutePostAMAlerts(ctx *contextmodel.ReqContext, alerts apimodels.PostableAlerts) response.Response

func (*LotexAM) RoutePostAlertingConfig

func (am *LotexAM) RoutePostAlertingConfig(ctx *contextmodel.ReqContext, config apimodels.PostableUserConfig) response.Response

type LotexProm

type LotexProm struct {
	*AlertingProxy
	// contains filtered or unexported fields
}

func NewLotexProm

func NewLotexProm(proxy *AlertingProxy, log log.Logger) *LotexProm

func (*LotexProm) RouteGetAlertStatuses

func (p *LotexProm) RouteGetAlertStatuses(ctx *contextmodel.ReqContext) response.Response

func (*LotexProm) RouteGetRuleStatuses

func (p *LotexProm) RouteGetRuleStatuses(ctx *contextmodel.ReqContext) response.Response

type LotexRuler

type LotexRuler struct {
	*AlertingProxy
	// contains filtered or unexported fields
}

func NewLotexRuler

func NewLotexRuler(proxy *AlertingProxy, log log.Logger) *LotexRuler

func (*LotexRuler) RouteDeleteNamespaceRulesConfig

func (r *LotexRuler) RouteDeleteNamespaceRulesConfig(ctx *contextmodel.ReqContext, namespace string) response.Response

func (*LotexRuler) RouteDeleteRuleGroupConfig

func (r *LotexRuler) RouteDeleteRuleGroupConfig(ctx *contextmodel.ReqContext, namespace string, group string) response.Response

func (*LotexRuler) RouteGetNamespaceRulesConfig

func (r *LotexRuler) RouteGetNamespaceRulesConfig(ctx *contextmodel.ReqContext, namespace string) response.Response

func (*LotexRuler) RouteGetRulegGroupConfig

func (r *LotexRuler) RouteGetRulegGroupConfig(ctx *contextmodel.ReqContext, namespace string, group string) response.Response

func (*LotexRuler) RouteGetRulesConfig

func (r *LotexRuler) RouteGetRulesConfig(ctx *contextmodel.ReqContext) response.Response

func (*LotexRuler) RoutePostNameRulesConfig

func (r *LotexRuler) RoutePostNameRulesConfig(ctx *contextmodel.ReqContext, conf apimodels.PostableRuleGroupConfig, ns string) response.Response

type MuteTimingService

type MuteTimingService interface {
	GetMuteTimings(ctx context.Context, orgID int64) ([]definitions.MuteTimeInterval, error)
	CreateMuteTiming(ctx context.Context, mt definitions.MuteTimeInterval, orgID int64) (*definitions.MuteTimeInterval, error)
	UpdateMuteTiming(ctx context.Context, mt definitions.MuteTimeInterval, orgID int64) (*definitions.MuteTimeInterval, error)
	DeleteMuteTiming(ctx context.Context, name string, orgID int64) error
}

type NotificationPolicyService

type NotificationPolicyService interface {
	GetPolicyTree(ctx context.Context, orgID int64) (definitions.Route, error)
	UpdatePolicyTree(ctx context.Context, orgID int64, tree definitions.Route, p alerting_models.Provenance) error
	ResetPolicyTree(ctx context.Context, orgID int64) (definitions.Route, error)
}

type PrometheusApi

type PrometheusApi interface {
	RouteGetAlertStatuses(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaAlertStatuses(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaRuleStatuses(*contextmodel.ReqContext) response.Response
	RouteGetRuleStatuses(*contextmodel.ReqContext) response.Response
}

type PrometheusApiHandler

type PrometheusApiHandler struct {
	ProxySvc        *LotexProm
	GrafanaSvc      *PrometheusSrv
	DatasourceCache datasources.CacheService
}

func NewForkingProm

func NewForkingProm(datasourceCache datasources.CacheService, proxy *LotexProm, grafana *PrometheusSrv) *PrometheusApiHandler

NewForkingProm implements a set of routes that proxy to various Prometheus-compatible backends.

func (*PrometheusApiHandler) RouteGetAlertStatuses

func (f *PrometheusApiHandler) RouteGetAlertStatuses(ctx *contextmodel.ReqContext) response.Response

func (*PrometheusApiHandler) RouteGetGrafanaAlertStatuses

func (f *PrometheusApiHandler) RouteGetGrafanaAlertStatuses(ctx *contextmodel.ReqContext) response.Response

func (*PrometheusApiHandler) RouteGetGrafanaRuleStatuses

func (f *PrometheusApiHandler) RouteGetGrafanaRuleStatuses(ctx *contextmodel.ReqContext) response.Response

func (*PrometheusApiHandler) RouteGetRuleStatuses

func (f *PrometheusApiHandler) RouteGetRuleStatuses(ctx *contextmodel.ReqContext) response.Response

type PrometheusSrv

type PrometheusSrv struct {
	// contains filtered or unexported fields
}

func (PrometheusSrv) RouteGetAlertStatuses

func (srv PrometheusSrv) RouteGetAlertStatuses(c *contextmodel.ReqContext) response.Response

func (PrometheusSrv) RouteGetRuleStatuses

func (srv PrometheusSrv) RouteGetRuleStatuses(c *contextmodel.ReqContext) response.Response

type ProvisioningApi

type ProvisioningApi interface {
	RouteDeleteAlertRule(*contextmodel.ReqContext) response.Response
	RouteDeleteContactpoints(*contextmodel.ReqContext) response.Response
	RouteDeleteMuteTiming(*contextmodel.ReqContext) response.Response
	RouteDeleteTemplate(*contextmodel.ReqContext) response.Response
	RouteGetAlertRule(*contextmodel.ReqContext) response.Response
	RouteGetAlertRuleExport(*contextmodel.ReqContext) response.Response
	RouteGetAlertRuleGroup(*contextmodel.ReqContext) response.Response
	RouteGetAlertRuleGroupExport(*contextmodel.ReqContext) response.Response
	RouteGetAlertRules(*contextmodel.ReqContext) response.Response
	RouteGetAlertRulesExport(*contextmodel.ReqContext) response.Response
	RouteGetContactpoints(*contextmodel.ReqContext) response.Response
	RouteGetMuteTiming(*contextmodel.ReqContext) response.Response
	RouteGetMuteTimings(*contextmodel.ReqContext) response.Response
	RouteGetPolicyTree(*contextmodel.ReqContext) response.Response
	RouteGetTemplate(*contextmodel.ReqContext) response.Response
	RouteGetTemplates(*contextmodel.ReqContext) response.Response
	RoutePostAlertRule(*contextmodel.ReqContext) response.Response
	RoutePostContactpoints(*contextmodel.ReqContext) response.Response
	RoutePostMuteTiming(*contextmodel.ReqContext) response.Response
	RoutePutAlertRule(*contextmodel.ReqContext) response.Response
	RoutePutAlertRuleGroup(*contextmodel.ReqContext) response.Response
	RoutePutContactpoint(*contextmodel.ReqContext) response.Response
	RoutePutMuteTiming(*contextmodel.ReqContext) response.Response
	RoutePutPolicyTree(*contextmodel.ReqContext) response.Response
	RoutePutTemplate(*contextmodel.ReqContext) response.Response
	RouteResetPolicyTree(*contextmodel.ReqContext) response.Response
}

type ProvisioningApiHandler

type ProvisioningApiHandler struct {
	// contains filtered or unexported fields
}

func NewProvisioningApi

func NewProvisioningApi(svc *ProvisioningSrv) *ProvisioningApiHandler

func (*ProvisioningApiHandler) RouteDeleteAlertRule

func (f *ProvisioningApiHandler) RouteDeleteAlertRule(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteDeleteContactpoints

func (f *ProvisioningApiHandler) RouteDeleteContactpoints(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteDeleteMuteTiming

func (f *ProvisioningApiHandler) RouteDeleteMuteTiming(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteDeleteTemplate

func (f *ProvisioningApiHandler) RouteDeleteTemplate(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetAlertRule

func (f *ProvisioningApiHandler) RouteGetAlertRule(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetAlertRuleExport

func (f *ProvisioningApiHandler) RouteGetAlertRuleExport(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetAlertRuleGroup

func (f *ProvisioningApiHandler) RouteGetAlertRuleGroup(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetAlertRuleGroupExport

func (f *ProvisioningApiHandler) RouteGetAlertRuleGroupExport(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetAlertRules

func (f *ProvisioningApiHandler) RouteGetAlertRules(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetAlertRulesExport

func (f *ProvisioningApiHandler) RouteGetAlertRulesExport(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetContactpoints

func (f *ProvisioningApiHandler) RouteGetContactpoints(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetMuteTiming

func (f *ProvisioningApiHandler) RouteGetMuteTiming(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetMuteTimings

func (f *ProvisioningApiHandler) RouteGetMuteTimings(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetPolicyTree

func (f *ProvisioningApiHandler) RouteGetPolicyTree(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RouteGetTemplate

func (*ProvisioningApiHandler) RouteGetTemplates

func (f *ProvisioningApiHandler) RouteGetTemplates(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RoutePostAlertRule

func (f *ProvisioningApiHandler) RoutePostAlertRule(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RoutePostContactpoints

func (f *ProvisioningApiHandler) RoutePostContactpoints(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RoutePostMuteTiming

func (f *ProvisioningApiHandler) RoutePostMuteTiming(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RoutePutAlertRule

func (f *ProvisioningApiHandler) RoutePutAlertRule(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RoutePutAlertRuleGroup

func (f *ProvisioningApiHandler) RoutePutAlertRuleGroup(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RoutePutContactpoint

func (f *ProvisioningApiHandler) RoutePutContactpoint(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RoutePutMuteTiming

func (f *ProvisioningApiHandler) RoutePutMuteTiming(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RoutePutPolicyTree

func (f *ProvisioningApiHandler) RoutePutPolicyTree(ctx *contextmodel.ReqContext) response.Response

func (*ProvisioningApiHandler) RoutePutTemplate

func (*ProvisioningApiHandler) RouteResetPolicyTree

func (f *ProvisioningApiHandler) RouteResetPolicyTree(ctx *contextmodel.ReqContext) response.Response

type ProvisioningSrv

type ProvisioningSrv struct {
	// contains filtered or unexported fields
}

func (*ProvisioningSrv) RouteDeleteAlertRule

func (srv *ProvisioningSrv) RouteDeleteAlertRule(c *contextmodel.ReqContext, UID string) response.Response

func (*ProvisioningSrv) RouteDeleteContactPoint

func (srv *ProvisioningSrv) RouteDeleteContactPoint(c *contextmodel.ReqContext, UID string) response.Response

func (*ProvisioningSrv) RouteDeleteMuteTiming

func (srv *ProvisioningSrv) RouteDeleteMuteTiming(c *contextmodel.ReqContext, name string) response.Response

func (*ProvisioningSrv) RouteDeleteTemplate

func (srv *ProvisioningSrv) RouteDeleteTemplate(c *contextmodel.ReqContext, name string) response.Response

func (*ProvisioningSrv) RouteGetAlertRuleExport

func (srv *ProvisioningSrv) RouteGetAlertRuleExport(c *contextmodel.ReqContext, UID string) response.Response

RouteGetAlertRuleExport retrieves the given alert rule in a format compatible with file provisioning.

func (*ProvisioningSrv) RouteGetAlertRuleGroup

func (srv *ProvisioningSrv) RouteGetAlertRuleGroup(c *contextmodel.ReqContext, folder string, group string) response.Response

func (*ProvisioningSrv) RouteGetAlertRuleGroupExport

func (srv *ProvisioningSrv) RouteGetAlertRuleGroupExport(c *contextmodel.ReqContext, folder string, group string) response.Response

RouteGetAlertRuleGroupExport retrieves the given alert rule group in a format compatible with file provisioning.

func (*ProvisioningSrv) RouteGetAlertRules

func (srv *ProvisioningSrv) RouteGetAlertRules(c *contextmodel.ReqContext) response.Response

func (*ProvisioningSrv) RouteGetAlertRulesExport

func (srv *ProvisioningSrv) RouteGetAlertRulesExport(c *contextmodel.ReqContext) response.Response

RouteGetAlertRulesExport retrieves all alert rules in a format compatible with file provisioning.

func (*ProvisioningSrv) RouteGetContactPoints

func (srv *ProvisioningSrv) RouteGetContactPoints(c *contextmodel.ReqContext) response.Response

func (*ProvisioningSrv) RouteGetMuteTiming

func (srv *ProvisioningSrv) RouteGetMuteTiming(c *contextmodel.ReqContext, name string) response.Response

func (*ProvisioningSrv) RouteGetMuteTimings

func (srv *ProvisioningSrv) RouteGetMuteTimings(c *contextmodel.ReqContext) response.Response

func (*ProvisioningSrv) RouteGetPolicyTree

func (srv *ProvisioningSrv) RouteGetPolicyTree(c *contextmodel.ReqContext) response.Response

func (*ProvisioningSrv) RouteGetTemplate

func (srv *ProvisioningSrv) RouteGetTemplate(c *contextmodel.ReqContext, name string) response.Response

func (*ProvisioningSrv) RouteGetTemplates

func (srv *ProvisioningSrv) RouteGetTemplates(c *contextmodel.ReqContext) response.Response

func (*ProvisioningSrv) RoutePostAlertRule

func (*ProvisioningSrv) RoutePostContactPoint

func (*ProvisioningSrv) RoutePostMuteTiming

func (*ProvisioningSrv) RoutePutAlertRule

func (*ProvisioningSrv) RoutePutAlertRuleGroup

func (srv *ProvisioningSrv) RoutePutAlertRuleGroup(c *contextmodel.ReqContext, ag definitions.AlertRuleGroup, folderUID string, group string) response.Response

func (*ProvisioningSrv) RoutePutContactPoint

func (*ProvisioningSrv) RoutePutMuteTiming

func (*ProvisioningSrv) RoutePutPolicyTree

func (srv *ProvisioningSrv) RoutePutPolicyTree(c *contextmodel.ReqContext, tree definitions.Route) response.Response

func (*ProvisioningSrv) RoutePutTemplate

func (*ProvisioningSrv) RouteResetPolicyTree

func (srv *ProvisioningSrv) RouteResetPolicyTree(c *contextmodel.ReqContext) response.Response

func (*ProvisioningSrv) RouteRouteGetAlertRule

func (srv *ProvisioningSrv) RouteRouteGetAlertRule(c *contextmodel.ReqContext, UID string) response.Response

type RequestHandlerFunc

type RequestHandlerFunc func(*contextmodel.ReqContext) response.Response

type RuleStore

type RuleStore interface {
	GetUserVisibleNamespaces(context.Context, int64, *user.SignedInUser) (map[string]*folder.Folder, error)
	GetNamespaceByTitle(context.Context, string, int64, *user.SignedInUser) (*folder.Folder, error)
	GetAlertRulesGroupByRuleUID(ctx context.Context, query *ngmodels.GetAlertRulesGroupByRuleUIDQuery) ([]*ngmodels.AlertRule, error)
	ListAlertRules(ctx context.Context, query *ngmodels.ListAlertRulesQuery) (ngmodels.RulesGroup, error)

	// InsertAlertRules will insert all alert rules passed into the function
	// and return the map of uuid to id.
	InsertAlertRules(ctx context.Context, rule []ngmodels.AlertRule) (map[string]int64, error)
	UpdateAlertRules(ctx context.Context, rule []ngmodels.UpdateRule) error
	DeleteAlertRulesByUID(ctx context.Context, orgID int64, ruleUID ...string) error

	// IncreaseVersionForAllRulesInNamespace Increases version for all rules that have specified namespace. Returns all rules that belong to the namespace
	IncreaseVersionForAllRulesInNamespace(ctx context.Context, orgID int64, namespaceUID string) ([]ngmodels.AlertRuleKeyWithVersionAndPauseStatus, error)

	Count(ctx context.Context, orgID int64) (int64, error)
}

RuleStore is the interface for persisting alert rules and instances

type RulerApi

type RulerApi interface {
	RouteDeleteGrafanaRuleGroupConfig(*contextmodel.ReqContext) response.Response
	RouteDeleteNamespaceGrafanaRulesConfig(*contextmodel.ReqContext) response.Response
	RouteDeleteNamespaceRulesConfig(*contextmodel.ReqContext) response.Response
	RouteDeleteRuleGroupConfig(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaRuleGroupConfig(*contextmodel.ReqContext) response.Response
	RouteGetGrafanaRulesConfig(*contextmodel.ReqContext) response.Response
	RouteGetNamespaceGrafanaRulesConfig(*contextmodel.ReqContext) response.Response
	RouteGetNamespaceRulesConfig(*contextmodel.ReqContext) response.Response
	RouteGetRulegGroupConfig(*contextmodel.ReqContext) response.Response
	RouteGetRulesConfig(*contextmodel.ReqContext) response.Response
	RoutePostNameGrafanaRulesConfig(*contextmodel.ReqContext) response.Response
	RoutePostNameRulesConfig(*contextmodel.ReqContext) response.Response
}

type RulerApiHandler

type RulerApiHandler struct {
	LotexRuler      *LotexRuler
	GrafanaRuler    *RulerSrv
	DatasourceCache datasources.CacheService
}

RulerApiHandler will validate and proxy requests to the correct backend type depending on the datasource.

func NewForkingRuler

func NewForkingRuler(datasourceCache datasources.CacheService, lotex *LotexRuler, grafana *RulerSrv) *RulerApiHandler

func (*RulerApiHandler) RouteDeleteGrafanaRuleGroupConfig

func (f *RulerApiHandler) RouteDeleteGrafanaRuleGroupConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RouteDeleteNamespaceGrafanaRulesConfig

func (f *RulerApiHandler) RouteDeleteNamespaceGrafanaRulesConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RouteDeleteNamespaceRulesConfig

func (f *RulerApiHandler) RouteDeleteNamespaceRulesConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RouteDeleteRuleGroupConfig

func (f *RulerApiHandler) RouteDeleteRuleGroupConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RouteGetGrafanaRuleGroupConfig

func (f *RulerApiHandler) RouteGetGrafanaRuleGroupConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RouteGetGrafanaRulesConfig

func (f *RulerApiHandler) RouteGetGrafanaRulesConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RouteGetNamespaceGrafanaRulesConfig

func (f *RulerApiHandler) RouteGetNamespaceGrafanaRulesConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RouteGetNamespaceRulesConfig

func (f *RulerApiHandler) RouteGetNamespaceRulesConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RouteGetRulegGroupConfig

func (f *RulerApiHandler) RouteGetRulegGroupConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RouteGetRulesConfig

func (f *RulerApiHandler) RouteGetRulesConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RoutePostNameGrafanaRulesConfig

func (f *RulerApiHandler) RoutePostNameGrafanaRulesConfig(ctx *contextmodel.ReqContext) response.Response

func (*RulerApiHandler) RoutePostNameRulesConfig

func (f *RulerApiHandler) RoutePostNameRulesConfig(ctx *contextmodel.ReqContext) response.Response

type RulerSrv

type RulerSrv struct {
	QuotaService quota.Service
	// contains filtered or unexported fields
}

func (RulerSrv) RouteDeleteAlertRules

func (srv RulerSrv) RouteDeleteAlertRules(c *contextmodel.ReqContext, namespaceTitle string, group string) response.Response

RouteDeleteAlertRules deletes all alert rules the user is authorized to access in the given namespace or, if non-empty, a specific group of rules in the namespace. Returns http.StatusUnauthorized if user does not have access to any of the rules that match the filter. Returns http.StatusBadRequest if all rules that match the filter and the user is authorized to delete are provisioned.

func (RulerSrv) RouteGetNamespaceRulesConfig

func (srv RulerSrv) RouteGetNamespaceRulesConfig(c *contextmodel.ReqContext, namespaceTitle string) response.Response

RouteGetNamespaceRulesConfig returns all rules in a specific folder that user has access to

func (RulerSrv) RouteGetRulesConfig

func (srv RulerSrv) RouteGetRulesConfig(c *contextmodel.ReqContext) response.Response

RouteGetRulesConfig returns all alert rules that are available to the current user

func (RulerSrv) RouteGetRulesGroupConfig

func (srv RulerSrv) RouteGetRulesGroupConfig(c *contextmodel.ReqContext, namespaceTitle string, ruleGroup string) response.Response

RouteGetRulesGroupConfig returns rules that belong to a specific group in a specific namespace (folder). If user does not have access to at least one of the rule in the group, returns status 401 Unauthorized

func (RulerSrv) RoutePostNameRulesConfig

func (srv RulerSrv) RoutePostNameRulesConfig(c *contextmodel.ReqContext, ruleGroupConfig apimodels.PostableRuleGroupConfig, namespaceTitle string) response.Response

type TemplateService

type TemplateService interface {
	GetTemplates(ctx context.Context, orgID int64) (map[string]string, error)
	SetTemplate(ctx context.Context, orgID int64, tmpl definitions.NotificationTemplate) (definitions.NotificationTemplate, error)
	DeleteTemplate(ctx context.Context, orgID int64, name string) error
}

type TestingApi

type TestingApi interface {
	BacktestConfig(*contextmodel.ReqContext) response.Response
	RouteEvalQueries(*contextmodel.ReqContext) response.Response
	RouteTestRuleConfig(*contextmodel.ReqContext) response.Response
	RouteTestRuleGrafanaConfig(*contextmodel.ReqContext) response.Response
}

type TestingApiHandler

type TestingApiHandler struct {
	// contains filtered or unexported fields
}

TestingApiHandler always forwards requests to grafana backend

func NewTestingApi

func NewTestingApi(svc *TestingApiSrv) *TestingApiHandler

func (*TestingApiHandler) BacktestConfig

func (f *TestingApiHandler) BacktestConfig(ctx *contextmodel.ReqContext) response.Response

func (*TestingApiHandler) RouteEvalQueries

func (f *TestingApiHandler) RouteEvalQueries(ctx *contextmodel.ReqContext) response.Response

func (*TestingApiHandler) RouteTestRuleConfig

func (f *TestingApiHandler) RouteTestRuleConfig(ctx *contextmodel.ReqContext) response.Response

func (*TestingApiHandler) RouteTestRuleGrafanaConfig

func (f *TestingApiHandler) RouteTestRuleGrafanaConfig(ctx *contextmodel.ReqContext) response.Response

type TestingApiSrv

type TestingApiSrv struct {
	*AlertingProxy
	DatasourceCache datasources.CacheService
	// contains filtered or unexported fields
}

func (TestingApiSrv) BacktestAlertRule

func (TestingApiSrv) RouteEvalQueries

func (TestingApiSrv) RouteTestGrafanaRuleConfig

func (srv TestingApiSrv) RouteTestGrafanaRuleConfig(c *contextmodel.ReqContext, body apimodels.TestRulePayload) response.Response

func (TestingApiSrv) RouteTestRuleConfig

func (srv TestingApiSrv) RouteTestRuleConfig(c *contextmodel.ReqContext, body apimodels.TestRulePayload, datasourceUID string) response.Response

type UnknownReceiverError

type UnknownReceiverError struct {
	UID string
}

func (UnknownReceiverError) Error

func (e UnknownReceiverError) Error() string

Directories

Path Synopsis
tooling
definitions
Grafana Alerting API.
Grafana Alerting API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL