Documentation ¶
Index ¶
- Variables
- func EmbeddedContactPointToGrafanaIntegrationConfig(e definitions.EmbeddedContactPoint) (alertingNotify.GrafanaIntegrationConfig, error)
- func GettableGrafanaReceiverToEmbeddedContactPoint(r *definitions.GettableGrafanaReceiver) (definitions.EmbeddedContactPoint, error)
- func MakeErrProvenanceChangeNotAllowed(from, to models.Provenance) error
- func MakeErrTimeIntervalInvalid(err error) error
- func PersistConfig(ctx context.Context, store AMConfigStore, ...) error
- func PostableGrafanaReceiverToEmbeddedContactPoint(contactPoint *definitions.PostableGrafanaReceiver, ...) (definitions.EmbeddedContactPoint, error)
- func RemoveSecretsForContactPoint(e *apimodels.EmbeddedContactPoint) (map[string]string, error)
- func ValidateContactPoint(ctx context.Context, e apimodels.EmbeddedContactPoint, ...) error
- func ValidateProvenanceRelaxed(from, to models.Provenance) error
- type AMConfigStore
- type AlertRuleNotificationSettingsStore
- type AlertRuleService
- func (service *AlertRuleService) CreateAlertRule(ctx context.Context, user identity.Requester, rule models.AlertRule, ...) (models.AlertRule, error)
- func (service *AlertRuleService) DeleteAlertRule(ctx context.Context, user identity.Requester, ruleUID string, ...) error
- func (service *AlertRuleService) DeleteRuleGroup(ctx context.Context, user identity.Requester, namespaceUID, group string, ...) error
- func (service *AlertRuleService) GetAlertGroupsWithFolderFullpath(ctx context.Context, user identity.Requester, folderUIDs []string) ([]models.AlertRuleGroupWithFolderFullpath, error)
- func (service *AlertRuleService) GetAlertRule(ctx context.Context, user identity.Requester, ruleUID string) (models.AlertRule, models.Provenance, error)
- func (service *AlertRuleService) GetAlertRuleGroupWithFolderFullpath(ctx context.Context, user identity.Requester, namespaceUID, group string) (models.AlertRuleGroupWithFolderFullpath, error)
- func (service *AlertRuleService) GetAlertRuleWithFolderFullpath(ctx context.Context, user identity.Requester, ruleUID string) (AlertRuleWithFolderFullpath, error)
- func (service *AlertRuleService) GetAlertRules(ctx context.Context, user identity.Requester) ([]*models.AlertRule, map[string]models.Provenance, error)
- func (service *AlertRuleService) GetRuleGroup(ctx context.Context, user identity.Requester, namespaceUID, group string) (models.AlertRuleGroup, error)
- func (service *AlertRuleService) ReplaceRuleGroup(ctx context.Context, user identity.Requester, group models.AlertRuleGroup, ...) error
- func (service *AlertRuleService) UpdateAlertRule(ctx context.Context, user identity.Requester, rule models.AlertRule, ...) (models.AlertRule, error)
- func (service *AlertRuleService) UpdateRuleGroup(ctx context.Context, user identity.Requester, namespaceUID string, ...) error
- type AlertRuleWithFolderFullpath
- type ContactPointQuery
- type ContactPointService
- func (ecp *ContactPointService) CreateContactPoint(ctx context.Context, orgID int64, contactPoint apimodels.EmbeddedContactPoint, ...) (apimodels.EmbeddedContactPoint, error)
- func (ecp *ContactPointService) DeleteContactPoint(ctx context.Context, orgID int64, uid string) error
- func (ecp *ContactPointService) GetContactPoints(ctx context.Context, q ContactPointQuery, u identity.Requester) ([]apimodels.EmbeddedContactPoint, error)
- func (ecp *ContactPointService) UpdateContactPoint(ctx context.Context, orgID int64, contactPoint apimodels.EmbeddedContactPoint, ...) error
- type MockAMConfigStore
- func (_m *MockAMConfigStore) EXPECT() *MockAMConfigStore_Expecter
- func (_m *MockAMConfigStore) GetLatestAlertmanagerConfiguration(ctx context.Context, orgID int64) (*models.AlertConfiguration, error)
- func (_m *MockAMConfigStore) UpdateAlertmanagerConfiguration(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd) error
- type MockAMConfigStore_Expecter
- func (_e *MockAMConfigStore_Expecter) GetLatestAlertmanagerConfiguration(ctx interface{}, orgID interface{}) *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call
- func (m *MockAMConfigStore_Expecter) GetsConfig(ac models.AlertConfiguration) *MockAMConfigStore_Expecter
- func (m *MockAMConfigStore_Expecter) SaveSucceeds() *MockAMConfigStore_Expecter
- func (m *MockAMConfigStore_Expecter) SaveSucceedsIntercept(intercepted *models.SaveAlertmanagerConfigurationCmd) *MockAMConfigStore_Expecter
- func (_e *MockAMConfigStore_Expecter) UpdateAlertmanagerConfiguration(ctx interface{}, cmd interface{}) *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call
- type MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call
- func (_c *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call) Return(_a0 *models.AlertConfiguration, _a1 error) *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call
- func (_c *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call) Run(run func(ctx context.Context, orgID int64)) *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call
- func (_c *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call) RunAndReturn(run func(context.Context, int64) (*models.AlertConfiguration, error)) *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call
- type MockAMConfigStore_UpdateAlertmanagerConfiguration_Call
- func (_c *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call) Return(_a0 error) *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call
- func (_c *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call) Run(run func(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd)) *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call
- func (_c *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call) RunAndReturn(run func(context.Context, *models.SaveAlertmanagerConfigurationCmd) error) *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call
- type MockProvisioningStore
- func (_m *MockProvisioningStore) DeleteProvenance(ctx context.Context, o models.Provisionable, org int64) error
- func (_m *MockProvisioningStore) EXPECT() *MockProvisioningStore_Expecter
- func (_m *MockProvisioningStore) GetProvenance(ctx context.Context, o models.Provisionable, org int64) (models.Provenance, error)
- func (_m *MockProvisioningStore) GetProvenances(ctx context.Context, org int64, resourceType string) (map[string]models.Provenance, error)
- func (_m *MockProvisioningStore) SetProvenance(ctx context.Context, o models.Provisionable, org int64, p models.Provenance) error
- type MockProvisioningStore_DeleteProvenance_Call
- func (_c *MockProvisioningStore_DeleteProvenance_Call) Return(_a0 error) *MockProvisioningStore_DeleteProvenance_Call
- func (_c *MockProvisioningStore_DeleteProvenance_Call) Run(run func(ctx context.Context, o models.Provisionable, org int64)) *MockProvisioningStore_DeleteProvenance_Call
- func (_c *MockProvisioningStore_DeleteProvenance_Call) RunAndReturn(run func(context.Context, models.Provisionable, int64) error) *MockProvisioningStore_DeleteProvenance_Call
- type MockProvisioningStore_Expecter
- func (_e *MockProvisioningStore_Expecter) DeleteProvenance(ctx interface{}, o interface{}, org interface{}) *MockProvisioningStore_DeleteProvenance_Call
- func (_e *MockProvisioningStore_Expecter) GetProvenance(ctx interface{}, o interface{}, org interface{}) *MockProvisioningStore_GetProvenance_Call
- func (_e *MockProvisioningStore_Expecter) GetProvenances(ctx interface{}, org interface{}, resourceType interface{}) *MockProvisioningStore_GetProvenances_Call
- func (m *MockProvisioningStore_Expecter) GetReturns(p models.Provenance) *MockProvisioningStore_Expecter
- func (m *MockProvisioningStore_Expecter) SaveSucceeds() *MockProvisioningStore_Expecter
- func (_e *MockProvisioningStore_Expecter) SetProvenance(ctx interface{}, o interface{}, org interface{}, p interface{}) *MockProvisioningStore_SetProvenance_Call
- type MockProvisioningStore_GetProvenance_Call
- func (_c *MockProvisioningStore_GetProvenance_Call) Return(_a0 models.Provenance, _a1 error) *MockProvisioningStore_GetProvenance_Call
- func (_c *MockProvisioningStore_GetProvenance_Call) Run(run func(ctx context.Context, o models.Provisionable, org int64)) *MockProvisioningStore_GetProvenance_Call
- func (_c *MockProvisioningStore_GetProvenance_Call) RunAndReturn(...) *MockProvisioningStore_GetProvenance_Call
- type MockProvisioningStore_GetProvenances_Call
- func (_c *MockProvisioningStore_GetProvenances_Call) Return(_a0 map[string]models.Provenance, _a1 error) *MockProvisioningStore_GetProvenances_Call
- func (_c *MockProvisioningStore_GetProvenances_Call) Run(run func(ctx context.Context, org int64, resourceType string)) *MockProvisioningStore_GetProvenances_Call
- func (_c *MockProvisioningStore_GetProvenances_Call) RunAndReturn(run func(context.Context, int64, string) (map[string]models.Provenance, error)) *MockProvisioningStore_GetProvenances_Call
- type MockProvisioningStore_SetProvenance_Call
- func (_c *MockProvisioningStore_SetProvenance_Call) Return(_a0 error) *MockProvisioningStore_SetProvenance_Call
- func (_c *MockProvisioningStore_SetProvenance_Call) Run(...) *MockProvisioningStore_SetProvenance_Call
- func (_c *MockProvisioningStore_SetProvenance_Call) RunAndReturn(...) *MockProvisioningStore_SetProvenance_Call
- type MockQuotaChecker
- type MockQuotaChecker_CheckQuotaReached_Call
- func (_c *MockQuotaChecker_CheckQuotaReached_Call) Return(_a0 bool, _a1 error) *MockQuotaChecker_CheckQuotaReached_Call
- func (_c *MockQuotaChecker_CheckQuotaReached_Call) Run(run func(ctx context.Context, target quota.TargetSrv, ...)) *MockQuotaChecker_CheckQuotaReached_Call
- func (_c *MockQuotaChecker_CheckQuotaReached_Call) RunAndReturn(...) *MockQuotaChecker_CheckQuotaReached_Call
- type MockQuotaChecker_Expecter
- func (_e *MockQuotaChecker_Expecter) CheckQuotaReached(ctx interface{}, target interface{}, scopeParams interface{}) *MockQuotaChecker_CheckQuotaReached_Call
- func (m *MockQuotaChecker_Expecter) LimitExceeded() *MockQuotaChecker_Expecter
- func (m *MockQuotaChecker_Expecter) LimitOK() *MockQuotaChecker_Expecter
- type MuteTimingService
- func (svc *MuteTimingService) CreateMuteTiming(ctx context.Context, mt definitions.MuteTimeInterval, orgID int64) (definitions.MuteTimeInterval, error)
- func (svc *MuteTimingService) DeleteMuteTiming(ctx context.Context, name string, orgID int64, ...) error
- func (svc *MuteTimingService) GetMuteTiming(ctx context.Context, name string, orgID int64) (definitions.MuteTimeInterval, error)
- func (svc *MuteTimingService) GetMuteTimings(ctx context.Context, orgID int64) ([]definitions.MuteTimeInterval, error)
- func (svc *MuteTimingService) UpdateMuteTiming(ctx context.Context, mt definitions.MuteTimeInterval, orgID int64) (definitions.MuteTimeInterval, error)
- type NopTransactionManager
- type NotificationPolicyService
- func (nps *NotificationPolicyService) GetAMConfigStore() AMConfigStore
- func (nps *NotificationPolicyService) GetPolicyTree(ctx context.Context, orgID int64) (definitions.Route, error)
- func (nps *NotificationPolicyService) ResetPolicyTree(ctx context.Context, orgID int64) (definitions.Route, error)
- func (nps *NotificationPolicyService) UpdatePolicyTree(ctx context.Context, orgID int64, tree definitions.Route, p models.Provenance) error
- type NotificationSettingsValidatorProvider
- type NotificationSettingsValidatorProviderFake
- type ProvenanceStatusTransitionValidator
- type ProvisioningStore
- type QuotaChecker
- type RuleAccessControlService
- type RuleStore
- type TemplateService
- func (t *TemplateService) DeleteTemplate(ctx context.Context, orgID int64, name string) error
- func (t *TemplateService) GetTemplates(ctx context.Context, orgID int64) ([]definitions.NotificationTemplate, error)
- func (t *TemplateService) SetTemplate(ctx context.Context, orgID int64, tmpl definitions.NotificationTemplate) (definitions.NotificationTemplate, error)
- type TransactionManager
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoAlertmanagerConfiguration = errutil.Internal("alerting.notification.configMissing", errutil.WithPublicMessage("No alertmanager configuration present in this organization")) ErrBadAlertmanagerConfiguration = errutil.Internal("alerting.notification.configCorrupted").MustTemplate("Failed to unmarshal the Alertmanager configuration", errutil.WithPublic("Current Alertmanager configuration in the storage is corrupted. Reset the configuration or rollback to a recent valid one.")) ErrProvenanceChangeNotAllowed = errutil.Forbidden("alerting.notifications.invalidProvenance").MustTemplate( "Resource with provenance status '{{ .Public.CurrentProvenance }}' cannot be managed via API that handles resources with provenance status '{{ .Public.TargetProvenance }}'", errutil.WithPublic("Resource with provenance status '{{ .Public.CurrentProvenance }}' cannot be managed via API that handles resources with provenance status '{{ .Public.TargetProvenance }}'. You must use appropriate API to manage this resource"), ) 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", errutil.WithPublicMessage("Time interval is used by one or many notification policies")) ErrContactPointReferenced = errutil.BadRequest("alerting.notifications.contact-points.referenced", errutil.WithPublicMessage("Contact point is currently referenced by a notification policy.")) )
var ErrNotFound = fmt.Errorf("object not found")
var ErrPermissionDenied = errors.New("permission denied")
var ErrValidation = fmt.Errorf("invalid object specification")
Functions ¶
func EmbeddedContactPointToGrafanaIntegrationConfig ¶
func EmbeddedContactPointToGrafanaIntegrationConfig(e definitions.EmbeddedContactPoint) (alertingNotify.GrafanaIntegrationConfig, error)
func GettableGrafanaReceiverToEmbeddedContactPoint ¶
func GettableGrafanaReceiverToEmbeddedContactPoint(r *definitions.GettableGrafanaReceiver) (definitions.EmbeddedContactPoint, error)
func MakeErrProvenanceChangeNotAllowed ¶
func MakeErrProvenanceChangeNotAllowed(from, to models.Provenance) error
func MakeErrTimeIntervalInvalid ¶
MakeErrTimeIntervalInvalid creates an error with the ErrTimeIntervalInvalid template
func PersistConfig ¶
func PersistConfig(ctx context.Context, store AMConfigStore, cmd *models.SaveAlertmanagerConfigurationCmd) error
PersistConfig validates to config before eventually persisting it if no error occurs
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.
func ValidateContactPoint ¶
func ValidateContactPoint(ctx context.Context, e apimodels.EmbeddedContactPoint, decryptFunc alertingNotify.GetDecryptedValueFn) error
func ValidateProvenanceRelaxed ¶
func ValidateProvenanceRelaxed(from, to models.Provenance) error
ValidateProvenanceRelaxed checks if the transition of provenance status from `from` to `to` is allowed. Applies relaxed checks that prevents only transition from any status to `none`. Returns ErrProvenanceChangeNotAllowed if transition is not allowed
Types ¶
type AMConfigStore ¶
type AMConfigStore interface { GetLatestAlertmanagerConfiguration(ctx context.Context, orgID int64) (*models.AlertConfiguration, error) UpdateAlertmanagerConfiguration(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd) error }
AMStore is a store of Alertmanager configurations.
type AlertRuleNotificationSettingsStore ¶
type AlertRuleNotificationSettingsStore interface { RenameReceiverInNotificationSettings(ctx context.Context, orgID int64, oldReceiver, newReceiver string) (int, 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) GetAlertGroupsWithFolderFullpath ¶
func (service *AlertRuleService) GetAlertGroupsWithFolderFullpath(ctx context.Context, user identity.Requester, folderUIDs []string) ([]models.AlertRuleGroupWithFolderFullpath, error)
GetAlertGroupsWithFolderFullpath returns all groups with folder's full path in the folders identified by folderUID that have at least one alert. If argument folderUIDs is nil or empty - returns groups in all folders.
func (*AlertRuleService) GetAlertRule ¶
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 (*AlertRuleService) GetRuleGroup ¶
func (service *AlertRuleService) GetRuleGroup(ctx context.Context, user identity.Requester, namespaceUID, group string) (models.AlertRuleGroup, error)
func (*AlertRuleService) ReplaceRuleGroup ¶
func (service *AlertRuleService) ReplaceRuleGroup(ctx context.Context, user identity.Requester, group 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.
type ContactPointQuery ¶
type ContactPointService ¶
type ContactPointService struct {
// contains filtered or unexported fields
}
func NewContactPointService ¶
func NewContactPointService(store AMConfigStore, encryptionService secrets.Service, provenanceStore ProvisioningStore, xact TransactionManager, receiverService receiverService, log log.Logger, nsStore AlertRuleNotificationSettingsStore) *ContactPointService
func (*ContactPointService) CreateContactPoint ¶
func (ecp *ContactPointService) CreateContactPoint(ctx context.Context, orgID int64, contactPoint apimodels.EmbeddedContactPoint, provenance models.Provenance) (apimodels.EmbeddedContactPoint, error)
func (*ContactPointService) DeleteContactPoint ¶
func (*ContactPointService) GetContactPoints ¶
func (ecp *ContactPointService) GetContactPoints(ctx context.Context, q ContactPointQuery, u identity.Requester) ([]apimodels.EmbeddedContactPoint, error)
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 MockAMConfigStore ¶
MockAMConfigStore is an autogenerated mock type for the AMConfigStore type
func NewMockAMConfigStore ¶
func NewMockAMConfigStore(t interface { mock.TestingT Cleanup(func()) }) *MockAMConfigStore
NewMockAMConfigStore creates a new instance of MockAMConfigStore. 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 (*MockAMConfigStore) EXPECT ¶
func (_m *MockAMConfigStore) EXPECT() *MockAMConfigStore_Expecter
func (*MockAMConfigStore) GetLatestAlertmanagerConfiguration ¶
func (_m *MockAMConfigStore) GetLatestAlertmanagerConfiguration(ctx context.Context, orgID int64) (*models.AlertConfiguration, error)
GetLatestAlertmanagerConfiguration provides a mock function with given fields: ctx, orgID
func (*MockAMConfigStore) UpdateAlertmanagerConfiguration ¶
func (_m *MockAMConfigStore) UpdateAlertmanagerConfiguration(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd) error
UpdateAlertmanagerConfiguration provides a mock function with given fields: ctx, cmd
type MockAMConfigStore_Expecter ¶
type MockAMConfigStore_Expecter struct {
// contains filtered or unexported fields
}
func (*MockAMConfigStore_Expecter) GetLatestAlertmanagerConfiguration ¶
func (_e *MockAMConfigStore_Expecter) GetLatestAlertmanagerConfiguration(ctx interface{}, orgID interface{}) *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call
GetLatestAlertmanagerConfiguration is a helper method to define mock.On call
- ctx context.Context
- orgID int64
func (*MockAMConfigStore_Expecter) GetsConfig ¶
func (m *MockAMConfigStore_Expecter) GetsConfig(ac models.AlertConfiguration) *MockAMConfigStore_Expecter
func (*MockAMConfigStore_Expecter) SaveSucceeds ¶
func (m *MockAMConfigStore_Expecter) SaveSucceeds() *MockAMConfigStore_Expecter
func (*MockAMConfigStore_Expecter) SaveSucceedsIntercept ¶
func (m *MockAMConfigStore_Expecter) SaveSucceedsIntercept(intercepted *models.SaveAlertmanagerConfigurationCmd) *MockAMConfigStore_Expecter
func (*MockAMConfigStore_Expecter) UpdateAlertmanagerConfiguration ¶
func (_e *MockAMConfigStore_Expecter) UpdateAlertmanagerConfiguration(ctx interface{}, cmd interface{}) *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call
UpdateAlertmanagerConfiguration is a helper method to define mock.On call
- ctx context.Context
- cmd *models.SaveAlertmanagerConfigurationCmd
type MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call ¶
MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestAlertmanagerConfiguration'
func (*MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call) Run ¶
func (_c *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call) Run(run func(ctx context.Context, orgID int64)) *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call
func (*MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call) RunAndReturn ¶
func (_c *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call) RunAndReturn(run func(context.Context, int64) (*models.AlertConfiguration, error)) *MockAMConfigStore_GetLatestAlertmanagerConfiguration_Call
type MockAMConfigStore_UpdateAlertmanagerConfiguration_Call ¶
MockAMConfigStore_UpdateAlertmanagerConfiguration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAlertmanagerConfiguration'
func (*MockAMConfigStore_UpdateAlertmanagerConfiguration_Call) Run ¶
func (_c *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call) Run(run func(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd)) *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call
func (*MockAMConfigStore_UpdateAlertmanagerConfiguration_Call) RunAndReturn ¶
func (_c *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call) RunAndReturn(run func(context.Context, *models.SaveAlertmanagerConfigurationCmd) error) *MockAMConfigStore_UpdateAlertmanagerConfiguration_Call
type MockProvisioningStore ¶
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 (_m *MockProvisioningStore) EXPECT() *MockProvisioningStore_Expecter
func (*MockProvisioningStore) GetProvenance ¶
func (_m *MockProvisioningStore) GetProvenance(ctx context.Context, o models.Provisionable, org int64) (models.Provenance, error)
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 ¶
func (_m *MockProvisioningStore) SetProvenance(ctx context.Context, o models.Provisionable, org int64, p models.Provenance) error
SetProvenance provides a mock function with given fields: ctx, o, org, p
type MockProvisioningStore_DeleteProvenance_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 (_c *MockProvisioningStore_DeleteProvenance_Call) Return(_a0 error) *MockProvisioningStore_DeleteProvenance_Call
func (*MockProvisioningStore_DeleteProvenance_Call) Run ¶
func (_c *MockProvisioningStore_DeleteProvenance_Call) Run(run func(ctx context.Context, o models.Provisionable, org int64)) *MockProvisioningStore_DeleteProvenance_Call
func (*MockProvisioningStore_DeleteProvenance_Call) RunAndReturn ¶
func (_c *MockProvisioningStore_DeleteProvenance_Call) RunAndReturn(run func(context.Context, models.Provisionable, int64) error) *MockProvisioningStore_DeleteProvenance_Call
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 (m *MockProvisioningStore_Expecter) GetReturns(p models.Provenance) *MockProvisioningStore_Expecter
func (*MockProvisioningStore_Expecter) SaveSucceeds ¶
func (m *MockProvisioningStore_Expecter) SaveSucceeds() *MockProvisioningStore_Expecter
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 ¶
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 (_c *MockProvisioningStore_GetProvenance_Call) Return(_a0 models.Provenance, _a1 error) *MockProvisioningStore_GetProvenance_Call
func (*MockProvisioningStore_GetProvenance_Call) Run ¶
func (_c *MockProvisioningStore_GetProvenance_Call) Run(run func(ctx context.Context, o models.Provisionable, org int64)) *MockProvisioningStore_GetProvenance_Call
func (*MockProvisioningStore_GetProvenance_Call) RunAndReturn ¶
func (_c *MockProvisioningStore_GetProvenance_Call) RunAndReturn(run func(context.Context, models.Provisionable, int64) (models.Provenance, error)) *MockProvisioningStore_GetProvenance_Call
type MockProvisioningStore_GetProvenances_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 (_c *MockProvisioningStore_GetProvenances_Call) Return(_a0 map[string]models.Provenance, _a1 error) *MockProvisioningStore_GetProvenances_Call
func (*MockProvisioningStore_GetProvenances_Call) Run ¶
func (_c *MockProvisioningStore_GetProvenances_Call) Run(run func(ctx context.Context, org int64, resourceType string)) *MockProvisioningStore_GetProvenances_Call
func (*MockProvisioningStore_GetProvenances_Call) RunAndReturn ¶
func (_c *MockProvisioningStore_GetProvenances_Call) RunAndReturn(run func(context.Context, int64, string) (map[string]models.Provenance, error)) *MockProvisioningStore_GetProvenances_Call
type MockProvisioningStore_SetProvenance_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 (_c *MockProvisioningStore_SetProvenance_Call) Return(_a0 error) *MockProvisioningStore_SetProvenance_Call
func (*MockProvisioningStore_SetProvenance_Call) Run ¶
func (_c *MockProvisioningStore_SetProvenance_Call) Run(run func(ctx context.Context, o models.Provisionable, org int64, p models.Provenance)) *MockProvisioningStore_SetProvenance_Call
func (*MockProvisioningStore_SetProvenance_Call) RunAndReturn ¶
func (_c *MockProvisioningStore_SetProvenance_Call) RunAndReturn(run func(context.Context, models.Provisionable, int64, models.Provenance) error) *MockProvisioningStore_SetProvenance_Call
type MockQuotaChecker ¶
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 ¶
func (_m *MockQuotaChecker) EXPECT() *MockQuotaChecker_Expecter
type MockQuotaChecker_CheckQuotaReached_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 (_c *MockQuotaChecker_CheckQuotaReached_Call) Return(_a0 bool, _a1 error) *MockQuotaChecker_CheckQuotaReached_Call
func (*MockQuotaChecker_CheckQuotaReached_Call) Run ¶
func (_c *MockQuotaChecker_CheckQuotaReached_Call) Run(run func(ctx context.Context, target quota.TargetSrv, scopeParams *quota.ScopeParameters)) *MockQuotaChecker_CheckQuotaReached_Call
func (*MockQuotaChecker_CheckQuotaReached_Call) RunAndReturn ¶
func (_c *MockQuotaChecker_CheckQuotaReached_Call) RunAndReturn(run func(context.Context, quota.TargetSrv, *quota.ScopeParameters) (bool, error)) *MockQuotaChecker_CheckQuotaReached_Call
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 (m *MockQuotaChecker_Expecter) LimitExceeded() *MockQuotaChecker_Expecter
func (*MockQuotaChecker_Expecter) LimitOK ¶
func (m *MockQuotaChecker_Expecter) LimitOK() *MockQuotaChecker_Expecter
type MuteTimingService ¶
type MuteTimingService struct {
// contains filtered or unexported fields
}
func NewMuteTimingService ¶
func NewMuteTimingService(config AMConfigStore, prov ProvisioningStore, xact TransactionManager, log log.Logger) *MuteTimingService
func (*MuteTimingService) CreateMuteTiming ¶
func (svc *MuteTimingService) CreateMuteTiming(ctx context.Context, mt definitions.MuteTimeInterval, orgID int64) (definitions.MuteTimeInterval, error)
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, name 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, name 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 ¶
func (svc *MuteTimingService) UpdateMuteTiming(ctx context.Context, mt definitions.MuteTimeInterval, orgID int64) (definitions.MuteTimeInterval, error)
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 ¶
type NotificationPolicyService ¶
type NotificationPolicyService struct {
// contains filtered or unexported fields
}
func NewNotificationPolicyService ¶
func NewNotificationPolicyService(am AMConfigStore, prov ProvisioningStore, xact TransactionManager, settings setting.UnifiedAlertingSettings, log log.Logger) *NotificationPolicyService
func (*NotificationPolicyService) GetAMConfigStore ¶
func (nps *NotificationPolicyService) GetAMConfigStore() AMConfigStore
func (*NotificationPolicyService) GetPolicyTree ¶
func (nps *NotificationPolicyService) GetPolicyTree(ctx context.Context, orgID int64) (definitions.Route, error)
func (*NotificationPolicyService) ResetPolicyTree ¶
func (nps *NotificationPolicyService) ResetPolicyTree(ctx context.Context, orgID int64) (definitions.Route, error)
func (*NotificationPolicyService) UpdatePolicyTree ¶
func (nps *NotificationPolicyService) UpdatePolicyTree(ctx context.Context, orgID int64, tree definitions.Route, p models.Provenance) error
type NotificationSettingsValidatorProviderFake ¶
type NotificationSettingsValidatorProviderFake struct { }
func (*NotificationSettingsValidatorProviderFake) Validator ¶
func (n *NotificationSettingsValidatorProviderFake) Validator(ctx context.Context, orgID int64) (notifier.NotificationSettingsValidator, error)
type ProvenanceStatusTransitionValidator ¶
type ProvenanceStatusTransitionValidator = func(from, to models.Provenance) error
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 accesscontrol.Namespaced) error AuthorizeRuleChanges(ctx context.Context, user identity.Requester, change *store.GroupDelta) 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) GetRuleGroupInterval(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string) (int64, error) InsertAlertRules(ctx context.Context, rule []models.AlertRule) ([]models.AlertRuleKeyWithId, error) UpdateAlertRules(ctx context.Context, rule []models.UpdateRule) error DeleteAlertRulesByUID(ctx context.Context, orgID int64, 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 AMConfigStore, prov ProvisioningStore, xact TransactionManager, log log.Logger) *TemplateService
func (*TemplateService) DeleteTemplate ¶
func (*TemplateService) GetTemplates ¶
func (t *TemplateService) GetTemplates(ctx context.Context, orgID int64) ([]definitions.NotificationTemplate, error)
func (*TemplateService) SetTemplate ¶
func (t *TemplateService) SetTemplate(ctx context.Context, orgID int64, tmpl definitions.NotificationTemplate) (definitions.NotificationTemplate, error)