Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add swagger api and audit_log_ext table model #21360

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

stonezdj
Copy link
Contributor

Thank you for contributing to Harbor!

Comprehensive Summary of your change

Issue being fixed

Fixes #(issue)

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

  add auditlog-ext related api in swagger
  add audit_log_ext table

Signed-off-by: stonezdj <[email protected]>
@stonezdj stonezdj force-pushed the 24dec27_add_swagger_model branch from 3e8f55d to 59ae032 Compare December 27, 2024 09:08
Copy link

codecov bot commented Dec 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.18%. Comparing base (c8c11b4) to head (59ae032).
Report is 343 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #21360      +/-   ##
==========================================
+ Coverage   45.36%   46.18%   +0.81%     
==========================================
  Files         244      247       +3     
  Lines       13333    13883     +550     
  Branches     2719     2875     +156     
==========================================
+ Hits         6049     6412     +363     
- Misses       6983     7134     +151     
- Partials      301      337      +36     
Flag Coverage Δ
unittests 46.18% <ø> (+0.81%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 491 files with indirect coverage changes

@@ -1755,6 +1755,59 @@ paths:
$ref: '#/responses/401'
'500':
$ref: '#/responses/500'
/auditlog-exts:
get:
summary: Get recent logs of the projects which the user is a member of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. As per the design the user has to be a project admin to see the audit log of a project.
  2. I don't really think we need to provide a aggregated view of audit log of different projects. How about we use this API only for system admin?

@@ -1755,6 +1755,59 @@ paths:
$ref: '#/responses/401'
'500':
$ref: '#/responses/500'
/auditlog-exts:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: IMO it should be auditlogs-ext, if you agree, please also update the code and other resources.

@@ -1789,6 +1842,40 @@ paths:
$ref: '#/responses/401'
'500':
$ref: '#/responses/500'
/projects/{project_name}/log-exts:
get:
summary: Get recent logs of the projects
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add some words to differentiate from the old API /projects/{project_name}/logs.
Maybe also updating the description of the old API to explicitly mention it's only for old data and will be deprecated?

$ref: '#/responses/401'
'500':
$ref: '#/responses/500'
/auditlog-exts/eventtypes:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it have to be a subresource of auditlog? How about /auditlog-eventtypes?

Shall we also mention the security requirements in the API description? I believe only system admin can use this API?

@@ -1789,6 +1842,40 @@ paths:
$ref: '#/responses/401'
'500':
$ref: '#/responses/500'
/projects/{project_name}/log-exts:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sometimes it's auditlog-ext but sometimes it's log-ext. Is there a reason for this inconsistency?

AuditLogEventType:
type: object
properties:
event_id:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also commented in the design, it seems there's a dup between event_id and name if we wanna set the value create_user for event_id and Create user for name.

@stonezdj stonezdj added the release-note/new-feature New Harbor Feature label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/new-feature New Harbor Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants