Documentation
¶
Index ¶
- Constants
- Variables
- func AddHeaders(req *http.Request, headers map[string]string)
- func AddNew(notificationTypes NotificationTypes)
- func GetJsonParamsBody(msgParam MessageParam) (io.Reader, error)
- func GetUrlValues(msgParam MessageParam) url.Values
- func LoginAuth(username, password string) smtp.Auth
- func Priority(priority string) alertsv2.Priority
- func SendErrorNotification(errorNotification model.ErrorNotification)
- func SendNotification(notification model.Notification)
- func SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification)
- func SendTestNotification()
- type HttpNotify
- func (httpNotify HttpNotify) GetClientName() string
- func (httpNotify HttpNotify) Initialize() error
- func (httpNotify HttpNotify) SendErrorNotification(errorNotification model.ErrorNotification) error
- func (httpNotify HttpNotify) SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification) error
- type MailNotify
- func (mailNotify MailNotify) GetClientName() string
- func (mailNotify MailNotify) Initialize() error
- func (mailNotify MailNotify) SendErrorNotification(errorNotification model.ErrorNotification) error
- func (mailNotify MailNotify) SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification) error
- type MessageParam
- type NewIncident
- type NotificationTypes
- type Notify
- type OpsgenieNotify
- type SamanageAPIHeader
- type SamanageNotify
- func (samanageNotify SamanageNotify) GetClientName() string
- func (samanageNotify SamanageNotify) Initialize() error
- func (samanageNotify SamanageNotify) SendErrorNotification(errorNotification model.ErrorNotification) error
- func (samanageNotify SamanageNotify) SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification) error
- type SlackNotify
- func (slackNotify SlackNotify) GetClientName() string
- func (slackNotify SlackNotify) Initialize() error
- func (slackNotify SlackNotify) SendErrorNotification(errorNotification model.ErrorNotification) error
- func (slackNotify SlackNotify) SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification) error
Constants ¶
View Source
const ( ContentType = "Content-Type" ContentLength = "Content-Length" FormContentType = "application/x-www-form-urlencoded" JsonContentType = "application/json" )
Variables ¶
View Source
var (
NotificationsList []Notify
)
Functions ¶
func AddNew ¶
func AddNew(notificationTypes NotificationTypes)
Add model.Notification clients given by user in config file to model.NotificationsList
func GetJsonParamsBody ¶
func GetJsonParamsBody(msgParam MessageParam) (io.Reader, error)
func GetUrlValues ¶
func GetUrlValues(msgParam MessageParam) url.Values
func SendErrorNotification ¶
func SendErrorNotification(errorNotification model.ErrorNotification)
Send Error model.Notification to all clients registered
func SendNotification ¶
func SendNotification(notification model.Notification)
Format model.Notification type and send
func SendResponseTimeNotification ¶
func SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification)
Send response time model.Notification to all clients registered
func SendTestNotification ¶
func SendTestNotification()
Send Test model.Notification to all registered clients .To make sure everything is working
Types ¶
type HttpNotify ¶
type HttpNotify struct { Url string `json:"url"` RequestType string `json:"requestType"` Headers map[string]string `json:"headers"` }
func (HttpNotify) GetClientName ¶
func (httpNotify HttpNotify) GetClientName() string
func (HttpNotify) Initialize ¶
func (httpNotify HttpNotify) Initialize() error
func (HttpNotify) SendErrorNotification ¶
func (httpNotify HttpNotify) SendErrorNotification(errorNotification model.ErrorNotification) error
func (HttpNotify) SendResponseTimeNotification ¶
func (httpNotify HttpNotify) SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification) error
type MailNotify ¶
type MailNotify struct { Username string `json:"username"` Password string `json:"password"` Host string `json:"smtpHost"` Port int `json:"port"` From string `json:"from"` To string `json:"to"` }
func (MailNotify) GetClientName ¶
func (mailNotify MailNotify) GetClientName() string
func (MailNotify) Initialize ¶
func (mailNotify MailNotify) Initialize() error
func (MailNotify) SendErrorNotification ¶
func (mailNotify MailNotify) SendErrorNotification(errorNotification model.ErrorNotification) error
func (MailNotify) SendResponseTimeNotification ¶
func (mailNotify MailNotify) SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification) error
type MessageParam ¶
type MessageParam struct {
Message string `json:"message"`
}
type NewIncident ¶
type NewIncident struct { Priority string `json:""` // contains filtered or unexported fields }
type NotificationTypes ¶
type NotificationTypes struct { MailNotify MailNotify `json:"mail"` Slack SlackNotify `json:"slack"` Http HttpNotify `json:"httpEndPoint"` Opsgenie OpsgenieNotify `json:"opsgenie"` Samanage SamanageNotify `json:"samanage"` }
Diffrent types of clients to deliver model.Notifications
type Notify ¶
type Notify interface { GetClientName() string Initialize() error SendNotification(notification model.Notification) error SendResponseTimeNotification(notification model.ResponseTimeNotification) error SendResponseCodeNotification(notification model.ResponseCodeNotification) error SendResponseBodyNotification(notification model.ResponseBodyNotification) error SendErrorNotification(notification model.ErrorNotification) error }
type OpsgenieNotify ¶
func (OpsgenieNotify) GetClientName ¶
func (opsgenieNotify OpsgenieNotify) GetClientName() string
func (OpsgenieNotify) Initialize ¶
func (opsgenieNotify OpsgenieNotify) Initialize() error
func (OpsgenieNotify) SendNotification ¶
func (opsgenieNotify OpsgenieNotify) SendNotification(notification model.Notification) error
type SamanageAPIHeader ¶
type SamanageAPIHeader string
const ( SamanageUrl SamanageAPIHeader = "https://api.samanage.com/" SamanageTokenKey SamanageAPIHeader = "X-Samanage-Authorization" SamanageAcceptAPIKey SamanageAPIHeader = "Accept" SamanageAcceptAPIValue SamanageAPIHeader = "application/vnd.samanage.v2.1+json" SamanageContentTypeKey SamanageAPIHeader = "Content-Type" SamanageContentTypeValue SamanageAPIHeader = "application/json" )
func (SamanageAPIHeader) String ¶
func (h SamanageAPIHeader) String() string
type SamanageNotify ¶
type SamanageNotify struct { RequestType string `json:"requestType"` Headers map[string]string `json:"headers"` SamanageTokenValue SamanageAPIHeader `json:"token"` }
func (SamanageNotify) GetClientName ¶
func (samanageNotify SamanageNotify) GetClientName() string
func (SamanageNotify) Initialize ¶
func (samanageNotify SamanageNotify) Initialize() error
func (SamanageNotify) SendErrorNotification ¶
func (samanageNotify SamanageNotify) SendErrorNotification(errorNotification model.ErrorNotification) error
func (SamanageNotify) SendResponseTimeNotification ¶
func (samanageNotify SamanageNotify) SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification) error
type SlackNotify ¶
type SlackNotify struct { Username string `json:"username"` ChannelName string `json:"channelName"` //Not mandatory field ChannelWebhookURL string `json:"channelWebhookURL"` IconUrl string `json:"iconUrl"` }
func (SlackNotify) GetClientName ¶
func (slackNotify SlackNotify) GetClientName() string
func (SlackNotify) Initialize ¶
func (slackNotify SlackNotify) Initialize() error
func (SlackNotify) SendErrorNotification ¶
func (slackNotify SlackNotify) SendErrorNotification(errorNotification model.ErrorNotification) error
func (SlackNotify) SendResponseTimeNotification ¶
func (slackNotify SlackNotify) SendResponseTimeNotification(responseTimeNotification model.ResponseTimeNotification) error
Click to show internal directories.
Click to hide internal directories.