client

package
v3.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConfig         = errors.New("No config exists for this user")
	ErrResourceNotFound = errors.New("requested resource not found")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	User            string `yaml:"user"`
	Key             string `yaml:"key"`
	Address         string `yaml:"address"`
	ID              string `yaml:"id"`
	TLS             tls.ClientConfig
	UseLegacyRoutes bool   `yaml:"use_legacy_routes"`
	AuthToken       string `yaml:"auth_token"`
}

Config is used to configure a Ruler Client

type LokiClient

type LokiClient struct {
	Client http.Client
	// contains filtered or unexported fields
}

LokiClient is used to get and load rules into a Loki ruler

func New

func New(cfg Config) (*LokiClient, error)

New returns a new Client

func (*LokiClient) CreateAlertmanagerConfig

func (r *LokiClient) CreateAlertmanagerConfig(ctx context.Context, cfg string, templates map[string]string) error

CreateAlertmanagerConfig creates a new alertmanager config

func (*LokiClient) CreateRuleGroup

func (r *LokiClient) CreateRuleGroup(ctx context.Context, namespace string, rg rwrulefmt.RuleGroup) error

CreateRuleGroup creates a new rule group

func (*LokiClient) DeleteAlermanagerConfig

func (r *LokiClient) DeleteAlermanagerConfig(ctx context.Context) error

DeleteAlermanagerConfig deletes the users alertmanagerconfig

func (*LokiClient) DeleteRuleGroup

func (r *LokiClient) DeleteRuleGroup(ctx context.Context, namespace, groupName string) error

DeleteRuleGroup creates a new rule group

func (*LokiClient) GetAlertmanagerConfig

func (r *LokiClient) GetAlertmanagerConfig(ctx context.Context) (string, map[string]string, error)

GetAlertmanagerConfig retrieves a rule group

func (*LokiClient) GetRuleGroup

func (r *LokiClient) GetRuleGroup(ctx context.Context, namespace, groupName string) (*rwrulefmt.RuleGroup, error)

GetRuleGroup retrieves a rule group

func (*LokiClient) ListRules

func (r *LokiClient) ListRules(ctx context.Context, namespace string) (map[string][]rwrulefmt.RuleGroup, error)

ListRules retrieves a rule group

func (*LokiClient) Query

func (r *LokiClient) Query(ctx context.Context, query string) (*http.Response, error)

Query executes a PromQL query against the Cortex cluster.

Jump to

Keyboard shortcuts

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