-
Notifications
You must be signed in to change notification settings - Fork 31
Implement simple API listing #509
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
Implement simple API listing #509
Conversation
Makes for easier/more natural reading for humans
As a corollary, should there be a build step that copies HTTP_API.md into |
5189f5d
to
cc68f45
Compare
cc68f45
to
ae2fc05
Compare
Out of curiosity, for the handlers that have the same path and verb, eg |
Yea, that's a good point - it probably isn't helpful at all. This happens because of |
Latest example output: {
"meta": {
"type": "application/json",
"status": "OK"
},
"data": {
"result": {
"overview": "https://0.0.0.0:8181/HTTP_API.md",
"endpoints": [
{
"version": "V1",
"verb": "POST",
"path": "/api/v1/auth"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/clienturl"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/grafana_dashboard_url"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/grafana_datasource_url"
},
{
"version": "V1",
"verb": "POST",
"path": "/api/v1/recordings"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/recordings"
},
{
"version": "V1",
"verb": "DELETE",
"path": "/api/v1/recordings/:recordingName"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/recordings/:recordingName"
},
{
"version": "V1",
"verb": "POST",
"path": "/api/v1/recordings/:recordingName/upload"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/reports/:recordingName"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/targets"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/targets/:targetId/events"
},
{
"version": "V1",
"verb": "PATCH",
"path": "/api/v1/targets/:targetId/recordingOptions"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/targets/:targetId/recordingOptions"
},
{
"version": "V1",
"verb": "POST",
"path": "/api/v1/targets/:targetId/recordings"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/targets/:targetId/recordings"
},
{
"version": "V1",
"verb": "DELETE",
"path": "/api/v1/targets/:targetId/recordings/:recordingName"
},
{
"version": "V1",
"verb": "PATCH",
"path": "/api/v1/targets/:targetId/recordings/:recordingName"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/targets/:targetId/recordings/:recordingName"
},
{
"version": "V1",
"verb": "POST",
"path": "/api/v1/targets/:targetId/recordings/:recordingName/upload"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/targets/:targetId/reports/:recordingName"
},
{
"version": "V1",
"verb": "POST",
"path": "/api/v1/targets/:targetId/snapshot"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/targets/:targetId/templates"
},
{
"version": "V1",
"verb": "GET",
"path": "/api/v1/targets/:targetId/templates/:templateName/type/:templateType"
},
{
"version": "V1",
"verb": "POST",
"path": "/api/v1/templates"
},
{
"version": "V1",
"verb": "DELETE",
"path": "/api/v1/templates/:templateName"
},
{
"version": "V2",
"verb": "POST",
"path": "/api/v2/certificates"
},
{
"version": "V2",
"verb": "POST",
"path": "/api/v2/targets"
},
{
"version": "V2",
"verb": "DELETE",
"path": "/api/v2/targets/:targetId"
},
{
"version": "V2",
"verb": "GET",
"path": "/api/v2/targets/:targetId/eventsSearch/:query"
},
{
"version": "V2",
"verb": "GET",
"path": "/api/v2/targets/:targetId/recordingOptionsList"
},
{
"version": "V2",
"verb": "POST",
"path": "/api/v2/targets/:targetId/snapshot"
}
]
}
}
} |
src/main/java/io/cryostat/net/web/http/api/v2/ApiListingHandler.java
Outdated
Show resolved
Hide resolved
Name follows existing handler naming convention
After extending the V2 base handler, does that mean |
In this specific case no/it doesn't quite matter - the |
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.
Looks good, although I'm a bit hesitant to approve since I don't fully understand 100% of the syntax/semantics. However, I did give it a good read-through and from what I do understand, the code is logically consistent with respect to what it's trying to do.
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.
Looks good to me!
* Implement simple API listing * Suppress comparator serialization * Apply spotless formatting * Place verb before path in results Makes for easier/more natural reading for humans * Migrate to V2 API response format and include HTTP_API.md resource with link * Add unit test * Add simple itest * Do not output duplicate endpoints * Remove unused field * Rename ApiListingHandler -> ApiGetHandler Name follows existing handler naming convention
Tests to come, this is a quick handler to allow Cryostat to give users a rough idea of the shape of the API that is deployed. There is no information about the purpose of a handler per se, but the verb and path give some idea at least.