shoutrrr

package
v0.0.0-...-9859c7c Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogInit

func LogInit(log *util.JLog)

LogInit for this package.

Types

type Shoutrrr

type Shoutrrr struct {
	ShoutrrrBase `yaml:",inline" json:",inline"`

	ID string `yaml:"-" json:"-"` // ID for this Shoutrrr sender

	Failed        *svcstatus.FailsShoutrrr `yaml:"-" json:"-"` // Whether the last send attempt failed
	ServiceStatus *svcstatus.Status        `yaml:"-" json:"-"` // Status of the Service (used for templating commands)

	Main         *ShoutrrrDefaults `yaml:"-" json:"-"` // The Shoutrrr that this Shoutrrr is calling (and may override parts of)
	Defaults     *ShoutrrrDefaults `yaml:"-" json:"-"` // Default values
	HardDefaults *ShoutrrrDefaults `yaml:"-" json:"-"` // Harcoded default values
}

func New

func New(
	failed *svcstatus.FailsShoutrrr,
	id string,
	options *map[string]string,
	params *map[string]string,
	sType string,
	urlFields *map[string]string,
	main *ShoutrrrDefaults,
	defaults *ShoutrrrDefaults,
	hardDefaults *ShoutrrrDefaults,
) (shoutrrr *Shoutrrr)

New Shoutrrr.

func (*Shoutrrr) BuildParams

func (s *Shoutrrr) BuildParams(context *util.ServiceInfo) (params *shoutrrr_types.Params)

BuildParams returns the params using everything from master>main>defaults>hardDefaults when the key is not defined in the lower level

func (*Shoutrrr) BuildURL

func (s *Shoutrrr) BuildURL() (url string)

func (*Shoutrrr) CheckValues

func (s *Shoutrrr) CheckValues(prefix string) (errs error)

CheckValues of this Notification.

func (*Shoutrrr) GetDelay

func (s *Shoutrrr) GetDelay() string

GetDelay before sending.

func (*Shoutrrr) GetDelayDuration

func (s *Shoutrrr) GetDelayDuration() (duration time.Duration)

GetDelayDuration before sending.

func (*Shoutrrr) GetMaxTries

func (s *Shoutrrr) GetMaxTries() uint

GetMaxTries allowed for the Gotification.

func (*Shoutrrr) GetOption

func (s *Shoutrrr) GetOption(key string) string

GetOption from this/Main/Defaults/HardDefaults on FiFo.

func (*Shoutrrr) GetParam

func (s *Shoutrrr) GetParam(key string) string

GetParam from this/Main/Defaults/HardDefaults on FiFo

func (*Shoutrrr) GetType

func (s *Shoutrrr) GetType() string

GetType of this Shoutrrr.

func (*Shoutrrr) GetURLField

func (s *Shoutrrr) GetURLField(key string) string

GetURLField from this/Main/Defaults/HardDefaults on FiFo

func (*Shoutrrr) Init

func (s *Shoutrrr) Init(
	serviceStatus *svcstatus.Status,
	main *ShoutrrrDefaults,
	defaults *ShoutrrrDefaults,
	hardDefaults *ShoutrrrDefaults,
)

Init the Shoutrrr metrics and hand out the defaults.

func (*Shoutrrr) InitMaps

func (s *Shoutrrr) InitMaps()

InitMaps will initialise all maps, converting all keys to lowercase.

func (*Shoutrrr) Message

func (s *Shoutrrr) Message(context *util.ServiceInfo) string

Message of the Shoutrrr after the context is applied and template evaluated.

func (*Shoutrrr) Send

func (s *Shoutrrr) Send(
	title string,
	message string,
	serviceInfo *util.ServiceInfo,
	useDelay bool,
) (errs error)

func (*Shoutrrr) String

func (s *Shoutrrr) String(prefix string) (str string)

String returns a string representation of the Shoutrrr.

func (*Shoutrrr) Title

func (s *Shoutrrr) Title(serviceInfo *util.ServiceInfo) string

Title of the Shoutrrr after the context is applied and template evaluated.

type ShoutrrrBase

