Documentation
¶
Index ¶
Constants ¶
View Source
const (
META_AUDIT_KEY = "audit"
)
View Source
const (
PRIORITY = 90
)
Variables ¶
View Source
var (
AppName = "audits"
)
Functions ¶
This section is empty.
Types ¶
type AuditLog ¶
type AuditLog struct {
// 事件Id,
Id string `json:"id" gorm:"primaryKey;column:id"`
// 谁
Who string `json:"who" gorm:"column:who"`
// 在什么时间
Time int64 `json:"time" gorm:"column:time"`
// 操作人的Ip
Ip string `json:"ip" gorm:"column:ip"`
// User Agent
UserAgent string `json:"user_agent" gorm:"column:user_agent"`
// 做了什么操作, 服务:资源:动作
// 服务 <cmdb, mcenter, ....>
Service string `json:"service" gorm:"column:service"`
// 哪个空间
Namespace string `json:"namespace" gorm:"column:namespace"`
// 资源 <secret, user, namespace, ...>
ResourceType string `json:"resource_type" gorm:"column:resource_type"`
// 动作 <list, get, update, create, delete, ....>
Action string `json:"action" gorm:"column:action"`
// 详情信息
ResourceId string `json:"resource_id" gorm:"column:resource_id"`
// 状态码 404
StatusCode int `json:"status_code" gorm:"column:status_code"`
// 具体信息
ErrorMessage string `json:"error_message" gorm:"column:error_message"`
// 标签
Label map[string]string `json:"label" gorm:"column:label;serializer:json;type:json" description:"事件标签" optional:"true"`
// 扩展信息
Extras map[string]string `json:"extras" gorm:"column:extras;serializer:json;type:json" description:"额外属性" optional:"true"`
}
用户操作事件 如何映射成 MongoDB BSON
func NewAuditLog ¶
func NewAuditLog() *AuditLog
type QueryAuditLogRequest ¶
type QueryAuditLogRequest struct {
// 分页请求参数
*request.PageRequest
// 事件标签, TaskId
Label map[string]string `json:"label" bson:"label" description:"事件标签" optional:"true"`
}
func NewQueryAuditLogRequest ¶
func NewQueryAuditLogRequest() *QueryAuditLogRequest
Click to show internal directories.
Click to hide internal directories.