event

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Level_name = map[int32]string{
		0: "Trace",
		1: "Debug",
		2: "Info",
		3: "Warn",
		4: "Error",
		5: "Critical",
		6: "Disaster",
	}
	Level_value = map[string]int32{
		"Trace":    0,
		"Debug":    1,
		"Info":     2,
		"Warn":     3,
		"Error":    4,
		"Critical": 5,
		"Disaster": 6,
	}
)

Enum value maps for Level.

View Source
var (
	Type_name = map[int32]string{
		0: "OperateEvent",
		1: "StatusEvent",
	}
	Type_value = map[string]int32{
		"OperateEvent": 0,
		"StatusEvent":  1,
	}
)

Enum value maps for Type.

View Source
var File_pb_event_event_proto protoreflect.FileDescriptor
View Source
var File_pb_event_level_proto protoreflect.FileDescriptor
View Source
var File_pb_event_type_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Event

type Event struct {

	// 事件ID
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"`
	// 事件发送时间
	Time int64 `protobuf:"varint,2,opt,name=time,proto3" json:"time" bson:"time"`
	Type Type  `protobuf:"varint,3,opt,name=type,proto3,enum=mcube.event.Type" json:"type" bson:"type"`
	// 事件来源
	Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source" bson:"source"`
	// 事件等级
	Level Level `protobuf:"varint,5,opt,name=level,proto3,enum=mcube.event.Level" json:"level" bson:"level"`
	// 数据meta
	Meta map[string]string `` /* 151-byte string literal not displayed */
	// data 具体的数据
	Data *anypb.Any `protobuf:"bytes,7,opt,name=data,proto3" json:"data" bson:"data"`
	// contains filtered or unexported fields
}

Event to be used by controllers.

func NewDefaultEvent added in v0.4.0

func NewDefaultEvent() *Event

NewDefaultEvent todo

func NewOperateEvent added in v0.4.0

func NewOperateEvent(e *OperateEventData) (*Event, error)

NewOperateEvent 实例

func (*Event) Descriptor deprecated added in v0.9.2

func (*Event) Descriptor() ([]byte, []int)

Deprecated: Use Event.ProtoReflect.Descriptor instead.

func (*Event) GetData added in v0.9.2

func (x *Event) GetData() *anypb.Any

func (*Event) GetId added in v0.9.2

func (x *Event) GetId() string

func (*Event) GetLevel added in v0.9.2

func (x *Event) GetLevel() Level

func (*Event) GetMeta added in v0.9.0

func (x *Event) GetMeta() map[string]string

func (*Event) GetMetaKey added in v0.9.2

func (e *Event) GetMetaKey(key string) string

GetMeta 获取meta信息

func (*Event) GetSource added in v0.9.2

func (x *Event) GetSource() string

func (*Event) GetTime added in v0.9.2

func (x *Event) GetTime() int64

func (*Event) GetType added in v0.9.2

func (x *Event) GetType() Type

func (*Event) ParseData added in v0.9.2

func (e *Event) ParseData(data proto.Message) error

ParseBody todo

func (*Event) ProtoMessage added in v0.9.2

func (*Event) ProtoMessage()

func (*Event) ProtoReflect added in v0.9.2

func (x *Event) ProtoReflect() protoreflect.Message

func (*Event) Reset added in v0.9.2

func (x *Event) Reset()

func (*Event) SetLevel added in v0.9.0

func (e *Event) SetLevel(l Level)

SetLevel 设置事件级别

func (*Event) SetMeta added in v0.9.0

func (e *Event) SetMeta(key, value string)

SetMeta 设置meta信息

func (*Event) SetSource added in v0.9.0

func (e *Event) SetSource(src string)

SetSource 设置事件来源

func (*Event) String added in v0.9.2

func (x *Event) String() string

func (*Event) Validate added in v0.5.7

func (e *Event) Validate() error

Validate 校验事件是否合法

type Level

type Level int32
const (
	Level_Trace    Level = 0
	Level_Debug    Level = 1
	Level_Info     Level = 2
	Level_Warn     Level = 3
	Level_Error    Level = 4
	Level_Critical Level = 5
	Level_Disaster Level = 6
)

func (Level) Descriptor added in v0.9.2

func (Level) Descriptor() protoreflect.EnumDescriptor

func (Level) Enum added in v0.9.2

func (x Level) Enum() *Level

func (Level) EnumDescriptor deprecated added in v0.9.2

func (Level) EnumDescriptor() ([]byte, []int)

Deprecated: Use Level.Descriptor instead.

func (Level) Number added in v0.9.2

func (x Level) Number() protoreflect.EnumNumber

func (Level) String added in v0.3.3

func (x Level) String() string

func (Level) Type added in v0.9.2

func (Level) Type() protoreflect.EnumType

type OperateEventData added in v0.9.2

