action

package
v0.0.0-...-a2946bf Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRepositoryEventQuerier

func CreateRepositoryEventQuerier(msgRepo repository.EventRepo) func(groupID primitive.ObjectID, limit int64) []repository.Event

CreateRepositoryEventQuerier 创建仓库事件查询器

Types

type Action

type Action interface {
	Validate(meta string, userRefs []string) error
	Handle(rule repository.Rule, trigger repository.Trigger, grp repository.EventGroup) error
}

Action 触发动作接口

type AliyunVoiceCallAction

type AliyunVoiceCallAction struct {
	// contains filtered or unexported fields
}

func NewPhoneCallAliyunAction

func NewPhoneCallAliyunAction(manager Manager) *AliyunVoiceCallAction

func (AliyunVoiceCallAction) Handle

func (AliyunVoiceCallAction) Validate

func (w AliyunVoiceCallAction) Validate(meta string, userRefs []string) error

type DingdingAction

type DingdingAction struct {
	// contains filtered or unexported fields
}

DingdingAction 钉钉发送动作

func NewDingdingAction

func NewDingdingAction(manager Manager) *DingdingAction

NewDingdingAction create a new dingdingAction

func (DingdingAction) Handle

Handle 钉钉动作处理

func (DingdingAction) Validate

func (d DingdingAction) Validate(meta string, userRefs []string) error

Validate 校验动作参数

type DingdingMeta

type DingdingMeta struct {
	Template string `json:"template"`
	RobotID  string `json:"robot_id"`
}

DingdingMeta 钉钉发送元数据

type EmailAction

type EmailAction struct {
	// contains filtered or unexported fields
}

func NewEmailAction

func NewEmailAction(manager Manager, conf *configs.Config) *EmailAction

func (EmailAction) Handle

func (e EmailAction) Handle(rule repository.Rule, trigger repository.Trigger, grp repository.EventGroup) error

func (EmailAction) Validate

func (e EmailAction) Validate(meta string, userRefs []string) error

type EmailMeta

type EmailMeta struct {
	Template string `json:"template"`
}

EmailMeta 邮件发送元数据

type EventQuerier

type EventQuerier func(groupID primitive.ObjectID, limit int64) []repository.Event

EventQuerier 事件查询接口

type HTTPAction

type HTTPAction struct {
	// contains filtered or unexported fields
}

HTTPAction HTTP 动作

func NewHTTPAction

func NewHTTPAction(manager Manager) *HTTPAction

NewHTTPAction create a new HTTPAction

func (HTTPAction) Handle

func (act HTTPAction) Handle(rule repository.Rule, trigger repository.Trigger, grp repository.EventGroup) error

Handle 动作处理

func (HTTPAction) Validate

func (act HTTPAction) Validate(meta string, userRefs []string) error

Validate 参数校验

type HTTPHeaderMeta

type HTTPHeaderMeta struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

HTTPHeaderMeta HTTP 请求头

type HTTPMeta

type HTTPMeta struct {
	URL     string           `json:"url"`
	Method  string           `json:"method"`
	Headers []HTTPHeaderMeta `json:"headers"`
	Body    string           `json:"body"`
}

HTTPMeta HTTP 元数据

type JiraAction

type JiraAction struct {
	// contains filtered or unexported fields
}

JiraAction Jira 发送动作

func NewJiraAction

func NewJiraAction(manager Manager) *JiraAction

NewJiraAction create a new jira Action

func (JiraAction) Handle

func (act JiraAction) Handle(rule repository.Rule, trigger repository.Trigger, grp repository.EventGroup) error

Handle 动作处理

func (JiraAction) Validate

func (act JiraAction) Validate(meta string, userRefs []string) error

Validate 参数校验

type JiraMeta

type JiraMeta struct {
	Issue       jira.Issue         `json:"issue"`
	Constraints []jira.CustomField `json:"constraints"`
}

JiraMeta Jira 动作元数据

type Manager

type Manager interface {
	Resolve(f interface{}) error
	MustResolve(f interface{})
	Get(key interface{}) (interface{}, error)
	Dispatch(action string) QueueAction
	Run(action string) Action
	Register(name string, action Action)
}

