notifications

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(name string, config Config, db *database.DB) (*Client, error)

func (*Client) Incidents added in v0.4.0

func (c *Client) Incidents(ctx context.Context) (io.ReadCloser, error)

func (*Client) ProcessEvent

func (c *Client) ProcessEvent(ctx context.Context, event Event) error

func (*Client) Stream

func (c *Client) Stream(ctx context.Context, entities <-chan any) error

Stream consumes the items from the given `entities` chan and triggers a notifications event for each of them.

type Config

type Config struct {
	// If URL is the empty string, notifications are disabled.
	Url              string `yaml:"url" env:"URL"`
	Username         string `yaml:"username" env:"USERNAME"`
	Password         string `yaml:"password" env:"PASSWORD"`
	KubernetesWebUrl string `yaml:"kubernetes_web_url" env:"KUBERNETES_WEB_URL" default:"http://localhost/icingaweb2/kubernetes"`
}

func (*Config) Validate

func (c *Config) Validate() error

Validate checks constraints in the supplied configuration and returns an error if they are violated.

type Event

type Event struct {
	Uuid        types.UUID
	ClusterUuid types.UUID
	Kind        string
	Name        string
	Severity    string
	Message     string
	URL         *url.URL
	Tags        map[string]string
	ExtraTags   map[string]string
}

func (Event) Carry added in v0.4.0

func (e Event) Carry() *event.Event

func (Event) MarshalJSON

func (e Event) MarshalJSON() ([]byte, error)

type Marshaler

type Marshaler interface {
	MarshalEvent() (Event, error)
}

Marshaler is the interface implemented by types that can marshal themselves into valid notification events.

type ScopeTransport added in v0.4.0

type ScopeTransport struct {
	http.RoundTripper
	UserAgent string
	BaseUrl   *url.URL
}

func (*ScopeTransport) RoundTrip added in v0.4.0

func (t *ScopeTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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