1 /**************************************************************** 2 * READ THIS WARNING FIRST 3 * This is an auto-generated header which contains definitions 4 * for Redfish DMTF defined messages. 5 * DO NOT modify this registry outside of running the 6 * parse_registries.py script. The definitions contained within 7 * this file are owned by DMTF. Any modifications to these files 8 * should be first pushed to the relevant registry in the DMTF 9 * github organization. 10 ***************************************************************/ 11 #include "resource_messages.hpp" 12 13 #include "registries.hpp" 14 #include "registries/resource_event_message_registry.hpp" 15 16 #include <nlohmann/json.hpp> 17 18 #include <array> 19 #include <cstddef> 20 #include <span> 21 #include <string_view> 22 23 // Clang can't seem to decide whether this header needs to be included or not, 24 // and is inconsistent. Include it for now 25 // NOLINTNEXTLINE(misc-include-cleaner) 26 #include <utility> 27 28 namespace redfish 29 { 30 31 namespace messages 32 { 33 34 static nlohmann::json getLog(redfish::registries::resource_event::Index name, 35 std::span<const std::string_view> args) 36 { 37 size_t index = static_cast<size_t>(name); 38 if (index >= redfish::registries::resource_event::registry.size()) 39 { 40 return {}; 41 } 42 return getLogFromRegistry(redfish::registries::resource_event::header, 43 redfish::registries::resource_event::registry, 44 index, args); 45 } 46 47 /** 48 * @internal 49 * @brief Formats ResourceCreated message into JSON 50 * 51 * See header file for more information 52 * @endinternal 53 */ 54 nlohmann::json resourceCreated() 55 { 56 return getLog(redfish::registries::resource_event::Index::resourceCreated, 57 {}); 58 } 59 60 /** 61 * @internal 62 * @brief Formats ResourceRemoved message into JSON 63 * 64 * See header file for more information 65 * @endinternal 66 */ 67 nlohmann::json resourceRemoved() 68 { 69 return getLog(redfish::registries::resource_event::Index::resourceRemoved, 70 {}); 71 } 72 73 /** 74 * @internal 75 * @brief Formats ResourceErrorsDetected message into JSON 76 * 77 * See header file for more information 78 * @endinternal 79 */ 80 nlohmann::json resourceErrorsDetected(std::string_view arg1, 81 std::string_view arg2) 82 { 83 return getLog( 84 redfish::registries::resource_event::Index::resourceErrorsDetected, 85 std::to_array({arg1, arg2})); 86 } 87 88 /** 89 * @internal 90 * @brief Formats ResourceErrorsCorrected message into JSON 91 * 92 * See header file for more information 93 * @endinternal 94 */ 95 nlohmann::json resourceErrorsCorrected(std::string_view arg1, 96 std::string_view arg2) 97 { 98 return getLog( 99 redfish::registries::resource_event::Index::resourceErrorsCorrected, 100 std::to_array({arg1, arg2})); 101 } 102 103 /** 104 * @internal 105 * @brief Formats ResourceErrorThresholdExceeded message into JSON 106 * 107 * See header file for more information 108 * @endinternal 109 */ 110 nlohmann::json 111 resourceErrorThresholdExceeded(std::string_view arg1, std::string_view arg2) 112 { 113 return getLog(redfish::registries::resource_event::Index:: 114 resourceErrorThresholdExceeded, 115 std::to_array({arg1, arg2})); 116 } 117 118 /** 119 * @internal 120 * @brief Formats ResourceErrorThresholdCleared message into JSON 121 * 122 * See header file for more information 123 * @endinternal 124 */ 125 nlohmann::json 126 resourceErrorThresholdCleared(std::string_view arg1, std::string_view arg2) 127 { 128 return getLog(redfish::registries::resource_event::Index:: 129 resourceErrorThresholdCleared, 130 std::to_array({arg1, arg2})); 131 } 132 133 /** 134 * @internal 135 * @brief Formats ResourceWarningThresholdExceeded message into JSON 136 * 137 * See header file for more information 138 * @endinternal 139 */ 140 nlohmann::json resourceWarningThresholdExceeded(std::string_view arg1, 141 std::string_view arg2) 142 { 143 return getLog(redfish::registries::resource_event::Index:: 144 resourceWarningThresholdExceeded, 145 std::to_array({arg1, arg2})); 146 } 147 148 /** 149 * @internal 150 * @brief Formats ResourceWarningThresholdCleared message into JSON 151 * 152 * See header file for more information 153 * @endinternal 154 */ 155 nlohmann::json resourceWarningThresholdCleared(std::string_view arg1, 156 std::string_view arg2) 157 { 158 return getLog(redfish::registries::resource_event::Index:: 159 resourceWarningThresholdCleared, 160 std::to_array({arg1, arg2})); 161 } 162 163 /** 164 * @internal 165 * @brief Formats ResourceStatusChangedOK message into JSON 166 * 167 * See header file for more information 168 * @endinternal 169 */ 170 nlohmann::json resourceStatusChangedOK(std::string_view arg1, 171 std::string_view arg2) 172 { 173 return getLog( 174 redfish::registries::resource_event::Index::resourceStatusChangedOK, 175 std::to_array({arg1, arg2})); 176 } 177 178 /** 179 * @internal 180 * @brief Formats ResourceStatusChangedWarning message into JSON 181 * 182 * See header file for more information 183 * @endinternal 184 */ 185 nlohmann::json 186 resourceStatusChangedWarning(std::string_view arg1, std::string_view arg2) 187 { 188 return getLog(redfish::registries::resource_event::Index:: 189 resourceStatusChangedWarning, 190 std::to_array({arg1, arg2})); 191 } 192 193 /** 194 * @internal 195 * @brief Formats ResourceStatusChangedCritical message into JSON 196 * 197 * See header file for more information 198 * @endinternal 199 */ 200 nlohmann::json 201 resourceStatusChangedCritical(std::string_view arg1, std::string_view arg2) 202 { 203 return getLog(redfish::registries::resource_event::Index:: 204 resourceStatusChangedCritical, 205 std::to_array({arg1, arg2})); 206 } 207 208 /** 209 * @internal 210 * @brief Formats ResourceStateChanged message into JSON 211 * 212 * See header file for more information 213 * @endinternal 214 */ 215 nlohmann::json resourceStateChanged(std::string_view arg1, 216 std::string_view arg2) 217 { 218 return getLog( 219 redfish::registries::resource_event::Index::resourceStateChanged, 220 std::to_array({arg1, arg2})); 221 } 222 223 /** 224 * @internal 225 * @brief Formats ResourcePoweredOn message into JSON 226 * 227 * See header file for more information 228 * @endinternal 229 */ 230 nlohmann::json resourcePoweredOn(std::string_view arg1) 231 { 232 return getLog(redfish::registries::resource_event::Index::resourcePoweredOn, 233 std::to_array({arg1})); 234 } 235 236 /** 237 * @internal 238 * @brief Formats ResourcePoweringOn message into JSON 239 * 240 * See header file for more information 241 * @endinternal 242 */ 243 nlohmann::json resourcePoweringOn(std::string_view arg1) 244 { 245 return getLog( 246 redfish::registries::resource_event::Index::resourcePoweringOn, 247 std::to_array({arg1})); 248 } 249 250 /** 251 * @internal 252 * @brief Formats ResourcePoweredOff message into JSON 253 * 254 * See header file for more information 255 * @endinternal 256 */ 257 nlohmann::json resourcePoweredOff(std::string_view arg1) 258 { 259 return getLog( 260 redfish::registries::resource_event::Index::resourcePoweredOff, 261 std::to_array({arg1})); 262 } 263 264 /** 265 * @internal 266 * @brief Formats ResourcePoweringOff message into JSON 267 * 268 * See header file for more information 269 * @endinternal 270 */ 271 nlohmann::json resourcePoweringOff(std::string_view arg1) 272 { 273 return getLog( 274 redfish::registries::resource_event::Index::resourcePoweringOff, 275 std::to_array({arg1})); 276 } 277 278 /** 279 * @internal 280 * @brief Formats ResourcePaused message into JSON 281 * 282 * See header file for more information 283 * @endinternal 284 */ 285 nlohmann::json resourcePaused(std::string_view arg1) 286 { 287 return getLog(redfish::registries::resource_event::Index::resourcePaused, 288 std::to_array({arg1})); 289 } 290 291 /** 292 * @internal 293 * @brief Formats URIForResourceChanged message into JSON 294 * 295 * See header file for more information 296 * @endinternal 297 */ 298 nlohmann::json uRIForResourceChanged() 299 { 300 return getLog( 301 redfish::registries::resource_event::Index::uRIForResourceChanged, {}); 302 } 303 304 /** 305 * @internal 306 * @brief Formats ResourceChanged message into JSON 307 * 308 * See header file for more information 309 * @endinternal 310 */ 311 nlohmann::json resourceChanged() 312 { 313 return getLog(redfish::registries::resource_event::Index::resourceChanged, 314 {}); 315 } 316 317 /** 318 * @internal 319 * @brief Formats ResourceVersionIncompatible message into JSON 320 * 321 * See header file for more information 322 * @endinternal 323 */ 324 nlohmann::json resourceVersionIncompatible(std::string_view arg1) 325 { 326 return getLog( 327 redfish::registries::resource_event::Index::resourceVersionIncompatible, 328 std::to_array({arg1})); 329 } 330 331 /** 332 * @internal 333 * @brief Formats ResourceSelfTestFailed message into JSON 334 * 335 * See header file for more information 336 * @endinternal 337 */ 338 nlohmann::json resourceSelfTestFailed(std::string_view arg1) 339 { 340 return getLog( 341 redfish::registries::resource_event::Index::resourceSelfTestFailed, 342 std::to_array({arg1})); 343 } 344 345 /** 346 * @internal 347 * @brief Formats ResourceSelfTestCompleted message into JSON 348 * 349 * See header file for more information 350 * @endinternal 351 */ 352 nlohmann::json resourceSelfTestCompleted() 353 { 354 return getLog( 355 redfish::registries::resource_event::Index::resourceSelfTestCompleted, 356 {}); 357 } 358 359 /** 360 * @internal 361 * @brief Formats TestMessage message into JSON 362 * 363 * See header file for more information 364 * @endinternal 365 */ 366 nlohmann::json testMessage() 367 { 368 return getLog(redfish::registries::resource_event::Index::testMessage, {}); 369 } 370 371 /** 372 * @internal 373 * @brief Formats AggregationSourceDiscovered message into JSON 374 * 375 * See header file for more information 376 * @endinternal 377 */ 378 nlohmann::json aggregationSourceDiscovered(std::string_view arg1, 379 std::string_view arg2) 380 { 381 return getLog( 382 redfish::registries::resource_event::Index::aggregationSourceDiscovered, 383 std::to_array({arg1, arg2})); 384 } 385 386 /** 387 * @internal 388 * @brief Formats LicenseExpired message into JSON 389 * 390 * See header file for more information 391 * @endinternal 392 */ 393 nlohmann::json licenseExpired(std::string_view arg1, std::string_view arg2) 394 { 395 return getLog(redfish::registries::resource_event::Index::licenseExpired, 396 std::to_array({arg1, arg2})); 397 } 398 399 /** 400 * @internal 401 * @brief Formats LicenseChanged message into JSON 402 * 403 * See header file for more information 404 * @endinternal 405 */ 406 nlohmann::json licenseChanged(std::string_view arg1, std::string_view arg2) 407 { 408 return getLog(redfish::registries::resource_event::Index::licenseChanged, 409 std::to_array({arg1, arg2})); 410 } 411 412 /** 413 * @internal 414 * @brief Formats LicenseAdded message into JSON 415 * 416 * See header file for more information 417 * @endinternal 418 */ 419 nlohmann::json licenseAdded(std::string_view arg1, std::string_view arg2) 420 { 421 return getLog(redfish::registries::resource_event::Index::licenseAdded, 422 std::to_array({arg1, arg2})); 423 } 424 425 } // namespace messages 426 } // namespace redfish 427