models

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Status       string    `json:"status"`
	Labels       KV        `json:"labels"`
	Annotations  KV        `json:"annotations"`
	StartsAt     time.Time `json:"startsAt"`
	EndsAt       time.Time `json:"endsAt"`
	GeneratorURL string    `json:"generatorURL"`
	Fingerprint  string    `json:"fingerprint"`
}

Alert holds one alert for notification templates.

type Alerts

type Alerts []Alert

Alerts is a list of Alert objects.

func (Alerts) Firing

func (as Alerts) Firing() []Alert

Firing returns the subset of alerts that are firing.

func (Alerts) Resolved

func (as Alerts) Resolved() []Alert

Resolved returns the subset of alerts that are resolved.

type Data

type Data struct {
	Receiver string `json:"receiver"`
	Status   string `json:"status"`
	Alerts   Alerts `json:"alerts"`

	GroupLabels       KV `json:"groupLabels"`
	CommonLabels      KV `json:"commonLabels"`
	CommonAnnotations KV `json:"commonAnnotations"`

	ExternalURL string `json:"externalURL"`
}

Data is the data passed to notification templates and webhook pushes.

End-users should not be exposed to Go's type system, as this will confuse them and prevent simple things like simple equality checks to fail. Map everything to float64/string.

type DingTalkNotification

type DingTalkNotification struct {
	MessageType string                          `json:"msgtype"`
	Text        *DingTalkNotificationText       `json:"text,omitempty"`
	Link        *DingTalkNotificationLink       `json:"link,omitempty"`
	Markdown    *DingTalkNotificationMarkdown   `json:"markdown,omitempty"`
	ActionCard  *DingTalkNotificationActionCard `json:"actionCard,omitempty"`
	At          *DingTalkNotificationAt         `json:"at,omitempty"`
}

type DingTalkNotificationActionCard

type DingTalkNotificationActionCard struct {
	Title             string                       `json:"title"`
	Text              string                       `json:"text"`
	HideAvatar        string                       `json:"hideAvatar"`
	ButtonOrientation string                       `json:"btnOrientation"`
	Buttons           []DingTalkNotificationButton `json:"btns,omitempty"`
	SingleTitle       string                       `json:"singleTitle,omitempty"`
	SingleURL         string                       `json:"singleURL"`
}

type DingTalkNotificationAt

type DingTalkNotificationAt struct {
	AtMobiles []string `json:"atMobiles,omitempty"`
	IsAtAll   bool     `json:"isAtAll,omitempty"`
}

type DingTalkNotificationButton

type DingTalkNotificationButton struct {
	Title     string `json:"title"`
	ActionURL string `json:"actionURL"`
}
type DingTalkNotificationLink struct {
	Title      string `json:"title"`
	Text       string `json:"text"`
	MessageURL string `json:"messageUrl"`
	PictureURL string `json:"picUrl"`
}

type DingTalkNotificationMarkdown

type DingTalkNotificationMarkdown struct {
	Title string `json:"title"`
	Text  string `json:"text"`
}

type DingTalkNotificationResponse

type DingTalkNotificationResponse struct {
	ErrorMessage string `json:"errmsg"`
	ErrorCode    int    `json:"errcode"`
}

type DingTalkNotificationText

type DingTalkNotificationText struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

type KV

type KV map[string]string

KV is a set of key/value string pairs.

func (KV) Names

func (kv KV) Names() []string

Names returns the names of the label names in the LabelSet.

func (KV) Remove

func (kv KV) Remove(keys []string) KV

Remove returns a copy of the key/value set without the given keys.

func (KV) SortedPairs

func (kv KV) SortedPairs() Pairs

SortedPairs returns a sorted list of key/value pairs.

func (KV) Values

func (kv KV) Values() []string

Values returns a list of the values in the LabelSet.

type Pair

type Pair struct {
	Name, Value string
}

Pair is a key/value string pair.

type Pairs

type Pairs []Pair

Pairs is a list of key/value string pairs.

func (Pairs) Names

func (ps Pairs) Names() []string

Names returns a list of names of the pairs.

func (Pairs) Values

func (ps Pairs) Values() []string

Values returns a list of values of the pairs.

type WebhookMessage

type WebhookMessage Data

Jump to

Keyboard shortcuts

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