45 lines
980 B
C++
45 lines
980 B
C++
#pragma once
|
|
#include <string>
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
#include "GnsProject.hpp"
|
|
|
|
|
|
namespace gns {
|
|
|
|
|
|
/**
|
|
* Represent a GNS3 server
|
|
* Wrapper around the GNS3 API (https://gns3-server.readthedocs.io/en/latest/endpoints.html)
|
|
*/
|
|
class GnsServer : public std::enable_shared_from_this<GnsServer> {
|
|
public:
|
|
GnsServer(const std::string& host, std::uint16_t port);
|
|
|
|
/**
|
|
* Get the base prefix for an API request
|
|
* @return the base prefix for an API request
|
|
*/
|
|
[[nodiscard]] std::string getApiBase() const;
|
|
|
|
/**
|
|
* Get all the projects in the server
|
|
* @return all the projects in the server
|
|
*/
|
|
[[nodiscard]] std::vector<std::shared_ptr<GnsProject>> getProjects() const;
|
|
|
|
/**
|
|
* Get all the nodes in the server
|
|
* @return all the nodes in the server
|
|
*/
|
|
[[nodiscard]] std::vector<std::shared_ptr<GnsNode>> getNodes() const;
|
|
|
|
private:
|
|
std::string host;
|
|
std::uint16_t port;
|
|
};
|
|
|
|
|
|
}
|