Documentation
¶
Index ¶
- type Call
- type FakeAlertmanagerConfigStore
- type FakeKVStore
- func (fkv *FakeKVStore) Del(_ context.Context, orgId int64, namespace string, key string) error
- func (fkv *FakeKVStore) Get(_ context.Context, orgId int64, namespace string, key string) (string, bool, error)
- func (fkv *FakeKVStore) GetAll(ctx context.Context, orgId int64, namespace string) (map[int64]map[string]string, error)
- func (fkv *FakeKVStore) Keys(ctx context.Context, orgID int64, namespace string, keyPrefix string) ([]kvstore.Key, error)
- func (fkv *FakeKVStore) Set(_ context.Context, orgId int64, namespace string, key string, value string) error
- type FakeProvisioningStore
- func (f *FakeProvisioningStore) DeleteProvenance(ctx context.Context, o models.Provisionable, org int64) error
- func (f *FakeProvisioningStore) GetProvenance(ctx context.Context, o models.Provisionable, org int64) (models.Provenance, error)
- func (f *FakeProvisioningStore) GetProvenances(ctx context.Context, orgID int64, resourceType string) (map[string]models.Provenance, error)
- func (f *FakeProvisioningStore) SetProvenance(ctx context.Context, o models.Provisionable, org int64, p models.Provenance) error
- type FakeReceiverService
- func (f *FakeReceiverService) GetReceiver(ctx context.Context, q models.GetReceiverQuery, u identity.Requester) (definitions.GettableApiReceiver, error)
- func (f *FakeReceiverService) GetReceivers(ctx context.Context, q models.GetReceiversQuery, u identity.Requester) ([]definitions.GettableApiReceiver, error)
- func (f *FakeReceiverService) PopMethodCall() ReceiverServiceMethodCall
- func (f *FakeReceiverService) Reset()
- type FakeSilenceStore
- func (s *FakeSilenceStore) CreateSilence(ctx context.Context, orgID int64, ps models.Silence) (string, error)
- func (s *FakeSilenceStore) DeleteSilence(ctx context.Context, orgID int64, id string) error
- func (s *FakeSilenceStore) GetSilence(ctx context.Context, orgID int64, id string) (*models.Silence, error)
- func (s *FakeSilenceStore) ListSilences(ctx context.Context, orgID int64, filter []string) ([]*models.Silence, error)
- func (s *FakeSilenceStore) UpdateSilence(ctx context.Context, orgID int64, ps models.Silence) (string, error)
- type GenericRecordedQuery
- type ReceiverServiceMethodCall
- type RuleStore
- func (f *RuleStore) CountInFolders(ctx context.Context, orgID int64, folderUIDs []string, u identity.Requester) (int64, error)
- func (f *RuleStore) DeleteAlertRulesByUID(_ context.Context, orgID int64, UIDs ...string) error
- func (f *RuleStore) GetAlertRuleByUID(_ context.Context, q *models.GetAlertRuleByUIDQuery) (*models.AlertRule, error)
- func (f *RuleStore) GetAlertRulesGroupByRuleUID(_ context.Context, q *models.GetAlertRulesGroupByRuleUIDQuery) ([]*models.AlertRule, error)
- func (f *RuleStore) GetNamespaceByUID(_ context.Context, uid string, orgID int64, user identity.Requester) (*folder.Folder, error)
- func (f *RuleStore) GetNamespacesByRuleUID(ctx context.Context, orgID int64, uids ...string) (map[string]string, error)
- func (f *RuleStore) GetRecordedCommands(predicate func(cmd any) (any, bool)) []any
- func (f *RuleStore) GetRuleGroupInterval(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string) (int64, error)
- func (f *RuleStore) GetUserVisibleNamespaces(_ context.Context, orgID int64, _ identity.Requester) (map[string]*folder.Folder, error)
- func (f *RuleStore) InTransaction(ctx context.Context, fn func(c context.Context) error) error
- func (f *RuleStore) IncreaseVersionForAllRulesInNamespace(_ context.Context, orgID int64, namespaceUID string) ([]models.AlertRuleKeyWithVersion, error)
- func (f *RuleStore) InsertAlertRules(_ context.Context, q []models.AlertRule) ([]models.AlertRuleKeyWithId, error)
- func (f *RuleStore) ListAlertRules(_ context.Context, q *models.ListAlertRulesQuery) (models.RulesGroup, error)
- func (f *RuleStore) PutRule(_ context.Context, rules ...*models.AlertRule)
- func (f *RuleStore) UpdateAlertRules(_ context.Context, q []models.UpdateRule) error
- func (f *RuleStore) UpdateRuleGroup(ctx context.Context, orgID int64, namespaceUID string, ruleGroup string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeAlertmanagerConfigStore ¶
type FakeAlertmanagerConfigStore struct { Config models.AlertConfiguration // GetFn is an optional function that can be set to mock the GetLatestAlertmanagerConfiguration method GetFn func(ctx context.Context, orgID int64) (*models.AlertConfiguration, error) // UpdateFn is an optional function that can be set to mock the UpdateAlertmanagerConfiguration method UpdateFn func(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd) error // LastSaveCommand is the last command that was passed to UpdateAlertmanagerConfiguration LastSaveCommand *models.SaveAlertmanagerConfigurationCmd }
func NewFakeAlertmanagerConfigStore ¶
func NewFakeAlertmanagerConfigStore(config string) *FakeAlertmanagerConfigStore
func (*FakeAlertmanagerConfigStore) GetLatestAlertmanagerConfiguration ¶
func (f *FakeAlertmanagerConfigStore) GetLatestAlertmanagerConfiguration(ctx context.Context, orgID int64) (*models.AlertConfiguration, error)
func (*FakeAlertmanagerConfigStore) UpdateAlertmanagerConfiguration ¶
func (f *FakeAlertmanagerConfigStore) UpdateAlertmanagerConfiguration(ctx context.Context, cmd *models.SaveAlertmanagerConfigurationCmd) error
type FakeKVStore ¶
func NewFakeKVStore ¶
func NewFakeKVStore(t *testing.T) *FakeKVStore
type FakeProvisioningStore ¶
type FakeProvisioningStore struct {
Records map[int64]map[string]models.Provenance
}
func NewFakeProvisioningStore ¶
func NewFakeProvisioningStore() *FakeProvisioningStore
func (*FakeProvisioningStore) DeleteProvenance ¶
func (f *FakeProvisioningStore) DeleteProvenance(ctx context.Context, o models.Provisionable, org int64) error
func (*FakeProvisioningStore) GetProvenance ¶
func (f *FakeProvisioningStore) GetProvenance(ctx context.Context, o models.Provisionable, org int64) (models.Provenance, error)
func (*FakeProvisioningStore) GetProvenances ¶
func (f *FakeProvisioningStore) GetProvenances(ctx context.Context, orgID int64, resourceType string) (map[string]models.Provenance, error)
func (*FakeProvisioningStore) SetProvenance ¶
func (f *FakeProvisioningStore) SetProvenance(ctx context.Context, o models.Provisionable, org int64, p models.Provenance) error
type FakeReceiverService ¶
type FakeReceiverService struct { MethodCalls []ReceiverServiceMethodCall GetReceiverFn func(ctx context.Context, q models.GetReceiverQuery, u identity.Requester) (definitions.GettableApiReceiver, error) GetReceiversFn func(ctx context.Context, q models.GetReceiversQuery, u identity.Requester) ([]definitions.GettableApiReceiver, error) }
func NewFakeReceiverService ¶
func NewFakeReceiverService() *FakeReceiverService
func (*FakeReceiverService) GetReceiver ¶
func (f *FakeReceiverService) GetReceiver(ctx context.Context, q models.GetReceiverQuery, u identity.Requester) (definitions.GettableApiReceiver, error)
func (*FakeReceiverService) GetReceivers ¶
func (f *FakeReceiverService) GetReceivers(ctx context.Context, q models.GetReceiversQuery, u identity.Requester) ([]definitions.GettableApiReceiver, error)
func (*FakeReceiverService) PopMethodCall ¶
func (f *FakeReceiverService) PopMethodCall() ReceiverServiceMethodCall
func (*FakeReceiverService) Reset ¶
func (f *FakeReceiverService) Reset()
type FakeSilenceStore ¶
type FakeSilenceStore struct { Silences map[string]*models.Silence RuleUIDFolders map[string]string RecordedOps []GenericRecordedQuery }
func (*FakeSilenceStore) CreateSilence ¶
func (*FakeSilenceStore) DeleteSilence ¶
func (*FakeSilenceStore) GetSilence ¶
func (*FakeSilenceStore) ListSilences ¶
func (*FakeSilenceStore) UpdateSilence ¶
type GenericRecordedQuery ¶
type ReceiverServiceMethodCall ¶
type ReceiverServiceMethodCall struct { Method string Args []interface{} }
type RuleStore ¶
type RuleStore struct { // OrgID -> RuleGroup -> Namespace -> Rules Rules map[int64][]*models.AlertRule Hook func(cmd any) error // use Hook if you need to intercept some query and return an error RecordedOps []any Folders map[int64][]*folder.Folder // contains filtered or unexported fields }
FakeRuleStore mocks the RuleStore of the scheduler.
func NewRuleStore ¶
func (*RuleStore) CountInFolders ¶
func (*RuleStore) DeleteAlertRulesByUID ¶
func (*RuleStore) GetAlertRuleByUID ¶
func (*RuleStore) GetAlertRulesGroupByRuleUID ¶
func (*RuleStore) GetNamespaceByUID ¶
func (*RuleStore) GetNamespacesByRuleUID ¶
func (*RuleStore) GetRecordedCommands ¶
GetRecordedCommands filters recorded commands using predicate function. Returns the subset of the recorded commands that meet the predicate
func (*RuleStore) GetRuleGroupInterval ¶
func (*RuleStore) GetUserVisibleNamespaces ¶
func (*RuleStore) InTransaction ¶
func (*RuleStore) IncreaseVersionForAllRulesInNamespace ¶
func (*RuleStore) InsertAlertRules ¶
func (*RuleStore) ListAlertRules ¶
func (f *RuleStore) ListAlertRules(_ context.Context, q *models.ListAlertRulesQuery) (models.RulesGroup, error)
func (*RuleStore) PutRule ¶
PutRule puts the rule in the Rules map. If there are existing rule in the same namespace, they will be overwritten
func (*RuleStore) UpdateAlertRules ¶
Click to show internal directories.
Click to hide internal directories.