Documentation
¶
Index ¶
- Constants
- type AlertManagerAlert
- type Alertmanager
- type AzureDevOps
- type AzureEventHub
- type Bitbucket
- type DataDog
- type Discord
- type Factory
- type Forwarder
- type GitHub
- type GitHubDispatch
- type GitLab
- type Gitea
- type GoogleChat
- type GoogleChatCard
- type GoogleChatCardHeader
- type GoogleChatCardSection
- type GoogleChatCardWidget
- type GoogleChatCardWidgetKeyValue
- type GoogleChatCardWidgetTextParagraph
- type GoogleChatPayload
- type GooglePubSub
- type Grafana
- type GraphitePayload
- type Interface
- type Lark
- type LarkCard
- type LarkConfig
- type LarkElement
- type LarkHeader
- type LarkPayload
- type LarkText
- type LarkTitle
- type MSTeams
- type MSTeamsField
- type MSTeamsPayload
- type MSTeamsSection
- type Matrix
- type MatrixPayload
- type NopNotifier
- type Opsgenie
- type OpsgenieAlert
- type PagerDuty
- type PureJWT
- type Rocket
- type Sentry
- type Slack
- type SlackAttachment
- type SlackField
- type SlackPayload
- type Telegram
- type Webex
- type WebexPayload
Constants ¶
const NotificationHeader = "gotk-component"
NotificationHeader is a header sent to identify requests from the notification controller.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertManagerAlert ¶
type Alertmanager ¶
func NewAlertmanager ¶
type AzureDevOps ¶
AzureDevOps is an Azure DevOps notifier.
func NewAzureDevOps ¶
func NewAzureDevOps(providerUID string, addr string, token string, certPool *x509.CertPool) (*AzureDevOps, error)
NewAzureDevOps creates and returns a new AzureDevOps notifier.
type AzureEventHub ¶
AzureEventHub holds the eventhub client
func NewAzureEventHub ¶
func NewAzureEventHub(endpointURL, token, eventHubNamespace string) (*AzureEventHub, error)
NewAzureEventHub creates a eventhub client
type Bitbucket ¶
Bitbucket is a Bitbucket Server notifier.
type DataDog ¶
type DataDog struct {
// contains filtered or unexported fields
}
func NewDataDog ¶
func NewDataDog(address string, proxyUrl string, certPool *x509.CertPool, token string) (*DataDog, error)
NewDataDog creates a new DataDog provider by mapping the notification provider API to sensible values for the DataDog API. url: The DataDog API endpoint to use. Examples: https://api.datadoghq.com, https://api.datadoghq.eu, etc. token: The DataDog API key (not the application key). headers: A map of extra tags to add to the event
type Discord ¶
Discord holds the hook URL
func NewDiscord ¶
NewDiscord validates the URL and returns a Discord object
type Factory ¶
type Factory struct {
URL string
ProxyURL string
Username string
Channel string
Token string
Headers map[string]string
CertPool *x509.CertPool
Password string
ProviderUID string
}
func NewFactory ¶
type Forwarder ¶
type Forwarder struct {
URL string
ProxyURL string
Headers map[string]string
CertPool *x509.CertPool
HMACKey []byte
}
Forwarder is an implementation of the notification Interface that posts the body as an HTTP request using an optional proxy.
func NewForwarder ¶
type GitHubDispatch ¶
func NewGitHubDispatch ¶
type Gitea ¶
type Gitea struct {
BaseURL string
Token string
Owner string
Repo string
ProviderUID string
Client *gitea.Client
Debug bool
}
type GoogleChat ¶
Slack holds the hook URL
func NewGoogleChat ¶
func NewGoogleChat(hookURL string, proxyURL string) (*GoogleChat, error)
NewGoogleChat validates the Google Chat URL and returns a GoogleChat object
type GoogleChatCard ¶
type GoogleChatCard struct {
Header GoogleChatCardHeader `json:"header"`
Sections []GoogleChatCardSection `json:"sections"`
}
type GoogleChatCardHeader ¶
type GoogleChatCardSection ¶
type GoogleChatCardSection struct {
Header string `json:"header"`
Widgets []GoogleChatCardWidget `json:"widgets"`
}
type GoogleChatCardWidget ¶
type GoogleChatCardWidget struct {
TextParagraph *GoogleChatCardWidgetTextParagraph `json:"textParagraph"`
KeyValue *GoogleChatCardWidgetKeyValue `json:"keyValue"`
}
type GoogleChatCardWidgetTextParagraph ¶
type GoogleChatCardWidgetTextParagraph struct {
Text string `json:"text"`
}
type GoogleChatPayload ¶
type GoogleChatPayload struct {
Cards []GoogleChatCard `json:"cards"`
}
GoogleChatPayload holds the channel and attachments
type GooglePubSub ¶
type GooglePubSub struct {
// contains filtered or unexported fields
}
GooglePubSub holds a Google Pub/Sub client and target topic.
func NewGooglePubSub ¶
func NewGooglePubSub(projectID, topicID, jsonCreds string, attrs map[string]string) (*GooglePubSub, error)
NewGooglePubSub creates a Google Pub/Sub client tied to a specific project and topic.
The jsonCreds parameter is optional, and if len(jsonCreds) == 0 then the automatic authentication methods of the Google libraries will take place, and therefore methods like Workload Identity will be automatically attempted.
The attrs paramter is optional, and if len(attrs) == 0 then no attributes will be added to the Pub/Sub message.
type Grafana ¶
type Grafana struct {
URL string
Token string
ProxyURL string
CertPool *x509.CertPool
Username string
Password string
}
type GraphitePayload ¶
type GraphitePayload struct {
When int64 `json:"when"` //optional unix timestamp (ms)
Text string `json:"text"`
Tags []string `json:"tags,omitempty"`
}
GraphiteAnnotation represents a Grafana API annotation in Graphite format
type LarkCard ¶
type LarkCard struct {
Config LarkConfig `json:"config"`
Header LarkHeader `json:"header"`
Elements []LarkElement `json:"elements"`
}
type LarkConfig ¶
type LarkConfig struct {
WideScreenMode bool `json:"wide_screen_mode"`
}
type LarkElement ¶
type LarkHeader ¶
type LarkPayload ¶
type MSTeams ¶
MS Teams holds the incoming webhook URL
func NewMSTeams ¶
NewMSTeams validates the MS Teams URL and returns a MSTeams object
type MSTeamsField ¶
type MSTeamsPayload ¶
type MSTeamsPayload struct {
Type string `json:"@type"`
Context string `json:"@context"`
ThemeColor string `json:"themeColor"`
Summary string `json:"summary"`
Sections []MSTeamsSection `json:"sections"`
}
MSTeamsPayload holds the message card data
type MSTeamsSection ¶
type MSTeamsSection struct {
ActivityTitle string `json:"activityTitle"`
ActivitySubtitle string `json:"activitySubtitle"`
Facts []MSTeamsField `json:"facts"`
}
MSTeamsSection holds the canary analysis result
type MatrixPayload ¶
type NopNotifier ¶
type NopNotifier struct{}
type Opsgenie ¶
func NewOpsgenie ¶
type OpsgenieAlert ¶
type PagerDuty ¶
func NewPagerDuty ¶
type PureJWT ¶
type PureJWT struct {
// contains filtered or unexported fields
}
PureJWT just contains the jwt
func NewJWTProvider ¶
NewJWTProvider create a pureJWT method
type Rocket ¶
type Rocket struct {
URL string
ProxyURL string
Username string
Channel string
CertPool *x509.CertPool
}
Rocket holds the hook URL
type Sentry ¶
Sentry holds the client instance
type Slack ¶
type Slack struct {
URL string
ProxyURL string
Token string
Username string
Channel string
CertPool *x509.CertPool
}
Slack holds the hook URL
type SlackAttachment ¶
type SlackAttachment struct {
Color string `json:"color"`
AuthorName string `json:"author_name"`
Text string `json:"text"`
MrkdwnIn []string `json:"mrkdwn_in"`
Fields []SlackField `json:"fields"`
}
SlackAttachment holds the markdown message body
type SlackField ¶
type SlackPayload ¶
type SlackPayload struct {
Channel string `json:"channel"`
Username string `json:"username"`
IconUrl string `json:"icon_url"`
IconEmoji string `json:"icon_emoji"`
Text string `json:"text,omitempty"`
Attachments []SlackAttachment `json:"attachments,omitempty"`
}
SlackPayload holds the channel and attachments
type Telegram ¶
func NewTelegram ¶
type Webex ¶
type Webex struct {
// mandatory: this should be set to the universal webex API server https://webexapis.com/v1/messages
URL string
// mandatory: webex room ID, specifies on which webex space notifications must be sent
RoomId string
// mandatory: webex bot access token, this access token must be generated after creating a webex bot
Token string
// optional: use a proxy as needed
ProxyURL string
// optional: x509 cert is no longer needed to post to a webex space
CertPool *x509.CertPool
}
Webex holds the hook URL
type WebexPayload ¶
type WebexPayload struct {
RoomId string `json:"roomId,omitempty"`
Markdown string `json:"markdown,omitempty"`
}
WebexPayload holds the message text
Source Files
¶
- alertmanager.go
- azure_devops.go
- azure_eventhub.go
- bitbucket.go
- client.go
- datadog.go
- discord.go
- factory.go
- forwarder.go
- gitea.go
- github.go
- github_dispatch.go
- gitlab.go
- google_chat.go
- google_pubsub.go
- grafana.go
- lark.go
- matrix.go
- nop.go
- notifier.go
- opsgenie.go
- pagerduty.go
- rocket.go
- sentry.go
- slack.go
- teams.go
- telegram.go
- util.go
- webex.go