public bool EditMachineHardware(EnvsListElement env, VmStatus vm, int?numCpus, int?memorySizeMBs, int?diskSizeGBs) { var Params = new Dictionary <string, string> { { "EnvId", env.envId }, { "VmId", vm.vmId } }; if (numCpus.HasValue) { Params["NumCpus"] = numCpus.Value.ToString(); } if (memorySizeMBs.HasValue) { Params["MemorySizeMBs"] = memorySizeMBs.Value.ToString(); } if (diskSizeGBs.HasValue) { Params["DiskSizeGBs"] = diskSizeGBs.Value.ToString(); } var json = _api.CallCSAPI("Env", "EditMachineHardware", Params); var dto = JsonConvert.DeserializeObject <EditMachineHardwareDto>(json); return(!dto.conflictsFound); }
public CheckExecutionStatusResult CheckExecutionStatus(EnvsListElement env, VmStatus ms, string executionId) { var @params = new Dictionary<string, string> { { "EnvId", env.envId }, { "VmId", ms.vmId }, { "ExecutionId", executionId } }; var json = _api.CallCSAPI("env", "CheckExecutionStatus", @params); return JsonConvert.DeserializeObject<CheckExecutionStatusResult>(json); }
public ExecutePathExtResult ExecutePathExt(EnvsListElement env, VmStatus ms, string path) { var @params = new Dictionary<string, string> { { "EnvId", env.envId }, { "VmId", ms.vmId }, { "Path", path } }; var json = _api.CallCSAPI("env", "ExecutePathExt", @params); return JsonConvert.DeserializeObject<ExecutePathExtResult>(json); }
public RemoteAccessFileResult GetRemoteAccessFile(EnvsListElement env, VmStatus ms, int desktopWidth, int desktopHeight, bool? isConsole) { var @params = new Dictionary<string, string> { { "EnvId", env.envId }, { "VmId", ms.vmId }, { "desktopWidth", desktopWidth.ToString() }, { "desktopHeight", desktopHeight.ToString() } }; if (isConsole != null) { @params.Add("isConsole", isConsole.Value ? "true" : "false"); } var json = _api.CallCSAPI("env", "GetRemoteAccessFile", @params); return JsonConvert.DeserializeObject<RemoteAccessFileResult>(json); }
public bool RebootVm(EnvsListElement env, VmStatus ms) { try { var Params = new Dictionary<string, string> { {"EnvId", env.envId}, {"VmId",ms.vmId} }; _api.CallCSAPI("env", "RebootVm", Params); return true; } catch (Exception e) { Console.WriteLine("Caught exception while rebooting a VM:\n" + e.Message); return false; } }
public bool EditMachineHardware(EnvsListElement env, VmStatus vm, int? numCpus, int? memorySizeMBs, int? diskSizeGBs) { var Params = new Dictionary<string, string> {{"EnvId", env.envId}, {"VmId", vm.vmId}}; if (numCpus.HasValue) Params["NumCpus"] = numCpus.Value.ToString(); if (memorySizeMBs.HasValue) Params["MemorySizeMBs"] = memorySizeMBs.Value.ToString(); if (diskSizeGBs.HasValue) Params["DiskSizeGBs"] = diskSizeGBs.Value.ToString(); var json = _api.CallCSAPI("Env", "EditMachineHardware", Params); var dto = JsonConvert.DeserializeObject<EditMachineHardwareDto>(json); return !dto.conflictsFound; }