#pragma once #include #include #define LOGURU_WITH_STREAMS 1 #include namespace kubecontrol { class KubernetesAPI { public: KubernetesAPI(); /** * constructor of the Kubernetes API * @param config - yaml node of the designated users kubectl yaml */ explicit KubernetesAPI(YAML::Node config); /** * @brief costructor of Kuernetes API object */ KubernetesAPI(std::string APIAddress, std::string Token); /** * @brief performs a request to the kubernetes API * @param request - string of the request * @param Methode - string (eg. GET, POST) * @result string - respone of the requestS */ std::string performRequest(std::string request,std::string Methode = "GET"); /** * @brief performs a request to the kubernetes API * @param request - string of the request * @param Methode - string (eg. GET, POST) * @param PostFields - string of the post fields which are sended in the request * @return string - respone of the requestS */ std::string performRequest(std::string request,std::string Methode,std::string PostFields); /** * @brief adds address of the kubernetes api * @param address - string */ void addAddress(std::string address); /** * @brief returns the address of the kubrnetes api stored in the object * @return std::string returns the address */ std::string getAddress(); /** * @brief add the bearer token which is necessary to access the api * @param Token - string */ void addToken(std::string Token); /** * @brief adds the yaml node which is required to hold all necessary data to access the api * @param conifg - YAML::Node object of the parsed file */ void addYaml(YAML::Node config); /** * @brief returns the namespace the object uses * @return string */ std::string getNamespace(); private: /// @brief api adress std::string APIAddress_; /// @brief bearer token std::string Token_; /// @brief namespace std::string Namespace_; }; }