MXS-1220: Add missing relationships
The relationships from servers to services and monitors and filters to services were not implemented. Now each server lists the services and monitors that use it and each filter lists the services that use the filter. This enables the creation of a server and linking of that server to services and monitors in one atomic operation.
This commit is contained in:

committed by
Markus Mäkelä

parent
b6add43bd2
commit
3d2219e8ef
@ -1457,5 +1457,31 @@ json_t* server_to_json(const SERVER* server, const char* host)
|
||||
|
||||
json_object_set_new(rval, "statictics", stats);
|
||||
|
||||
json_t* rel = json_object();
|
||||
|
||||
json_t* arr = service_relations_to_server(server, host);
|
||||
|
||||
if (json_array_size(arr) > 0)
|
||||
{
|
||||
json_object_set_new(rel, "services", arr);
|
||||
}
|
||||
else
|
||||
{
|
||||
json_decref(arr);
|
||||
}
|
||||
|
||||
arr = monitor_relations_to_server(server, host);
|
||||
|
||||
if (json_array_size(arr) > 0)
|
||||
{
|
||||
json_object_set_new(rel, "monitors", arr);
|
||||
}
|
||||
else
|
||||
{
|
||||
json_decref(arr);
|
||||
}
|
||||
|
||||
json_object_set_new(rval, "relationships", rel);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
Reference in New Issue
Block a user