1 /* 2 // Copyright (c) 2020 Intel Corporation 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 */ 16 17 namespace redfish 18 { 19 20 namespace messages 21 { 22 23 inline nlohmann::json taskAborted(const std::string& arg1) 24 { 25 return nlohmann::json{ 26 {"@odata.type", "#Message.v1_0_0.Message"}, 27 {"MessageId", "TaskEvent.1.0.1.TaskAborted"}, 28 {"Message", "The task with id " + arg1 + " has been aborted."}, 29 {"MessageArgs", {arg1}}, 30 {"Severity", "Critical"}, 31 {"Resolution", "None."}}; 32 } 33 34 inline nlohmann::json taskCancelled(const std::string& arg1) 35 { 36 return nlohmann::json{ 37 {"@odata.type", "#Message.v1_0_0.Message"}, 38 {"MessageId", "TaskEvent.1.0.1.TaskCancelled"}, 39 {"Message", "The task with id " + arg1 + " has been cancelled."}, 40 {"MessageArgs", {arg1}}, 41 {"Severity", "Warning"}, 42 {"Resolution", "None."}}; 43 } 44 45 inline nlohmann::json taskCompletedOK(const std::string& arg1) 46 { 47 return nlohmann::json{ 48 {"@odata.type", "#Message.v1_0_0.Message"}, 49 {"MessageId", "TaskEvent.1.0.1.TaskCompletedOK"}, 50 {"Message", "The task with id " + arg1 + " has Completed."}, 51 {"MessageArgs", {arg1}}, 52 {"Severity", "OK"}, 53 {"Resolution", "None."}}; 54 } 55 56 inline nlohmann::json taskCompletedWarning(const std::string& arg1) 57 { 58 return nlohmann::json{{"@odata.type", "#Message.v1_0_0.Message"}, 59 {"MessageId", "TaskEvent.1.0.1.TaskCompletedWarning"}, 60 {"Message", "The task with id " + arg1 + 61 " has completed with warnings."}, 62 {"MessageArgs", {arg1}}, 63 {"Severity", "Warning"}, 64 {"Resolution", "None."}}; 65 } 66 67 inline nlohmann::json taskPaused(const std::string& arg1) 68 { 69 return nlohmann::json{ 70 {"@odata.type", "#Message.v1_0_0.Message"}, 71 {"MessageId", "TaskEvent.1.0.1.TaskPaused"}, 72 {"Message", "The task with id " + arg1 + " has been paused."}, 73 {"MessageArgs", {arg1}}, 74 {"Severity", "Warning"}, 75 {"Resolution", "None."}}; 76 } 77 78 inline nlohmann::json taskProgressChanged(const std::string& arg1, 79 const size_t arg2) 80 { 81 return nlohmann::json{ 82 {"@odata.type", "#Message.v1_0_0.Message"}, 83 {"MessageId", "TaskEvent.1.0.1.TaskProgressChanged"}, 84 {"Message", "The task with id " + arg1 + " has changed to progress " + 85 std::to_string(arg2) + " percent complete."}, 86 {"MessageArgs", {arg1, std::to_string(arg2)}}, 87 {"Severity", "OK"}, 88 {"Resolution", "None."}}; 89 } 90 91 inline nlohmann::json taskRemoved(const std::string& arg1) 92 { 93 return nlohmann::json{ 94 {"@odata.type", "#Message.v1_0_0.Message"}, 95 {"MessageId", "TaskEvent.1.0.1.TaskRemoved"}, 96 {"Message", "The task with id " + arg1 + " has been removed."}, 97 {"MessageArgs", {arg1}}, 98 {"Severity", "Warning"}, 99 {"Resolution", "None."}}; 100 } 101 102 inline nlohmann::json taskResumed(const std::string& arg1) 103 { 104 return nlohmann::json{ 105 {"@odata.type", "#Message.v1_0_0.Message"}, 106 {"MessageId", "TaskEvent.1.0.1.TaskResumed"}, 107 {"Message", "The task with id " + arg1 + " has been resumed."}, 108 {"MessageArgs", {arg1}}, 109 {"Severity", "OK"}, 110 {"Resolution", "None."}}; 111 } 112 113 inline nlohmann::json taskStarted(const std::string& arg1) 114 { 115 return nlohmann::json{ 116 {"@odata.type", "#Message.v1_0_0.Message"}, 117 {"MessageId", "TaskEvent.1.0.1.TaskStarted"}, 118 {"Message", "The task with id " + arg1 + " has started."}, 119 {"MessageArgs", {arg1}}, 120 {"Severity", "OK"}, 121 {"Resolution", "None."}}; 122 } 123 124 } // namespace messages 125 126 } // namespace redfish 127