provisioning

package
v0.0.0-...-e3efe30 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVersionConflict = errutil.Conflict("alerting.notifications.conflict")

	ErrTimeIntervalNotFound                     = errutil.NotFound("alerting.notifications.time-intervals.notFound")
	ErrTimeIntervalExists                       = errutil.BadRequest("alerting.notifications.time-intervals.nameExists", errutil.WithPublicMessage("Time interval with this name already exists. Use a different name or update existing one."))
	ErrTimeIntervalInvalid                      = errutil.BadRequest("alerting.notifications.time-intervals.invalidFormat").MustTemplate("Invalid format of the submitted time interval", errutil.WithPublic("Time interval is in invalid format. Correct the payload and try again."))
	ErrTimeIntervalInUse                        = errutil.Conflict("alerting.notifications.time-intervals.used").MustTemplate("Time interval is used")
	ErrTimeIntervalDependentResourcesProvenance = errutil.Conflict("alerting.notifications.time-intervals.usedProvisioned").MustTemplate(
		"Time interval cannot be renamed because it is used by provisioned {{ if .Public.UsedByRules }}alert rules{{ end }}{{ if .Public.UsedByRoutes }}{{ if .Public.UsedByRules }} and {{ end }}notification policies{{ end }}",
		errutil.WithPublic(`Time interval cannot be renamed because it is used by provisioned {{ if .Public.UsedByRules }}alert rules{{ end }}{{ if .Public.UsedByRoutes }}{{ if .Public.UsedByRules }} and {{ end }}notification policies{{ end }}. You must update those resources first using the original provision method.`),
	)

	ErrTemplateNotFound = errutil.NotFound("alerting.notifications.templates.notFound")
	ErrTemplateInvalid  = errutil.BadRequest("alerting.notifications.templates.invalidFormat").MustTemplate("Invalid format of the submitted template", errutil.WithPublic("Template is in invalid format. Correct the payload and try again."))
	ErrTemplateExists   = errutil.BadRequest("alerting.notifications.templates.nameExists", errutil.WithPublicMessage("Template file with this name already exists. Use a different name or update existing one."))

	ErrContactPointReferenced = errutil.Conflict("alerting.notifications.contact-points.referenced", errutil.WithPublicMessage("Contact point is currently referenced by a notification policy."))
	ErrContactPointUsedInRule = errutil.Conflict("alerting.notifications.contact-points.used-by-rule", errutil.WithPublicMessage("Contact point is currently used in the notification settings of one or many alert rules."))

	ErrContactPointUidExists = errutil.Conflict("alerting.notifications.contact-points.uidInUse").MustTemplate(
		contactPointUidExists, errutil.WithPublic(contactPointUidExists),
	)

	ErrRouteInvalidFormat = errutil.BadRequest("alerting.notifications.routes.invalidFormat").MustTemplate(
		"Invalid format of the submitted route.",
		errutil.WithPublic("Invalid format of the submitted route: {{.Public.Error}}. Correct the payload and try again."),
	)

	ErrRouteConflictingMatchers = errutil.BadRequest("alerting.notifications.routes.conflictingMatchers").MustTemplate("Routing tree conflicts with the external configuration",
		errutil.WithPublic("Cannot add\\update route: matchers conflict with an external routing tree merging matchers {{ .Public.Matchers }}, making the added\\updated route unreachable."),
	)
)
View Source
var ErrNotFound = fmt.Errorf("object not found")
View Source
var ErrValidation = fmt.Errorf("invalid object specification")

Functions

func GrafanaIntegrationConfigToEmbeddedContactPoint

func GrafanaIntegrationConfigToEmbeddedContactPoint(r *models.Integration, provenance models.Provenance) definitions.EmbeddedContactPoint

func MakeErrContactPointUidExists

func MakeErrContactPointUidExists(uid, name string) error

func MakeErrRouteConflictingMatchers

func MakeErrRouteConflictingMatchers(matchers string) error

func MakeErrRouteInvalidFormat

func MakeErrRouteInvalidFormat(err error) error

func MakeErrTemplateInvalid

func MakeErrTemplateInvalid(err error) error

MakeErrTimeIntervalInvalid creates an error with the ErrTimeIntervalInvalid template

func MakeErrTimeIntervalDependentResourcesProvenance

