@@ -96,6 +96,10 @@ type AuditQueryCondition struct {
9696 FuzzyQuery bool `json:"fuzzy_query"`
9797 // Condition is used for new way to search audit log by user or resource_name
9898 Condition []querybuilder.AtomRule `json:"condition"`
99+ // Scene filters audit logs by operation scene
100+ Scene string `json:"scene"`
101+ // SceneCode filters audit logs by operation scene code
102+ SceneCode string `json:"scene_code"`
99103}
100104
101105// Validate is a AuditQueryCondition validator to validate user resource_name condition whether exist at the same time
@@ -172,6 +176,10 @@ type InstAuditCondition struct {
172176 OperationTime OperationTimeCondition `json:"operation_time"`
173177 // ID is an audit record's id
174178 ID []int64 `json:"id"`
179+ // Scene filters audit logs by operation scene
180+ Scene string `json:"scene"`
181+ // SceneCode filters audit logs by operation scene code
182+ SceneCode string `json:"scene_code"`
175183}
176184
177185// AuditLog struct for audit log
@@ -209,6 +217,12 @@ type AuditLog struct {
209217 RequestID string `json:"rid,omitempty" bson:"rid,omitempty"`
210218 // todo ExtendResourceName for the temporary solution of ipv6
211219 ExtendResourceName string `json:"extend_resource_name" bson:"extend_resource_name"`
220+ // Scene the operation scene of the audit log
221+ Scene string `json:"scene" bson:"scene"`
222+ // SceneDesc the operation scene description of the audit log
223+ SceneDesc string `json:"scene_desc" bson:"scene_desc"`
224+ // SceneCode the operation scene code of the audit log
225+ SceneCode string `json:"scene_code" bson:"scene_code"`
212226}
213227
214228type bsonAuditLog struct {
@@ -227,6 +241,9 @@ type bsonAuditLog struct {
227241 AppCode string `json:"code" bson:"code"`
228242 RequestID string `json:"rid" bson:"rid"`
229243 ExtendResourceName string `json:"extend_resource_name" bson:"extend_resource_name"`
244+ Scene string `json:"scene" bson:"scene"`
245+ SceneDesc string `json:"scene_desc" bson:"scene_desc"`
246+ SceneCode string `json:"scene_code" bson:"scene_code"`
230247}
231248
232249type jsonAuditLog struct {
@@ -245,6 +262,9 @@ type jsonAuditLog struct {
245262 AppCode string `json:"code" bson:"code"`
246263 RequestID string `json:"rid" bson:"rid"`
247264 ExtendResourceName string `json:"extend_resource_name" bson:"extend_resource_name"`
265+ Scene string `json:"scene" bson:"scene"`
266+ SceneDesc string `json:"scene_desc" bson:"scene_desc"`
267+ SceneCode string `json:"scene_code" bson:"scene_code"`
248268}
249269
250270// DetailFactory TODO
@@ -293,6 +313,9 @@ func (auditLog *AuditLog) UnmarshalJSON(data []byte) error {
293313 auditLog .AppCode = audit .AppCode
294314 auditLog .RequestID = audit .RequestID
295315 auditLog .ExtendResourceName = audit .ExtendResourceName
316+ auditLog .Scene = audit .Scene
317+ auditLog .SceneDesc = audit .SceneDesc
318+ auditLog .SceneCode = audit .SceneCode
296319
297320 if audit .OperationDetail == nil {
298321 return nil
@@ -357,6 +380,9 @@ func (auditLog *AuditLog) UnmarshalBSON(data []byte) error {
357380 auditLog .AppCode = audit .AppCode
358381 auditLog .RequestID = audit .RequestID
359382 auditLog .ExtendResourceName = audit .ExtendResourceName
383+ auditLog .Scene = audit .Scene
384+ auditLog .SceneDesc = audit .SceneDesc
385+ auditLog .SceneCode = audit .SceneCode
360386
361387 if audit .OperationDetail == nil {
362388 return nil
@@ -416,6 +442,9 @@ func (auditLog AuditLog) MarshalBSON() ([]byte, error) {
416442 audit .AppCode = auditLog .AppCode
417443 audit .RequestID = auditLog .RequestID
418444 audit .ExtendResourceName = auditLog .ExtendResourceName
445+ audit .Scene = auditLog .Scene
446+ audit .SceneDesc = auditLog .SceneDesc
447+ audit .SceneCode = auditLog .SceneCode
419448 var err error
420449 switch val := auditLog .OperationDetail .(type ) {
421450 default :
0 commit comments