2019-02-25 08:48:22 -05:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2014-10-18 13:31:52 -04:00
|
|
|
|
|
|
|
|
#ifndef FEATUREUTILITY_H
|
|
|
|
|
#define FEATUREUTILITY_H
|
|
|
|
|
|
|
|
|
|
#include "base/i2-base.hpp"
|
2015-02-26 05:04:57 -05:00
|
|
|
#include "cli/i2-cli.hpp"
|
2014-10-19 08:48:19 -04:00
|
|
|
#include "base/string.hpp"
|
2014-10-18 13:31:52 -04:00
|
|
|
#include <vector>
|
2015-02-15 07:09:53 -05:00
|
|
|
#include <iostream>
|
2014-10-18 13:31:52 -04:00
|
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @ingroup cli
|
|
|
|
|
*/
|
2017-12-31 01:22:16 -05:00
|
|
|
class FeatureUtility
|
2014-10-18 13:31:52 -04:00
|
|
|
{
|
|
|
|
|
public:
|
2018-01-03 22:25:35 -05:00
|
|
|
static String GetFeaturesAvailablePath();
|
|
|
|
|
static String GetFeaturesEnabledPath();
|
2014-10-18 13:31:52 -04:00
|
|
|
|
2014-10-21 12:35:43 -04:00
|
|
|
static std::vector<String> GetFieldCompletionSuggestions(const String& word, bool enable);
|
|
|
|
|
|
2018-07-26 11:09:06 -04:00
|
|
|
static int EnableFeatures(const std::vector<std::string>& features);
|
|
|
|
|
static int DisableFeatures(const std::vector<std::string>& features);
|
2015-01-22 06:10:32 -05:00
|
|
|
static int ListFeatures(std::ostream& os = std::cout);
|
2014-10-21 12:35:43 -04:00
|
|
|
|
|
|
|
|
static bool GetFeatures(std::vector<String>& features, bool enable);
|
2015-06-25 04:14:19 -04:00
|
|
|
static bool CheckFeatureEnabled(const String& feature);
|
|
|
|
|
static bool CheckFeatureDisabled(const String& feature);
|
2014-10-21 12:35:43 -04:00
|
|
|
|
2014-10-18 13:31:52 -04:00
|
|
|
private:
|
2018-01-03 22:25:35 -05:00
|
|
|
FeatureUtility();
|
2014-10-18 13:31:52 -04:00
|
|
|
static void CollectFeatures(const String& feature_file, std::vector<String>& features);
|
2015-06-25 04:14:19 -04:00
|
|
|
static bool CheckFeatureInternal(const String& feature, bool check_disabled);
|
2014-10-18 13:31:52 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* FEATUREUTILITY_H */
|