func MakeErrTimeIntervalDependentResourcesProvenance(usedByRoutes bool, rules []models.AlertRuleKey) error

func MakeErrTimeIntervalInUse

func MakeErrTimeIntervalInUse(usedByRoutes bool, rules []models.AlertRuleKey) error

func MakeErrTimeIntervalInvalid

func MakeErrTimeIntervalInvalid(err error) error

MakeErrTimeIntervalInvalid creates an error with the ErrTimeIntervalInvalid template

func PostableGrafanaReceiverToEmbeddedContactPoint

func PostableGrafanaReceiverToEmbeddedContactPoint(contactPoint *definitions.PostableGrafanaReceiver, provenance models.Provenance, decryptValue func(string) string) (definitions.EmbeddedContactPoint, error)

func RemoveSecretsForContactPoint

func RemoveSecretsForContactPoint(e *apimodels.EmbeddedContactPoint) (map[string]string, error)

RemoveSecretsForContactPoint removes all secrets from the contact point's settings and returns them as a map. Returns error if contact point type is not known.

Types

type AlertRuleNotificationSettingsStore

type AlertRuleNotificationSettingsStore interface {
	RenameReceiverInNotificationSettings(ctx context.Context, orgID int64, oldReceiver, newReceiver string, validateProvenance func(models.Provenance) bool, dryRun bool) ([]models.AlertRuleKey, []models.AlertRuleKey, error)
	RenameTimeIntervalInNotificationSettings(ctx context.Context, orgID int64, oldTimeInterval, newTimeInterval string, validateProvenance func(models.Provenance) bool, dryRun bool) ([]models.AlertRuleKey, []models.AlertRuleKey, error)
	ListNotificationSettings(ctx context.Context, q models.ListNotificationSettingsQuery) (map[models.AlertRuleKey][]models.NotificationSettings, error)
}

type AlertRuleService

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

func NewAlertRuleService

func NewAlertRuleService(ruleStore RuleStore,
	provenanceStore ProvisioningStore,
	folderService folder.Service,
	quotas QuotaChecker,
	xact TransactionManager,
	defaultIntervalSeconds int64,
	baseIntervalSeconds int64,
	rulesPerRuleGroupLimit int64,
	log log.Logger,
	ns NotificationSettingsValidatorProvider,
	authz RuleAccessControlService,
) *AlertRuleService

func (*AlertRuleService) CreateAlertRule

func (service *AlertRuleService) CreateAlertRule(ctx context.Context, user identity.Requester, rule models.AlertRule, provenance models.Provenance) (models.AlertRule, error)

CreateAlertRule creates a new alert rule. This function will ignore any interval that is set in the rule struct and use the already existing group interval or the default one.

func (*AlertRuleService) DeleteAlertRule

func (service *AlertRuleService) DeleteAlertRule(ctx context.Context, user identity.Requester, ruleUID string, provenance models.Provenance) error

func (*AlertRuleService) DeleteRuleGroup

func (service *AlertRuleService) DeleteRuleGroup(ctx context.Context, user identity.Requester, namespaceUID, group string, provenance models.Provenance) error

func (*AlertRuleService) DeleteRuleGroups

func (service *AlertRuleService) DeleteRuleGroups(ctx context.Context, user identity.Requester, provenance models.Provenance, filterOpts *FilterOptions) error

DeleteRuleGroups deletes alert rule groups by the specified filter options.

func (*AlertRuleService) GetAlertGroupsWithFolderFullpath

func (service *AlertRuleService) GetAlertGroupsWithFolderFullpath(ctx context.Context, user identity.Requester, filterOpts *FilterOptions) ([]models.AlertRuleGroupWithFolderFullpath, error)

It queries all alert rules for the user's organization, applies optional filtering specified in filterOpts, and groups the rules by groups. The function then fetches folder details (including the full path) for each namespace (folder UID) associated with the rule groups. If the user lacks blanket read permissions, only the groups that the user is authorized to view are returned.

func (*AlertRuleService) GetAlertRule

func (service *AlertRuleService) GetAlertRule(ctx context.Context, user identity.Requester, ruleUID string) (models.AlertRule, models.Provenance, error)

func (*AlertRuleService) GetAlertRuleGroupWithFolderFullpath

