public HomeModule() { Get["/"] = _ => View["home"]; Get["/host"] = _ => { return(Response.AsText(Hostname())); }; Get["/date"] = _ => { return(Response.AsJson(new Times { App = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), Hw = Hwclock() })); }; Get["/cls"] = x => { return(ApiConsumer.GetJson("http://localhost:8086/cluster")); }; Post["/ok"] = x => { return(ApiConsumer.Post("http://localhost:8086/device/ok")); }; Get["/chk"] = x => { return(ApiConsumer.Post("http://localhost:8086/device/checklist")); }; Get["/clschk"] = x => { return(ApiConsumer.Post("http://localhost:8086/device/clusterchecklist")); }; }
public DeviceModule() : base("/device") { Get["/description"] = x => { var model = ApiConsumer.Get <ServiceDiscoveryModel>(CommonString.Append(Application.ServerUrl, Request.Path)); return(Response.AsXml(model)); }; Get["/services"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/ok"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/checklist"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/clusterchecklist"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/vm"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/antduptime"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; }
public SshModule() : base("/ssh") { this.RequiresAuthentication(); Before += ctx => { Agent = ApiConsumer.GetString(CommonString.Append(Application.ServerUrl, "/agent")); return(null); }; Get["/authorizedkeys"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/publickey"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/save/authorizedkeys"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/apply/authorizedkeys"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; }
public ClusterModule() : base("/cluster") { //this.RequiresAuthentication(); Get["/"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/status"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/save"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/import"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; /// <summary> /// Inizia ANCHE la procedura di "condivisione della configurazione nel cluster" /// In questo contesto passerà SOLO la configurazione relativa al cluster stesso /// Questa API viene richiesta dall'utente (tramite GUI) /// </summary> Post["/apply"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/deploy"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; #region [ Handshake + cluster init ] Post["/handshake"] = x => { string apple = Request.Form.ApplePie; var dict = new Dictionary <string, string> { { "ApplePie", apple } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["Add Device to Cluster", "/handshake/begin"] = x => { var conf = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", conf } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; #endregion }
public DmesgModule() : base("/dmesg") { this.RequiresAuthentication(); Get["/"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; }
public GatewayModule() : base("/gateway") { this.RequiresAuthentication(); Get["/"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/save"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; }
public InfoModule() : base("/info") { this.RequiresAuthentication(); Get["/memory"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/free"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/cpu"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; }
public JournalctlModule() : base("/journalctl") { this.RequiresAuthentication(); Get["/"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/unit/{unitname}"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/unit/antd"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/unit/antdui"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/last/{hours}"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; }
public BootModule() : base("/boot") { this.RequiresAuthentication(); Get["/parameters"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/modules"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/modules/list"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/services"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/services/list"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/commands"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/save/parameters"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/modules"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/services"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/commands"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/apply/parameters"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/modules"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/services"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/commands"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; }
public NetworkModule() : base("/network") { Get["/primarydomain"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/knowndns"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/knownhosts"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/knownnetworks"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/internalnetwork"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/externalnetwork"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/networkinterfaces"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/routingtables"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/routing"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/devices"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/devices/addr"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/interfaces"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/default/hosts"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/default/networks"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/tuns"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Get["/taps"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/save/knowndns"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/knownhosts"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/knownnetworks"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/internalnetwork"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/externalnetwork"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/networkinterfaces"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/routingtables"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/routing"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/interfaces"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/tuns"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/save/taps"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/apply/knowndns"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/knownhosts"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/knownnetworks"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/internalnetwork"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/externalnetwork"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/networkinterfaces"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/routingtables"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/routing"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/interfaces"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/tuns"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/apply/taps"] = x => { return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path))); }; }
public VirshModule() : base("/virsh") { this.RequiresAuthentication(); Get["/"] = x => { return(ApiConsumer.GetJson(CommonString.Append(Application.ServerUrl, Request.Path))); }; Post["/save"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/destroy"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/reboot"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/reset"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/restore"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/resume"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/shutdown"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/start"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/suspend"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/dompmsuspend"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; Post["/dompmwakeup"] = x => { string data = Request.Form.Data; var dict = new Dictionary <string, string> { { "Data", data } }; return(ApiConsumer.Post(CommonString.Append(Application.ServerUrl, Request.Path), dict)); }; }