webhook

package
v1.27.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSink

func NewSink(logger *zap.Logger, webhookClient Client) audit.Sink

NewSink is the constructor for a Sink.

Types

type Client

type Client interface {
	SendAudit(ctx context.Context, e audit.Event) error
}

Client is the client-side contract for sending an audit to a configured sink.

type ClientOption

type ClientOption func(h *HTTPClient)

func WithMaxBackoffDuration

func WithMaxBackoffDuration(maxBackoffDuration time.Duration) ClientOption

WithMaxBackoffDuration allows for a configurable backoff duration configuration.

type HTTPClient

type HTTPClient struct {
	*http.Client
	// contains filtered or unexported fields
}

HTTPClient allows for sending the event payload to a configured webhook service.

func NewHTTPClient

func NewHTTPClient(logger *zap.Logger, url, signingSecret string, opts ...ClientOption) *HTTPClient

NewHTTPClient is the constructor for a HTTPClient.

func (*HTTPClient) SendAudit

func (w *HTTPClient) SendAudit(ctx context.Context, e audit.Event) error

SendAudit will send an audit event to a configured server at a URL.

type Sink

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

Sink is a structure in charge of sending Audits to a configured webhook at a URL.

func (*Sink) Close

func (w *Sink) Close() error

func (*Sink) SendAudits

func (w *Sink) SendAudits(ctx context.Context, events []audit.Event) error

func (*Sink) String

func (w *Sink) String() string

Jump to

Keyboard shortcuts

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