webhookstructs

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WEBHOOK_TYPE_NEW_CALLBACK WEBHOOK_TYPE = "new_callback"
	WEBHOOK_TYPE_NEW_FEEDBACK              = "new_feedback"
	WEBHOOK_TYPE_NEW_STARTUP               = "new_startup"
	WEBHOOK_TYPE_NEW_ALERT                 = "new_alert"
	WEBHOOK_TYPE_NEW_CUSTOM                = "new_custom"
)
View Source
const EMIT_WEBHOOK_ROUTING_KEY_PREFIX = "emit_webhook"

Variables

View Source
var (
	AllWebhookData containerWebhookData
)
View Source
var HTTPClient = &http.Client{
	Timeout:   5 * time.Second,
	Transport: tr,
}

Functions

func GetRoutingKeyFor

func GetRoutingKeyFor(webhookType string) string

func SubmitWebRequest

func SubmitWebRequest(method string, url string, body interface{}) ([]byte, int, error)

Types

type NewAlertWebhookData

type NewAlertWebhookData struct {
	OperatorID int    `json:"operator_id"`
	Message    string `json:"message"`
	Source     string `json:"source"`
	Count      int    `json:"count"`
	Timestamp  string `json:"timestamp"`
}

type NewAlertWebhookMessage

type NewAlertWebhookMessage struct {
	Data NewAlertWebhookData `json:"data"`
	// contains filtered or unexported fields
}

type NewCallbackWebhookData

type NewCallbackWebhookData struct {
	User                 string `json:"user" mapstructure:"user"`
	Host                 string `json:"host" mapstructure:"host"`
	IPs                  string `json:"ips" mapstructure:"ips"`
	Domain               string `json:"domain" mapstructure:"domain"`
	ExternalIP           string `json:"external_ip" mapstructure:"external_ip"`
	ProcessName          string `json:"process_name" mapstructure:"process_name"`
	PID                  int    `json:"pid" mapstructure:"pid"`
	Os                   string `json:"os" mapstructure:"os"`
	Architecture         string `json:"architecture" mapstructure:"architecture"`
	AgentType            string `json:"agent_type" mapstructure:"agent_type"`
	Description          string `json:"description" mapstructure:"description"`
	ExtraInfo            string `json:"extra_info" mapstructure:"extra_info"`
	SleepInfo            string `json:"sleep_info" mapstructure:"sleep_info"`
	DisplayID            int    `json:"display_id" mapstructure:"display_id"`
	ID                   int    `json:"id" mapstructure:"id"`
	IntegrityLevel       int    `json:"integrity_level" mapstructure:"integrity_level"`
	Cwd                  string `json:"cwd" mapstructure:"cwd"`
	ImpersonationContext string `json:"impersonation_context" mapstructure:"impersonation_context"`
}

type NewCallbackWebookMessage

type NewCallbackWebookMessage struct {
	Data NewCallbackWebhookData `json:"data"`
	// contains filtered or unexported fields
}

type NewCustomWebhookMessage

type NewCustomWebhookMessage struct {
	Data map[string]string `json:"data"`
	// contains filtered or unexported fields
}

type NewFeedbackWebhookData

type NewFeedbackWebhookData struct {
	TaskID        *int   `json:"task_id,omitempty"`
	TaskDisplayID *int   `json:"display_id,omitempty"`
	Message       string `json:"message"`
	FeedbackType  string `json:"feedback_type"`
}

type NewFeedbackWebookMessage

type NewFeedbackWebookMessage struct {
	Data NewFeedbackWebhookData `json:"data"`
	// contains filtered or unexported fields
}

type NewStartupWebhookData

type NewStartupWebhookData struct {
	StartupMessage string `json:"startup_message"`
}

type NewStartupWebhookMessage

type NewStartupWebhookMessage struct {
	Data NewStartupWebhookData `json:"data"`
	// contains filtered or unexported fields
}

type SlackWebhookMessage

type SlackWebhookMessage struct {
	Channel     string                          `json:"channel"`
	Username    string                          `json:"username"`
	IconEmoji   string                          `json:"icon_emoji"`
	Attachments []SlackWebhookMessageAttachment `json:"attachments"`
}

func GetNewDefaultWebhookMessage

func GetNewDefaultWebhookMessage() SlackWebhookMessage

type SlackWebhookMessageAttachment

type SlackWebhookMessageAttachment struct {
	Title  string                                `json:"fallback"`
	Color  string                                `json:"color,omitempty"`
	Blocks *[]SlackWebhookMessageAttachmentBlock `json:"blocks,omitempty"`
}

type SlackWebhookMessageAttachmentBlock

type SlackWebhookMessageAttachmentBlock struct {
	Type   string                                    `json:"type"`
	Text   *SlackWebhookMessageAttachmentBlockText   `json:"text,omitempty"`
	Fields *[]SlackWebhookMessageAttachmentBlockText `json:"fields,omitempty"`
}

type SlackWebhookMessageAttachmentBlockText

type SlackWebhookMessageAttachmentBlockText struct {
	Type string `json:"type,omitempty"`
	Text string `json:"text,omitempty"`
}

type WEBHOOK_TYPE

type WEBHOOK_TYPE = string

type WebhookDefinition

type WebhookDefinition struct {
	Name        string
	Description string
	// SemVer is a specific semantic version tracker you can use for your payload type
	SemVer                   string `json:"semver"`
	WebhookURL               string
	WebhookChannel           string
	NewFeedbackFunction      func(input NewFeedbackWebookMessage)
	NewCallbackFunction      func(input NewCallbackWebookMessage)
	NewStartupFunction       func(input NewStartupWebhookMessage)
	NewAlertFunction         func(input NewAlertWebhookMessage)
	NewCustomFunction        func(input NewCustomWebhookMessage)
	Subscriptions            []string
	OnContainerStartFunction func(sharedStructs.ContainerOnStartMessage) sharedStructs.ContainerOnStartMessageResponse
}

Jump to

Keyboard shortcuts

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