Documentation
¶
Overview ¶
Package events *
- @Title: 事件业务处理
- @Description: *
- 事件业务处理 * *
Index ¶
Constants ¶
View Source
const ( // EventResourceType 事件上报的资源类型 EventResourceType = "polardb-o" // EventSourceFrom 事件上报的资源类型 EventSourceFrom = "Polardbstack-Daemon" // EventHeader1 事件上报请求头部信息 1 EventHeader1 = "event_resource;log;20210220001;POLAR_STACK" // EventHeader2 事件上报请求头部信息 2 EventHeader2 = "event" // EventLevelInfo 提示信息 EventLevelInfo EventLevel = "INFO" // EventLevelWarn 不影响系统正常流程 EventLevelWarn EventLevel = "WARN" // EventLevelError 系统错误,流程还能继续 EventLevelError EventLevel = "ERROR" // EventLevelCritical 不可逆错误,等同系统宕机 EventLevelCritical EventLevel = "CRITICAL" // EventFloatingIPAddSuccess 浮动IP添加成功 EventFloatingIPAddSuccess EventCode = "FloatingIPAddSuccess" // EventFloatingIPAddFailed 浮动IP添加失败 EventFloatingIPAddFailed EventCode = "FloatingIPAddFailed" // EventFloatingIPDeleteSuccess 浮动IP删除成功 EventFloatingIPDeleteSuccess EventCode = "FloatingIPDeleteSuccess" // EventFloatingIPDeleteFailed 浮动IP删除失败 EventFloatingIPDeleteFailed EventCode = "FloatingIPDeleteFailed" // EventNeedToAddFloatingIP 应该存在该ip, 但却不存在 需要添加 EventNeedToAddFloatingIP EventCode = "EventNeedToAddFloatingIP" // EventRemoveUnUseFloatingIPSuccess 删除不应该存在的IP成功 EventRemoveUnUseFloatingIPSuccess EventCode = "EventRemoveUnUseFloatingIPSuccess" // EventRemoveUnUseFloatingIPFailed 删除不应该存在的IP失败 EventRemoveUnUseFloatingIPFailed EventCode = "EventRemoveUnUseFloatingIPFailed" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EventBody ¶
type EventBody struct {
// 事件发生时业务域内唯一ID
EventId string `json:"eventId"`
// 事件规则编码
EventCode EventCode `json:"eventCode"`
// 来源
Source Source `json:"source"`
// 事件的级别
// - CRITICAL : "不可逆错误,等同系统宕机"
// - ERROR : "系统错误,流程还能继续"
// - WARN : "不影响系统正常流程"
// - INFO : "提示信息"
Level EventLevel `json:"level"`
// 事件发生时间 毫秒级时间戳
Time int64 `json:"time"`
// 事件内容,json格式
Body Body `json:"body"`
}
EventBody *
- @Title: 上报日志的请求消息体 *
type EventLevel ¶
type EventLevel string
EventLevel 事件级别
func (EventLevel) ToString ¶
func (el EventLevel) ToString() string
ToString *
- @Title: EventLevel.ToString
- @Description: *
- 将 EventLevel 由枚举类型转字符型,默认为 "INFO" * *
type EventResponse ¶
type EventResponse struct {
Success bool `json:"success"`
Msg string `json:"msg"`
DataList interface{} `json:"dataList"`
}
EventResponse *
- @Title: 事件上报的响应结果 *
func UploadEvent ¶
func UploadEvent(eventCode EventCode, insName string, ip string, describe string) (er EventResponse, err error)
UploadEvent *
- @Title: 事件上报 *
Click to show internal directories.
Click to hide internal directories.