MXS-1220: Treat service listeners as service sub-resources
The listeners under the /services/:service/listeners collection are now fully JSON API compliant resources. The listeners could also be exposed as a /listeners collection to easily group all listener type resources in one place. This approach does has some semantical and practical problems, namely the fact that each listener has a many-to-one relationship with its service and listeners by themselves can't exist alone.
This commit is contained in:
@ -283,15 +283,7 @@ HttpResponse cb_get_service(const HttpRequest& request)
|
||||
HttpResponse cb_get_service_listeners(const HttpRequest& request)
|
||||
{
|
||||
SERVICE* service = service_find(request.uri_part(1).c_str());
|
||||
json_t* json = service_to_json(service, request.host());
|
||||
|
||||
// The 'listeners' key is always defined
|
||||
json_t* listeners = json_incref(json_object_get(json, CN_LISTENERS));
|
||||
ss_dassert(listeners);
|
||||
|
||||
json_decref(json);
|
||||
|
||||
return HttpResponse(MHD_HTTP_OK, listeners);
|
||||
return HttpResponse(MHD_HTTP_OK, service_listeners_to_json(service, request.host()));
|
||||
}
|
||||
|
||||
HttpResponse cb_all_filters(const HttpRequest& request)
|
||||
|
Reference in New Issue
Block a user