// Copyright Epic Games, Inc. All Rights Reserved. #include namespace zen::nomad { bool NomadConfig::Validate() const { if (ServerUrl.empty()) { return false; } if (BinDistribution == BinaryDistribution::PreDeployed && BinaryPath.empty()) { return false; } if (BinDistribution == BinaryDistribution::Artifact && ArtifactSource.empty()) { return false; } if (TaskDriver == Driver::Docker && DockerImage.empty()) { return false; } return true; } const char* ToString(Driver D) { switch (D) { case Driver::RawExec: return "raw_exec"; case Driver::Docker: return "docker"; } return "raw_exec"; } const char* ToString(BinaryDistribution Dist) { switch (Dist) { case BinaryDistribution::PreDeployed: return "predeployed"; case BinaryDistribution::Artifact: return "artifact"; } return "predeployed"; } bool FromString(Driver& OutDriver, std::string_view Str) { if (Str == "raw_exec") { OutDriver = Driver::RawExec; return true; } if (Str == "docker") { OutDriver = Driver::Docker; return true; } return false; } bool FromString(BinaryDistribution& OutDist, std::string_view Str) { if (Str == "predeployed") { OutDist = BinaryDistribution::PreDeployed; return true; } if (Str == "artifact") { OutDist = BinaryDistribution::Artifact; return true; } return false; } } // namespace zen::nomad