#include "GnsNode.hpp" #include "GnsPort.hpp" #include "GnsProject.hpp" #include #include namespace gns { GnsNode::GnsNode(const GnsProject *project, const std::string& uuid, const std::vector& ports) { this->project = project; this->uuid = uuid; this->ports = ports; } std::string GnsNode::getApiBase() const { return this->project->getApiBase() + "nodes/" + this->getUuid() + "/"; } std::string GnsNode::getUuid() const { return this->uuid; } std::vector GnsNode::getPorts() const { return this->ports; } void GnsNode::start() const { // request the API endpoint cpr::Url endpoint = this->getApiBase() + "start"; const cpr::Response response = Post(endpoint); // check for a valid response if (response.error.code != cpr::ErrorCode::OK) throw std::runtime_error(response.error.message); } }