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 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 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 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 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 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 nlohmann::json taskProgressChanged(const std::string& arg1, const size_t arg2)
79 {
80     return nlohmann::json{
81         {"@odata.type", "#Message.v1_0_0.Message"},
82         {"MessageId", "TaskEvent.1.0.1.TaskProgressChanged"},
83         {"Message", "The task with id " + arg1 + " has changed to progress " +
84                         std::to_string(arg2) + " percent complete."},
85         {"MessageArgs", {arg1, arg2}},
86         {"Severity", "OK"},
87         {"Resolution", "None."}};
88 }
89 
90 nlohmann::json taskRemoved(const std::string& arg1)
91 {
92     return nlohmann::json{
93         {"@odata.type", "#Message.v1_0_0.Message"},
94         {"MessageId", "TaskEvent.1.0.1.TaskRemoved"},
95         {"Message", "The task with id " + arg1 + " has been removed."},
96         {"MessageArgs", {arg1}},
97         {"Severity", "Warning"},
98         {"Resolution", "None."}};
99 }
100 
101 nlohmann::json taskResumed(const std::string& arg1)
102 {
103     return nlohmann::json{
104         {"@odata.type", "#Message.v1_0_0.Message"},
105         {"MessageId", "TaskEvent.1.0.1.TaskResumed"},
106         {"Message", "The task with id " + arg1 + " has been resumed."},
107         {"MessageArgs", {arg1}},
108         {"Severity", "OK"},
109         {"Resolution", "None."}};
110 }
111 
112 nlohmann::json taskStarted(const std::string& arg1)
113 {
114     return nlohmann::json{
115         {"@odata.type", "#Message.v1_0_0.Message"},
116         {"MessageId", "TaskEvent.1.0.1.TaskStarted"},
117         {"Message", "The task with id " + arg1 + " has started."},
118         {"MessageArgs", {arg1}},
119         {"Severity", "OK"},
120         {"Resolution", "None."}};
121 }
122 
123 } // namespace messages
124 
125 } // namespace redfish
126