exporters

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2019 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter interface {
	// Send a message through the exporter.
	Send(c context.Context, client *http.Client, message msg.Message) error

	// Return a new line as a string for the exporter.
	NewLine() string

	// Return a link formatted for the exporter.
	FormatLink(link string, name string) string

	// Returns the name of the exporter.
	Name() string
}

An exporter sends a formatted event to an upstream.

type FakeExporter

type FakeExporter struct {
	Sent []msg.Message
}
func (f *FakeExporter) FormatLink(link string, name string) string

func (*FakeExporter) Name

func (f *FakeExporter) Name() string

func (*FakeExporter) NewLine

func (f *FakeExporter) NewLine() string

func (*FakeExporter) Send

func (f *FakeExporter) Send(_ context.Context, _ *http.Client, message msg.Message) error

type MSTeams added in v0.3.7

type MSTeams struct {
	Url string
}

The MSTeams exporter sends Flux events to a Microsoft Teams channel via a webhook.

func NewMSTeams added in v0.3.7

func NewMSTeams(config config.Config) (*MSTeams, error)

Initialize a new MSTeams instance

func (s *MSTeams) FormatLink(link string, name string) string

Return a formatted link for MS Teams.

func (*MSTeams) Name added in v0.3.7

func (s *MSTeams) Name() string

Return the name of the exporter.

func (*MSTeams) NewLine added in v0.3.7

func (s *MSTeams) NewLine() string

Return the new line character for MS Teams messages

func (*MSTeams) NewMSTeamsMessage added in v0.3.7

func (s *MSTeams) NewMSTeamsMessage(message msg.Message) MSTeamsMessage

Convert a flux event into a MS Teams message

func (*MSTeams) Send added in v0.3.7

func (s *MSTeams) Send(ctx context.Context, client *http.Client, message msg.Message) error

Send a MSTeamsMessage to MS Teams

type MSTeamsAction added in v0.3.7

type MSTeamsAction struct {
	Type    string                `json:"@type"`
	Name    string                `json:"name"`
	Targets []MSTeamsActionTarget `json:"targets"`
}

Represents an action embedded in a MS Teams message

type MSTeamsActionTarget added in v0.3.7

type MSTeamsActionTarget struct {
	OS  string `json:"os"`
	URI string `json:"uri"`
}

Represents a slack channel and the Kubernetes namespace linked to it

type MSTeamsMessage added in v0.3.7

type MSTeamsMessage struct {
	Context    string          `json:"@context"`
	Type       string          `json:"@type"`
	ThemeColor string          `json:"themeColor"`
	Title      string          `json:"title"`
	Text       string          `json:"text"`
	Actions    []MSTeamsAction `json:"potentialAction"`
}

Represents a MS Teams message sent to the API

type Matrix added in v0.3.1

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

The Matrix exporter sends Flux events to a Matrix channel.

func NewMatrix added in v0.3.1

func NewMatrix(config config.Config) (*Matrix, error)

Initialize a new Matrix instance

func (s *Matrix) FormatLink(link string, name string) string

Return a formatted link for Matrix.

func (*Matrix) GetUrl added in v0.3.1

func (s *Matrix) GetUrl() (string, error)

func (*Matrix) Name added in v0.3.1

func (s *Matrix) Name() string

Return the name of the exporter.

func (*Matrix) NewLine added in v0.3.1

func (s *Matrix) NewLine() string

Return the new line character for Matrix messages

func (*Matrix) Send added in v0.3.1

func (s *Matrix) Send(c context.Context, client *http.Client, message msg.Message) error

Send a Message to Matrix

type MatrixMessage added in v0.3.1

type MatrixMessage struct {
	MsgType       string `json:"msgtype"`
	Format        string `json:"format"`
	FormattedBody string `json:"formatted_body"`
	Body          string `json:"body"`
}

type Slack

type Slack struct {
	Url       string
	Username  string
	Token     string
	Channels  []SlackChannel
	IconEmoji string
}

The Slack exporter sends Flux events to a Slack channel via a webhook.

func NewSlack

func NewSlack(config config.Config) (*Slack, error)

Initialize a new Slack instance

func (s *Slack) FormatLink(link string, name string) string

Return a formatted link for Slack.

func (*Slack) Name

func (s *Slack) Name() string

Return the name of the exporter.

func (*Slack) NewLine

func (s *Slack) NewLine() string

Return the new line character for Slack messages

func (*Slack) NewSlackMessage

func (s *Slack) NewSlackMessage(message msg.Message) []SlackMessage

Convert a flux event into a Slack message(s)

func (*Slack) Send

func (s *Slack) Send(c context.Context, client *http.Client, message msg.Message) error

Send a SlackMessage to Slack

type SlackAttachment

type SlackAttachment struct {
	Color     string `json:"color"`
	Title     string `json:"title"`
	TitleLink string `json:"title_link"`
	Text      string `json:"text"`
}

Represents a section of a slack message that is sent to the API

type SlackChannel added in v0.2.10

type SlackChannel struct {
	Channel   string `json:"channel"`
	Namespace string `json:"namespace"`
}

Represents a slack channel and the Kubernetes namespace linked to it

type SlackMessage

type SlackMessage struct {
	Channel     string            `json:"channel"`
	IconEmoji   string            `json:"icon_emoji"`
	Username    string            `json:"username"`
	Attachments []SlackAttachment `json:"attachments"`
}

Represents a slack message sent to the API

type Webhook

type Webhook struct {
	Url string
}

The Webhook exporter sends Flux events to a Webhook channel via a webhook.

func NewWebhook

func NewWebhook(config config.Config) (*Webhook, error)

Initialize a new Webhook instance

func (s *Webhook) FormatLink(link string, name string) string

Return a formatted link for Webhook.

func (*Webhook) Name

func (s *Webhook) Name() string

Return the name of the exporter.

func (*Webhook) NewLine

func (s *Webhook) NewLine() string

Return the new line character for Webhook messages

func (*Webhook) Send

func (s *Webhook) Send(c context.Context, client *http.Client, message msg.Message) error

Send a WebhookMessage to Webhook

Jump to

Keyboard shortcuts

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