summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/audit_events.py
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2021-03-07 12:50:26 +0100
committerNejc Habjan <hab.nejc@gmail.com>2021-03-07 15:00:06 +0100
commit2a0fbdf9fe98da6c436230be47b0ddb198c7eca9 (patch)
tree1d5c585508385b339d0b60224b74b7cc47a6cf92 /gitlab/v4/objects/audit_events.py
parent84e3247d0cd3ddb1f3aa0ac91fb977c3e1e197b5 (diff)
downloadgitlab-feat/all-audit-events.tar.gz
feat(objects): add support for group audit events APIfeat/all-audit-events
Diffstat (limited to 'gitlab/v4/objects/audit_events.py')
-rw-r--r--gitlab/v4/objects/audit_events.py46
1 files changed, 43 insertions, 3 deletions
diff --git a/gitlab/v4/objects/audit_events.py b/gitlab/v4/objects/audit_events.py
index a4437be..c99856a 100644
--- a/gitlab/v4/objects/audit_events.py
+++ b/gitlab/v4/objects/audit_events.py
@@ -2,6 +2,7 @@
GitLab API:
https://docs.gitlab.com/ee/api/audit_events.html
"""
+import warnings
from gitlab.base import RESTManager, RESTObject
from gitlab.mixins import RetrieveMixin
@@ -9,6 +10,10 @@ from gitlab.mixins import RetrieveMixin
__all__ = [
"AuditEvent",
"AuditEventManager",
+ "GroupAuditEvent",
+ "GroupAuditEventManager",
+ "ProjectAuditEvent",
+ "ProjectAuditEventManager",
"ProjectAudit",
"ProjectAuditManager",
]
@@ -24,12 +29,47 @@ class AuditEventManager(RetrieveMixin, RESTManager):
_list_filters = ("created_after", "created_before", "entity_type", "entity_id")
-class ProjectAudit(RESTObject):
+class GroupAuditEvent(RESTObject):
_id_attr = "id"
-class ProjectAuditManager(RetrieveMixin, RESTManager):
+class GroupAuditEventManager(RetrieveMixin, RESTManager):
+ _path = "/groups/%(group_id)s/audit_events"
+ _obj_cls = GroupAuditEvent
+ _from_parent_attrs = {"group_id": "id"}
+ _list_filters = ("created_after", "created_before")
+
+
+class ProjectAuditEvent(RESTObject):
+ _id_attr = "id"
+
+ def __init_subclass__(self):
+ warnings.warn(
+ "This class has been renamed to ProjectAuditEvent "
+ "and will be removed in a future release.",
+ DeprecationWarning,
+ 2,
+ )
+
+
+class ProjectAuditEventManager(RetrieveMixin, RESTManager):
_path = "/projects/%(project_id)s/audit_events"
- _obj_cls = ProjectAudit
+ _obj_cls = ProjectAuditEvent
_from_parent_attrs = {"project_id": "id"}
_list_filters = ("created_after", "created_before")
+
+ def __init_subclass__(self):
+ warnings.warn(
+ "This class has been renamed to ProjectAuditEventManager "
+ "and will be removed in a future release.",
+ DeprecationWarning,
+ 2,
+ )
+
+
+class ProjectAudit(ProjectAuditEvent):
+ pass
+
+
+class ProjectAuditManager(ProjectAuditEventManager):
+ pass