MXS-1220: Add JSON functions for servers

The servers can now be printed in JSON format.
This commit is contained in:
Markus Mäkelä
2017-04-17 12:44:49 +03:00
committed by Markus Mäkelä
parent b975518996
commit c4a8f8c8a6
2 changed files with 106 additions and 89 deletions

View File

@ -21,6 +21,7 @@
#include <maxscale/cdefs.h>
#include <maxscale/dcb.h>
#include <maxscale/resultset.h>
#include <maxscale/jansson.h>
MXS_BEGIN_DECLS
@ -265,6 +266,22 @@ bool server_remove_parameter(SERVER *server, const char *name);
*/
bool server_is_mxs_service(const SERVER *server);
/**
* @brief Convert a server to JSON format
*
* @param server Server to convert
*
* @return JSON representation of server or NULL if an error occurred
*/
json_t* server_to_json(SERVER* server);
/**
* @brief Convert all servers into JSON format
*
* @return JSON array of servers or NULL if an error occurred
*/
json_t* server_list_to_json();
extern int server_free(SERVER *server);
extern SERVER *server_find_by_unique_name(const char *name);
extern int server_find_by_unique_names(char **server_names, int size, SERVER*** output);