func (service *AlertRuleService) GetAlertRuleGroupWithFolderFullpath(ctx context.Context, user identity.Requester, namespaceUID, group string) (models.AlertRuleGroupWithFolderFullpath, error)

GetAlertRuleGroupWithFolderFullpath returns the alert rule group with folder title.

func (*AlertRuleService) GetAlertRuleWithFolderFullpath

func (service *AlertRuleService) GetAlertRuleWithFolderFullpath(ctx context.Context, user identity.Requester, ruleUID string) (AlertRuleWithFolderFullpath, error)

GetAlertRuleWithFolderFullpath returns a single alert rule with its folder title.

func (*AlertRuleService) GetAlertRules

func (service *AlertRuleService) GetAlertRules(ctx context.Context, user identity.Requester) ([]*models.AlertRule, map[string]models.Provenance, error)

func (*AlertRuleService) GetRuleGroup

func (service *AlertRuleService) GetRuleGroup(ctx context.Context, user identity.Requester, namespaceUID, group string) (models.AlertRuleGroup, error)

func (*AlertRuleService) ListAlertRules

func (service *AlertRuleService) ListAlertRules(ctx context.Context, user identity.Requester, opts ListAlertRulesOptions) (rules []*models.AlertRule, provenances map[string]models.Provenance, nextToken string, err error)

func (*AlertRuleService) ReplaceRuleGroup

func (service *AlertRuleService) ReplaceRuleGroup(ctx context.Context, user identity.Requester, group models.AlertRuleGroup, provenance models.Provenance) error

func (*AlertRuleService) ReplaceRuleGroups

func (service *AlertRuleService) ReplaceRuleGroups(ctx context.Context, user identity.Requester, groups []*models.AlertRuleGroup, provenance models.Provenance) error

func (*AlertRuleService) UpdateAlertRule

func (service *AlertRuleService) UpdateAlertRule(ctx context.Context, user identity.Requester, rule models.AlertRule, provenance models.Provenance) (models.AlertRule, error)

UpdateAlertRule updates an alert rule.

func (*AlertRuleService) UpdateRuleGroup

func (service *AlertRuleService) UpdateRuleGroup(ctx context.Context, user identity.Requester, namespaceUID string, ruleGroup string, intervalSeconds int64) error

UpdateRuleGroup will update the interval for all rules in the group.

type AlertRuleWithFolderFullpath

type AlertRuleWithFolderFullpath struct {
	AlertRule      models.AlertRule
	FolderFullpath string
}

type ContactPointQuery

type ContactPointQuery struct {
	// Optionally filter by name.
	Name  string
	OrgID int64
	// Optionally decrypt secure settings, requires OrgAdmin.
	Decrypt bool
}

type ContactPointService

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

func NewContactPointService

func NewContactPointService(
	store alertmanagerConfigStore,
	encryptionService secrets.Service,
	provenanceStore ProvisioningStore,
	xact TransactionManager,
	receiverService receiverService,
	log log.Logger,
	nsStore AlertRuleNotificationSettingsStore,
	resourcePermissions ac.ReceiverPermissionsService,
) *ContactPointService

func (*ContactPointService) CreateContactPoint

func (ecp *ContactPointService) CreateContactPoint(
	ctx context.Context,
	orgID int64,
	user identity.Requester,
	contactPoint apimodels.EmbeddedContactPoint,
	provenance models.Provenance,
) (apimodels.EmbeddedContactPoint, error)

func (*ContactPointService) DeleteContactPoint

func (ecp *ContactPointService) DeleteContactPoint(ctx context.Context, orgID int64, uid string) error

func (*ContactPointService) GetContactPoints

GetContactPoints returns contact points. If q.Decrypt is true and the user is an OrgAdmin, decrypted secure settings are included instead of redacted ones.

func (*ContactPointService) UpdateContactPoint

func (ecp *ContactPointService) UpdateContactPoint(ctx context.Context, orgID int64, contactPoint apimodels.EmbeddedContactPoint, provenance models.Provenance) error

type FilterOptions

type FilterOptions struct {
	HasPrometheusRuleDefinition *bool
	RuleGroups                  []string
	NamespaceUIDs               []string
}

FilterOptions provides filtering for alert rule queries. All fields are optional and will be applied as filters if provided.

