Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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); 
        }
Example #5
0
 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;
     }
 }
Example #6
0
 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;
 }