Manager 动作管理器接口

func NewManager

func NewManager(cc infra.Resolver) Manager

NewManager create a new Manager

type Payload

type Payload struct {
	Action             string                `json:"action"`
	Rule               repository.Rule       `json:"rule"`
	Trigger            repository.Trigger    `json:"trigger"`
	Group              repository.EventGroup `json:"group"`
	RuleTemplateParsed string                `json:"rule_template_parsed"`
	PreviewURL         string                `json:"preview_url"`
	ReportURL          string                `json:"report_url"`
	// contains filtered or unexported fields
}

Payload 事件描述生成时使用的对象,用于模板解析

func CreatePayload

func CreatePayload(conf *configs.Config, eventQuerier EventQuerier, action string, rule repository.Rule, trigger repository.Trigger, grp repository.EventGroup) *Payload

CreatePayload 创建一个 Payload

func (*Payload) Decode

func (payload *Payload) Decode(data []byte) error

Decode 从字符串解析出 Payload 对象

func (*Payload) Encode

func (payload *Payload) Encode() []byte

Encode 将 Payload 编码

func (*Payload) EventType

func (payload *Payload) EventType() string

EventType return message type in group

func (*Payload) Events

func (payload *Payload) Events(limit int64) []repository.Event

Events get messages for group

func (*Payload) FirstEvent

func (payload *Payload) FirstEvent() repository.Event

FirstEvent get first event

func (*Payload) Init

func (payload *Payload) Init(eventQuerier EventQuerier)

Init initialize a payload

func (*Payload) IsPlain

func (payload *Payload) IsPlain() bool

IsPlain return whether the messages in group is plain message

func (*Payload) IsRecoverable

func (payload *Payload) IsRecoverable() bool

IsRecoverable return whether the messages in group is recoverable message

func (*Payload) IsRecovery

func (payload *Payload) IsRecovery() bool

IsRecovery return whether the messages in group is recovery message

func (*Payload) MessageType

func (payload *Payload) MessageType() string

MessageType return message type in group This method is depressed

func (*Payload) Messages

func (payload *Payload) Messages(limit int64) []repository.Event

Messages get messages for group This method is depressed

type Provider

type Provider struct{}

func (Provider) Boot

func (s Provider) Boot(app infra.Resolver)

func (Provider) Register

func (s Provider) Register(app infra.Binder)

type QueueAction

type QueueAction struct {
	// contains filtered or unexported fields
}

QueueAction 动作队列

func (QueueAction) Handle

func (q QueueAction) Handle(rule repository.Rule, tr repository.Trigger, grp repository.EventGroup) (trigger repository.Trigger, err error)

Handle 动作处理

func (QueueAction) Validate

func (q QueueAction) Validate(meta string, userRefs []string) error

Validate 校验动作参数

type SmsAliyun

type SmsAliyun struct {
	// contains filtered or unexported fields
}

func NewSmsAliyunAction

func NewSmsAliyunAction(manager Manager) *SmsAliyun

func (SmsAliyun) Handle

func (w SmsAliyun) Handle(rule repository.Rule, trigger repository.Trigger, grp repository.EventGroup) error

func (SmsAliyun) Validate

func (w SmsAliyun) Validate(meta string, userRefs []string) error

type SmsYunxin

type SmsYunxin struct {
	// contains filtered or unexported fields
}

func NewSmsYunxinAction

func NewSmsYunxinAction(manager Manager) *SmsYunxin

func (SmsYunxin) Handle

func (w SmsYunxin) Handle(rule repository.Rule, trigger repository.Trigger, grp repository.EventGroup) error

func (SmsYunxin) Validate

func (w SmsYunxin) Validate(meta string, userRefs []string) error

type VoiceCallMeta

type VoiceCallMeta struct {
	Title string `json:"title"`
}

type WechatAction

type WechatAction struct {
	// contains filtered or unexported fields
}

func NewWechatAction

func NewWechatAction(manager Manager) *WechatAction

func (WechatAction) Handle

func (WechatAction) Validate

func (w WechatAction) Validate(meta string, userRefs []string) error

Jump to

Keyboard shortcuts

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