Documentation
¶
Index ¶
- Variables
- func PostRuleGroupWithCortex(ctx context.Context, client CortexClient, templateService TemplateService, ...) error
- type CortexClient
- type Filter
- type NamespaceService
- type ProviderService
- type Repository
- type Rule
- type RuleVariable
- type Service
- type TemplateService
- type Transactor
- type Variables
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDuplicate = errors.New("rule conflicted with existing") ErrRelation = errors.New("provider's namespace does not exist") )
Functions ¶
func PostRuleGroupWithCortex ¶
func PostRuleGroupWithCortex(ctx context.Context, client CortexClient, templateService TemplateService, nspace, groupName, tenantName string, rulesWithinGroup []Rule) error
Types ¶
type CortexClient ¶
type CortexClient interface {
CreateAlertmanagerConfig(cortex.AlertManagerConfig, string) error
CreateRuleGroup(ctx context.Context, namespace string, rg rwrulefmt.RuleGroup) error
DeleteRuleGroup(ctx context.Context, namespace, groupName string) error
GetRuleGroup(ctx context.Context, namespace, groupName string) (*rwrulefmt.RuleGroup, error)
ListRules(ctx context.Context, namespace string) (map[string][]rwrulefmt.RuleGroup, error)
}
type NamespaceService ¶
type ProviderService ¶
type Repository ¶
type Rule ¶
type Rule struct {
ID uint64 `json:"id"`
Name string `json:"name"`
Enabled bool `json:"enabled" validate:"required"`
GroupName string `json:"group_name" validate:"required"`
Namespace string `json:"namespace" validate:"required"`
Template string `json:"template" validate:"required"`
Variables []RuleVariable `json:"variables" validate:"required,dive,required"`
ProviderNamespace uint64 `json:"provider_namespace" validate:"required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type RuleVariable ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles business logic
func NewService ¶
func NewService( repository Repository, templateService TemplateService, namespaceService NamespaceService, providerService ProviderService, cortexClient CortexClient, ) *Service
NewService returns repository struct
type TemplateService ¶
type TemplateService interface {
Upsert(context.Context, *template.Template) error
List(context.Context, template.Filter) ([]template.Template, error)
GetByName(context.Context, string) (*template.Template, error)
Delete(context.Context, string) error
Render(context.Context, string, map[string]string) (string, error)
}
type Transactor ¶
Click to show internal directories.
Click to hide internal directories.