Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1363 from python-gitlab/feat/all-audit-events
Feat: cover all audit events
- Loading branch information
Showing
6 changed files
with
98 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,75 @@ | ||
""" | ||
GitLab API: | ||
https://docs.gitlab.com/ee/api/audit_events.html#project-audit-events | ||
https://docs.gitlab.com/ee/api/audit_events.html | ||
""" | ||
import warnings | ||
|
||
from gitlab.base import RESTManager, RESTObject | ||
from gitlab.mixins import RetrieveMixin | ||
|
||
__all__ = [ | ||
"AuditEvent", | ||
"AuditEventManager", | ||
"GroupAuditEvent", | ||
"GroupAuditEventManager", | ||
"ProjectAuditEvent", | ||
"ProjectAuditEventManager", | ||
"ProjectAudit", | ||
"ProjectAuditManager", | ||
] | ||
|
||
|
||
class ProjectAudit(RESTObject): | ||
class AuditEvent(RESTObject): | ||
_id_attr = "id" | ||
|
||
|
||
class ProjectAuditManager(RetrieveMixin, RESTManager): | ||
class AuditEventManager(RetrieveMixin, RESTManager): | ||
_path = "/audit_events" | ||
_obj_cls = AuditEvent | ||
_list_filters = ("created_after", "created_before", "entity_type", "entity_id") | ||
|
||
|
||
class GroupAuditEvent(RESTObject): | ||
_id_attr = "id" | ||
|
||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters