1*f175c280SEd Tanous /**************************************************************** 2*f175c280SEd Tanous * READ THIS WARNING FIRST 3*f175c280SEd Tanous * This is an auto-generated header which contains definitions 4*f175c280SEd Tanous * for Redfish DMTF defined messages. 5*f175c280SEd Tanous * DO NOT modify this registry outside of running the 6*f175c280SEd Tanous * parse_registries.py script. The definitions contained within 7*f175c280SEd Tanous * this file are owned by DMTF. Any modifications to these files 8*f175c280SEd Tanous * should be first pushed to the relevant registry in the DMTF 9*f175c280SEd Tanous * github organization. 10*f175c280SEd Tanous ***************************************************************/ 11*f175c280SEd Tanous #include "task_messages.hpp" 12*f175c280SEd Tanous 13*f175c280SEd Tanous #include "registries.hpp" 14*f175c280SEd Tanous #include "registries/task_event_message_registry.hpp" 15*f175c280SEd Tanous 16*f175c280SEd Tanous #include <nlohmann/json.hpp> 17*f175c280SEd Tanous 18*f175c280SEd Tanous #include <array> 19*f175c280SEd Tanous #include <cstddef> 20*f175c280SEd Tanous #include <cstdint> 21*f175c280SEd Tanous #include <span> 22*f175c280SEd Tanous #include <string> 23*f175c280SEd Tanous #include <string_view> 24*f175c280SEd Tanous 25*f175c280SEd Tanous // Clang can't seem to decide whether this header needs to be included or not, 26*f175c280SEd Tanous // and is inconsistent. Include it for now 27*f175c280SEd Tanous // NOLINTNEXTLINE(misc-include-cleaner) 28*f175c280SEd Tanous #include <utility> 29*f175c280SEd Tanous 30*f175c280SEd Tanous namespace redfish 31*f175c280SEd Tanous { 32*f175c280SEd Tanous 33*f175c280SEd Tanous namespace messages 34*f175c280SEd Tanous { 35*f175c280SEd Tanous 36*f175c280SEd Tanous static nlohmann::json getLog(redfish::registries::task_event::Index name, 37*f175c280SEd Tanous std::span<const std::string_view> args) 38*f175c280SEd Tanous { 39*f175c280SEd Tanous size_t index = static_cast<size_t>(name); 40*f175c280SEd Tanous if (index >= redfish::registries::task_event::registry.size()) 41*f175c280SEd Tanous { 42*f175c280SEd Tanous return {}; 43*f175c280SEd Tanous } 44*f175c280SEd Tanous return getLogFromRegistry(redfish::registries::task_event::header, 45*f175c280SEd Tanous redfish::registries::task_event::registry, index, 46*f175c280SEd Tanous args); 47*f175c280SEd Tanous } 48*f175c280SEd Tanous 49*f175c280SEd Tanous /** 50*f175c280SEd Tanous * @internal 51*f175c280SEd Tanous * @brief Formats TaskStarted message into JSON 52*f175c280SEd Tanous * 53*f175c280SEd Tanous * See header file for more information 54*f175c280SEd Tanous * @endinternal 55*f175c280SEd Tanous */ 56*f175c280SEd Tanous nlohmann::json taskStarted(std::string_view arg1) 57*f175c280SEd Tanous { 58*f175c280SEd Tanous return getLog(redfish::registries::task_event::Index::taskStarted, 59*f175c280SEd Tanous std::to_array({arg1})); 60*f175c280SEd Tanous } 61*f175c280SEd Tanous 62*f175c280SEd Tanous /** 63*f175c280SEd Tanous * @internal 64*f175c280SEd Tanous * @brief Formats TaskCompletedOK message into JSON 65*f175c280SEd Tanous * 66*f175c280SEd Tanous * See header file for more information 67*f175c280SEd Tanous * @endinternal 68*f175c280SEd Tanous */ 69*f175c280SEd Tanous nlohmann::json taskCompletedOK(std::string_view arg1) 70*f175c280SEd Tanous { 71*f175c280SEd Tanous return getLog(redfish::registries::task_event::Index::taskCompletedOK, 72*f175c280SEd Tanous std::to_array({arg1})); 73*f175c280SEd Tanous } 74*f175c280SEd Tanous 75*f175c280SEd Tanous /** 76*f175c280SEd Tanous * @internal 77*f175c280SEd Tanous * @brief Formats TaskCompletedWarning message into JSON 78*f175c280SEd Tanous * 79*f175c280SEd Tanous * See header file for more information 80*f175c280SEd Tanous * @endinternal 81*f175c280SEd Tanous */ 82*f175c280SEd Tanous nlohmann::json taskCompletedWarning(std::string_view arg1) 83*f175c280SEd Tanous { 84*f175c280SEd Tanous return getLog(redfish::registries::task_event::Index::taskCompletedWarning, 85*f175c280SEd Tanous std::to_array({arg1})); 86*f175c280SEd Tanous } 87*f175c280SEd Tanous 88*f175c280SEd Tanous /** 89*f175c280SEd Tanous * @internal 90*f175c280SEd Tanous * @brief Formats TaskAborted message into JSON 91*f175c280SEd Tanous * 92*f175c280SEd Tanous * See header file for more information 93*f175c280SEd Tanous * @endinternal 94*f175c280SEd Tanous */ 95*f175c280SEd Tanous nlohmann::json taskAborted(std::string_view arg1) 96*f175c280SEd Tanous { 97*f175c280SEd Tanous return getLog(redfish::registries::task_event::Index::taskAborted, 98*f175c280SEd Tanous std::to_array({arg1})); 99*f175c280SEd Tanous } 100*f175c280SEd Tanous 101*f175c280SEd Tanous /** 102*f175c280SEd Tanous * @internal 103*f175c280SEd Tanous * @brief Formats TaskCancelled message into JSON 104*f175c280SEd Tanous * 105*f175c280SEd Tanous * See header file for more information 106*f175c280SEd Tanous * @endinternal 107*f175c280SEd Tanous */ 108*f175c280SEd Tanous nlohmann::json taskCancelled(std::string_view arg1) 109*f175c280SEd Tanous { 110*f175c280SEd Tanous return getLog(redfish::registries::task_event::Index::taskCancelled, 111*f175c280SEd Tanous std::to_array({arg1})); 112*f175c280SEd Tanous } 113*f175c280SEd Tanous 114*f175c280SEd Tanous /** 115*f175c280SEd Tanous * @internal 116*f175c280SEd Tanous * @brief Formats TaskRemoved message into JSON 117*f175c280SEd Tanous * 118*f175c280SEd Tanous * See header file for more information 119*f175c280SEd Tanous * @endinternal 120*f175c280SEd Tanous */ 121*f175c280SEd Tanous nlohmann::json taskRemoved(std::string_view arg1) 122*f175c280SEd Tanous { 123*f175c280SEd Tanous return getLog(redfish::registries::task_event::Index::taskRemoved, 124*f175c280SEd Tanous std::to_array({arg1})); 125*f175c280SEd Tanous } 126*f175c280SEd Tanous 127*f175c280SEd Tanous /** 128*f175c280SEd Tanous * @internal 129*f175c280SEd Tanous * @brief Formats TaskPaused message into JSON 130*f175c280SEd Tanous * 131*f175c280SEd Tanous * See header file for more information 132*f175c280SEd Tanous * @endinternal 133*f175c280SEd Tanous */ 134*f175c280SEd Tanous nlohmann::json taskPaused(std::string_view arg1) 135*f175c280SEd Tanous { 136*f175c280SEd Tanous return getLog(redfish::registries::task_event::Index::taskPaused, 137*f175c280SEd Tanous std::to_array({arg1})); 138*f175c280SEd Tanous } 139*f175c280SEd Tanous 140*f175c280SEd Tanous /** 141*f175c280SEd Tanous * @internal 142*f175c280SEd Tanous * @brief Formats TaskResumed message into JSON 143*f175c280SEd Tanous * 144*f175c280SEd Tanous * See header file for more information 145*f175c280SEd Tanous * @endinternal 146*f175c280SEd Tanous */ 147*f175c280SEd Tanous nlohmann::json taskResumed(std::string_view arg1) 148*f175c280SEd Tanous { 149*f175c280SEd Tanous return getLog(redfish::registries::task_event::Index::taskResumed, 150*f175c280SEd Tanous std::to_array({arg1})); 151*f175c280SEd Tanous } 152*f175c280SEd Tanous 153*f175c280SEd Tanous /** 154*f175c280SEd Tanous * @internal 155*f175c280SEd Tanous * @brief Formats TaskProgressChanged message into JSON 156*f175c280SEd Tanous * 157*f175c280SEd Tanous * See header file for more information 158*f175c280SEd Tanous * @endinternal 159*f175c280SEd Tanous */ 160*f175c280SEd Tanous nlohmann::json taskProgressChanged(std::string_view arg1, uint64_t arg2) 161*f175c280SEd Tanous { 162*f175c280SEd Tanous std::string arg2Str = std::to_string(arg2); 163*f175c280SEd Tanous return getLog(redfish::registries::task_event::Index::taskProgressChanged, 164*f175c280SEd Tanous std::to_array<std::string_view>({arg1, arg2Str})); 165*f175c280SEd Tanous } 166*f175c280SEd Tanous 167*f175c280SEd Tanous } // namespace messages 168*f175c280SEd Tanous } // namespace redfish 169