This commit is contained in:
Kris Moore
2016-01-07 15:41:09 -05:00
2 changed files with 92 additions and 7 deletions

View File

@@ -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"
}

View File

@@ -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