Files
KubeControl/include/kubecontrol/PodController.hpp
2023-12-21 17:15:28 +01:00

55 lines
1.5 KiB
C++

#pragma once
#include "kubecontrol/KubernetesAPI.hpp"
#include "kubecontrol/PodInfo.hpp"
#include <cstddef>
#include <kubecontrol/KubePod.hpp>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
namespace kubecontrol
{
class PodController
{
public:
PodController(std::string pathToKubectlConfig);
std::string getServerAddress();
void startPod(KubePod Pod,bool WaitTillRunning = true );
void stopPod(std::string uuid);
void stopAllPods();
std::string getInfoForAllPods();
// std::string getInfoForOwnPod();
std::string getInfoForPod(std::string uuid);
size_t getListOfChildPods();
void checkPodsHierarchy();
std::string getPodsInfoForAll();
std::shared_ptr<PodInfo> getPodsInfo(std::string uuid);
private:
KubernetesAPI APIInterface_;
std::vector<KubePod> PodList_;
std::string performRequest(std::string url);
void performForceStopRequest(std::string uuid);
std::string BearerToken_;
std::string ServerAddress_;
std::string Namespace_;
std::string ApiCall_;
// void addPodInfoToInfoList(std::shared_ptr<PodInfo> podinfo);
std::shared_ptr<PodInfo> getPodInfo(std::string uuid);
std::vector<std::shared_ptr<PodInfo>> podsInfoList_;
mutable std::mutex mx_;
};
} // namespace ku