1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-23 00:00:01 +01:00
VILLASnode/lib/api/requests/node.cpp

36 lines
825 B
C++
Raw Normal View History

/** Node API Request.
*
* @file
2022-03-15 09:18:01 -04:00
* @author Steffen Vogel <svogel2@eonerc.rwth-aachen.de>
2022-03-15 09:28:57 -04:00
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
2022-07-04 18:20:03 +02:00
* @license Apache 2.0
*********************************************************************************/
2022-03-25 17:27:16 +01:00
#include <villas/api/requests/node.hpp>
using namespace villas::node::api;
void NodeRequest::prepare()
{
int ret;
auto &nodes = session->getSuperNode()->getNodes();
uuid_t uuid;
ret = uuid_parse(matches[1].c_str(), uuid);
if (ret) {
node = nodes.lookup(matches[1]);
if (!node)
throw BadRequest("Unknown node", "{ s: s }",
"node", matches[1].c_str()
);
}
else {
node = nodes.lookup(uuid);
if (!node)
throw BadRequest("No node found with with matching UUID", "{ s: s }",
"uuid", matches[1].c_str()
);
}
}