xref: /openbmc/bmcweb/redfish-core/src/update_messages.cpp (revision d3616d13fbd236204477312ddf2e9913a7001010)
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 "update_messages.hpp"
12 
13 #include "registries.hpp"
14 #include "registries/update_message_registry.hpp"
15 
16 #include <nlohmann/json.hpp>
17 
18 #include <array>
19 #include <cstddef>
20 #include <cstdint>
21 #include <span>
22 #include <string>
23 #include <string_view>
24 
25 // Clang can't seem to decide whether this header needs to be included or not,
26 // and is inconsistent.  Include it for now
27 // NOLINTNEXTLINE(misc-include-cleaner)
28 #include <utility>
29 
30 namespace redfish
31 {
32 
33 namespace messages
34 {
35 
getLog(redfish::registries::Update::Index name,std::span<const std::string_view> args)36 static nlohmann::json::object_t getLog(redfish::registries::Update::Index name,
37                                        std::span<const std::string_view> args)
38 {
39     size_t index = static_cast<size_t>(name);
40     if (index >= redfish::registries::Update::registry.size())
41     {
42         return {};
43     }
44     return getLogFromRegistry(redfish::registries::Update::header,
45                               redfish::registries::Update::registry, index,
46                               args);
47 }
48 
49 /**
50  * @internal
51  * @brief Formats TargetDetermined message into JSON
52  *
53  * See header file for more information
54  * @endinternal
55  */
targetDetermined(std::string_view arg1,std::string_view arg2)56 nlohmann::json::object_t targetDetermined(std::string_view arg1,
57                                           std::string_view arg2)
58 {
59     return getLog(redfish::registries::Update::Index::targetDetermined,
60                   std::to_array({arg1, arg2}));
61 }
62 
63 /**
64  * @internal
65  * @brief Formats AllTargetsDetermined message into JSON
66  *
67  * See header file for more information
68  * @endinternal
69  */
allTargetsDetermined()70 nlohmann::json::object_t allTargetsDetermined()
71 {
72     return getLog(redfish::registries::Update::Index::allTargetsDetermined, {});
73 }
74 
75 /**
76  * @internal
77  * @brief Formats NoTargetsDetermined message into JSON
78  *
79  * See header file for more information
80  * @endinternal
81  */
noTargetsDetermined(std::string_view arg1)82 nlohmann::json::object_t noTargetsDetermined(std::string_view arg1)
83 {
84     return getLog(redfish::registries::Update::Index::noTargetsDetermined,
85                   std::to_array({arg1}));
86 }
87 
88 /**
89  * @internal
90  * @brief Formats UpdateInProgress message into JSON
91  *
92  * See header file for more information
93  * @endinternal
94  */
updateInProgress()95 nlohmann::json::object_t updateInProgress()
96 {
97     return getLog(redfish::registries::Update::Index::updateInProgress, {});
98 }
99 
100 /**
101  * @internal
102  * @brief Formats TransferringToComponent message into JSON
103  *
104  * See header file for more information
105  * @endinternal
106  */
transferringToComponent(std::string_view arg1,std::string_view arg2)107 nlohmann::json::object_t transferringToComponent(std::string_view arg1,
108                                                  std::string_view arg2)
109 {
110     return getLog(redfish::registries::Update::Index::transferringToComponent,
111                   std::to_array({arg1, arg2}));
112 }
113 
114 /**
115  * @internal
116  * @brief Formats VerifyingAtComponent message into JSON
117  *
118  * See header file for more information
119  * @endinternal
120  */
verifyingAtComponent(std::string_view arg1,std::string_view arg2)121 nlohmann::json::object_t verifyingAtComponent(std::string_view arg1,
122                                               std::string_view arg2)
123 {
124     return getLog(redfish::registries::Update::Index::verifyingAtComponent,
125                   std::to_array({arg1, arg2}));
126 }
127 
128 /**
129  * @internal
130  * @brief Formats InstallingOnComponent message into JSON
131  *
132  * See header file for more information
133  * @endinternal
134  */
installingOnComponent(std::string_view arg1,std::string_view arg2)135 nlohmann::json::object_t installingOnComponent(std::string_view arg1,
136                                                std::string_view arg2)
137 {
138     return getLog(redfish::registries::Update::Index::installingOnComponent,
139                   std::to_array({arg1, arg2}));
140 }
141 
142 /**
143  * @internal
144  * @brief Formats ApplyingOnComponent message into JSON
145  *
146  * See header file for more information
147  * @endinternal
148  */
applyingOnComponent(std::string_view arg1,std::string_view arg2)149 nlohmann::json::object_t applyingOnComponent(std::string_view arg1,
150                                              std::string_view arg2)
151 {
152     return getLog(redfish::registries::Update::Index::applyingOnComponent,
153                   std::to_array({arg1, arg2}));
154 }
155 
156 /**
157  * @internal
158  * @brief Formats TransferFailed message into JSON
159  *
160  * See header file for more information
161  * @endinternal
162  */
transferFailed(std::string_view arg1,std::string_view arg2)163 nlohmann::json::object_t transferFailed(std::string_view arg1,
164                                         std::string_view arg2)
165 {
166     return getLog(redfish::registries::Update::Index::transferFailed,
167                   std::to_array({arg1, arg2}));
168 }
169 
170 /**
171  * @internal
172  * @brief Formats VerificationFailed message into JSON
173  *
174  * See header file for more information
175  * @endinternal
176  */
verificationFailed(std::string_view arg1,std::string_view arg2)177 nlohmann::json::object_t verificationFailed(std::string_view arg1,
178                                             std::string_view arg2)
179 {
180     return getLog(redfish::registries::Update::Index::verificationFailed,
181                   std::to_array({arg1, arg2}));
182 }
183 
184 /**
185  * @internal
186  * @brief Formats ApplyFailed message into JSON
187  *
188  * See header file for more information
189  * @endinternal
190  */
applyFailed(std::string_view arg1,std::string_view arg2)191 nlohmann::json::object_t applyFailed(std::string_view arg1,
192                                      std::string_view arg2)
193 {
194     return getLog(redfish::registries::Update::Index::applyFailed,
195                   std::to_array({arg1, arg2}));
196 }
197 
198 /**
199  * @internal
200  * @brief Formats ActivateFailed message into JSON
201  *
202  * See header file for more information
203  * @endinternal
204  */
activateFailed(std::string_view arg1,std::string_view arg2)205 nlohmann::json::object_t activateFailed(std::string_view arg1,
206                                         std::string_view arg2)
207 {
208     return getLog(redfish::registries::Update::Index::activateFailed,
209                   std::to_array({arg1, arg2}));
210 }
211 
212 /**
213  * @internal
214  * @brief Formats AwaitToUpdate message into JSON
215  *
216  * See header file for more information
217  * @endinternal
218  */
awaitToUpdate(std::string_view arg1,std::string_view arg2)219 nlohmann::json::object_t awaitToUpdate(std::string_view arg1,
220                                        std::string_view arg2)
221 {
222     return getLog(redfish::registries::Update::Index::awaitToUpdate,
223                   std::to_array({arg1, arg2}));
224 }
225 
226 /**
227  * @internal
228  * @brief Formats AwaitToActivate message into JSON
229  *
230  * See header file for more information
231  * @endinternal
232  */
awaitToActivate(std::string_view arg1,std::string_view arg2)233 nlohmann::json::object_t awaitToActivate(std::string_view arg1,
234                                          std::string_view arg2)
235 {
236     return getLog(redfish::registries::Update::Index::awaitToActivate,
237                   std::to_array({arg1, arg2}));
238 }
239 
240 /**
241  * @internal
242  * @brief Formats UpdateSuccessful message into JSON
243  *
244  * See header file for more information
245  * @endinternal
246  */
updateSuccessful(std::string_view arg1,std::string_view arg2)247 nlohmann::json::object_t updateSuccessful(std::string_view arg1,
248                                           std::string_view arg2)
249 {
250     return getLog(redfish::registries::Update::Index::updateSuccessful,
251                   std::to_array({arg1, arg2}));
252 }
253 
254 /**
255  * @internal
256  * @brief Formats OperationTransitionedToJob message into JSON
257  *
258  * See header file for more information
259  * @endinternal
260  */
operationTransitionedToJob(std::string_view arg1)261 nlohmann::json::object_t operationTransitionedToJob(std::string_view arg1)
262 {
263     return getLog(
264         redfish::registries::Update::Index::operationTransitionedToJob,
265         std::to_array({arg1}));
266 }
267 
268 /**
269  * @internal
270  * @brief Formats UpdateSkipped message into JSON
271  *
272  * See header file for more information
273  * @endinternal
274  */
updateSkipped(std::string_view arg1,std::string_view arg2)275 nlohmann::json::object_t updateSkipped(std::string_view arg1,
276                                        std::string_view arg2)
277 {
278     return getLog(redfish::registries::Update::Index::updateSkipped,
279                   std::to_array({arg1, arg2}));
280 }
281 
282 /**
283  * @internal
284  * @brief Formats UpdateSkippedSameVersion message into JSON
285  *
286  * See header file for more information
287  * @endinternal
288  */
updateSkippedSameVersion(std::string_view arg1,std::string_view arg2)289 nlohmann::json::object_t updateSkippedSameVersion(std::string_view arg1,
290                                                   std::string_view arg2)
291 {
292     return getLog(redfish::registries::Update::Index::updateSkippedSameVersion,
293                   std::to_array({arg1, arg2}));
294 }
295 
296 /**
297  * @internal
298  * @brief Formats UpdateNotApplicable message into JSON
299  *
300  * See header file for more information
301  * @endinternal
302  */
updateNotApplicable(std::string_view arg1,std::string_view arg2)303 nlohmann::json::object_t updateNotApplicable(std::string_view arg1,
304                                              std::string_view arg2)
305 {
306     return getLog(redfish::registries::Update::Index::updateNotApplicable,
307                   std::to_array({arg1, arg2}));
308 }
309 
310 } // namespace messages
311 } // namespace redfish
312