Пример #1
0
        public string LaunchServer(string budget, string name, string description, string machineImageId, string product, string dataCenterId) //tested
        {
            clearHeaders();
            AddHeader("x-es-details", verbosity);
            AddHeader("Accept", "application/xml"); // for JSON use application/json
            string resource   = api_root + "/infrastructure/Server";
            launch l          = new launch(budget, name, description, machineImageId, product, dataCenterId);
            var    serializer = new EnstratiusSerializer <launch>();
            //return invokeCommand(Method.POST, resource, null, l, serializer);
            string xml    = serializer.Serialize(l);
            string result = invokeStringPost(resource, xml);

            return(result);
        }
Пример #2
0
        public string StopServer(string serverId) //tested
        {
            clearHeaders();
            AddHeader("x-es-details", verbosity);
            AddHeader("Accept", "application/xml");
            string resource = api_root + "/infrastructure/Server/" + serverId;
            stop   s        = new stop();

            s.force  = true;
            s.server = "";
            var    serializer = new EnstratiusSerializer <stop>();
            string xml        = serializer.Serialize(s);

            return(invokeStringPost(resource, xml, true));
        }