Documentation ¶
Overview ¶
Package ia contains Integrated Alerting APIs implementations.
Index ¶
- type AlertsService
- type ChannelsService
- func (s *ChannelsService) AddChannel(ctx context.Context, req *iav1beta1.AddChannelRequest) (*iav1beta1.AddChannelResponse, error)
- func (s *ChannelsService) ChangeChannel(ctx context.Context, req *iav1beta1.ChangeChannelRequest) (*iav1beta1.ChangeChannelResponse, error)
- func (s *ChannelsService) Enabled() bool
- func (s *ChannelsService) ListChannels(ctx context.Context, req *iav1beta1.ListChannelsRequest) (*iav1beta1.ListChannelsResponse, error)
- func (s *ChannelsService) RemoveChannel(ctx context.Context, req *iav1beta1.RemoveChannelRequest) (*iav1beta1.RemoveChannelResponse, error)
- type RulesService
- func (s *RulesService) CreateAlertRule(ctx context.Context, req *iav1beta1.CreateAlertRuleRequest) (*iav1beta1.CreateAlertRuleResponse, error)
- func (s *RulesService) DeleteAlertRule(ctx context.Context, req *iav1beta1.DeleteAlertRuleRequest) (*iav1beta1.DeleteAlertRuleResponse, error)
- func (s *RulesService) Enabled() bool
- func (s *RulesService) ListAlertRules(ctx context.Context, req *iav1beta1.ListAlertRulesRequest) (*iav1beta1.ListAlertRulesResponse, error)
- func (s *RulesService) RemoveVMAlertRulesFiles() error
- func (s *RulesService) ToggleAlertRule(ctx context.Context, req *iav1beta1.ToggleAlertRuleRequest) (*iav1beta1.ToggleAlertRuleResponse, error)
- func (s *RulesService) UpdateAlertRule(ctx context.Context, req *iav1beta1.UpdateAlertRuleRequest) (*iav1beta1.UpdateAlertRuleResponse, error)
- func (s *RulesService) WriteVMAlertRulesFiles()
- type TemplatesService
- func (s *TemplatesService) Collect(ctx context.Context)
- func (s *TemplatesService) CreateTemplate(ctx context.Context, req *iav1beta1.CreateTemplateRequest) (*iav1beta1.CreateTemplateResponse, error)
- func (s *TemplatesService) DeleteTemplate(ctx context.Context, req *iav1beta1.DeleteTemplateRequest) (*iav1beta1.DeleteTemplateResponse, error)
- func (s *TemplatesService) Enabled() bool
- func (s *TemplatesService) ListTemplates(ctx context.Context, req *iav1beta1.ListTemplatesRequest) (*iav1beta1.ListTemplatesResponse, error)
- func (s *TemplatesService) UpdateTemplate(ctx context.Context, req *iav1beta1.UpdateTemplateRequest) (*iav1beta1.UpdateTemplateResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertsService ¶
type AlertsService struct {
// contains filtered or unexported fields
}
AlertsService represents integrated alerting alerts API.
func NewAlertsService ¶
func NewAlertsService(db *reform.DB, alertManager alertManager, templatesService *TemplatesService) *AlertsService
NewAlertsService creates new alerts API service.
func (*AlertsService) Enabled ¶
func (s *AlertsService) Enabled() bool
Enabled returns if service is enabled and can be used.
func (*AlertsService) ListAlerts ¶
func (s *AlertsService) ListAlerts(ctx context.Context, req *iav1beta1.ListAlertsRequest) (*iav1beta1.ListAlertsResponse, error)
ListAlerts returns list of existing alerts.
func (*AlertsService) ToggleAlert ¶
func (s *AlertsService) ToggleAlert(ctx context.Context, req *iav1beta1.ToggleAlertRequest) (*iav1beta1.ToggleAlertResponse, error)
ToggleAlert allows to silence/unsilence specified alerts.
type ChannelsService ¶
type ChannelsService struct {
// contains filtered or unexported fields
}
ChannelsService represents integrated alerting channels API.
func NewChannelsService ¶
func NewChannelsService(db *reform.DB, alertManager alertManager) *ChannelsService
NewChannelsService creates new channels API service.
func (*ChannelsService) AddChannel ¶
func (s *ChannelsService) AddChannel(ctx context.Context, req *iav1beta1.AddChannelRequest) (*iav1beta1.AddChannelResponse, error)
AddChannel adds new notification channel.
func (*ChannelsService) ChangeChannel ¶
func (s *ChannelsService) ChangeChannel(ctx context.Context, req *iav1beta1.ChangeChannelRequest) (*iav1beta1.ChangeChannelResponse, error)
ChangeChannel changes existing notification channel.
func (*ChannelsService) Enabled ¶
func (s *ChannelsService) Enabled() bool
Enabled returns if service is enabled and can be used.
func (*ChannelsService) ListChannels ¶
func (s *ChannelsService) ListChannels(ctx context.Context, req *iav1beta1.ListChannelsRequest) (*iav1beta1.ListChannelsResponse, error)
ListChannels returns list of available channels.
func (*ChannelsService) RemoveChannel ¶
func (s *ChannelsService) RemoveChannel(ctx context.Context, req *iav1beta1.RemoveChannelRequest) (*iav1beta1.RemoveChannelResponse, error)
RemoveChannel removes notification channel.
type RulesService ¶
type RulesService struct {
// contains filtered or unexported fields
}
RulesService represents API for Integrated Alerting Rules.
func NewRulesService ¶
func NewRulesService(db *reform.DB, templates *TemplatesService, vmalert vmAlert, alertManager alertManager) *RulesService
NewRulesService creates an API for Integrated Alerting Rules.
func (*RulesService) CreateAlertRule ¶
func (s *RulesService) CreateAlertRule(ctx context.Context, req *iav1beta1.CreateAlertRuleRequest) (*iav1beta1.CreateAlertRuleResponse, error)
CreateAlertRule creates Integrated Alerting rule.
func (*RulesService) DeleteAlertRule ¶
func (s *RulesService) DeleteAlertRule(ctx context.Context, req *iav1beta1.DeleteAlertRuleRequest) (*iav1beta1.DeleteAlertRuleResponse, error)
DeleteAlertRule deletes Integrated Alerting rule.
func (*RulesService) Enabled ¶
func (s *RulesService) Enabled() bool
Enabled returns if service is enabled and can be used.
func (*RulesService) ListAlertRules ¶
func (s *RulesService) ListAlertRules(ctx context.Context, req *iav1beta1.ListAlertRulesRequest) (*iav1beta1.ListAlertRulesResponse, error)
ListAlertRules returns a list of all Integrated Alerting rules.
func (*RulesService) RemoveVMAlertRulesFiles ¶
func (s *RulesService) RemoveVMAlertRulesFiles() error
RemoveVMAlertRulesFiles removes all generated rules files (*.yml) on the ia path.
func (*RulesService) ToggleAlertRule ¶
func (s *RulesService) ToggleAlertRule(ctx context.Context, req *iav1beta1.ToggleAlertRuleRequest) (*iav1beta1.ToggleAlertRuleResponse, error)
ToggleAlertRule allows to switch between disabled and enabled states of an Alert Rule.
func (*RulesService) UpdateAlertRule ¶
func (s *RulesService) UpdateAlertRule(ctx context.Context, req *iav1beta1.UpdateAlertRuleRequest) (*iav1beta1.UpdateAlertRuleResponse, error)
UpdateAlertRule updates Integrated Alerting rule.
func (*RulesService) WriteVMAlertRulesFiles ¶
func (s *RulesService) WriteVMAlertRulesFiles()
writeVMAlertRulesFiles converts all available rules to VMAlert rule files.
type TemplatesService ¶
type TemplatesService struct {
// contains filtered or unexported fields
}
TemplatesService is responsible for interactions with IA rule templates.
func NewTemplatesService ¶
func NewTemplatesService(db *reform.DB) *TemplatesService
NewTemplatesService creates a new TemplatesService.
func (*TemplatesService) Collect ¶
func (s *TemplatesService) Collect(ctx context.Context)
Collect collects IA rule templates from various sources like: builtin templates: read from the generated code in bindata.go. user file templates: read from yaml files created by the user in `/srv/ia/templates` user API templates: in the DB created using the API.
func (*TemplatesService) CreateTemplate ¶
func (s *TemplatesService) CreateTemplate(ctx context.Context, req *iav1beta1.CreateTemplateRequest) (*iav1beta1.CreateTemplateResponse, error)
CreateTemplate creates a new template.
func (*TemplatesService) DeleteTemplate ¶
func (s *TemplatesService) DeleteTemplate(ctx context.Context, req *iav1beta1.DeleteTemplateRequest) (*iav1beta1.DeleteTemplateResponse, error)
DeleteTemplate deletes existing, previously created via API.
func (*TemplatesService) Enabled ¶
func (s *TemplatesService) Enabled() bool
Enabled returns if service is enabled and can be used.
func (*TemplatesService) ListTemplates ¶
func (s *TemplatesService) ListTemplates(ctx context.Context, req *iav1beta1.ListTemplatesRequest) (*iav1beta1.ListTemplatesResponse, error)
ListTemplates returns a list of all collected Alert Rule Templates.
func (*TemplatesService) UpdateTemplate ¶
func (s *TemplatesService) UpdateTemplate(ctx context.Context, req *iav1beta1.UpdateTemplateRequest) (*iav1beta1.UpdateTemplateResponse, error)
UpdateTemplate updates existing template, previously created via API.