type ListAlertRulesOptions

type ListAlertRulesOptions struct {
	RuleType      models.RuleTypeFilter
	Limit         int64
	ContinueToken string
}

type MockProvisioningStore

type MockProvisioningStore struct {
	mock.Mock
}

MockProvisioningStore is an autogenerated mock type for the ProvisioningStore type

func NewMockProvisioningStore

func NewMockProvisioningStore(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockProvisioningStore

NewMockProvisioningStore creates a new instance of MockProvisioningStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockProvisioningStore) DeleteProvenance

func (_m *MockProvisioningStore) DeleteProvenance(ctx context.Context, o models.Provisionable, org int64) error

DeleteProvenance provides a mock function with given fields: ctx, o, org

func (*MockProvisioningStore) EXPECT

func (*MockProvisioningStore) GetProvenance

GetProvenance provides a mock function with given fields: ctx, o, org

func (*MockProvisioningStore) GetProvenances

func (_m *MockProvisioningStore) GetProvenances(ctx context.Context, org int64, resourceType string) (map[string]models.Provenance, error)

GetProvenances provides a mock function with given fields: ctx, org, resourceType

func (*MockProvisioningStore) SetProvenance

SetProvenance provides a mock function with given fields: ctx, o, org, p

type MockProvisioningStore_DeleteProvenance_Call

type MockProvisioningStore_DeleteProvenance_Call struct {
	*mock.Call
}

MockProvisioningStore_DeleteProvenance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteProvenance'

func (*MockProvisioningStore_DeleteProvenance_Call) Return

func (*MockProvisioningStore_DeleteProvenance_Call) Run

func (*MockProvisioningStore_DeleteProvenance_Call) RunAndReturn

type MockProvisioningStore_Expecter

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

func (*MockProvisioningStore_Expecter) DeleteProvenance

func (_e *MockProvisioningStore_Expecter) DeleteProvenance(ctx interface{}, o interface{}, org interface{}) *MockProvisioningStore_DeleteProvenance_Call

DeleteProvenance is a helper method to define mock.On call

  • ctx context.Context
  • o models.Provisionable
  • org int64

func (*MockProvisioningStore_Expecter) GetProvenance

func (_e *MockProvisioningStore_Expecter) GetProvenance(ctx interface{}, o interface{}, org interface{}) *MockProvisioningStore_GetProvenance_Call

GetProvenance is a helper method to define mock.On call

  • ctx context.Context
  • o models.Provisionable
  • org int64

func (*MockProvisioningStore_Expecter) GetProvenances

func (_e *MockProvisioningStore_Expecter) GetProvenances(ctx interface{}, org interface{}, resourceType interface{}) *MockProvisioningStore_GetProvenances_Call

GetProvenances is a helper method to define mock.On call

  • ctx context.Context
  • org int64
  • resourceType string

func (*MockProvisioningStore_Expecter) GetReturns

func (*MockProvisioningStore_Expecter) SaveSucceeds

func (*MockProvisioningStore_Expecter) SetProvenance

func (_e *MockProvisioningStore_Expecter) SetProvenance(ctx interface{}, o interface{}, org interface{}, p interface{}) *MockProvisioningStore_SetProvenance_Call

SetProvenance is a helper method to define mock.On call

  • ctx context.Context
  • o models.Provisionable
  • org int64
  • p models.Provenance

type MockProvisioningStore_GetProvenance_Call

type MockProvisioningStore_GetProvenance_Call struct {
	*mock.Call
}

MockProvisioningStore_GetProvenance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProvenance'

func (*MockProvisioningStore_GetProvenance_Call) Return

func (*MockProvisioningStore_GetProvenance_Call) Run

func (*MockProvisioningStore_GetProvenance_Call) RunAndReturn

type MockProvisioningStore_GetProvenances_Call

type MockProvisioningStore_GetProvenances_Call struct {
	*mock.Call
}

MockProvisioningStore_GetProvenances_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProvenances'

func (*MockProvisioningStore_GetProvenances_Call) Return

func (*MockProvisioningStore_GetProvenances_Call) Run

func (*MockProvisioningStore_GetProvenances_Call) RunAndReturn

type MockProvisioningStore_SetProvenance_Call

