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:
Markus Mäkelä
2017-05-05 06:38:45 +03:00
parent 1d98b4b67b
commit 08dca8c273
6 changed files with 66 additions and 41 deletions

View File

@ -32,7 +32,7 @@ static json_t* self_link(const char* host, const char* endpoint)
json_t* mxs_json_resource(const char* host, const char* self, json_t* data)
{
ss_dassert(data && (json_is_array(data) || json_is_object(data)));
ss_dassert(data && (json_is_array(data) || json_is_object(data) || json_is_null(data)));
json_t* rval = json_object();
json_object_set_new(rval, CN_LINKS, self_link(host, self));
json_object_set_new(rval, CN_DATA, data);