From 25ecc6f8133f7667b383069b06f7d058af4ec636 Mon Sep 17 00:00:00 2001 From: dlavigne Date: Thu, 7 Jan 2016 11:43:17 -0500 Subject: [PATCH 1/2] Add first action for lifepresever class. --- api/classes/lifepreserver.rst | 89 ++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 2 deletions(-) diff --git a/api/classes/lifepreserver.rst b/api/classes/lifepreserver.rst index 0ecc365..751495c 100644 --- a/api/classes/lifepreserver.rst +++ b/api/classes/lifepreserver.rst @@ -1,6 +1,91 @@ .. _lifepreserver: lifepreserver -============= +************* -Some intro text here... +The lifepreserver class is used to manage and retrieve information about scheduled snapshots and replication. + +Every lifepreserver class request contains the following parameters: + ++---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+ +| **Parameter** | **Value** | **Description** | +| | | | ++=================================+===============+======================================================================================================================+ +| id | | any unique value for the request; examples include a hash, checksum, or uuid | +| | | | ++---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+ +| name | sysadm | | +| | | | ++---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+ +| namespace | lifepreserver | | +| | | | ++---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+ +| action | | supported actions include listcron | +| | | | ++---------------------------------+---------------+----------------------------------------------------------------------------------------------------------------------+ + +The rest of this section provides examples of the available *actions* for each type of request, along with their responses. + +.. _List Schedules: + +List Schedules +============== + +The "listcron" action retrieves the information for each scheduled snapshot. For each schedule, it lists the name of the ZFS pool, the number of snapshots to keep, and the time that the +snapshot is taken. + +**REST Request** + +.. code-block:: json + + PUT /sysadm/lifepreserver + { + "action" : "listcron" + } + + +**REST Response** + +.. code-block:: json + + { + "args": { + "listcron": { + "tank1": { + "keep": "3", + "schedule": "daily@18" + } + } + } + } + +**WebSocket Request** + +.. code-block:: json + + { + "args" : { + "action" : "listcron" + }, + "name" : "lifepreserver", + "namespace" : "sysadm", + "id" : "fooid" + } + +**WebSocket Response** + +.. code-block:: json + + { + "args": { + "listcron": { + "tank1": { + "keep": "3", + "schedule": "daily@18" + } + } + }, + "id": "fooid", + "name": "response", + "namespace": "sysadm" + } \ No newline at end of file From 40a7e412136abeedfdf80d870eea912939a103cb Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 7 Jan 2016 15:14:46 -0500 Subject: [PATCH 2/2] Fix a bug with event notifications and the new output structure (ensure it sets the output data properly). --- src/server/WebSocket.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server/WebSocket.cpp b/src/server/WebSocket.cpp index 1e5987f..d4b2f61 100644 --- a/src/server/WebSocket.cpp +++ b/src/server/WebSocket.cpp @@ -326,13 +326,13 @@ void WebSocket::AppCafeStatusUpdate(QString msg){ if(!SendAppCafeEvents){ return; } //don't report events on this socket RestOutputStruct out; out.CODE = RestOutputStruct::OK; - out.in_struct.name = "event"; + out.in_struct.name = "dispatcher"; out.in_struct.namesp = "events"; //Pre-set any output fields - QJsonObject outargs; - outargs.insert("name", "dispatcher"); - outargs.insert("args",QJsonValue(msg)); - out.out_args = outargs; + //QJsonObject outargs; + //outargs.insert("name", "dispatcher"); + // outargs.insert("args",QJsonValue(msg)); + out.out_args = QJsonValue(msg);//outargs; //Assemble the output JSON document/text out.Header << "Content-Type: text/json; charset=utf-8"; //REST header info