notification

package
v2.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualStringMap

func EqualStringMap(a, b []string) bool

Types

type Destination

type Destination struct {
	UUID         string        `json:"uuid"`
	Name         string        `json:"name"`
	Type         string        `json:"type"`
	Labels       models.Labels `json:"labels"`
	Sender       string        `json:"sender"`
	Destinations []string      `json:"destinations"`
}

func (*Destination) Equal

func (d *Destination) Equal(dest *Destination) bool

type Destinations

type Destinations struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDestinations

func NewDestinations() *Destinations

func (*Destinations) Add

func (d *Destinations) Add(dest *Destination)

func (*Destinations) All

func (d *Destinations) All() map[string]*Destination

func (*Destinations) Get

func (d *Destinations) Get(uuid string) *Destination

func (*Destinations) Load

func (d *Destinations) Load(filename string) error

Load loads the rules from rules.json.

func (*Destinations) Remove

func (d *Destinations) Remove(uuid string)

func (*Destinations) Save

func (d *Destinations) Save(filename string) error

Save saves the rules to rules.json.

func (*Destinations) Trigger

func (d *Destinations) Trigger(uuid, body string) error

type Message

type Message struct {
	DestinationSelector models.Labels `json:"destinationSelector"`
	Head                string        `json:"head"`
	Body                string        `json:"body"`
}

type Messages

type Messages []Message

type Sender

type Sender struct {
	UUID       string          `json:"uuid"`
	Name       string          `json:"name"`
	Type       string          `json:"type"`
	Parameters json.RawMessage `json:"parameters"`
}

func (Sender) Destinations

func (s Sender) Destinations() (map[string]string, error)

func (Sender) Release

func (s Sender) Release(dest *Destination, body string) error

func (Sender) Trigger

func (s Sender) Trigger(dest *Destination, body string) error

type SenderInterface

type SenderInterface interface {
	Trigger([]string, string) error
	Release([]string, string) error
	Destinations() (map[string]string, error)
}

func NewSender

func NewSender(t string, p json.RawMessage) SenderInterface

type Senders

type Senders struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSenders

func NewSenders() *Senders

func (*Senders) Add

func (s *Senders) Add(sender Sender)

func (*Senders) All

func (s *Senders) All() map[string]Sender

func (*Senders) Get

func (s *Senders) Get(id string) (Sender, bool)

func (*Senders) Load

func (s *Senders) Load(filename string) error

Load loads the rules from rules.json.

func (*Senders) Remove

func (s *Senders) Remove(id string)

func (*Senders) Save

func (s *Senders) Save(filename string) error

Save saves the rules to rules.json.

type Type

type Type string
const (
	TypeMail Type = "mail"
	TypeSms  Type = "sms"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL