rulesclient

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Status int    `json:"status"`
	Title  string `json:"title"`
}

func (*ApiError) Error

func (a *ApiError) Error() string

type ApiErrors

type ApiErrors struct {
	Errors []ApiError `json:"errors"`
}

type Duration

type Duration time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) String

func (d Duration) String() string

func (*Duration) Type

func (d *Duration) Type() string

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type Manager

type Manager struct {
	Id              string `json:"id"`
	AlertManagerUrl string `json:"alertmanager_url"`
}

func (*Manager) Validate

func (m *Manager) Validate() error

type ManagerData

type ManagerData struct {
	Data Manager `json:"data"`
}

type Rule

type Rule struct {
	Record      string            `json:"record,omitempty"`
	Alert       string            `json:"alert,omitempty"`
	Expr        string            `json:"expr"`
	For         string            `json:"for,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

func (*Rule) Validate

func (r *Rule) Validate() error

type RuleGroup

type RuleGroup struct {
	Name     string   `json:"name"`
	Interval Duration `json:"interval,omitempty"`
	Rules    []Rule   `json:"rules"`
}

func (*RuleGroup) ConvertToPromRuleGroup

func (rg *RuleGroup) ConvertToPromRuleGroup() (*rulefmt.RuleGroup, error)

func (*RuleGroup) Validate

func (rg *RuleGroup) Validate() error

type RuleGroupData

type RuleGroupData struct {
	Data RuleGroup `json:"data"`
}

type RulesClient

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

func NewRulesClient

func NewRulesClient(addr string, tlsConfig *tls.Config, opts ...RulesClientOption) *RulesClient

func (*RulesClient) CreateManager

func (c *RulesClient) CreateManager(managerId, alertmanagerAddr string) (*Manager, *ApiError)

func (*RulesClient) DeleteManager

func (c *RulesClient) DeleteManager(managerId string) *ApiError

func (*RulesClient) UpsertRuleGroup

func (c *RulesClient) UpsertRuleGroup(managerId string, ruleGroup RuleGroup) (*RuleGroup, *ApiError)

type RulesClientOption

type RulesClientOption func(*RulesClient)

func WithRulesClientLogger

func WithRulesClientLogger(log *logger.Logger) RulesClientOption

func WithRulesClientPrivate

func WithRulesClientPrivate() RulesClientOption

func WithRulesClientTimeout

func WithRulesClientTimeout(timeout time.Duration) RulesClientOption

Jump to

Keyboard shortcuts

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