sink

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 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, event event.Event, eventSources []string) (err error)

SendEvent sends event notification to Elasticsearch

func (*Elasticsearch) SendGenericMessage added in v0.16.0

func (e *Elasticsearch) SendGenericMessage(_ context.Context, _ interactive.GenericMessage, _ []string) error

SendGenericMessage is no-op.

func (*Elasticsearch) SendMessageToAll added in v0.16.0

func (e *Elasticsearch) SendMessageToAll(_ context.Context, _ interactive.Message) error

SendMessageToAll is no-op.

func (*Elasticsearch) Type

Type describes the notifier type.

type EventMeta

type EventMeta struct {
	Kind      string `json:"kind"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Cluster   string `json:"cluster,omitempty"`
}

EventMeta contains the metadata about the event occurred

type EventStatus

type EventStatus struct {
	Type     config.EventType `json:"type"`
	Level    config.Level     `json:"level"`
	Reason   string           `json:"reason,omitempty"`
	Error    string           `json:"error,omitempty"`
	Messages []string         `json:"messages,omitempty"`
}

EventStatus contains the status about the event occurred

type Sink

type Sink interface {
	notifier.Notifier
}

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, event event.Event, eventSources []string) (err error)

SendEvent sends event notification to Webhook url

func (*Webhook) SendGenericMessage added in v0.16.0

func (w *Webhook) SendGenericMessage(_ context.Context, _ interactive.GenericMessage, _ []string) error

SendGenericMessage is no-op.

func (*Webhook) SendMessageToAll added in v0.16.0

func (w *Webhook) SendMessageToAll(_ context.Context, _ interactive.Message) error

SendMessageToAll is no-op.

func (*Webhook) Type

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

Type describes the notifier type.

type WebhookPayload

type WebhookPayload struct {
	EventMeta       EventMeta   `json:"meta"`
	EventStatus     EventStatus `json:"status"`
	EventSummary    string      `json:"summary"`
	TimeStamp       time.Time   `json:"timestamp"`
	Recommendations []string    `json:"recommendations,omitempty"`
	Warnings        []string    `json:"warnings,omitempty"`
}

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
JackTT - Gopher 🇻🇳