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