sink

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyticsReporter

type AnalyticsReporter interface {
	// ReportSinkEnabled reports an enabled sink.
	ReportSinkEnabled(platform config.CommPlatformIntegration) error
}

AnalyticsReporter defines a reporter that collects analytics data for sinks.

type Elasticsearch

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

Elasticsearch provides integration with the Elasticsearch solution.

func NewElasticsearch

func NewElasticsearch(log logrus.FieldLogger, c config.Elasticsearch, reporter AnalyticsReporter) (*Elasticsearch, error)

NewElasticsearch creates a new Elasticsearch instance.

func (*Elasticsearch) IntegrationName

func (e *Elasticsearch) IntegrationName() config.CommPlatformIntegration

IntegrationName describes the notifier integration name.

func (*Elasticsearch) SendEvent

func (e *Elasticsearch) SendEvent(ctx context.Context, rawData any, sources []string) error

SendEvent sends an event to a configured elasticsearch server.

func (*Elasticsearch) Type

Type describes the notifier type.

type Sink

type Sink interface {
	notifier.Sink
}

Sink sends messages to communication channels. It is a one-way integration.

type Webhook

type Webhook struct {
	URL      string
	Bindings config.SinkBindings
	// contains filtered or unexported fields
}

Webhook provides functionality to notify external service about new events.

func NewWebhook

func NewWebhook(log logrus.FieldLogger, c config.Webhook, reporter AnalyticsReporter) (*Webhook, error)

NewWebhook creates a new Webhook instance.

func (*Webhook) IntegrationName

func (w *Webhook) IntegrationName() config.CommPlatformIntegration

IntegrationName describes the notifier integration name.

func (*Webhook) PostWebhook

func (w *Webhook) PostWebhook(ctx context.Context, jsonPayload *WebhookPayload) (err error)

PostWebhook posts webhook to listener

func (*Webhook) SendEvent

func (w *Webhook) SendEvent(ctx context.Context, rawData any, sources []string) error

SendEvent sends an event to a configured server.

func (*Webhook) Type

func (w *Webhook) Type() config.IntegrationType

Type describes the notifier type.

type WebhookPayload

type WebhookPayload struct {
	Source    string    `json:"source,omitempty"`
	Data      any       `json:"data,omitempty"`
	TimeStamp time.Time `json:"timeStamp"`
}

WebhookPayload contains json payload to be sent to webhook url

Jump to

Keyboard shortcuts

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