public AntdTimeModule() { Get["/time"] = x => { var model = _api.Get <PageTimeModel>($"http://127.0.0.1:{Application.ServerPort}/time/info"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/time/timezone"] = x => { string timezone = Request.Form.Timezone; var dict = new Dictionary <string, string> { { "Timezone", timezone } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/host/timezone", dict)); }; Post["/time/synctime"] = x => _api.Post($"http://127.0.0.1:{Application.ServerPort}/host/synctime"); Post["/time/ntpdate"] = x => { string ntpdate = Request.Form.Ntpdate; var dict = new Dictionary <string, string> { { "Ntpdate", ntpdate } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/host/ntpdate", dict)); }; Post["/time/ntpd"] = x => { string ntpd = Request.Form.Ntpd; var dict = new Dictionary <string, string> { { "Ntpd", ntpd } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/host/ntpd", dict)); }; }
public AssetSettingModule() { Get["/assetsetting"] = x => { var model = _api.Get <PageAssetSettingModel>($"http://127.0.0.1:{Application.ServerPort}/assetsetting"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/netscan/setsubnet"] = x => { string subnet = Request.Form.Subnet; string label = Request.Form.Label; var dict = new Dictionary <string, string> { { "Subnet", subnet }, { "Label", label } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/netscan/setsubnet", dict)); }; Post["/netscan/setlabel"] = x => { string letter = Request.Form.Letter; string number = Request.Form.Number; string label = Request.Form.Label; var dict = new Dictionary <string, string> { { "Letter", letter }, { "Number", number }, { "Label", label } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/netscan/setlabel", dict)); }; }
public AntdUsersModule() { Get["/users"] = x => { var model = _api.Get <PageUsersModel>($"http://127.0.0.1:{Application.ServerPort}/users/list"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/users"] = x => { string user = Request.Form.User; string password = Request.Form.Password; var dict = new Dictionary <string, string> { { "User", user }, { "Password", password } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/users", dict)); }; Post["/users/master/password"] = x => { string password = Request.Form.Password; var dict = new Dictionary <string, string> { { "Password", password } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/users/master/password", dict)); }; }
public AntdStorageModule() { Get["/storage"] = x => { var model = _api.Get <PageStorageModel>($"http://127.0.0.1:{Application.ServerPort}/storage"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/storage/print"] = x => { //todo non sono convinto che sia un POST string disk = Request.Form.Disk; var dict = new Dictionary <string, string> { { "Disk", disk } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/storage/print", dict)); }; Post["/storage/mklabel"] = x => { string disk = Request.Form.Disk; string type = Request.Form.Type; string yn = Request.Form.Confirm; var dict = new Dictionary <string, string> { { "Disk", disk }, { "Type", type }, { "Confirm", yn }, }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/storage/mklabel", dict)); }; }
public BootModulesModule() { Get["/boot/modules"] = x => { var model = _api.Get <PageBootModulesModel>($"http://127.0.0.1:{Application.ServerPort}/boot/modules"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/boot/modules"] = x => { string config = Request.Form.Config; var dict = new Dictionary <string, string> { { "Config", config } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/boot/modules", dict)); }; Post["/boot/rmmodules"] = x => { string config = Request.Form.Config; var dict = new Dictionary <string, string> { { "Config", config } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/boot/rmmodules", dict)); }; Post["/boot/modblacklist"] = x => { string config = Request.Form.Config; var dict = new Dictionary <string, string> { { "Config", config } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/boot/modblacklist", dict)); }; }
public void Download(string appName, MachineIdsModel machineUid, byte[] publicKey) { if (File.Exists(_licensePath)) { return; } var cloudaddress = new AppConfiguration().Get().CloudAddress; if (string.IsNullOrEmpty(cloudaddress)) { return; } if (cloudaddress.Contains("localhost")) { return; } if (!cloudaddress.EndsWith("/")) { cloudaddress = cloudaddress + "/"; } var pk = Encoding.ASCII.GetString(publicKey); var dict = new Dictionary <string, string> { { "AppName", appName }, { "PartNumber", machineUid.PartNumber }, { "SerialNumber", machineUid.SerialNumber }, { "Uid", machineUid.MachineUid }, { "PublicKey", pk } }; var lic = _api.Post <string>($"{cloudaddress}license/create", dict); if (lic != null) { FileWithAcl.WriteAllText(_licensePath, lic, "644", "root", "wheel"); } }
public AntdZfsModule() { Get["/zfs"] = x => { var model = _api.Get <PageZfsModel>($"http://127.0.0.1:{Application.ServerPort}/zfs"); var json = JsonConvert.SerializeObject(model); return(json); }; Get["/zfs/cron"] = x => { throw new NotImplementedException(); }; Post["/zfs/snap"] = x => { string pool = Request.Form.Pool; string interval = Request.Form.Interval; var dict = new Dictionary <string, string> { { "Pool", pool }, { "Interval", interval }, }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/zfs/snap", dict)); }; Post["/zfs/snap/disable"] = x => { string guid = Request.Form.Guid; var dict = new Dictionary <string, string> { { "Guid", guid }, }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/zfs/snap/disable", dict)); }; Post["/zpool/create"] = x => { string altroot = Request.Form.Altroot; string poolname = Request.Form.Name; string pooltype = Request.Form.Type; string disk = Request.Form.Disk; var dict = new Dictionary <string, string> { { "Altroot", altroot }, { "Name", poolname }, { "Type", pooltype }, { "Disk", disk } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/zpool/create", dict)); }; Post["/zfs/create"] = x => { string altroot = Request.Form.Altroot; string poolname = Request.Form.Name; string datasetname = Request.Form.Dataset; var dict = new Dictionary <string, string> { { "Altroot", altroot }, { "Name", poolname }, { "Dataset", datasetname }, }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/zfs/create", dict)); }; }
public AntdServicesModule() { Get["/services"] = x => { var model = _api.Get <PageServicesModel>($"http://127.0.0.1:{Application.ServerPort}/services"); var json = JsonConvert.SerializeObject(model); return(json); }; Get["/services/log"] = x => { string unit = Request.Query.unit; var model = _api.Get <IEnumerable <string> >($"http://127.0.0.1:{Application.ServerPort}/services/log?unit={unit}"); var json = JsonConvert.SerializeObject(model.JoinToString("<br />")); return(json); }; Post["/services/start"] = x => { string unit = Request.Form.Unit; var dict = new Dictionary <string, string> { { "Unit", unit } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/services/start", dict)); }; Post["/services/restart"] = x => { string unit = Request.Form.Unit; var dict = new Dictionary <string, string> { { "Unit", unit } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/services/restart", dict)); }; Post["/services/stop"] = x => { string unit = Request.Form.Unit; var dict = new Dictionary <string, string> { { "Unit", unit } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/services/stop", dict)); }; Post["/services/enable"] = x => { string unit = Request.Form.Unit; var dict = new Dictionary <string, string> { { "Unit", unit } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/services/enable", dict)); }; Post["/services/disable"] = x => { string unit = Request.Form.Unit; var dict = new Dictionary <string, string> { { "Unit", unit } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/services/disable", dict)); }; }
public AntdGlusterModule() { Get["/gluster"] = x => { var model = _api.Get <PageGlusterModel>($"http://127.0.0.1:{Application.ServerPort}/gluster"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/gluster/set"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/set")); }; Post["/gluster/restart"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/restart")); }; Post["/gluster/stop"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/stop")); }; Post["/gluster/enable"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/enable")); }; Post["/gluster/disable"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/disable")); }; Post["/gluster/options"] = x => { string nodes = Request.Form.GlusterNode; string volumeNames = Request.Form.GlusterVolumeName; string volumeBrick = Request.Form.GlusterVolumeBrick; string volumeMountPoint = Request.Form.GlusterVolumeMountPoint; var dict = new Dictionary <string, string> { { "GlusterNode", nodes }, { "GlusterVolumeName", volumeNames }, { "GlusterVolumeBrick", volumeBrick }, { "GlusterVolumeMountPoint", volumeMountPoint }, }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/options", dict)); }; Post["/gluster/node"] = x => { string node = Request.Form.Node; var dict = new Dictionary <string, string> { { "Node", node } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/node", dict)); }; Post["/gluster/node/del"] = x => { string node = Request.Form.Node; var dict = new Dictionary <string, string> { { "Node", node } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/node/del", dict)); }; }
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 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))); }; }
private ClusterNodeChecklistModel NodeStatus(ClusterNode node) { //ConsoleLogger.Log($"[hb] check node {node.Hostname} {node.MachineUid}"); var status = new ClusterNodeChecklistModel(); status.TargetNodeMachineUid = node.MachineUid; status.Hostname = node.Hostname; //controllo l'IP pubblico status.KnownPublicIpReach = PingStatus(node.PublicIp); if (status.KnownPublicIpReach == 1) { //ConsoleLogger.Warn($"[hb] {node.Hostname} is unreachable at its known public ip"); return(status); } //controllo antd var serviceStatus = ApiConsumer.Post(CommonString.Append(node.EntryPoint, serviceStatusPath)); if (serviceStatus == Nancy.HttpStatusCode.OK) { status.ServiceReach = 0; } //controllo se ho già salvato delle informazioni var storedNodeIps = Application.ClusterChecklist?.FirstOrDefault(_ => _.TargetNodeMachineUid == node.MachineUid)?.DiscoveredIpsReach?.Select(_ => _.IpAddress) ?? new string[0]; //controllo gli IP scoperti var nodeIps = ApiConsumer.Get <string[]>(CommonString.Append(node.EntryPoint, networkAddressPath)) ?? new string[0]; nodeIps = storedNodeIps.Union(nodeIps).Where(_ => _ != localIp).ToArray(); var ipStatusList = new ClusterNodeIpStatusModel[nodeIps.Length]; for (var n = 0; n < nodeIps.Length; n++) { var ipStatus = new ClusterNodeIpStatusModel(); ipStatus.IpAddress = nodeIps[n]; ipStatus.Status = PingStatus(nodeIps[n]); ipStatusList[n] = ipStatus; } status.DiscoveredIpsReach = ipStatusList; var uptime = ApiConsumer.GetString(CommonString.Append(node.EntryPoint, appUptimePath)); status.ApplicationUptime = uptime; //controllo stato nodo var nodeChecklist = ApiConsumer.Get <MachineStatusChecklistModel>(CommonString.Append(node.EntryPoint, machineChecklistPath)) ?? new MachineStatusChecklistModel(); status.InternetReach = nodeChecklist.InternetReach; status.InternetDnsReach = nodeChecklist.InternetDnsReach; //controllo servizio: virsh var virshStatus = ApiConsumer.Get <VirshModel>(CommonString.Append(node.EntryPoint, virshStatusPath)) ?? new VirshModel(); status.VirshService = virshStatus; return(status); }
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")); }; }
private void Action(object sender, ElapsedEventArgs e) { var dtnow = DateTime.Now; var pk = Encoding.ASCII.GetString(_asymmetricKeys.PublicKey); var internalIp = ""; var externalIp = WhatIsMyIp.Get(); var machineInfo = new MachineInfo(); var ut = machineInfo.GetUptime(); var uptime = ut.Uptime; var loadAverage = ut.LoadAverage; var du = new DiskUsage().GetInfo().FirstOrDefault(_ => _.MountedOn == "/mnt/cdrom"); var diskUsage = du?.UsePercentage; var hostnamectl = _launcher.Launch("hostnamectl").ToList(); var hostname = hostnamectl.First(_ => _.Contains("Static hostname:")).Split(new[] { ":" }, 2, StringSplitOptions.RemoveEmptyEntries)[1]; var antdVersion = GetVersionDateFromFile(_bash.Execute("file /mnt/cdrom/Apps/Anthilla_Antd/active-version")); var systemVersion = GetVersionDateFromFile(_bash.Execute("file /mnt/cdrom/System/active-system")); var kernelVersion = GetVersionDateFromFile(_bash.Execute("file /mnt/cdrom/Kernel/active-kernel")); var dict = new Dictionary <string, string> { { "AppName", "Antd" }, { "MachineUid", _machineId }, { "KeyValue", pk }, { "InternalIp", internalIp }, { "ExternalIp", externalIp }, { "Uptime", uptime }, { "DiskUsage", diskUsage }, { "LoadAverage", loadAverage }, { "Hostname", hostname }, { "AntdVersion", antdVersion }, { "SystemVersion", systemVersion }, { "KernelVersion", kernelVersion } }; _api.Post($"{Parameter.Cloud}repo/assetinfo/save", dict); ConsoleLogger.Log($"[cloud-uptime] info sent to cloud - data gathered in {DateTime.Now - dtnow}"); }
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 AppsManagementModule() { Get["/apps/management"] = x => { var model = _api.Get <PageAppsManagementModel>($"http://127.0.0.1:{Application.ServerPort}/apps/management"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/apps/setup"] = x => { string appName = Request.Form.AppName; var dict = new Dictionary <string, string> { { "AppName", appName } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/apps/setup", dict)); }; Get["/apps/status/{unit}"] = x => { string unit = x.unit; var model = _api.Get <string>($"http://127.0.0.1:{Application.ServerPort}/apps/status/" + unit); var json = JsonConvert.SerializeObject(model); return(json); }; Get["/apps/active/{unit}"] = x => { string unit = x.unit; var model = _api.Get <bool>($"http://127.0.0.1:{Application.ServerPort}/apps/active/" + unit); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/apps/restart"] = x => { string name = Request.Form.Name; var dict = new Dictionary <string, string> { { "Name", name } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/apps/restart", dict)); }; Post["/apps/stop"] = x => { string name = Request.Form.Name; var dict = new Dictionary <string, string> { { "Name", name } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/apps/stop", dict)); }; }
public AssetSyncMachineModule() { Get["/syncmachine"] = x => { var model = _api.Get <PageAssetSyncMachineModel>($"http://127.0.0.1:{Application.ServerPort}/syncmachine"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/syncmachine/set"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/syncmachine/set")); }; Post["/syncmachine/restart"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/syncmachine/restart")); }; Post["/syncmachine/stop"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/syncmachine/stop")); }; Post["/syncmachine/enable"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/syncmachine/enable")); }; Post["/syncmachine/disable"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/syncmachine/disable")); }; Post["/syncmachine/machine"] = x => { string machineAddress = Request.Form.MachineAddress; var dict = new Dictionary <string, string> { { "MachineAddress", machineAddress } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/syncmachine/machine", dict)); }; Post["/syncmachine/machine/del"] = x => { string guid = Request.Form.Guid; var dict = new Dictionary <string, string> { { "Guid", guid } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/syncmachine/machine/del", dict)); }; Post["Accept Configuration", "/syncmachine/accept"] = x => { string file = Request.Form.File; string content = Request.Form.Content; var dict = new Dictionary <string, string> { { "File", file }, { "Content", content } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/syncmachine/accept", dict)); }; }
public IActionResult Create([Bind("Id,Name")] Branch branch) { if (ModelState.IsValid) { var response = ApiConsumer.Post <Branch>(branch, _options.Value.ApiUrl + "branch"); return(RedirectToAction(nameof(Index))); } return(View(branch)); }
public IActionResult Create([Bind("Name,Key,Logins")] Tag tag) { if (ModelState.IsValid) { var response = ApiConsumer.Post <Tag>(tag, _options.Value.ApiUrl + "tag/v2"); return(RedirectToAction(nameof(Index))); } return(View(tag)); }
public IActionResult Create([Bind("Id,Name,Description")] Regulation regulation) { if (ModelState.IsValid) { ApiConsumer.Post <Regulation>(regulation, _options.Value.ApiUrl + "regulation"); return(RedirectToAction(nameof(Index))); } return(View(regulation)); }
public void Download(string appName, string machineUid, byte[] publicKey) { if (File.Exists(_licensePath)) { return; } var pk = Encoding.ASCII.GetString(publicKey); var dict = new Dictionary <string, string> { { "AppName", appName }, { "Uid", machineUid }, { "PublicKey", pk } }; var lic = _api.Post <string>($"{Parameter.Cloud}license/create", dict); if (lic != null) { File.WriteAllText(_licensePath, lic); } }
public AntdRsyncModule() { Get["/rsync"] = x => { var model = _api.Get <PageRsyncModel>($"http://127.0.0.1:{Application.ServerPort}/rsync"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/rsync/set"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/rsync/set")); }; Post["/rsync/restart"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/rsync/restart")); }; Post["/rsync/stop"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/rsync/stop")); }; Post["/rsync/enable"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/rsync/enable")); }; Post["/rsync/disable"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/rsync/disable")); }; Post["/rsync/options"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/rsync/options")); }; Post["/rsync/directory"] = x => { string source = Request.Form.Source; string destination = Request.Form.Destination; string type = Request.Form.Type; var dict = new Dictionary <string, string> { { "Source", source }, { "Destination", destination }, { "Type", type }, }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/rsync/directory", dict)); }; Post["/rsync/directory/del"] = x => { string guid = Request.Form.Guid; var dict = new Dictionary <string, string> { { "Guid", guid }, }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/rsync/directory/del", dict)); }; }
public IActionResult Create([Bind("Id,Name,Description,IsEnable")] Company company) { if (ModelState.IsValid) { ApiConsumer.Post <Company>(company, _options.Value.ApiUrl + "company"); return(RedirectToAction(nameof(Index))); } return(View(company)); }
public IActionResult Create([Bind("Id,Name,Region,Dns,IpAddress,MetaType,MetaVersion,Description")] Server server) { if (ModelState.IsValid) { ApiConsumer.Post <Server>(server, _options.Value.ApiUrl + "server"); return(RedirectToAction(nameof(Index))); } return(View(server)); }
public LogReportModule() { Get["/report"] = x => { var model = _api.Get <PageLogModel>($"http://127.0.0.1:{Application.ServerPort}/report"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/report"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/report")); }; }
public WizardModule() { Get["/wizard/data"] = x => { var model = _api.Get <PageWizardModel>($"http://127.0.0.1:{Application.ServerPort}/wizard/data"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/wizard"] = x => { string password = Request.Form.Password; string hostname = Request.Form.Hostname; string location = Request.Form.Location; string chassis = Request.Form.Chassis; string deployment = Request.Form.Deployment; string timezone = Request.Form.Timezone; string ntpServer = Request.Form.NtpServer; string domainInt = Request.Form.DomainInt; string domainExt = Request.Form.DomainExt; string hosts = Request.Form.Hosts; string networks = Request.Form.Networks; string resolv = Request.Form.Resolv; string nsswitch = Request.Form.Nsswitch; string Interface = Request.Form.Interface; string txqueuelen = Request.Form.Txqueuelen; string mtu = Request.Form.Mtu; string mode = Request.Form.Mode; string staticAddress = Request.Form.StaticAddress; string staticRange = Request.Form.StaticRange; var dict = new Dictionary <string, string> { { "Password", password }, { "Hostname", hostname }, { "Location", location }, { "Chassis", chassis }, { "Deployment", deployment }, { "Timezone", timezone }, { "NtpServer", ntpServer }, { "DomainInt", domainInt }, { "DomainExt", domainExt }, { "Hosts", hosts }, { "Networks", networks }, { "Resolv", resolv }, { "Nsswitch", nsswitch }, { "Interface", Interface }, { "Txqueuelen", txqueuelen }, { "Mtu", mtu }, { "Mode", mode }, { "StaticAddress", staticAddress }, { "StaticRange", staticRange } }; _api.Post($"http://127.0.0.1:{Application.ServerPort}/wizard", dict); return(Response.AsRedirect("/logout")); }; }
public AntdSchedulerModule() { Get["/scheduler"] = x => { var model = _api.Get <PageSchedulerModel>($"http://127.0.0.1:{Application.ServerPort}/scheduler"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/scheduler/set"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/scheduler/set")); }; Post["/scheduler/enable"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/scheduler/enable")); }; Post["/scheduler/disable"] = x => { return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/scheduler/disable")); }; Post["/scheduler/timer"] = x => { string alias = Request.Form.Alias; string time = Request.Form.Time; string command = Request.Form.Command; var dict = new Dictionary <string, string> { { "Alias", alias }, { "Time", time }, { "Command", command }, }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/scheduler/timer", dict)); }; Post["/scheduler/timer/del"] = x => { string guid = Request.Form.Guid; var dict = new Dictionary <string, string> { { "Guid", guid } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/scheduler/timer/del", dict)); }; }
public AssetGlusterModule() { Get["/gluster"] = x => { var model = _api.Get <PageGlusterModel>($"http://127.0.0.1:{Application.ServerPort}/gluster"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/gluster/set"] = x => _api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/set"); Post["/gluster/restart"] = x => _api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/restart"); Post["/gluster/stop"] = x => _api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/stop"); Post["/gluster/enable"] = x => _api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/enable"); Post["/gluster/disable"] = x => _api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/disable"); Post["/gluster/save"] = x => { string config = Request.Form.Config; var dict = new Dictionary <string, string> { { "Config", config } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/gluster/save", dict)); }; }
public AntdHostModule() { Get["/host"] = x => { var model = _api.Get <PageHostModel>($"http://127.0.0.1:{Application.ServerPort}/host/info"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/host/name"] = x => { string name = Request.Form.Name; var dict = new Dictionary <string, string> { { "Name", name } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/host/info/name", dict)); }; Post["/host/chassis"] = x => { string chassis = Request.Form.Chassis; var dict = new Dictionary <string, string> { { "Chassis", chassis } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/host/info/chassis", dict)); }; Post["/host/deployment"] = x => { string deployment = Request.Form.Deployment; var dict = new Dictionary <string, string> { { "Deployment", deployment } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/host/info/deployment", dict)); }; Post["/host/location"] = x => { string location = Request.Form.Location; var dict = new Dictionary <string, string> { { "Location", location } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/host/info/location", dict)); }; }
public AssetDiscoveryModule() { Get["/discovery"] = x => { var model = _api.Get <PageAssetDiscoveryModel>($"http://127.0.0.1:{Application.ServerPort}/discovery"); var json = JsonConvert.SerializeObject(model); return(json); }; Post["/asset/handshake/start"] = x => { var hostIp = Request.Form.Host; var hostPort = Request.Form.Port; var dict = new Dictionary <string, string> { { "Host", hostIp }, { "Port", hostPort } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/asset/handshake/start", dict)); }; Post["/asset/handshake"] = x => { string apple = Request.Form.ApplePie; var dict = new Dictionary <string, string> { { "ApplePie", apple } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/asset/handshake", dict)); }; Post["/asset/wol"] = x => { string mac = Request.Form.MacAddress; var dict = new Dictionary <string, string> { { "MacAddress", mac } }; return(_api.Post($"http://127.0.0.1:{Application.ServerPort}/asset/wol", dict)); }; Get["/asset/nmap/{ip}"] = x => { string ip = x.ip; var model = _api.Get <List <NmapScanStatus> >($"http://127.0.0.1:{Application.ServerPort}/asset/nmap/" + ip); return(JsonConvert.SerializeObject(model)); }; }