1"""
2GitLab API:
3https://docs.gitlab.com/ee/api/audit_events.html
4"""
5from gitlab.base import RESTManager, RESTObject
6from gitlab.mixins import RetrieveMixin
7
8__all__ = [
9    "AuditEvent",
10    "AuditEventManager",
11    "GroupAuditEvent",
12    "GroupAuditEventManager",
13    "ProjectAuditEvent",
14    "ProjectAuditEventManager",
15    "ProjectAudit",
16    "ProjectAuditManager",
17]
18
19
20class AuditEvent(RESTObject):
21    _id_attr = "id"
22
23
24class AuditEventManager(RetrieveMixin, RESTManager):
25    _path = "/audit_events"
26    _obj_cls = AuditEvent
27    _list_filters = ("created_after", "created_before", "entity_type", "entity_id")
28
29
30class GroupAuditEvent(RESTObject):
31    _id_attr = "id"
32
33
34class GroupAuditEventManager(RetrieveMixin, RESTManager):
35    _path = "/groups/%(group_id)s/audit_events"
36    _obj_cls = GroupAuditEvent
37    _from_parent_attrs = {"group_id": "id"}
38    _list_filters = ("created_after", "created_before")
39
40
41class ProjectAuditEvent(RESTObject):
42    _id_attr = "id"
43
44
45class ProjectAuditEventManager(RetrieveMixin, RESTManager):
46    _path = "/projects/%(project_id)s/audit_events"
47    _obj_cls = ProjectAuditEvent
48    _from_parent_attrs = {"project_id": "id"}
49    _list_filters = ("created_after", "created_before")
50
51
52class ProjectAudit(ProjectAuditEvent):
53    pass
54
55
56class ProjectAuditManager(ProjectAuditEventManager):
57    pass
58