type OperateEventData struct {

	// 回话ID
	Session string `protobuf:"bytes,1,opt,name=session,proto3" json:"session" bson:"session"`
	// 操作人
	Account string `protobuf:"bytes,2,opt,name=account,proto3" json:"account" bson:"account"`
	// 请求ID
	RequestId string `protobuf:"bytes,3,opt,name=request_id,json=requestId,proto3" json:"request_id" bson:"request_id"`
	// 操作者IP
	IpAddress string `protobuf:"bytes,4,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address" bson:"ip_address"`
	// 用户UA
	UserAgent string `protobuf:"bytes,5,opt,name=user_agent,json=userAgent,proto3" json:"user_agent" bson:"user_agent"`
	// 用户名称
	UserName string `protobuf:"bytes,6,opt,name=user_name,json=userName,proto3" json:"user_name" bson:"user_name"`
	// 用户类型
	UserType string `protobuf:"bytes,7,opt,name=user_type,json=userType,proto3" json:"user_type" bson:"user_type"`
	// 操作的域
	UserDomain string `protobuf:"bytes,8,opt,name=user_domain,json=userDomain,proto3" json:"user_domain" bson:"user_domain"`
	// 服务名称
	ServiceName string `protobuf:"bytes,9,opt,name=service_name,json=serviceName,proto3" json:"service_name" bson:"service_name"`
	// 功能路径
	FeaturePath string `protobuf:"bytes,10,opt,name=feature_path,json=featurePath,proto3" json:"feature_path" bson:"feature_path"`
	// 资源类型
	ResourceType string `protobuf:"bytes,11,opt,name=resource_type,json=resourceType,proto3" json:"resource_type" bson:"resource_type"`
	// 操作动作
	Action string `protobuf:"bytes,12,opt,name=action,proto3" json:"action" bson:"action"`
	// 事件数据
	Request *anypb.Any `protobuf:"bytes,13,opt,name=request,proto3" json:"request,omitempty" bson:"request"`
	// 事件数据
	Response *anypb.Any `protobuf:"bytes,14,opt,name=response,proto3" json:"response,omitempty" bson:"response"`
	// contains filtered or unexported fields
}

OperateEvent 事件具体数据

func (*OperateEventData) Descriptor deprecated added in v0.9.2

func (*OperateEventData) Descriptor() ([]byte, []int)

Deprecated: Use OperateEventData.ProtoReflect.Descriptor instead.

func (*OperateEventData) GetAccount added in v0.9.2

func (x *OperateEventData) GetAccount() string

func (*OperateEventData) GetAction added in v0.9.2

func (x *OperateEventData) GetAction() string

func (*OperateEventData) GetFeaturePath added in v0.9.2

func (x *OperateEventData) GetFeaturePath() string

func (*OperateEventData) GetIpAddress added in v0.9.2

func (x *OperateEventData) GetIpAddress() string

func (*OperateEventData) GetRequest added in v0.9.2

func (x *OperateEventData) GetRequest() *anypb.Any

func (*OperateEventData) GetRequestId added in v0.9.2

func (x *OperateEventData) GetRequestId() string

func (*OperateEventData) GetResourceType added in v0.9.2

func (x *OperateEventData) GetResourceType() string

func (*OperateEventData) GetResponse added in v0.9.2

func (x *OperateEventData) GetResponse() *anypb.Any

func (*OperateEventData) GetServiceName added in v0.9.2

func (x *OperateEventData) GetServiceName() string

func (*OperateEventData) GetSession added in v0.9.2

func (x *OperateEventData) GetSession() string

func (*OperateEventData) GetUserAgent added in v0.9.2

func (x *OperateEventData) GetUserAgent() string

func (*OperateEventData) GetUserDomain added in v0.9.2

func (x *OperateEventData) GetUserDomain() string

func (*OperateEventData) GetUserName added in v0.9.2

func (x *OperateEventData) GetUserName() string

func (*OperateEventData) GetUserType added in v0.9.2

func (x *OperateEventData) GetUserType() string

func (*OperateEventData) ProtoMessage added in v0.9.2

func (*OperateEventData) ProtoMessage()

func (*OperateEventData) ProtoReflect added in v0.9.2

func (x *OperateEventData) ProtoReflect() protoreflect.Message

func (*OperateEventData) Reset added in v0.9.2

func (x *OperateEventData) Reset()

func (*OperateEventData) String added in v0.9.2

func (x *OperateEventData) String() string

type Type added in v0.4.0

type Type int32
const (
	// 全局配置, 所有服务可以读取
	Type_OperateEvent Type = 0
	// 组内配置, 组里面的服务可以读取
	Type_StatusEvent Type = 1
)

func (Type) Descriptor added in v0.9.2

func (Type) Descriptor() protoreflect.EnumDescriptor

func (Type) Enum added in v0.9.2

func (x Type) Enum() *Type

func (Type) EnumDescriptor deprecated added in v0.9.2

func (Type) EnumDescriptor() ([]byte, []int)

Deprecated: Use Type.Descriptor instead.

func (Type) Number added in v0.9.2

func (x Type) Number() protoreflect.EnumNumber

func (Type) String added in v0.4.0

func (x Type) String() string

func (Type) Type added in v0.9.2

func (Type) Type() protoreflect.EnumType

Jump to

Keyboard shortcuts

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