EventService : Send event for the ConfigFile creation

This implements the sendEvent when the IBM management console
creates the ConfigFile at BMC using the PUT operation on the
url /ibm/v1/Host/ConfigFiles

Tested by: (Used https://github.com/DMTF/Redfish-Event-Listener)
    1. Create a subscription by passing "ResourceTypes" as ["IBMConfigFile"]
       POST -D headers.txt https://${bmc}/redfish/v1/EventService/Subscriptions
       -d '{"Destination" : "https://<host:port>,"ResourceTypes":["IBMConfigFile"],"Protocol":"Redfish"}'
    2. Create a ConfigFile
        PUT https://${bmc}/ibm/v1/Host/ConfigFiles/<filename> --data-binary "@<local_path>"
    3. Verify the event is generated and posted to the subscriber as below example

       bodydata: {
         "@odata.type":"#Event.v1_4_0.Event",
         "Events":[
           {
             "EventId":1,
             "EventTimestamp":"2020-06-26T08:40:04+00:00",
             "EventType":"ResourceAdded",
             "MemberId":0,
             "Message":"The resource has been created successfully.",
             "MessageArgs":null,
             "MessageId":"ResourceEvent.1.0.3.ResourceCreated",
             "OriginOfCondition":"/ibm/v1/Host/ConfigFiles/<filename>",
             "MessageSeverity":"OK"
           }
         ],
         "Id":1,
         "Name":"Event Log"
       }
    4. Verified the event is sent to the subscriber when the resourceType list is empty.
    5. Verified the client subscribes for other resource - not ConfigFile ; then
       the event is not sent to the subscriber.

Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com>
Change-Id: Ic9b195266fe2df67a3160197d03d9ac155ef0cd1
diff --git a/include/ibm/management_console_rest.hpp b/include/ibm/management_console_rest.hpp
index 3038916..af87b76 100644
--- a/include/ibm/management_console_rest.hpp
+++ b/include/ibm/management_console_rest.hpp
@@ -6,8 +6,10 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/container/flat_set.hpp>
 #include <error_messages.hpp>
+#include <event_service_manager.hpp>
 #include <ibm/locks.hpp>
 #include <nlohmann/json.hpp>
+#include <resource_messages.hpp>
 #include <sdbusplus/message/types.hpp>
 #include <utils/json_utils.hpp>
 
@@ -30,6 +32,7 @@
 {
 namespace ibm_mc
 {
+using namespace redfish;
 constexpr const char* methodNotAllowedMsg = "Method Not Allowed";
 constexpr const char* resourceNotFoundMsg = "Resource Not Found";
 constexpr const char* contentNotAcceptableMsg = "Content Not Acceptable";
@@ -127,6 +130,10 @@
         file << data;
         BMCWEB_LOG_DEBUG << "save-area file is created";
         res.jsonValue["Description"] = "File Created";
+        // Push an event
+        std::string origin = "/ibm/v1/Host/ConfigFiles/" + fileID;
+        redfish::EventServiceManager::getInstance().sendEvent(
+            redfish::messages::ResourceCreated(), origin, "IBMConfigFile");
     }
 }