2021-02-25 17:17:11 -05:00
|
|
|
/* Path API Request.
|
|
|
|
*
|
2022-03-15 09:18:01 -04:00
|
|
|
* Author: Steffen Vogel <post@steffenvogel.de>
|
2022-03-15 09:28:57 -04:00
|
|
|
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
|
2022-07-04 18:20:03 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2021-02-25 17:17:11 -05:00
|
|
|
*/
|
|
|
|
|
2022-03-25 17:27:16 +01:00
|
|
|
#include <villas/api/requests/path.hpp>
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <villas/path.hpp>
|
2021-02-25 17:17:11 -05:00
|
|
|
|
|
|
|
using namespace villas::node::api;
|
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
void PathRequest::prepare() {
|
|
|
|
int ret;
|
|
|
|
uuid_t uuid;
|
2021-02-25 17:17:11 -05:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
ret = uuid_parse(matches[1].c_str(), uuid);
|
|
|
|
if (ret)
|
|
|
|
throw BadRequest("Invalid UUID", "{ s: s }", "uuid", matches[1].c_str());
|
2021-02-25 17:17:11 -05:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
auto paths = session->getSuperNode()->getPaths();
|
|
|
|
path = paths.lookup(uuid);
|
|
|
|
if (!path)
|
|
|
|
throw BadRequest("No path found with with matching UUID", "{ s: s }",
|
|
|
|
"uuid", matches[1].c_str());
|
2021-02-25 17:17:11 -05:00
|
|
|
}
|