rulesclient

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CertificateRegexp = regexp.MustCompile(`^-----BEGIN .+?-----([\s\S]*)-----END .+?-----\s?$`)

Functions

func YAMLNodeFromString added in v1.4.3

func YAMLNodeFromString(value string) yaml.Node

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 interface {
	Id() string
	AlertManagers() *prom_config.AlertmanagerConfigs
}

type ManagerConfig added in v1.4.0

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

func ManagerConfigFromJSON added in v1.4.0

func ManagerConfigFromJSON(body io.ReadCloser) (*ManagerConfig, error)

func NewManagerConfig added in v1.4.0

func NewManagerConfig(id string, alertmanagers *prom_config.AlertmanagerConfigs) *ManagerConfig

func (*ManagerConfig) AlertManagers added in v1.4.0

func (m *ManagerConfig) AlertManagers() *prom_config.AlertmanagerConfigs

func (*ManagerConfig) GenerateId added in v1.4.0

func (m *ManagerConfig) GenerateId()

func (*ManagerConfig) Id added in v1.4.0

func (m *ManagerConfig) Id() string

func (*ManagerConfig) ToJSON added in v1.4.0

func (m *ManagerConfig) ToJSON() ([]byte, error)

func (*ManagerConfig) Validate added in v1.4.0

func (m *ManagerConfig) Validate() error

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) Validate

func (rg *RuleGroup) Validate() error

type RuleGroupData

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

type RuleGroups added in v1.4.3

type RuleGroups struct {
	Groups []RuleGroup `json:"groups"`
}

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 string, alertmanagerConfigs *prom_config.AlertmanagerConfigs) (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