-
Notifications
You must be signed in to change notification settings - Fork 1.2k
api,server: apis return their http request type #11382
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Abhishek Kumar <[email protected]>
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14531 |
|
good initiative, would it make sense to have GET or POST as default so we don’t have to change all external plugins? |
|
@DaanHoogland with change, it already returns GET/POST based on the apiName when the annotation is not added, I added the annotation to some classes because they were listed in ApiServlet class as GET commands explicitly |
|
ok, @shwstppr , not claiming this as a universal truth but for this change would have made the change simpler. |
@DaanHoogland not necessarily IMO. If we return |
Signed-off-by: Abhishek Kumar <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #11382 +/- ##
============================================
+ Coverage 17.56% 17.58% +0.01%
- Complexity 15548 15582 +34
============================================
Files 5913 5913
Lines 529440 529466 +26
Branches 64670 64677 +7
============================================
+ Hits 93018 93124 +106
+ Misses 425964 425874 -90
- Partials 10458 10468 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14559 |
Signed-off-by: Abhishek Kumar <[email protected]>
|
@blueorangutan package |
|
@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 14580 |
|
@blueorangutan test |
|
@shwstppr a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
|
[SF] Trillian test result (tid-14048)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds HTTP request type information to the listApis API response, allowing clients to know whether to use GET or POST when invoking APIs. The implementation includes adding an httpMethod annotation parameter to the @APICommand annotation and logic to determine the appropriate HTTP method based on annotations or API naming patterns.
Key changes:
- Added
httpMethodparameter to@APICommandannotation for explicit HTTP method specification - Modified API discovery service to include HTTP request type in response
- Updated validation logic to use annotations and naming patterns to determine allowed HTTP methods
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| api/src/main/java/org/apache/cloudstack/api/APICommand.java | Added httpMethod parameter to APICommand annotation |
| api/src/main/java/org/apache/cloudstack/api/ApiConstants.java | Added HTTP_REQUEST_TYPE constant |
| api/src/main/java/org/apache/cloudstack/api/command/admin/offering/IsAccountAllowedToCreateOfferingsWithTagsCmd.java | Added GET httpMethod annotation |
| plugins/api/discovery/src/main/java/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java | Added httpRequestType field to API response |
| plugins/api/discovery/src/main/java/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java | Implemented logic to determine HTTP request type |
| plugins/api/discovery/src/test/java/org/apache/cloudstack/discovery/ApiDiscoveryServiceImplTest.java | Added comprehensive test coverage for HTTP request type logic |
| server/src/main/java/com/cloud/api/ApiServlet.java | Refactored validation logic to use annotations and patterns |
| server/src/test/java/com/cloud/api/ApiServletTest.java | Added extensive test coverage for validation logic |
| Multiple plugin command files | Added GET httpMethod annotations to read-only APIs |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
DaanHoogland
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clgtm, not all co-pilot’s comments are senseless, though I can live without addressing them in this context.
Signed-off-by: Abhishek Kumar <[email protected]>
|
@DaanHoogland I've addressed 2 of 3 comments from Copilot. For changing match pattern I think it can be a separate PR @blueorangutan package |
|
@shwstppr a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15853 |
Description
This PR adds the httprequesttype parameter to the listApis response, allowing clients to invoke APIs using the appropriate HTTP methods — GET or POST. API classes can specify the supported HTTP methods via annotations. If no annotation is present, the request type will be inferred based on the API name.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
lisApis output,
How did you try to break this feature and the system with this change?