type MockProvisioningStore_SetProvenance_Call struct {
	*mock.Call
}

MockProvisioningStore_SetProvenance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetProvenance'

func (*MockProvisioningStore_SetProvenance_Call) Return

func (*MockProvisioningStore_SetProvenance_Call) Run

type MockQuotaChecker

type MockQuotaChecker struct {
	mock.Mock
}

MockQuotaChecker is an autogenerated mock type for the QuotaChecker type

func NewMockQuotaChecker

func NewMockQuotaChecker(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockQuotaChecker

NewMockQuotaChecker creates a new instance of MockQuotaChecker. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockQuotaChecker) CheckQuotaReached

func (_m *MockQuotaChecker) CheckQuotaReached(ctx context.Context, target quota.TargetSrv, scopeParams *quota.ScopeParameters) (bool, error)

CheckQuotaReached provides a mock function with given fields: ctx, target, scopeParams

func (*MockQuotaChecker) EXPECT

type MockQuotaChecker_CheckQuotaReached_Call

type MockQuotaChecker_CheckQuotaReached_Call struct {
	*mock.Call
}

MockQuotaChecker_CheckQuotaReached_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckQuotaReached'

func (*MockQuotaChecker_CheckQuotaReached_Call) Return

func (*MockQuotaChecker_CheckQuotaReached_Call) Run

func (*MockQuotaChecker_CheckQuotaReached_Call) RunAndReturn

type MockQuotaChecker_Expecter

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

func (*MockQuotaChecker_Expecter) CheckQuotaReached

func (_e *MockQuotaChecker_Expecter) CheckQuotaReached(ctx interface{}, target interface{}, scopeParams interface{}) *MockQuotaChecker_CheckQuotaReached_Call

CheckQuotaReached is a helper method to define mock.On call

  • ctx context.Context
  • target quota.TargetSrv
  • scopeParams *quota.ScopeParameters

func (*MockQuotaChecker_Expecter) LimitExceeded

func (*MockQuotaChecker_Expecter) LimitOK

type MuteTimingService

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

func NewMuteTimingService

func NewMuteTimingService(config alertmanagerConfigStore, prov ProvisioningStore, xact TransactionManager, log log.Logger, ns AlertRuleNotificationSettingsStore) *MuteTimingService

func (*MuteTimingService) CreateMuteTiming

CreateMuteTiming adds a new mute timing within the specified org. The created mute timing is returned.

func (*MuteTimingService) DeleteMuteTiming

func (svc *MuteTimingService) DeleteMuteTiming(ctx context.Context, nameOrUID string, orgID int64, provenance definitions.Provenance, version string) error

DeleteMuteTiming deletes the mute timing with the given name in the given org. If the mute timing does not exist, no error is returned.

func (*MuteTimingService) GetMuteTiming

func (svc *MuteTimingService) GetMuteTiming(ctx context.Context, nameOrUID string, orgID int64) (definitions.MuteTimeInterval, error)

GetMuteTiming returns a mute timing by name

func (*MuteTimingService) GetMuteTimings

func (svc *MuteTimingService) GetMuteTimings(ctx context.Context, orgID int64) ([]definitions.MuteTimeInterval, error)

GetMuteTimings returns a slice of all mute timings within the specified org.

func (*MuteTimingService) UpdateMuteTiming

UpdateMuteTiming replaces an existing mute timing within the specified org. The replaced mute timing is returned. If the mute timing does not exist, ErrMuteTimingsNotFound is returned.

type NopTransactionManager

type NopTransactionManager struct{}

func (*NopTransactionManager) InTransaction

func (n *NopTransactionManager) InTransaction(ctx context.Context, work func(ctx context.Context) error) error

type NotificationPolicyService

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

func NewNotificationPolicyService

func NewNotificationPolicyService(am alertmanagerConfigStore, prov ProvisioningStore,
	xact TransactionManager, settings setting.UnifiedAlertingSettings, log log.Logger) *NotificationPolicyService

func (*NotificationPolicyService) GetPolicyTree

func (nps *NotificationPolicyService) GetPolicyTree(ctx context.Context, orgID int64) (definitions.Route, string, error)

func (*NotificationPolicyService) ResetPolicyTree

func (nps *NotificationPolicyService) ResetPolicyTree(ctx context.Context, orgID int64, provenance models.Provenance) (definitions.Route, error)

func (*NotificationPolicyService) UpdatePolicyTree

func (nps *NotificationPolicyService) UpdatePolicyTree(ctx context.Context, orgID int64, tree definitions.Route, p models.Provenance, version string) (definitions.Route, string, error)

type NotificationSettingsValidatorProvider

type NotificationSettingsValidatorProvider interface {
	Validator(ctx context.Context, orgID int64) (notifier.NotificationSettingsValidator, error)
}

type NotificationSettingsValidatorProviderFake

type NotificationSettingsValidatorProviderFake struct {
}

func (*NotificationSettingsValidatorProviderFake) Validator

type ProvisioningStore

type ProvisioningStore interface {
	GetProvenance(ctx context.Context, o models.Provisionable, org int64) (models.Provenance, error)
	GetProvenances(ctx context.Context, org int64, resourceType string) (map[string]models.Provenance, error)
	SetProvenance(ctx context.Context, o models.Provisionable, org int64, p models.Provenance) error
	DeleteProvenance(ctx context.Context, o models.Provisionable, org int64) error
}

ProvisioningStore is a store of provisioning data for arbitrary objects.

type QuotaChecker

type QuotaChecker interface {
	CheckQuotaReached(ctx context.Context, target quota.TargetSrv, scopeParams *quota.ScopeParameters) (bool, error)
}

QuotaChecker represents the ability to evaluate whether quotas are met.

type RuleAccessControlService

type RuleAccessControlService interface {
	HasAccess(ctx context.Context, user identity.Requester, evaluator ac.Evaluator) (bool, error)
	AuthorizeAccessToRuleGroup(ctx context.Context, user identity.Requester, rules models.RulesGroup) error
	AuthorizeAccessInFolder(ctx context.Context, user identity.Requester, namespaced models.Namespaced) error
	AuthorizeRuleChanges(ctx context.Context, user identity.Requester, change *store.GroupDelta) error
	HasAccessInFolder(ctx context.Context, user identity.Requester, folder models.Namespaced) (bool, error)
}

type RuleStore

type RuleStore interface {
	GetAlertRuleByUID(ctx context.Context, query *models.GetAlertRuleByUIDQuery) (*models.AlertRule, error)
	ListAlertRules(ctx context.Context, query *models.ListAlertRulesQuery) (models.RulesGroup, error)
	ListAlertRulesPaginated(ctx context.Context, query *models.ListAlertRulesExtendedQuery) (models.RulesGroup, string, error)
	GetRuleGroupInterval(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string) (int64, error)
	InsertAlertRules(ctx context.Context, user *models.UserUID, rule []models.AlertRule) ([]models.AlertRuleKeyWithId, error)
	UpdateAlertRules(ctx context.Context, user *models.UserUID, rule []models.UpdateRule) error
	DeleteAlertRulesByUID(ctx context.Context, orgID int64, user *models.UserUID, permanently bool, ruleUID ...string) error
	GetAlertRulesGroupByRuleUID(ctx context.Context, query *models.GetAlertRulesGroupByRuleUIDQuery) ([]*models.AlertRule, error)
}

RuleStore represents the ability to persist and query alert rules.

type TemplateService

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

func NewTemplateService

func NewTemplateService(config alertmanagerConfigStore, prov ProvisioningStore, xact TransactionManager, log log.Logger) *TemplateService

func (*TemplateService) CreateTemplate

func (*TemplateService) DeleteTemplate

func (t *TemplateService) DeleteTemplate(ctx context.Context, orgID int64, nameOrUid string, provenance definitions.Provenance, version string) error

func (*TemplateService) GetTemplate

func (t *TemplateService) GetTemplate(ctx context.Context, orgID int64, nameOrUid string) (definitions.NotificationTemplate, error)

func (*TemplateService) GetTemplates

func (t *TemplateService) GetTemplates(ctx context.Context, orgID int64) ([]definitions.NotificationTemplate, error)

func (*TemplateService) UpdateTemplate

func (*TemplateService) UpsertTemplate

type TransactionManager

type TransactionManager interface {
	InTransaction(ctx context.Context, work func(ctx context.Context) error) error
}

TransactionManager represents the ability to issue and close transactions through contexts.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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