- Notifications
You must be signed in to change notification settings - Fork673
Feat: cover all audit events#1363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
5 commits Select commitHold shift + click to select a range
48ba88f
refactor(objects): move instance audit events where they belong
nejchc3f0a6f
fix(objects): add single get endpoint for instance audit events
nejch35a190c
chore: import audit events in objects
nejch84e3247
test(objects): add unit test for instance audit events
nejch2a0fbdf
feat(objects): add support for group audit events API
nejchFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
44 changes: 37 additions & 7 deletionsgitlab/tests/objects/test_audit_events.py
This file contains hidden or 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
1 change: 1 addition & 0 deletionsgitlab/v4/objects/__init__.py
This file contains hidden or 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
60 changes: 56 additions & 4 deletionsgitlab/v4/objects/audit_events.py
This file contains hidden or 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 | ||
""" | ||
import warnings | ||
from gitlab.base import RESTManager, RESTObject | ||
from gitlab.mixins import RetrieveMixin | ||
__all__ = [ | ||
"AuditEvent", | ||
"AuditEventManager", | ||
"GroupAuditEvent", | ||
"GroupAuditEventManager", | ||
"ProjectAuditEvent", | ||
"ProjectAuditEventManager", | ||
"ProjectAudit", | ||
"ProjectAuditManager", | ||
] | ||
classAuditEvent(RESTObject): | ||
_id_attr = "id" | ||
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 =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 |
12 changes: 0 additions & 12 deletionsgitlab/v4/objects/events.py
This file contains hidden or 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
2 changes: 2 additions & 0 deletionsgitlab/v4/objects/groups.py
This file contains hidden or 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
4 changes: 2 additions & 2 deletionsgitlab/v4/objects/projects.py
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.