Documentation
¶
Index ¶
- Constants
- Variables
- type Configurations
- type Encryptor
- type Filter
- type HTTPService
- func (s *HTTPService) Decrypt(r *Receiver) error
- func (s *HTTPService) Encrypt(r *Receiver) error
- func (s *HTTPService) GetSubscriptionConfig(subsConfs map[string]string, receiverConfs Configurations) (map[string]string, error)
- func (s *HTTPService) Notify(ctx context.Context, rcv *Receiver, payloadMessage NotificationMessage) error
- func (s *HTTPService) PopulateReceiver(ctx context.Context, rcv *Receiver) (*Receiver, error)
- func (s *HTTPService) ValidateConfiguration(rcv *Receiver) error
- type NotFoundError
- type NotificationMessage
- type PagerDutyService
- func (s *PagerDutyService) Decrypt(r *Receiver) error
- func (s *PagerDutyService) Encrypt(r *Receiver) error
- func (s *PagerDutyService) GetSubscriptionConfig(subsConfs map[string]string, receiverConfs Configurations) (map[string]string, error)
- func (s *PagerDutyService) Notify(ctx context.Context, rcv *Receiver, payloadMessage NotificationMessage) error
- func (s *PagerDutyService) PopulateReceiver(ctx context.Context, rcv *Receiver) (*Receiver, error)
- func (s *PagerDutyService) ValidateConfiguration(rcv *Receiver) error
- type Receiver
- type Repository
- type Service
- func (s *Service) Create(ctx context.Context, rcv *Receiver) error
- func (s *Service) Delete(ctx context.Context, id uint64) error
- func (s *Service) Get(ctx context.Context, id uint64) (*Receiver, error)
- func (s *Service) GetSubscriptionConfig(subsConfs map[string]string, rcv *Receiver) (map[string]string, error)
- func (s *Service) List(ctx context.Context, flt Filter) ([]Receiver, error)
- func (s *Service) Notify(ctx context.Context, id uint64, payloadMessage NotificationMessage) error
- func (s *Service) Update(ctx context.Context, rcv *Receiver) error
- type SlackClient
- type SlackService
- func (s *SlackService) Decrypt(r *Receiver) error
- func (s *SlackService) Encrypt(r *Receiver) error
- func (s *SlackService) GetSubscriptionConfig(subsConfs map[string]string, receiverConfs Configurations) (map[string]string, error)
- func (s *SlackService) Notify(ctx context.Context, rcv *Receiver, payloadMessage NotificationMessage) error
- func (s *SlackService) PopulateReceiver(ctx context.Context, rcv *Receiver) (*Receiver, error)
- func (s *SlackService) ValidateConfiguration(rcv *Receiver) error
- type TypeService
Constants ¶
View Source
const ( TypeSlack string = "slack" TypeHTTP string = "http" TypePagerDuty string = "pagerduty" )
Variables ¶
View Source
var (
ErrNotImplemented = errors.New("operation not supported")
)
Functions ¶
This section is empty.
Types ¶
type Configurations ¶
type Configurations map[string]interface{}
type HTTPService ¶
type HTTPService struct{}
func NewHTTPService ¶
func NewHTTPService() *HTTPService
NewHTTPService returns slack service struct
func (*HTTPService) Decrypt ¶
func (s *HTTPService) Decrypt(r *Receiver) error
func (*HTTPService) Encrypt ¶
func (s *HTTPService) Encrypt(r *Receiver) error
func (*HTTPService) GetSubscriptionConfig ¶
func (s *HTTPService) GetSubscriptionConfig(subsConfs map[string]string, receiverConfs Configurations) (map[string]string, error)
func (*HTTPService) Notify ¶
func (s *HTTPService) Notify(ctx context.Context, rcv *Receiver, payloadMessage NotificationMessage) error
func (*HTTPService) PopulateReceiver ¶
func (*HTTPService) ValidateConfiguration ¶
func (s *HTTPService) ValidateConfiguration(rcv *Receiver) error
type NotFoundError ¶
type NotFoundError struct {
ID uint64
}
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type NotificationMessage ¶
type NotificationMessage map[string]interface{}
NotificationMessage is an abstraction of receiver's notification message
func (NotificationMessage) ToSlackMessage ¶
func (nm NotificationMessage) ToSlackMessage() (*slack.Message, error)
ToSlackMessage
{
"receiver_name": "",
"receiver_type": "",
"message": "",
"blocks": [
{
"": ""
}
]
}
type PagerDutyService ¶
type PagerDutyService struct{}
func NewPagerDutyService ¶
func NewPagerDutyService() *PagerDutyService
NewPagerDutyService returns slack service struct
func (*PagerDutyService) Decrypt ¶
func (s *PagerDutyService) Decrypt(r *Receiver) error
func (*PagerDutyService) Encrypt ¶
func (s *PagerDutyService) Encrypt(r *Receiver) error
func (*PagerDutyService) GetSubscriptionConfig ¶
func (s *PagerDutyService) GetSubscriptionConfig(subsConfs map[string]string, receiverConfs Configurations) (map[string]string, error)
func (*PagerDutyService) Notify ¶
func (s *PagerDutyService) Notify(ctx context.Context, rcv *Receiver, payloadMessage NotificationMessage) error
func (*PagerDutyService) PopulateReceiver ¶
func (*PagerDutyService) ValidateConfiguration ¶
func (s *PagerDutyService) ValidateConfiguration(rcv *Receiver) error
type Receiver ¶
type Receiver struct {
ID uint64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Labels map[string]string `json:"labels"`
Configurations Configurations `json:"configurations"`
Data map[string]interface{} `json:"data"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Repository ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles business logic
func NewService ¶
func NewService(repository Repository, registry map[string]TypeService) *Service
func (*Service) GetSubscriptionConfig ¶
type SlackClient ¶
type SlackService ¶
type SlackService struct {
// contains filtered or unexported fields
}
func NewSlackService ¶
func NewSlackService(slackClient SlackClient, cryptoClient Encryptor) *SlackService
NewService returns slack service struct
func (*SlackService) Decrypt ¶
func (s *SlackService) Decrypt(r *Receiver) error
func (*SlackService) Encrypt ¶
func (s *SlackService) Encrypt(r *Receiver) error
func (*SlackService) GetSubscriptionConfig ¶
func (s *SlackService) GetSubscriptionConfig(subsConfs map[string]string, receiverConfs Configurations) (map[string]string, error)
func (*SlackService) Notify ¶
func (s *SlackService) Notify(ctx context.Context, rcv *Receiver, payloadMessage NotificationMessage) error
func (*SlackService) PopulateReceiver ¶
func (*SlackService) ValidateConfiguration ¶
func (s *SlackService) ValidateConfiguration(rcv *Receiver) error
type TypeService ¶
type TypeService interface {
Encrypt(r *Receiver) error
Decrypt(r *Receiver) error
PopulateReceiver(ctx context.Context, rcv *Receiver) (*Receiver, error)
Notify(ctx context.Context, rcv *Receiver, payloadMessage NotificationMessage) error
ValidateConfiguration(rcv *Receiver) error
GetSubscriptionConfig(subsConfs map[string]string, receiverConfs Configurations) (map[string]string, error)
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.