type ShoutrrrBase struct {
	Type      string            `yaml:"type,omitempty" json:"type,omitempty"`             // Notification type, e.g. slack
	Options   map[string]string `yaml:"options,omitempty" json:"options,omitempty"`       // Options
	URLFields map[string]string `yaml:"url_fields,omitempty" json:"url_fields,omitempty"` // URL Fields
	Params    map[string]string `yaml:"params,omitempty" json:"params,omitempty"`         // Query/Param Props
}

ShoutrrrBase is the base Shoutrrr.

func (*ShoutrrrBase) CheckValues

func (s *ShoutrrrBase) CheckValues(prefix string) (errs error)

CheckValues of this Notification.

func (*ShoutrrrBase) GetOption

func (s *ShoutrrrBase) GetOption(key string) string

GetOption gets Options[key] from this Shoutrrr

func (*ShoutrrrBase) GetParam

func (s *ShoutrrrBase) GetParam(key string) string

GetParam gets Params[key] from this Shoutrrr

func (*ShoutrrrBase) GetURLField

func (s *ShoutrrrBase) GetURLField(key string) string

GetURLField gets URLFields[key] from this Shoutrrr

func (*ShoutrrrBase) Init

func (s *ShoutrrrBase) Init()

Init the Shoutrrr.

func (*ShoutrrrBase) InitMaps

func (s *ShoutrrrBase) InitMaps()

InitMaps will initialise all maps, converting all keys to lowercase.

func (*ShoutrrrBase) SetOption

func (s *ShoutrrrBase) SetOption(key string, value string)

SetOption[key] to value

func (*ShoutrrrBase) SetParam

func (s *ShoutrrrBase) SetParam(key string, value string)

SetParam[key] to value

func (*ShoutrrrBase) SetURLField

func (s *ShoutrrrBase) SetURLField(key string, value string)

SetURLField[key] to value

type ShoutrrrDefaults

type ShoutrrrDefaults struct {
	ShoutrrrBase `yaml:",inline" json:",inline"`
}

ShoutrrrDefaults are the default values for Shoutrrr.

func NewDefaults

func NewDefaults(
	sType string,
	options *map[string]string,
	params *map[string]string,
	urlFields *map[string]string,
) (defaults *ShoutrrrDefaults)

NewDefaults returns a new ShoutrrrDefaults.

func (*ShoutrrrDefaults) String

func (s *ShoutrrrDefaults) String(prefix string) (str string)

String returns a string representation of the ShoutrrrDefaults.

type Slice

type Slice map[string]*Shoutrrr

Slice mapping of Shoutrrr.

func (*Slice) CheckValues

func (s *Slice) CheckValues(prefix string) (errs error)

CheckValues of this Slice.

func (*Slice) DeleteMetrics

func (s *Slice) DeleteMetrics()

DeleteMetrics for this Slice.

func (*Slice) Init

func (s *Slice) Init(
	serviceStatus *svcstatus.Status,
	mains *SliceDefaults,
	defaults *SliceDefaults,
	hardDefaults *SliceDefaults,
)

Init the Slice metrics amd hand out the defaults.

func (*Slice) InitMetrics

func (s *Slice) InitMetrics()

InitMetrics for this Slice.

func (*Slice) Send

func (s *Slice) Send(
	title string,
	message string,
	serviceInfo *util.ServiceInfo,
	useDelay bool,
) (errs error)

func (*Slice) String

func (s *Slice) String(prefix string) (str string)

String returns a string representation of the Slice.

type SliceDefaults

type SliceDefaults map[string]*ShoutrrrDefaults

SliceDefaults mapping of ShoutrrrDefaults.

func (*SliceDefaults) CheckValues

func (s *SliceDefaults) CheckValues(prefix string) (errs error)

CheckValues of this SliceDefaults.

func (*SliceDefaults) Print

func (s *SliceDefaults) Print(prefix string)

Print the SliceDefaults.

func (*SliceDefaults) SetDefaults

func (s *SliceDefaults) SetDefaults()

SetDefaults for Shoutrrr.

func (*SliceDefaults) String

func (s *SliceDefaults) String(prefix string) (str string)

String returns a string representation of the SliceDefaults.

Jump to

Keyboard shortcuts

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