card

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseTemplateFile

func ParseTemplateFile(f string) (*template.Template, error)
ParseTemplateFile creates an alertmanager template from the given file.

The functions include all functions (except 'env' and 'expandenv' ) from sprig (http://masterminds.github.io/sprig/) and the following functions from HELM templating:

  • toToml
  • toYaml
  • fromYaml
  • toJson
  • fromJson

Types

type Action added in v1.3.4

type Action map[string]interface{}

Action represents https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#actions It is currently impossible to support each type in one struct. This is Go's limitation.

type Converter

type Converter interface {
	Convert(context.Context, webhook.Message) (Office365ConnectorCard, error)
}

Converter converts an alert manager webhook message to Office365ConnectorCard.

func NewCreatorLoggingMiddleware

func NewCreatorLoggingMiddleware(l log.Logger, n Converter) Converter

NewCreatorLoggingMiddleware creates a loggingMiddleware.

func NewTemplatedCardCreator

func NewTemplatedCardCreator(template *template.Template, escapeUnderscores bool) Converter

NewTemplatedCardCreator creates a templatedCard.

type FactSection added in v1.3.4

type FactSection struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Image added in v1.3.4

type Image struct {
	Image string `json:"image,omitempty"`
	Title string `json:"title,omitempty"`
}

Image represents https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#image-object

type Office365ConnectorCard added in v1.3.4

type Office365ConnectorCard struct {
	Context         string    `json:"@context"`
	Type            string    `json:"@type"`
	Title           string    `json:"title"`
	ExpectedActors  []string  `json:"expectedActors,omitempty"`
	Text            string    `json:"text"`
	Summary         string    `json:"summary"`
	ThemeColor      string    `json:"themeColor"`
	Sections        []Section `json:"sections,omitempty"`
	PotentialAction []Action  `json:"potentialAction,omitempty"`
}

Office365ConnectorCard represents https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#example-office-365-connector-card

type Section added in v1.3.4

type Section struct {
	Title            string        `json:"title,omitempty"`
	ActivityTitle    string        `json:"activityTitle,omitempty"`
	ActivityText     string        `json:"activityText,omitempty"`
	ActivitySubtitle string        `json:"activitySubtitle,omitempty"`
	ActivityImage    string        `json:"activityImage,omitempty"`
	Text             string        `json:"text,omitempty"`
	Markdown         bool          `json:"markdown"`
	Facts            []FactSection `json:"facts,omitempty"`
	Images           []Image       `json:"images,omitempty"`
	PotentialAction  []Action      `json:"potentialAction,omitempty"`
}

Section represents https://docs.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#section-fields

Jump to

Keyboard shortcuts

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