Esempio n. 1
0
        public void ApiClientSetup()
        {
            var appConfig = new AppConfig ();

            var config = appConfig.Data ["TestProxmox"];
            user = new User { Username = config["Username"], Password = config["Password"], Realm = config["Realm"] };
            server = new Server { Ip = config["Ip"], Port = config["Port"] };
            node = config ["Node"];
            pool = config["Pool"];
            vmId = config ["VmId"];

            client = new ApiClient (server, node);

            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;

            response = client.Login (user);

            var tasks = client.TaskStatusList().Data;

            if (tasks.Count > 0)
            {
                upid =  tasks[0].Upid;
            }

            template = new LxcTemplate {
                Cpuunits = "1",
                Password = "******",
                Hostname = "api.proxmox.test",
                Net = "name=eth0,bridge=vmbr0,hwaddr=DE:88:0F:D7:79:33,ip=dhcp,ip6=dhcp,type=veth",
                Memory = "1000",
                Ostemplate = "disk1:vztmpl/debian-8.0-standard_8.6-1_amd64.tar.gz",
                Ostype = "debian",
                Storage = "disk1",
                Swap = "512",
                Vmid = vmId,
                Pool = pool,
            };
        }
Esempio n. 2
0
 public ApiClient(Server server, string node)
 {
     _baseUrl = "https://" + server.Ip + ":" + server.Port + "/api2/json/";
     _node = node;
 }