sinks

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Overview

Package sinks contains sinks for emitting ValidationResults.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidEndpoint is returned when an Alertmanager endpoint is invalid.
	ErrInvalidEndpoint = errors.New("invalid Alertmanager config: endpoint scheme and host are required")

	// ErrEndpointRequired is returned when the Alertmanager endpoint is not provided.
	ErrEndpointRequired = errors.New("invalid Alertmanager config: endpoint required")
)
View Source
var ErrSinkEmissionFailed = errors.New("sink emission failed")

ErrSinkEmissionFailed is returned when emitting a validation result to a sink fails.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	// Annotations are arbitrary key-value pairs.
	Annotations map[string]string `json:"annotations"`

	// Labels are key-value pairs that can be used to group and filter alerts.
	Labels map[string]string `json:"labels"`
}

Alert is an Alertmanager alert.

type AlertmanagerSink

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

AlertmanagerSink is a sink for sending validation results to Alertmanager.

func (*AlertmanagerSink) Configure

func (s *AlertmanagerSink) Configure(c Client, config map[string][]byte) error

Configure configures the AlertmanagerSink with the provided configuration.

func (*AlertmanagerSink) Emit

Emit sends a ValidationResult to Alertmanager.

type Client

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

Client is an HTTP client for a Sink.

func NewClient

func NewClient(timeout time.Duration) *Client

NewClient returns a new Client with the provided timeout.

type Sink

type Sink interface {
	Configure(c Client, config map[string][]byte) error
	Emit(result v1alpha1.ValidationResult) error
}

Sink is an interface for sending validation results to a sink.

func NewSink

func NewSink(sinkType types.SinkType, log logr.Logger) Sink

NewSink returns a new Sink based on the provided SinkType.

type SlackSink

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

SlackSink is a sink for sending validation results to Slack.

func (*SlackSink) Configure

func (s *SlackSink) Configure(c Client, config map[string][]byte) error

Configure configures the SlackSink with the provided configuration.

func (*SlackSink) Emit

Emit sends a ValidationResult to Slack.

Jump to

Keyboard shortcuts

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