control: Add 'events' section to dump

Add an events section to the fan control dump that contains all of the
configured events with their contained action and group names.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I8e9fa9ce975ac30837b0842908faeb63ddc31e2a
diff --git a/control/json/actions/action.hpp b/control/json/actions/action.hpp
index 40547b9..cafa542 100644
--- a/control/json/actions/action.hpp
+++ b/control/json/actions/action.hpp
@@ -213,6 +213,25 @@
         }
     }
 
+    /**
+     * @brief Dump the action as JSON
+     *
+     * For now just dump its group names
+     *
+     * @return json
+     */
+    json dump() const
+    {
+        json groups = json::array();
+        std::for_each(_groups.begin(), _groups.end(),
+                      [&groups](const auto& group) {
+                          groups.push_back(group.getName());
+                      });
+        json output;
+        output["groups"] = groups;
+        return output;
+    }
+
   protected:
     /**
      * @brief Logs a message to the flight recorder using