models

package
v0.0.0-...-b77f4ed Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: Apache-2.0 Imports: 2 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"`
}

type Alerts

type Alerts []Alert

func (Alerts) Firing

func (as Alerts) Firing() []Alert

Firing Alerts 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"`
}

type GetTokenResponse

type GetTokenResponse struct {
	Errcode     int    `json:"errcode"`
	Errmsg      string `json:"errmsg"`
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

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 struct {
	*Data

	// The protocol version.
	Version  string `json:"version"`
	GroupKey string `json:"groupKey"`
}

type WechatNotification

type WechatNotification struct {
	Text    *WechatNotificationText `json:"text,omitempty"`
	Chatid  string                  `json:"chatid"`
	Msgtype string                  `json:"msgtype"`
}

type WechatNotificationButton

type WechatNotificationButton struct {
	ActionURL string `json:"actionURL"`
}

type WechatNotificationResponse

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

type WechatNotificationText

type WechatNotificationText struct {
	Content string `json:"content"`
}

Jump to

Keyboard shortcuts

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