76 Commits

Author SHA1 Message Date
Markus Mäkelä
e3c4bd7f72 MXS-1220: Add more validation checks to request JSON
The requests that send a body should define at least a `data` member.

Added a simple test that checks that bad requests are rejected. This test
should be expanded to check that the returned error body contains the
correct members.
2017-05-24 15:05:10 +03:00
Markus Mäkelä
f1c790db52 MXS-1220: Add logging priorities to logs resoure
The logging priorities can now be queried and altered.
2017-05-17 10:14:57 +03:00
Markus Mäkelä
05cb49d48a MXS-1220: Add error messages to bad request
Requests now contain a JSON API-conforming, human-readable error message.
2017-05-17 10:14:57 +03:00
Markus Mäkelä
ffc6dba720 MXS-1220: Fix error on PUT request with no parameters
Whena server was modified and no parameters were given, the operation was
reported as a failure even though it was successful.
2017-05-14 10:06:02 +03:00
Markus Mäkelä
c30b817abc MXS-1220: Add warnings for invalid request JSON
Converted info level log messages to warnings and added a missing warning
to server creation.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
461cd6afd9 MXS-1220: Add creation of listeners via REST API
Listeners can now be created via the REST API by doing a POST request to
the service listener resource.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
a384665141 MXS-1220: Allow modification of logging options
The logging options can now be modified with a PUT request.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
18b52adaeb MXS-1220: Fix minor bug in monitor creation
The JSON validation function wasn't using the JSON Pointer function for
all values.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
c1968aac2f MXS-1220: Migrate create/update monitor to JSON API format
The creation and modification of moitor now supports the JSON API
conforming format generated by the GET endpoints.

Also added tests for creating and altering monitors via the REST API.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
6c220a1151 MXS-1220: Migrate create/update server to JSON API format
The creation and modification of servers now supports the JSON API
conforming format generated by the GET endpoints.
2017-05-09 15:32:42 +03:00
Markus Mäkelä
af2a4e792f MXS-1220: Process monitor parameters on resource creation
When a monitor is created, any parameters given to it are immediately
processed. This is done by processing the initial request as if it were an
update to the monitor that was just created.

Changed the order in which servers are linked to objects. The old
relations are removed first and only after that are the new relations
added. This fixed a problem when the monitor which monitors a server was
being changed.

Also fixed a few minor bugs.
2017-05-04 09:17:50 +03:00
Markus Mäkelä
fdf279265a MXS-1220: Fix minor bugs
Destroyed servers were still shown as a part of the servers resource
collection.

If a parameter defined in persisted configurations was replaced, the value
would be appended to itself after it was replaced.

Return correct error codes for internal errors.

The server check was checking for old parameter locations.
2017-05-04 09:17:50 +03:00
Markus Mäkelä
d248c7e081 MXS-1220: Add PUT support for services
Service parameters can now be altered with a PUT request to the REST
API. This allows general level parameters to be altered.

Module specific parameters need to be altered with a different mechanism,
namely the module command system. This requires that a generic way to call
a function needs to be devised.
2017-05-04 09:17:49 +03:00
Markus Mäkelä
d282b14b36 Allow runtime changes to service parameters
General service parameters can now be altered at runtime.
2017-05-04 09:17:49 +03:00
Markus Mäkelä
f7fefad2e6 Improve persisted configuration handling
When a persisted configuration file is read, the values in it are
considered to be more up-to-date than the ones in the main configuration
file. This allows all objects to be persisted in a more complete form
making it easier to change configuration values at runtime.

This change is intended to help make runtime alterations to services
possible.
2017-05-04 09:17:49 +03:00
Markus Mäkelä
1e1c4abcb7 MXS-1220: Add PUT support for monitors
Monitor resources can now be altered with a PUT request. The method allows
alterations on all parameters that the maxadmin `alter monitor` command
allows.
2017-05-04 09:17:48 +03:00
Markus Mäkelä
bab7957952 MXS-1220: Only process updated server parameters
The alteration function is only called when the value of a parameter
changes. This removes some of the redundant logging that was caused by
calling the alteration function with the same values.
2017-05-04 09:14:04 +03:00
Markus Mäkelä
043ed95bdf MXS-1220: Add PUT support for servers
The server can now be modified with a PUT request of a modified server
resource. The server resource was reorganized to have the parameters as a
separate entity from the other more general entities of the resource.

The PUT/POST functions return a more appropriate error message when no
request body is provided.

Moved some of the constant names used in server.cc into the config.h
header.
2017-05-04 09:14:04 +03:00
Markus Mäkelä
1e55ee5b2f Add more common constants
Now all relevant and working core configuration parameters have constants
for their names. This removes some of the risk that comes with the
repetition of the same parameter name in more than place.
2017-05-04 09:14:04 +03:00
Markus Mäkelä
695a4032ca Use common constants for monitor and server parameters
The parameter names for monitors and servers now use a set of constant
names. This removes some of the errors caused by spelling mistakes when
the same parameter name is repeated in multiple places.

The service, filter and listener parameters should also be converted to
constants. This allows for a consistent user experience.
2017-05-04 09:14:04 +03:00
Markus Mäkelä
9aa4138705 MXS-1220: Add POST handling for monitors
Doing a POST on the /monitors/ resource now creates a new monitor.
2017-05-04 09:14:03 +03:00
Markus Mäkelä
80104d6dad MXS-1220: Add POST handling for servers
New servers can now be created by POSTing a new server definition to the
/servers/ resource.
2017-05-04 09:14:03 +03:00
Markus Mäkelä
ad1c05b015 Merge branch '2.1' into develop 2017-04-05 11:35:13 +03:00
Esa Korhonen
a362bd0024 Add parameter backend_connect_attempts to monitor
This number (defaults to 1) sets how many times mon_connect_to_db
will try to connect to a backend before returning an error. Every
connection attempt may take backend_connect_timeout seconds to
complete.

Also refactored code a bit. Renamed mon_connect_to_db to
mon_ping_or_connect_to_db, since it does not connect if the connection
is already alive.
2017-04-03 09:56:22 +03:00
MassimilianoPinto
8e24f847e6 Fix compile errors in Centos 6
Fix compile errors in Centos 6
2017-03-27 09:49:21 +02:00
Johan Wikman
71ae3cf524 Compile config_runtime.c as C++ 2017-03-24 09:21:20 +02:00