]> git.stg.codes - stg.git/blobdiff - projects/sgconf/main.cpp
Implemented some operations with tariffs.
[stg.git] / projects / sgconf / main.cpp
index 3ad0519eb2af722a3eba2357a87de1d9a477120e..1e64ca2a741a0ced8b3752c8a8ce4501bc7234b1 100644 (file)
@@ -24,6 +24,8 @@
 #include "sg_error_codes.h"
 
 #include "xml.h"
+#include "admins.h"
+#include "tariffs.h"
 #include "options.h"
 #include "actions.h"
 #include "config.h"
@@ -377,6 +379,13 @@ ACTION * MakeAPIAction(COMMANDS & commands,
 return new API_ACTION(commands, paramDescription, needArgument, funPtr);
 }
 
+inline
+ACTION * MakeAPIAction(COMMANDS & commands,
+                       API_FUNCTION funPtr)
+{
+return new API_ACTION(commands, "", false, funPtr);
+}
+
 bool RawXMLFunction(const SGCONF::CONFIG & config,
                     const std::string & arg,
                     const std::map<std::string, std::string> & /*options*/)
@@ -1375,12 +1384,18 @@ SGCONF::OPTION_BLOCK & block = blocks.Add("Connection options")
       .Add("a", "address", SGCONF::MakeParamAction(config, "<connection string>"), "connection params as a single string in format: <login>:<password>@<host>:<port>");
 blocks.Add("Raw XML")
       .Add("r", "raw", SGCONF::MakeAPIAction(commands, "<xml>", true, SGCONF::RawXMLFunction), "\tmake raw XML request");
-/*blocks.Add("Admins management options")
-      .Add("get-admins", SGCONF::MakeConfAction())
-      .Add("get-admin", SGCONF::MakeConfAction())
-      .Add("add-admin", SGCONF::MakeConfAction())
-      .Add("del-admin", SGCONF::MakeConfAction())
-      .Add("chg-admin", SGCONF::MakeConfAction());*/
+blocks.Add("Admin management options")
+      .Add("get-admins", SGCONF::MakeAPIAction(commands, SGCONF::GetAdminsFunction), "\tget admin list")
+      .Add("get-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::GetAdminFunction), "\tget admin")
+      .Add("add-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::AddAdminFunction), "\tadd admin")
+      .Add("del-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::DelAdminFunction), "\tdel admin")
+      .Add("chg-admin", SGCONF::MakeAPIAction(commands, "<login>", true, SGCONF::ChgAdminFunction), "\tchange admin");
+blocks.Add("Tariff management options")
+      .Add("get-tariffs", SGCONF::MakeAPIAction(commands, SGCONF::GetTariffsFunction), "\tget tariff list")
+      .Add("get-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::GetTariffFunction), "\tget tariff")
+      .Add("add-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::AddTariffFunction), "\tadd tariff")
+      .Add("del-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::DelTariffFunction), "\tdel tariff")
+      .Add("chg-tariff", SGCONF::MakeAPIAction(commands, "<name>", true, SGCONF::ChgTariffFunction), "\tchange tariff");
 
 
 SGCONF::PARSER_STATE state(false, argc, argv);