alert

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SuppliedVariables = []string{"name", "team", "entity"}

Functions

This section is empty.

Types

type Alert

type Alert struct {
	ID          string    `json:"id"`
	Resource    string    `json:"resource"`
	Metric      string    `json:"metric"`
	Value       string    `json:"value"`
	Severity    string    `json:"severity"`
	Rule        string    `json:"Rule"`
	TriggeredAt time.Time `json:"triggered_at"`
}

type Policy

type Policy struct {
	Resource string `json:"resource"`
	Rules    []Rule `json:"rules"`
}

type Rule

type Rule struct {
	ID        string     `json:"id"`
	Template  string     `json:"Template"`
	Enabled   bool       `json:"enabled"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	Variables []Variable `json:"variables"`
}

func AddSuppliedVariablesFromRules added in v0.2.1

func AddSuppliedVariablesFromRules(rules []Rule, vars map[string]string) []Rule

func RemoveSuppliedVariablesFromRules added in v0.2.1

func RemoveSuppliedVariablesFromRules(rules []Rule, varKeys []string) []Rule

type Service

type Service struct {
	Siren sirenv1beta1.SirenServiceClient
}

func (*Service) GetAlertPolicy

func (svc *Service) GetAlertPolicy(ctx context.Context, projectSlug string, resource string) (*Policy, error)

func (*Service) GetAlertTemplate

func (svc *Service) GetAlertTemplate(ctx context.Context, urn string) (*Template, error)

func (*Service) GetProjectDataSource

func (svc *Service) GetProjectDataSource(ctx context.Context, projectSlug string) (string, error)

func (*Service) HandleListTemplates added in v0.2.1

func (svc *Service) HandleListTemplates() http.HandlerFunc

func (*Service) ListAlertTemplates

func (svc *Service) ListAlertTemplates(ctx context.Context, tag string) ([]Template, error)

func (*Service) ListAlerts

func (svc *Service) ListAlerts(ctx context.Context, projectSlug string, resource string) ([]Alert, error)

func (*Service) UpsertAlertPolicy

func (svc *Service) UpsertAlertPolicy(ctx context.Context, projectSlug string, update Policy) (*Policy, error)

type Template

type Template struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	Body      string     `json:"body"`
	Tags      []string   `json:"tags"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	Variables []Variable `json:"variables"`
}

func RemoveSuppliedVariablesFromTemplates added in v0.2.1

func RemoveSuppliedVariablesFromTemplates(templates []Template, varKeys []string) []Template

type Variable

type Variable struct {
	Name        string `json:"name"`
	Value       string `json:"value,omitempty"`
	Default     string `json:"default,omitempty"`
	Type        string `json:"type"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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