decoder

package
v0.0.0-...-e358696 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Copyright 2024 CloudDetail SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

View Source
var PagerDutyStatusMap = map[string]string{
	"triggered": alert.StatusFiring,
	"resolved":  alert.StatusResolved,
}

Functions

func Decode

func Decode(sourceFrom ainput.SourceFrom, data []byte) ([]ainput.AlertEvent, error)

func DecodeEvent

func DecodeEvent(input map[string]interface{}, result interface{}) error

func ToTimeHookFunc

func ToTimeHookFunc() mapstructure.DecodeHookFunc

Types

type Agent

type Agent struct {
	HtmlURL string `json:"html_url"`
	ID      string `json:"id"`
	Self    string `json:"self"`
	Summary string `json:"summary"`
	Type    string `json:"type"`
}

type Client

type Client struct {
	Name string `json:"name"`
}

type DatadogDecoder

type DatadogDecoder struct{}

func (DatadogDecoder) Decode

func (d DatadogDecoder) Decode(sourceFrom alert.SourceFrom, data []byte) ([]alert.AlertEvent, error)

type DatadogPayload

type DatadogPayload struct {
	AlertID         string `json:"alert_id"`
	AggRegKey       string `json:"agg_reg_key"`
	AlertType       string `json:"alert_type"`
	AlertQuery      string `json:"alert_query"`
	AlertTitle      string `json:"alert_title"`
	AlertCircleKey  string `json:"alert_cycle_key"`
	AlertTransition string `json:"alert_transition"`
	ID              string `json:"id"` // EventID
	EventTitle      string `json:"event_title"`
	EventType       string `json:"event_type"`
	EventMsg        string `json:"event_msg"`
	LastUpdated     string `json:"last_updated"`
	AlertPriority   string `json:"alert_priority"`
	Tags            string `json:"tags"`
	Date            string `json:"date"`
	OrgID           string `json:"org_id"`
	OrgName         string `json:"org_name"`
}

type Decoder

type Decoder interface {
	Decode(sourceFrom ainput.SourceFrom, data []byte) ([]ainput.AlertEvent, error)
}

type ErrDecoderNotFound

type ErrDecoderNotFound struct {
	InputType string
}

func (ErrDecoderNotFound) Error

func (e ErrDecoderNotFound) Error() string

type JsonDecoder

type JsonDecoder struct{}

func (JsonDecoder) Decode

func (d JsonDecoder) Decode(sourceFrom alert.SourceFrom, data []byte) ([]alert.AlertEvent, error)

type PagerDutyDecoder

type PagerDutyDecoder struct{}

func (PagerDutyDecoder) Decode

func (d PagerDutyDecoder) Decode(sourceFrom alert.SourceFrom, data []byte) ([]alert.AlertEvent, error)

type PagerDutyEvent

type PagerDutyEvent struct {
	Event struct {
		ID           string      `json:"id"`
		EventType    string      `json:"event_type"`
		ResourceType string      `json:"resource_type"`
		OccurredAt   string      `json:"occurred_at"`
		Agent        Agent       `json:"agent"`
		Client       Client      `json:"client"`
		Data         pd.Incident `json:"data"`
	} `json:"event"`
}

type PrometheusDecoder

type PrometheusDecoder struct{}

func (PrometheusDecoder) Decode

func (d PrometheusDecoder) Decode(sourceFrom alert.SourceFrom, data []byte) ([]alert.AlertEvent, error)

type ZabbixDecoder

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

func (ZabbixDecoder) Decode

func (d ZabbixDecoder) Decode(sourceFrom alert.SourceFrom, data []byte) ([]alert.AlertEvent, error)

Jump to

Keyboard shortcuts

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