slack

package
v0.0.0-...-8c5716a Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTimeout is the default HTTP client timeout for Slack webhook requests
	DefaultTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func SendWebhook

func SendWebhook(ctx context.Context, webhookURL string, payload interface{}) error

SendWebhook is a package-level convenience function that sends a payload using the default client

Types

type AnalysisResult

type AnalysisResult struct {
	Status   string         `json:"status"`
	Content  string         `json:"content"`
	Metadata map[string]any `json:"metadata,omitempty"`
	Error    string         `json:"error,omitempty"`
	Prompt   string         `json:"prompt,omitempty"`
}

AnalysisResult represents the analysis output passed to reporters.

type ArtifactLink struct {
	Name string
	URL  string
	Size int64
}

ArtifactLink represents a single uploaded artifact with its presigned URL.

type Client

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

Client provides methods for interacting with Slack webhooks

func NewClient

func NewClient() *Client

NewClient creates a new Slack client with default settings

func NewClientWithTimeout

func NewClientWithTimeout(timeout time.Duration) *Client

NewClientWithTimeout creates a new Slack client with a custom timeout

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, webhookURL string, text string) error

SendMessage is a convenience method to send a simple text message to Slack

func (*Client) SendWebhook

func (c *Client) SendWebhook(ctx context.Context, webhookURL string, payload interface{}) error

SendWebhook sends a JSON payload to a Slack webhook URL payload can be any struct that will be marshaled to JSON

type ClusterInfo

type ClusterInfo struct {
	ID            string
	Name          string
	Provider      string
	Region        string
	CloudProvider string
	Version       string
	Expiration    string
}

ClusterInfo holds cluster information for reporting

type NotificationConfig

type NotificationConfig struct {
	Enabled   bool             `json:"enabled" yaml:"enabled"`
	Reporters []ReporterConfig `json:"reporters" yaml:"reporters"`
}

NotificationConfig holds configuration for notification settings

func BuildNotificationConfig

func BuildNotificationConfig(webhook string, channel string, clusterInfo interface{}, reportDir string) *NotificationConfig

BuildNotificationConfig creates notification configuration for log analysis.

type ReporterConfig

type ReporterConfig struct {
	Type     string                 `json:"type" yaml:"type"`
	Enabled  bool                   `json:"enabled" yaml:"enabled"`
	Settings map[string]interface{} `json:"settings" yaml:"settings"`
}

ReporterConfig holds configuration for different reporter implementations

func SlackReporterConfig

func SlackReporterConfig(webhookURL string, enabled bool) ReporterConfig

SlackReporterConfig creates a reporter config for Slack

type SlackReporter

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

SlackReporter implements Reporter interface for Slack webhook notifications

func NewSlackReporter

func NewSlackReporter() *SlackReporter

NewSlackReporter creates a new Slack reporter

func (*SlackReporter) Name

func (s *SlackReporter) Name() string

Name returns the reporter identifier

func (*SlackReporter) Report

func (s *SlackReporter) Report(ctx context.Context, result *AnalysisResult, config *ReporterConfig) error

Report sends the analysis result to Slack via webhook

type WorkflowPayload

type WorkflowPayload struct {
	Channel        string `json:"channel"`
	Summary        string `json:"summary"`
	Analysis       string `json:"analysis"`
	ExtendedLogs   string `json:"extended_logs,omitempty"`
	ClusterDetails string `json:"cluster_details,omitempty"`
	Image          string `json:"image,omitempty"`
	Env            string `json:"env,omitempty"`
	Commit         string `json:"commit,omitempty"`
	TektonURL      string `json:"tekton_url,omitempty"`
	RepoLink       string `json:"repo_link"`
	LogLink        string `json:"log_link"`
	JunitXMLLink   string `json:"junit_xml_link"`
}

WorkflowPayload represents the Slack workflow webhook payload

Jump to

Keyboard shortcuts

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