Documentation
¶
Index ¶
- func FormatDiscord(e *event.Event) ([]byte, error)
- type DiscordMessageEmbed
- type DiscordMessageEmbedField
- type DiscordWebhookEvent
- type WebhookOptionFunc
- func WithBasicAuth(username, password string) WebhookOptionFunc
- func WithDurableQueue(path string, maxPending int) WebhookOptionFunc
- func WithFormat(format string) WebhookOptionFunc
- func WithLogger(logger plugin.Logger) WebhookOptionFunc
- func WithRetryConfig(maxRetries int, initialBackoff, maxBackoff time.Duration) WebhookOptionFunc
- func WithUrl(url string, skipVerify bool) WebhookOptionFunc
- type WebhookOutput
- func (w *WebhookOutput) Role() plugin.PluginType
- func (w *WebhookOutput) SendWebhook(e *event.Event) error
- func (w *WebhookOutput) SetDeliveryMetrics(observer plugin.DeliveryMetricsObserver)
- func (w *WebhookOutput) SetHTTPClient(client *http.Client)
- func (w *WebhookOutput) SetProcessingObserver(observer func())
- func (w *WebhookOutput) Start() error
- func (w *WebhookOutput) StartContext(ctx context.Context) error
- func (w *WebhookOutput) Stop() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DiscordMessageEmbed ¶
type DiscordMessageEmbed struct {
URL string `json:"url,omitempty"`
Title string `json:"title,omitempty"`
Fields []*DiscordMessageEmbedField `json:"fields,omitempty"`
}
type DiscordWebhookEvent ¶
type DiscordWebhookEvent struct {
Content string `json:"content,omitempty"`
Embeds []*DiscordMessageEmbed `json:"embeds,omitempty"`
}
type WebhookOptionFunc ¶
type WebhookOptionFunc func(*WebhookOutput)
func WithBasicAuth ¶
func WithBasicAuth(username, password string) WebhookOptionFunc
WithBasicAuth specifies the username and password
func WithDurableQueue ¶ added in v0.47.0
func WithDurableQueue(path string, maxPending int) WebhookOptionFunc
WithDurableQueue stores pending webhook deliveries in a SQLite database.
func WithFormat ¶
func WithFormat(format string) WebhookOptionFunc
WithFormat specifies the output webhook format
func WithLogger ¶
func WithLogger(logger plugin.Logger) WebhookOptionFunc
WithLogger specifies the logger object to use for logging messages
func WithRetryConfig ¶ added in v0.36.0
func WithRetryConfig( maxRetries int, initialBackoff, maxBackoff time.Duration, ) WebhookOptionFunc
WithRetryConfig specifies the retry configuration for webhook delivery
func WithUrl ¶
func WithUrl(url string, skipVerify bool) WebhookOptionFunc
WithUrl specifies the webhook URL
type WebhookOutput ¶
func New ¶
func New(options ...WebhookOptionFunc) *WebhookOutput
func (*WebhookOutput) Role ¶ added in v0.46.0
func (w *WebhookOutput) Role() plugin.PluginType
Role identifies this plugin as a pipeline output.
func (*WebhookOutput) SendWebhook ¶
func (w *WebhookOutput) SendWebhook(e *event.Event) error
func (*WebhookOutput) SetDeliveryMetrics ¶ added in v0.47.0
func (w *WebhookOutput) SetDeliveryMetrics( observer plugin.DeliveryMetricsObserver, )
SetDeliveryMetrics connects this output to its owning pipeline's aggregate metrics. Call before Start or SendWebhook.
func (*WebhookOutput) SetHTTPClient ¶ added in v0.47.0
func (w *WebhookOutput) SetHTTPClient(client *http.Client)
SetHTTPClient supplies an instance-owned HTTP policy. Call before Start. The client must enforce request deadlines and any required destination and redirect restrictions, including response body reads. An injected transport may wait for a provider quota before starting its request deadline.
func (*WebhookOutput) SetProcessingObserver ¶ added in v0.47.0
func (w *WebhookOutput) SetProcessingObserver(observer func())
SetProcessingObserver observes completion of each supported event's processing. It does not acknowledge external delivery. Configure before Start; the callback must not block, mutate the plugin, or call Stop.
func (*WebhookOutput) StartContext ¶ added in v0.46.0
func (w *WebhookOutput) StartContext(ctx context.Context) error
StartContext starts the plugin with ctx governing setup and run operations. Call Stop to wait for workers and release resources, including after cancellation.