settings

package
v0.0.1-dev-ec4a8d8 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Module        = "settings"
	DB            = "settings"
	ReqCollection = "requests"
	PolicyDir     = "/etc/policies/alert_setting"
	PolicyV1      = "/etc/policies/alert_setting/alert_setting1_0.yml"

	MaxRecipientCount = 10
	MaxSlackCount     = 10
)

Variables

This section is empty.

Functions

func SetCosSchema

func SetCosSchema(alert *Cos)

Types

type Api

type Api struct {
	TitlePrefix `json:"titlePrefix" bson:"titlePrefix"`
	Email       email.Options `json:"email" bson:"email"`
	Slack       slack.Options `json:"slack" bson:"slack"`
}

func (*Api) SetOkStatus

func (a *Api) SetOkStatus()

type Cos

type Cos struct {
	TitlePrefix string `json:"titlePrefix" yaml:"titlePrefix"`
	Sender      `json:"sender" yaml:"sender"`
	Receiver    `json:"receiver" yaml:"receiver"`
}

func GetCosSchema

func GetCosSchema() *Cos

func (*Cos) GetSlackUrlByName

func (c *Cos) GetSlackUrlByName(name string) string

func (*Cos) HasRecipient

func (c *Cos) HasRecipient(address string) bool

func (*Cos) HasSender

func (c *Cos) HasSender(host string) bool

func (*Cos) HasSlack

func (c *Cos) HasSlack(channel slack.CosChannel) bool

func (*Cos) IsRecipientEqual

func (c *Cos) IsRecipientEqual(recipient email.Recipient) bool

func (*Cos) ToApiSchema

func (c *Cos) ToApiSchema() Api

type Receiver

type Receiver struct {
	Emails []email.Recipient  `json:"emails" yaml:"emails"`
	Slacks []slack.CosChannel `json:"slacks" yaml:"slacks"`
}

type Sender

type Sender struct {
	Email *email.CosSender `json:"email,omitempty" yaml:"email,omitempty"`
}

type Setting

type Setting struct {
	Type             string `json:"type" bson:"type"`
	Key              string `json:"key" bson:"key"`
	Value            any    `json:"value" bson:"value"`
	IsReportRequired bool   `json:"-" bson:"-"`

	*TitlePrefix     `json:"titlePrefix,omitempty" bson:"titlePrefix,omitempty"`
	*email.Sender    `json:"sender,omitempty" bson:"sender,omitempty"`
	*email.Recipient `json:"recipient,omitempty" bson:"recipient,omitempty"`
	Slack            *slack.ApiChannel `json:"slack,omitempty" bson:"slack,omitempty"`

	Status status.Settings `json:"status" bson:"status"`
}

func (*Setting) GenTaskUpdate

func (o *Setting) GenTaskUpdate() Setting

func (*Setting) SetCompleted

func (o *Setting) SetCompleted()

func (*Setting) SetCreating

func (o *Setting) SetCreating()

func (*Setting) SetDeleting

func (o *Setting) SetDeleting()

func (*Setting) SetError

func (o *Setting) SetError()

func (*Setting) SetUpdating

func (o *Setting) SetUpdating()

type TitlePrefix

type TitlePrefix struct {
	Value  string          `json:"value" bson:"value"`
	Status status.Settings `json:"status" bson:"status"`
}

func (*TitlePrefix) SetUpdating

func (t *TitlePrefix) SetUpdating()

Jump to

Keyboard shortcuts

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