ADD: beautified the class and removed unnecessary class
This commit is contained in:
@@ -14,32 +14,77 @@ namespace kubecontrol
|
||||
class PodController
|
||||
{
|
||||
public:
|
||||
explicit PodController(std::string pathToKubectlConfig);
|
||||
/**
|
||||
* @brief constructs the podcontroller
|
||||
* @param pathToKubectlConfig - string path to the kubectl config file
|
||||
*/
|
||||
explicit PodController(std::string pathToKubectlConfig);
|
||||
|
||||
/**
|
||||
* @brief returns the Server Address of the given kubernetes api
|
||||
* @return string
|
||||
*/
|
||||
std::string getServerAddress();
|
||||
|
||||
std::string getServerAddress();
|
||||
/**
|
||||
* @brief starts a pod
|
||||
* @param Pod - pod objet
|
||||
* @param WaitTillRunning - bool (default: true) indicates if the controller should wait till the pod is startet
|
||||
*/
|
||||
void startPod(KubePod Pod,bool WaitTillRunning = true );
|
||||
|
||||
/**
|
||||
* @brief starts a pod
|
||||
* @param Pod - std::shared_ptr<KubePod> objet
|
||||
* @param WaitTillRunning - bool (default: true) indicates if the controller should wait till the pod is startet
|
||||
*/
|
||||
void startPod(std::shared_ptr<KubePod> Pod,bool WaitTillRunning = true );
|
||||
|
||||
void startPod(KubePod Pod,bool WaitTillRunning = true );
|
||||
void startPod(std::shared_ptr<KubePod> Pod,bool WaitTillRunning = true );
|
||||
/**
|
||||
* @brief stops a pod referenced by its uuid
|
||||
* @param uuid - string
|
||||
*/
|
||||
void stopPod(std::string uuid);
|
||||
|
||||
void stopPod(std::string uuid);
|
||||
void stopAllPods();
|
||||
/**
|
||||
* @brief stops all pods the controller knows
|
||||
*/
|
||||
void stopAllPods();
|
||||
|
||||
std::vector<PodInfos> getInfoForAllPods();
|
||||
PodInfos getInfoForPod(std::string uuid);
|
||||
/**
|
||||
* @brief returns a vector of PodInfos of all pod
|
||||
* @return std::vector<PodInfos>
|
||||
*/
|
||||
std::vector<PodInfos> getInfoForAllPods();
|
||||
|
||||
KubernetesAPI getKubernetesAPI();
|
||||
/**
|
||||
* @brief returns a PodInfo object of a specific pod
|
||||
* @param uuid - string
|
||||
* @return PodInfo
|
||||
*/
|
||||
PodInfos getInfoForPod(std::string uuid);
|
||||
|
||||
/**
|
||||
* @brief retursn a copy of ne current used kubernetes API
|
||||
*/
|
||||
KubernetesAPI getKubernetesAPI();
|
||||
|
||||
private:
|
||||
KubernetesAPI APIInterface_;
|
||||
std::vector<std::unique_ptr<KubePod>> PodList_;
|
||||
/// @brief object of the kubernetes api object
|
||||
KubernetesAPI APIInterface_;
|
||||
/// @brief vector of unique poitners of owned KubePod objects
|
||||
std::vector<std::unique_ptr<KubePod>> PodList_;
|
||||
/// @brief current namespace
|
||||
std::string Namespace_;
|
||||
/// @brief base apiCall (default: "/api/v1/namespaces/Simulator/pods/")
|
||||
std::string ApiCall_;
|
||||
/**
|
||||
* @brief gets infos for specific pod
|
||||
*/
|
||||
PodInfos extractInfosFromKubePod(KubePod *pod);
|
||||
|
||||
std::string Namespace_;
|
||||
std::string ApiCall_;
|
||||
|
||||
PodInfos extractInfosFromKubePod(KubePod *pod);
|
||||
|
||||
|
||||
mutable std::mutex mx_;
|
||||
/// @brief mutex
|
||||
mutable std::mutex mx_;
|
||||
|
||||
};
|
||||
} // namespace ku
|
||||
|
||||
Reference in New Issue
Block a user