Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ANS ¶
ANS holds the setup for the xsuaa service to retrieve a bearer token for authorization and the URL to the SAP Alert Notification Service backend
func (*ANS) CheckCorrectSetup ¶
CheckCorrectSetup of the SAP Alert Notification Service
func (*ANS) SetServiceKey ¶
func (ans *ANS) SetServiceKey(serviceKey ServiceKey)
SetServiceKey sets the xsuaa service key
type Client ¶
type Client interface {
Send(event Event) error
CheckCorrectSetup() error
SetServiceKey(serviceKey ServiceKey)
}
Client to send the event to the SAP Alert Notification Service
type Event ¶
type Event struct {
EventType string `json:"eventType,omitempty"`
EventTimestamp int64 `json:"eventTimestamp,omitempty" validate:"omitempty,min=0"`
Severity string `json:"severity,omitempty" validate:"omitempty,oneof=INFO NOTICE WARNING ERROR FATAL"`
Category string `json:"category,omitempty" validate:"omitempty,oneof=EXCEPTION ALERT NOTIFICATION"`
Subject string `json:"subject,omitempty"`
Body string `json:"body,omitempty"`
Priority int `json:"priority,omitempty" validate:"omitempty,min=1,max=1000"`
Tags map[string]interface{} `json:"tags,omitempty"`
Resource *Resource `json:"resource,omitempty"`
}
Event structure of the SAP Alert Notification Service
func (*Event) MergeWithJSON ¶
MergeWithJSON unmarshalls an ANS Event JSON string and merges it with the existing receiver Event
func (*Event) SetSeverityAndCategory ¶
SetSeverityAndCategory takes the logrus log level and sets the corresponding ANS severity and category string
type Resource ¶
type Resource struct {
ResourceName string `json:"resourceName,omitempty"`
ResourceType string `json:"resourceType,omitempty"`
ResourceInstance string `json:"resourceInstance,omitempty"`
Tags map[string]interface{} `json:"tags,omitempty"`
}
Resource structure of the SAP Alert Notification Service Event
type ServiceKey ¶
type ServiceKey struct {
Url string `json:"url"`
ClientId string `json:"client_id"`
ClientSecret string `json:"client_secret"`
OauthUrl string `json:"oauth_url"`
}
ServiceKey holds the information about the SAP Alert Notification Service to send the events to
func UnmarshallServiceKeyJSON ¶
func UnmarshallServiceKeyJSON(serviceKeyJSON string) (ansServiceKey ServiceKey, err error)
UnmarshallServiceKeyJSON unmarshalls the given json service key string.