#pragma once #include "kubecontrol/KubernetesAPI.hpp" #include "nlohmann/json_fwd.hpp" #include "yaml-cpp/node/node.h" #include #include #include #include #include #include #include #include #include #include #include #include #include namespace kubecontrol { class KubePod { public: KubePod(std::string Owner, std::string Uuid, std::string ContainerImage,std::string Namespace = "simulator") ; KubePod(std::string Owner, std::string Uuid, std::string Component, std::string ContainerImage,std::string Namespace = "simulator"); std::string getUUID(); std::string getOwner(); std::string getIp(); std::string getStatus(); void setEnvironmentVar(std::string key, std::string val); std::map GetEnvironmentVars(); std::string GetEnvironmentVar(std::string key); void setArgs(std::string args); std::vector GetArgs(); void setCommand(std::string command); std::string getCommand(); void setComponent(std::string component); std::string getComponent(); /** * @brief sets the name of the pod * @param string - term to be displayed */ void setName(std::string name); /** * @brief return the name of the pod * @return std::string */ std::string getName(); int start(KubernetesAPI APIInterface,bool WaitTillRunning = true); int stop(KubernetesAPI APIInterface); int stopChilds(KubernetesAPI APIInterface); /** *@brief updates the infos for a pod from the give Kubernetes API *@param KubernetesAPI - object of KubernetesAPI wich holds all necessary to perfom requests *@return returns 1 on failure */ int updateInfoForThisPod(KubernetesAPI APIInterface); std::vector getUUIDsForChildPods(KubernetesAPI APIInterface); private: static const int MaxWaitTimeInSeconds; std::string Owner_; std::string Uuid_; std::string Name_; std::string Component_; std::string ContainerImage_; std::string ContainerRegistry_; std::string PathToYaml_; std::string Namespace_; std::string Ip_; std::string Status_; std::string PartOf_; std::vector uuidsOfShildContainers; std::string PodCommand_; YAML::Node YAMLNode_; std::map EnvirmonentVars_; std::vector Args_; std::string createYAML(); /** * @brief extracts the asked inforamtion from the kubernetes response * * */ int extractInformationFromResopnse(std::string response); }; }