bridge

package
v0.0.0-...-f8a25d4 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertmanagerEvent

type AlertmanagerEvent struct {
	Receiver string `json:"receiver"`
	Status   string `json:"status"`
	Alerts   []struct {
		Status       string            `json:"status"`
		Labels       map[string]string `json:"labels"`
		Annotations  map[string]string `json:"annotations"`
		StartsAt     time.Time         `json:"startsAt"`
		EndsAt       time.Time         `json:"endsAt"`
		GeneratorURL string            `json:"generatorURL"`
		Fingerprint  string            `json:"fingerprint"`
	} `json:"alerts"`
	GroupLabels       map[string]string `json:"groupLabels"`
	CommonLabels      map[string]string `json:"commonLabels"`
	CommonAnnotations map[string]string `json:"commonAnnotations"`
	ExternalURL       string            `json:"externalURL"`
	Version           string            `json:"version"`
	GroupKey          string            `json:"groupKey"`
	TruncatedAlerts   int               `json:"truncatedAlerts"`
}

type AlertmanagerHandler

type AlertmanagerHandler struct{}

func NewAlertmanagerHandler

func NewAlertmanagerHandler() AlertmanagerHandler

func (AlertmanagerHandler) ProduceNotifications

func (d AlertmanagerHandler) ProduceNotifications(r *http.Request) ([]Notification, error)

type Auth

type Auth struct {
	Username string
	Password string

	AccessToken string
}

func (Auth) IsEmpty

func (a Auth) IsEmpty() bool

type Bridge

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

func NewBridge

func NewBridge(baseURL, topic string, handler Handler) Bridge

func (Bridge) ServeHTTP

func (b Bridge) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Bridge) WithAuth

func (b *Bridge) WithAuth(auth Auth)

type DiscordEmbedHandler

type DiscordEmbedHandler struct{}

func NewDiscordEmbedHandler

func NewDiscordEmbedHandler() DiscordEmbedHandler

func (DiscordEmbedHandler) ProduceNotifications

func (d DiscordEmbedHandler) ProduceNotifications(r *http.Request) ([]Notification, error)

type DiscordMessage

type DiscordMessage struct {
	Content string `json:"content"`
	Embeds  []struct {
		Title       string `json:"title"`
		Description string `json:"description"`
		URL         string `json:"url"`
		Footer      struct {
			Text string `json:"text"`
		} `json:"footer"`
		Author struct {
			Name string `json:"name"`
			URL  string `json:"url"`
		} `json:"author"`
	} `json:"embeds"`
}

type FluxHandler

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

func NewFluxHandler

func NewFluxHandler() FluxHandler

func (FluxHandler) ProduceNotifications

func (f FluxHandler) ProduceNotifications(r *http.Request) ([]Notification, error)

type FluxNotification

type FluxNotification struct {
	InvolvedObject fluxInvolvedObject `json:"involvedObject"`
	Severity       string             `json:"severity"`
	Timestamp      time.Time          `json:"timestamp"`
	Message        string             `json:"message"`
	Reason         string             `json:"reason"`
	Metadata       struct {
		CommitStatus string `json:"commit_status"`
		Revision     string `json:"revision"`
		Summary      string `json:"summary"`
	} `json:"metadata"`
	ReportingController string `json:"reportingController"`
	ReportingInstance   string `json:"reportingInstance"`
}

type Handler

type Handler interface {
	ProduceNotifications(r *http.Request) ([]Notification, error)
}

type Notification

type Notification struct {
	Title      string
	Body       string
	Priority   int
	Tags       []string
	Actions    []NotificationAction
	IsMarkdown bool
	// contains filtered or unexported fields
}

func (Notification) IsEmpty

func (n Notification) IsEmpty() bool

func (Notification) Send

func (n Notification) Send(base string) error

type NotificationAction

type NotificationAction struct {
	Action string
	Label  string
	Params []string
}

func NewViewAction

func NewViewAction(label, url string, params ...string) NotificationAction

func (NotificationAction) Format

func (n NotificationAction) Format() string

type NotificationError

type NotificationError struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
}

Jump to

Keyboard shortcuts

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