Documentation
¶
Index ¶
- Constants
- type AlertManagerAlert
- type Alertmanager
- type AzureDevOps
- type AzureEventHub
- type Bitbucket
- type BitbucketServer
- 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 NATS
- 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 ¶ added in v0.18.0
type Alertmanager ¶ added in v0.18.0
func NewAlertmanager ¶ added in v0.18.0
type AzureDevOps ¶ added in v0.4.0
AzureDevOps is an Azure DevOps notifier.
func NewAzureDevOps ¶ added in v0.4.0
func NewAzureDevOps(providerUID string, addr string, token string, certPool *x509.CertPool) (*AzureDevOps, error)
NewAzureDevOps creates and returns a new AzureDevOps notifier.
type AzureEventHub ¶ added in v0.14.0
AzureEventHub holds the eventhub client
func NewAzureEventHub ¶ added in v0.14.0
func NewAzureEventHub(endpointURL, token, eventHubNamespace string) (*AzureEventHub, error)
NewAzureEventHub creates a eventhub client
type Bitbucket ¶ added in v0.2.1
Bitbucket is a Bitbucket Server notifier.
type BitbucketServer ¶ added in v1.2.0
type BitbucketServer struct {
ProjectKey string
RepositorySlug string
ProviderUID string
ProviderAddress string
Host string
Username string
Password string
Token string
Client *retryablehttp.Client
}
BitbucketServer is a notifier for BitBucket Server and Data Center.
type DataDog ¶ added in v1.1.0
type DataDog struct {
// contains filtered or unexported fields
}
func NewDataDog ¶ added in v1.1.0
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 ¶ added in v0.24.0
func NewGitHubDispatch ¶ added in v0.24.0
type Gitea ¶ added in v0.30.0
type Gitea struct {
BaseURL string
Token string
Owner string
Repo string
ProviderUID string
Client *gitea.Client
Debug bool
}
type GoogleChat ¶ added in v0.10.0
Slack holds the hook URL
func NewGoogleChat ¶ added in v0.10.0
func NewGoogleChat(hookURL string, proxyURL string) (*GoogleChat, error)
NewGoogleChat validates the Google Chat URL and returns a GoogleChat object
type GoogleChatCard ¶ added in v0.10.0
type GoogleChatCard struct {
Header GoogleChatCardHeader `json:"header"`
Sections []GoogleChatCardSection `json:"sections"`
}
type GoogleChatCardHeader ¶ added in v0.10.0
type GoogleChatCardSection ¶ added in v0.10.0
type GoogleChatCardSection struct {
Header string `json:"header"`
Widgets []GoogleChatCardWidget `json:"widgets"`
}
type GoogleChatCardWidget ¶ added in v0.10.0
type GoogleChatCardWidget struct {
TextParagraph *GoogleChatCardWidgetTextParagraph `json:"textParagraph"`
KeyValue *GoogleChatCardWidgetKeyValue `json:"keyValue"`
}
type GoogleChatCardWidgetKeyValue ¶ added in v0.10.0
type GoogleChatCardWidgetTextParagraph ¶ added in v0.10.0
type GoogleChatCardWidgetTextParagraph struct {
Text string `json:"text"`
}
type GoogleChatPayload ¶ added in v0.10.0
type GoogleChatPayload struct {
Cards []GoogleChatCard `json:"cards"`
}
GoogleChatPayload holds the channel and attachments
type GooglePubSub ¶ added in v1.0.0
type GooglePubSub struct {
// contains filtered or unexported fields
}
GooglePubSub holds a Google Pub/Sub client and target topic.
func NewGooglePubSub ¶ added in v1.0.0
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 ¶ added in v0.22.0
type Grafana struct {
URL string
Token string
ProxyURL string
CertPool *x509.CertPool
Username string
Password string
}
type GraphitePayload ¶ added in v0.22.0
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 ¶ added in v0.16.0
type LarkCard struct {
Config LarkConfig `json:"config"`
Header LarkHeader `json:"header"`
Elements []LarkElement `json:"elements"`
}
type LarkConfig ¶ added in v0.16.0
type LarkConfig struct {
WideScreenMode bool `json:"wide_screen_mode"`
}
type LarkElement ¶ added in v0.16.0
type LarkHeader ¶ added in v0.16.0
type LarkPayload ¶ added in v0.16.0
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 ¶ added in v0.16.0
type NATS ¶ added in v1.2.0
type NATS struct {
// contains filtered or unexported fields
}
NATS holds a NATS client and target subject.
type NopNotifier ¶
type NopNotifier struct{}
type Opsgenie ¶ added in v0.17.0
func NewOpsgenie ¶ added in v0.17.0
type OpsgenieAlert ¶ added in v0.17.0
type PagerDuty ¶ added in v1.0.0
func NewPagerDuty ¶ added in v1.0.0
type PureJWT ¶ added in v0.14.0
type PureJWT struct {
// contains filtered or unexported fields
}
PureJWT just contains the jwt
func NewJWTProvider ¶ added in v0.14.0
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 ¶ added in v0.12.0
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 ¶ added in v0.16.0
func NewTelegram ¶ added in v0.16.0
type Webex ¶ added in v0.11.0
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
func NewWebex ¶ added in v0.11.0
func NewWebex(hookURL, proxyURL string, certPool *x509.CertPool, channel string, token string) (*Webex, error)
NewWebex validates the Webex URL and returns a Webex object
func (*Webex) CreateMarkdown ¶ added in v0.23.2
type WebexPayload ¶ added in v0.11.0
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
- bitbucketserver.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
- nats.go
- nop.go
- notifier.go
- opsgenie.go
- pagerduty.go
- rocket.go
- sentry.go
- slack.go
- teams.go
- telegram.go
- util.go
- webex.go