hooks

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2021 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHooksNameExits = errors.New("hook名称已存在")
	ErrEventsNotFound = errors.New("抱歉,您要绑定的事件不存在")
	ErrHooksCreate    = errors.New("创建Hook失败")
	ErrHooksCount     = errors.New("hook总数获取失败")
	ErrHooksList      = errors.New("hook列表获取失败")
	ErrHooksGet       = errors.New("hook获取失败")
)

Functions

func MakeHandler

func MakeHandler(svc Service, logger kitlog.Logger, repository repository.Repository) http.Handler

Types

type Data

type Data struct {
	Url      string
	Params   url.Values
	Headers  string
	ProxyUrl string //代理
	Count    int
}

type Service

type Service interface {
	// 获取单个hook信息
	Get(ctx context.Context, id int) (res *types.Webhook, err error)

	// 获取hook列表
	List(ctx context.Context, name, appName, namespace string, page, limit int) (res map[string]interface{}, err error)

	// 创建hook
	Post(ctx context.Context, req hookRequest) (err error)

	// 修改hook信息
	Update(ctx context.Context, req hookRequest) (err error)

	// 删除hook信息
	Delete(ctx context.Context, id int) (err error)

	// 发送测试信号
	TestSend(ctx context.Context, id int) error
}

func NewLoggingService

func NewLoggingService(logger log.Logger, s Service) Service

func NewService

func NewService(logger log.Logger, store repository.Repository, hookQueueSvc ServiceHookQueue) Service

type ServiceHookQueue

type ServiceHookQueue interface {
	/**
	 * @Title hook数据写入队列及event
	 */
	SendHookQueue(ctx context.Context, kind repository.EventsKind, name, ns, msg string) error

	/**
	 * @Title 发送一条测试数据
	 */
	TestHookQueue(req *event.WebhooksRequest, webHook *types.Webhook) error

	/**
	 * @Title 处理消费出来的 hook数据
	 */
	HookReceiver(ctx context.Context, data string) error
}

func NewServiceHookQueue

func NewServiceHookQueue(logger log.Logger,
	amqpClient amqp.AmqpClient,
	conf *config.Config,
	repository repository.Repository,
	noticeSvc notice.Service) ServiceHookQueue

Jump to

Keyboard shortcuts

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