opsgenie

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SendTags    = "tags"
	SendDetails = "details"
	SendBoth    = "both"

	DefaultAlertsURL = "https://api.opsgenie.com/v2/alerts"
)
View Source
const FullValidConfigForTesting = `` /* 416-byte string literal not displayed */

FullValidConfigForTesting is a string representation of a JSON object that contains all fields supported by the notifier Config. It can be used without secrets.

View Source
const FullValidSecretsForTesting = `{
	"apiKey": "test-secret-api-key"
}`

FullValidSecretsForTesting is a string representation of JSON object that contains all fields that can be overridden from secrets

Variables

View Source
var SupportedResponderTypes = []string{"team", "teams", "user", "escalation", "schedule"}
View Source
var (
	ValidPriorities = map[string]bool{"P1": true, "P2": true, "P3": true, "P4": true, "P5": true}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	APIKey           string
	APIUrl           string
	Message          string
	Description      string
	AutoClose        bool
	OverridePriority bool
	SendTagsAs       string
	Responders       []MessageResponder
}

func NewConfig

func NewConfig(jsonData json.RawMessage, decryptFn receivers.DecryptFunc) (Config, error)

type MessageResponder

type MessageResponder struct {
	ID       string `json:"id,omitempty" yaml:"id,omitempty"`
	Name     string `json:"name,omitempty" yaml:"name,omitempty"`
	Username string `json:"username,omitempty" yaml:"username,omitempty"`
	Type     string `json:"type" yaml:"type"` // team, user, escalation, schedule etc.
}

type Notifier

type Notifier struct {
	*receivers.Base
	// contains filtered or unexported fields
}

Notifier is responsible for sending alert notifications to Opsgenie.

func New

func New(cfg Config, meta receivers.Metadata, template *templates.Template, sender receivers.WebhookSender, images images.Provider, logger logging.Logger) *Notifier

func (*Notifier) Notify

func (on *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)

Notify sends an alert notification to Opsgenie

func (*Notifier) SendResolved

func (on *Notifier) SendResolved() bool

Jump to

Keyboard shortcuts

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