Documentation
¶
Index ¶
- Constants
- func GetAuditData(c *gin.Context) map[string]string
- func GetExtraAuditData(c *gin.Context) (string, map[string]string)
- type AuditInterface
- type DefaultAuditInstance
- func (audit *DefaultAuditInstance) AuditProxyFunc(c *gin.Context, proxyobj *ProxyObject)
- func (audit *DefaultAuditInstance) Consumer(ctx context.Context) error
- func (audit *DefaultAuditInstance) Log(username, module, tenant, operation, name string, labels map[string]string, ...)
- func (audit *DefaultAuditInstance) LogIt(c *gin.Context, t time.Time, raw gin.H)
- func (audit *DefaultAuditInstance) Middleware() func(c *gin.Context)
- func (audit *DefaultAuditInstance) SaveAuditLog(c *gin.Context)
- func (audit *DefaultAuditInstance) SetAuditData(c *gin.Context, action, module, name string)
- func (audit *DefaultAuditInstance) SetExtraAuditData(c *gin.Context, kind string, uid uint)
- func (audit *DefaultAuditInstance) SetExtraAuditDataByClusterNamespace(c *gin.Context, cluster, namespace string)
- func (audit *DefaultAuditInstance) WebsocketAuditFunc(username string, parents []cache.CommonResourceIface, ip string, ...) func(cmd string)
- type ProxyObject
Constants ¶
View Source
const ( AuditMark = "needAudit" AuditAction = "auditAction" )
View Source
const ( AuditSubjectKey = "audit_subject" AuditExtraDataKey = "audit_extra_datas" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuditInterface ¶
type AuditInterface interface { AuditProxyFunc(c *gin.Context, p *ProxyObject) WebsocketAuditFunc(username string, parents []cache.CommonResourceIface, ip string, proxyobj *ProxyObject) func(cmd string) SetAuditData(c *gin.Context, action, mod, name string) SetExtraAuditData(c *gin.Context, kind string, uid uint) SetExtraAuditDataByClusterNamespace(c *gin.Context, cluster, namesapce string) }
type DefaultAuditInstance ¶
type DefaultAuditInstance struct {
// contains filtered or unexported fields
}
func NewAuditMiddleware ¶
func NewAuditMiddleware(db *gorm.DB, cache *cache.ModelCache, uinterface aaa.ContextUserOperator) *DefaultAuditInstance
func (*DefaultAuditInstance) AuditProxyFunc ¶
func (audit *DefaultAuditInstance) AuditProxyFunc(c *gin.Context, proxyobj *ProxyObject)
func (*DefaultAuditInstance) Consumer ¶
func (audit *DefaultAuditInstance) Consumer(ctx context.Context) error
func (*DefaultAuditInstance) Middleware ¶
func (audit *DefaultAuditInstance) Middleware() func(c *gin.Context)
func (*DefaultAuditInstance) SaveAuditLog ¶
func (audit *DefaultAuditInstance) SaveAuditLog(c *gin.Context)
func (*DefaultAuditInstance) SetAuditData ¶
func (audit *DefaultAuditInstance) SetAuditData(c *gin.Context, action, module, name string)
SetAuditData set audit data in context
func (*DefaultAuditInstance) SetExtraAuditData ¶
func (audit *DefaultAuditInstance) SetExtraAuditData(c *gin.Context, kind string, uid uint)
SetExtraAuditData set audit extra data in context
func (*DefaultAuditInstance) SetExtraAuditDataByClusterNamespace ¶
func (audit *DefaultAuditInstance) SetExtraAuditDataByClusterNamespace(c *gin.Context, cluster, namespace string)
SetExtraAuditDataByClusterNamespace set context audit info via namespapce
func (*DefaultAuditInstance) WebsocketAuditFunc ¶
func (audit *DefaultAuditInstance) WebsocketAuditFunc(username string, parents []cache.CommonResourceIface, ip string, proxyobj *ProxyObject) func(cmd string)
type ProxyObject ¶
type ProxyObject struct { NamespacedScoped bool Cluster string Namespace string Name string Group string Version string Resource string Action string }
func (*ProxyObject) InNamespace ¶
func (p *ProxyObject) InNamespace() bool
Click to show internal directories.
Click to hide internal directories.